@@ -15,12 +15,11 @@ import UiApi = require('../../../interfaces/ui');
1515import user_interface = require( '../../../generic_ui/scripts/ui' ) ;
1616import CoreConnector = require( '../../../generic_ui/scripts/core_connector' ) ;
1717import uproxy_core_api = require( '../../../interfaces/uproxy_core_api' ) ;
18+ import Constants = require( '../../../generic_ui/scripts/constants' ) ;
1819
1920/// <reference path='../../../freedom/typings/social.d.ts' />
2021/// <reference path='../../../third_party/typings/chrome/chrome.d.ts'/>
2122
22- export import model = user_interface . model ;
23-
2423// --------------------- Communicating with the App ----------------------------
2524export var browserConnector :ChromeCoreConnector ; // way for ui to speak to a uProxy.CoreApi
2625export var core :CoreConnector ; // way for ui to speak to a uProxy.CoreApi
@@ -63,13 +62,25 @@ chrome.runtime.onMessageExternal.addListener((request :any, sender :chrome.runti
6362 * updates from the Chrome App side propogate to the UI.
6463 */
6564browserApi = new ChromeBrowserApi ( ) ;
65+ browserConnector = new ChromeCoreConnector ( { name : 'uproxy-extension-to-app-port' } ) ;
66+ browserConnector . onUpdate ( uproxy_core_api . Update . LAUNCH_UPROXY ,
67+ browserApi . bringUproxyToFront ) ;
68+
6669// TODO (lucyhe): Make sure that the "install" event isn't missed if we
6770// are adding the listener after the event is fired.
6871chrome . runtime . onInstalled . addListener ( ( details :chrome . runtime . InstalledDetails ) => {
6972 if ( details . reason !== 'install' ) {
7073 // we only want to launch the window on the first install
7174 return ;
7275 }
76+ browserConnector . onceConnected . then ( ( ) => {
77+ chrome . browserAction . setIcon ( {
78+ path : {
79+ "19" : "icons/19_" + Constants . DEFAULT_ICON ,
80+ "38" : "icons/38_" + Constants . DEFAULT_ICON ,
81+ }
82+ } ) ;
83+ } ) ;
7384
7485 chrome . tabs . query ( { currentWindow : true , active : true } , function ( tabs ) {
7586 // Do not open the extension when it's installed if the user is
@@ -85,10 +96,6 @@ chrome.browserAction.onClicked.addListener((tab) => {
8596 browserApi . bringUproxyToFront ( ) ;
8697} ) ;
8798
88- browserConnector = new ChromeCoreConnector ( { name : 'uproxy-extension-to-app-port' } ) ;
89- browserConnector . onUpdate ( uproxy_core_api . Update . LAUNCH_UPROXY ,
90- browserApi . bringUproxyToFront ) ;
91-
9299core = new CoreConnector ( browserConnector ) ;
93100var oAuth = new ChromeTabAuth ( ) ;
94101browserConnector . onUpdate ( uproxy_core_api . Update . GET_CREDENTIALS ,
0 commit comments