|
9 | 9 | // Assumes that core_stub.ts has been loaded. |
10 | 10 | // UserInterface is defined in 'generic_ui/scripts/ui.ts'. |
11 | 11 |
|
| 12 | +import background_ui = require('../../../generic_ui/scripts/background_ui'); |
| 13 | +import chrome_panel_connector = require('./chrome_panel_connector'); |
12 | 14 | import ChromeBrowserApi = require('./chrome_browser_api'); |
13 | 15 | import ChromeCoreConnector = require('./chrome_core_connector'); |
14 | 16 | import ChromeTabAuth = require('./chrome_tab_auth'); |
15 | | - |
16 | | -import UiApi = require('../../../interfaces/ui'); |
17 | | -import user_interface = require('../../../generic_ui/scripts/ui'); |
18 | | -import CoreConnector = require('../../../generic_ui/scripts/core_connector'); |
19 | | -import uproxy_core_api = require('../../../interfaces/uproxy_core_api'); |
20 | 17 | import Constants = require('../../../generic_ui/scripts/constants'); |
| 18 | +import CoreConnector = require('../../../generic_ui/scripts/core_connector'); |
| 19 | +import user_interface = require('../../../generic_ui/scripts/ui'); |
| 20 | + |
21 | 21 | import compareVersion = require('compare-version'); |
| 22 | +import uproxy_core_api = require('../../../interfaces/uproxy_core_api'); |
22 | 23 |
|
23 | 24 | /// <reference path='../../../freedom/typings/social.d.ts' /> |
24 | 25 | /// <reference path='../../../third_party/typings/chrome/chrome.d.ts'/> |
25 | 26 |
|
26 | 27 | // --------------------- Communicating with the App ---------------------------- |
27 | 28 | export var browserConnector :ChromeCoreConnector; // way for ui to speak to a uProxy.CoreApi |
28 | 29 | export var core :CoreConnector; // way for ui to speak to a uProxy.CoreApi |
| 30 | +export var backgroundUi: background_ui.BackgroundUi; |
29 | 31 | export var browserApi :ChromeBrowserApi; |
30 | 32 | // Chrome Window ID of the window used to launch uProxy, |
31 | 33 | // i.e. the window where the extension icon was clicked |
@@ -146,7 +148,20 @@ core = new CoreConnector(browserConnector); |
146 | 148 | var oAuth = new ChromeTabAuth(); |
147 | 149 | browserConnector.onUpdate(uproxy_core_api.Update.GET_CREDENTIALS, |
148 | 150 | oAuth.login.bind(oAuth)); |
149 | | -var ui = new user_interface.UserInterface(core, browserApi); |
| 151 | + |
| 152 | +backgroundUi = new background_ui.BackgroundUi( |
| 153 | + new chrome_panel_connector.ChromePanelConnector(), |
| 154 | + core); |
| 155 | + |
| 156 | +/* |
| 157 | + * TODO: this is a separate user_interface object from the one we refer to |
| 158 | + * elsewhere in the code. It will register listeners for all events and |
| 159 | + * commands, however, these listeners will immediately be unbound after the |
| 160 | + * panel is opened for the first time. Its version of any data should not be |
| 161 | + * relied upon as canonical and no updates made to data here should be expected |
| 162 | + * to persist within the general UI. |
| 163 | + */ |
| 164 | +var ui = new user_interface.UserInterface(core, browserApi, backgroundUi); |
150 | 165 |
|
151 | 166 | // used for de-duplicating urls caught by the listeners |
152 | 167 | var lastUrl = ''; |
@@ -206,4 +221,3 @@ chrome.webRequest.onBeforeRequest.addListener( |
206 | 221 | { urls: ['https://www.uproxy.org/request/*', 'https://www.uproxy.org/offer/*'] }, |
207 | 222 | ['blocking'] |
208 | 223 | ); |
209 | | - |
|
0 commit comments