OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * This view displays information on the proxy setup: | 6 * This view displays information on the proxy setup: |
7 * | 7 * |
8 * - Shows the current proxy settings. | 8 * - Shows the current proxy settings. |
9 * - Has a button to reload these settings. | 9 * - Has a button to reload these settings. |
10 * - Shows the list of proxy hostnames that are cached as "bad". | 10 * - Shows the list of proxy hostnames that are cached as "bad". |
11 * - Has a button to clear the cached bad proxies. | 11 * - Has a button to clear the cached bad proxies. |
12 */ | 12 */ |
13 var ProxyView = (function() { | 13 var ProxyView = (function() { |
14 'use strict'; | 14 'use strict'; |
15 | 15 |
16 // We inherit from DivView. | 16 // We inherit from DivView. |
17 var superClass = DivView; | 17 var superClass = DivView; |
18 | 18 |
19 /** | 19 /** |
20 * @constructor | 20 * @constructor |
21 */ | 21 */ |
22 function ProxyView() { | 22 function ProxyView() { |
23 assertFirstConstructorCall(ProxyView); | 23 assertFirstConstructorCall(ProxyView); |
24 | 24 |
25 // Call superclass's constructor. | 25 // Call superclass's constructor. |
26 superClass.call(this, ProxyView.MAIN_BOX_ID); | 26 superClass.call(this, ProxyView.MAIN_BOX_ID); |
27 | 27 |
28 // Hook up the UI components. | |
29 $(ProxyView.RELOAD_SETTINGS_BUTTON_ID).onclick = | |
30 g_browser.sendReloadProxySettings.bind(g_browser); | |
31 $(ProxyView.CLEAR_BAD_PROXIES_BUTTON_ID).onclick = | |
32 g_browser.sendClearBadProxies.bind(g_browser); | |
33 | |
34 // Register to receive proxy information as it changes. | 28 // Register to receive proxy information as it changes. |
35 g_browser.addProxySettingsObserver(this, true); | 29 g_browser.addProxySettingsObserver(this, true); |
36 g_browser.addBadProxiesObserver(this, true); | 30 g_browser.addBadProxiesObserver(this, true); |
37 } | 31 } |
38 | 32 |
39 ProxyView.TAB_ID = 'tab-handle-proxy'; | 33 ProxyView.TAB_ID = 'tab-handle-proxy'; |
40 ProxyView.TAB_NAME = 'Proxy'; | 34 ProxyView.TAB_NAME = 'Proxy'; |
41 ProxyView.TAB_HASH = '#proxy'; | 35 ProxyView.TAB_HASH = '#proxy'; |
42 | 36 |
43 // IDs for special HTML elements in proxy_view.html | 37 // IDs for special HTML elements in proxy_view.html |
44 ProxyView.MAIN_BOX_ID = 'proxy-view-tab-content'; | 38 ProxyView.MAIN_BOX_ID = 'proxy-view-tab-content'; |
45 ProxyView.ORIGINAL_SETTINGS_DIV_ID = 'proxy-view-original-settings'; | 39 ProxyView.ORIGINAL_SETTINGS_DIV_ID = 'proxy-view-original-settings'; |
46 ProxyView.EFFECTIVE_SETTINGS_DIV_ID = 'proxy-view-effective-settings'; | 40 ProxyView.EFFECTIVE_SETTINGS_DIV_ID = 'proxy-view-effective-settings'; |
47 ProxyView.ORIGINAL_CONTENT_DIV_ID = 'proxy-view-original-content'; | 41 ProxyView.ORIGINAL_CONTENT_DIV_ID = 'proxy-view-original-content'; |
48 ProxyView.EFFECTIVE_CONTENT_DIV_ID = 'proxy-view-effective-content'; | 42 ProxyView.EFFECTIVE_CONTENT_DIV_ID = 'proxy-view-effective-content'; |
49 ProxyView.RELOAD_SETTINGS_BUTTON_ID = 'proxy-view-reload-settings'; | |
50 ProxyView.BAD_PROXIES_DIV_ID = 'proxy-view-bad-proxies-div'; | 43 ProxyView.BAD_PROXIES_DIV_ID = 'proxy-view-bad-proxies-div'; |
51 ProxyView.BAD_PROXIES_TBODY_ID = 'proxy-view-bad-proxies-tbody'; | 44 ProxyView.BAD_PROXIES_TBODY_ID = 'proxy-view-bad-proxies-tbody'; |
52 ProxyView.CLEAR_BAD_PROXIES_BUTTON_ID = 'proxy-view-clear-bad-proxies'; | |
53 ProxyView.SOCKS_HINTS_DIV_ID = 'proxy-view-socks-hints'; | 45 ProxyView.SOCKS_HINTS_DIV_ID = 'proxy-view-socks-hints'; |
54 ProxyView.SOCKS_HINTS_FLAG_DIV_ID = 'proxy-view-socks-hints-flag'; | 46 ProxyView.SOCKS_HINTS_FLAG_DIV_ID = 'proxy-view-socks-hints-flag'; |
55 | 47 |
56 cr.addSingletonGetter(ProxyView); | 48 cr.addSingletonGetter(ProxyView); |
57 | 49 |
58 ProxyView.prototype = { | 50 ProxyView.prototype = { |
59 // Inherit the superclass's methods. | 51 // Inherit the superclass's methods. |
60 __proto__: superClass.prototype, | 52 __proto__: superClass.prototype, |
61 | 53 |
62 onLoadLogFinish: function(data) { | 54 onLoadLogFinish: function(data) { |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 matches = /^\[(.*)\]$/.exec(result.host); | 170 matches = /^\[(.*)\]$/.exec(result.host); |
179 if (matches) | 171 if (matches) |
180 result.host = matches[1]; | 172 result.host = matches[1]; |
181 | 173 |
182 return result; | 174 return result; |
183 } | 175 } |
184 | 176 |
185 return ProxyView; | 177 return ProxyView; |
186 })(); | 178 })(); |
187 | 179 |
OLD | NEW |