| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 log entries for the most recent INIT_PROXY_RESOLVER source | 10 * - Shows the log entries for the most recent INIT_PROXY_RESOLVER source |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // ID for special HTML element in category_tabs.html | 43 // ID for special HTML element in category_tabs.html |
| 44 ProxyView.TAB_HANDLE_ID = 'tab-handle-proxy'; | 44 ProxyView.TAB_HANDLE_ID = 'tab-handle-proxy'; |
| 45 | 45 |
| 46 // IDs for special HTML elements in proxy_view.html | 46 // IDs for special HTML elements in proxy_view.html |
| 47 ProxyView.MAIN_BOX_ID = 'proxy-view-tab-content'; | 47 ProxyView.MAIN_BOX_ID = 'proxy-view-tab-content'; |
| 48 ProxyView.ORIGINAL_SETTINGS_DIV_ID = 'proxy-view-original-settings'; | 48 ProxyView.ORIGINAL_SETTINGS_DIV_ID = 'proxy-view-original-settings'; |
| 49 ProxyView.EFFECTIVE_SETTINGS_DIV_ID = 'proxy-view-effective-settings'; | 49 ProxyView.EFFECTIVE_SETTINGS_DIV_ID = 'proxy-view-effective-settings'; |
| 50 ProxyView.RELOAD_SETTINGS_BUTTON_ID = 'proxy-view-reload-settings'; | 50 ProxyView.RELOAD_SETTINGS_BUTTON_ID = 'proxy-view-reload-settings'; |
| 51 ProxyView.BAD_PROXIES_TBODY_ID = 'proxy-view-bad-proxies-tbody'; | 51 ProxyView.BAD_PROXIES_TBODY_ID = 'proxy-view-bad-proxies-tbody'; |
| 52 ProxyView.CLEAR_BAD_PROXIES_BUTTON_ID = 'proxy-view-clear-bad-proxies'; | 52 ProxyView.CLEAR_BAD_PROXIES_BUTTON_ID = 'proxy-view-clear-bad-proxies'; |
| 53 ProxyView.PROXY_RESOLVER_LOG_PRE_ID = 'proxy-view-resolver-log'; | 53 ProxyView.PROXY_RESOLVER_LOG_DIV_ID = 'proxy-view-resolver-log'; |
| 54 | 54 |
| 55 cr.addSingletonGetter(ProxyView); | 55 cr.addSingletonGetter(ProxyView); |
| 56 | 56 |
| 57 ProxyView.prototype = { | 57 ProxyView.prototype = { |
| 58 // Inherit the superclass's methods. | 58 // Inherit the superclass's methods. |
| 59 __proto__: superClass.prototype, | 59 __proto__: superClass.prototype, |
| 60 | 60 |
| 61 onLoadLogStart: function(data) { | 61 onLoadLogStart: function(data) { |
| 62 // Need to reset this so the latest proxy source from the dump can be | 62 // Need to reset this so the latest proxy source from the dump can be |
| 63 // identified when the log entries are loaded. | 63 // identified when the log entries are loaded. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 for (var i = sourceEntries.length - 1; i >= 0; --i) { | 134 for (var i = sourceEntries.length - 1; i >= 0; --i) { |
| 135 var sourceEntry = sourceEntries[i]; | 135 var sourceEntry = sourceEntries[i]; |
| 136 | 136 |
| 137 if (sourceEntry.getSourceType() != LogSourceType.INIT_PROXY_RESOLVER || | 137 if (sourceEntry.getSourceType() != LogSourceType.INIT_PROXY_RESOLVER || |
| 138 this.latestProxySourceId_ > sourceEntry.getSourceId()) { | 138 this.latestProxySourceId_ > sourceEntry.getSourceId()) { |
| 139 continue; | 139 continue; |
| 140 } | 140 } |
| 141 | 141 |
| 142 this.latestProxySourceId_ = sourceEntry.getSourceId(); | 142 this.latestProxySourceId_ = sourceEntry.getSourceId(); |
| 143 | 143 |
| 144 $(ProxyView.PROXY_RESOLVER_LOG_PRE_ID).innerText = | 144 $(ProxyView.PROXY_RESOLVER_LOG_DIV_ID).innerHTML = ''; |
| 145 sourceEntry.printAsText(); | 145 sourceEntry.printAsText($(ProxyView.PROXY_RESOLVER_LOG_DIV_ID)); |
| 146 } | 146 } |
| 147 }, | 147 }, |
| 148 | 148 |
| 149 /** | 149 /** |
| 150 * Clears the display of and log entries for the last proxy lookup. | 150 * Clears the display of and log entries for the last proxy lookup. |
| 151 */ | 151 */ |
| 152 clearLog_: function() { | 152 clearLog_: function() { |
| 153 // Prevents display of partial logs. | 153 // Prevents display of partial logs. |
| 154 ++this.latestProxySourceId_; | 154 ++this.latestProxySourceId_; |
| 155 | 155 |
| 156 $(ProxyView.PROXY_RESOLVER_LOG_PRE_ID).innerHTML = ''; | 156 $(ProxyView.PROXY_RESOLVER_LOG_PRE_ID).innerHTML = ''; |
| 157 $(ProxyView.PROXY_RESOLVER_LOG_PRE_ID).innerText = 'Deleted.'; | 157 $(ProxyView.PROXY_RESOLVER_LOG_PRE_ID).innerText = 'Deleted.'; |
| 158 }, | 158 }, |
| 159 | 159 |
| 160 onSourceEntriesDeleted: function(sourceIds) { | 160 onSourceEntriesDeleted: function(sourceIds) { |
| 161 if (sourceIds.indexOf(this.latestProxySourceId_) != -1) | 161 if (sourceIds.indexOf(this.latestProxySourceId_) != -1) |
| 162 this.clearLog_(); | 162 this.clearLog_(); |
| 163 }, | 163 }, |
| 164 | 164 |
| 165 onAllSourceEntriesDeleted: function() { | 165 onAllSourceEntriesDeleted: function() { |
| 166 this.clearLog_(); | 166 this.clearLog_(); |
| 167 } | 167 } |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 return ProxyView; | 170 return ProxyView; |
| 171 })(); | 171 })(); |
| OLD | NEW |