| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * This view displays information related to HTTP throttling. | |
| 7 */ | |
| 8 var HttpThrottlingView = (function() { | |
| 9 'use strict'; | |
| 10 | |
| 11 // We inherit from DivView. | |
| 12 var superClass = DivView; | |
| 13 | |
| 14 /** | |
| 15 * @constructor | |
| 16 */ | |
| 17 function HttpThrottlingView() { | |
| 18 assertFirstConstructorCall(HttpThrottlingView); | |
| 19 | |
| 20 // Call superclass's constructor. | |
| 21 superClass.call(this, HttpThrottlingView.MAIN_BOX_ID); | |
| 22 | |
| 23 this.enableCheckbox_ = $(HttpThrottlingView.ENABLE_CHECKBOX_ID); | |
| 24 this.enableCheckbox_.onclick = this.onEnableCheckboxClicked_.bind(this); | |
| 25 | |
| 26 g_browser.addHttpThrottlingObserver(this); | |
| 27 } | |
| 28 | |
| 29 // ID for special HTML element in category_tabs.html | |
| 30 HttpThrottlingView.TAB_HANDLE_ID = 'tab-handle-http-throttling'; | |
| 31 | |
| 32 // IDs for special HTML elements in http_throttling_view.html | |
| 33 HttpThrottlingView.MAIN_BOX_ID = 'http-throttling-view-tab-content'; | |
| 34 HttpThrottlingView.ENABLE_CHECKBOX_ID = | |
| 35 'http-throttling-view-enable-checkbox'; | |
| 36 | |
| 37 cr.addSingletonGetter(HttpThrottlingView); | |
| 38 | |
| 39 HttpThrottlingView.prototype = { | |
| 40 // Inherit the superclass's methods. | |
| 41 __proto__: superClass.prototype, | |
| 42 | |
| 43 /** | |
| 44 * Gets informed that HTTP throttling has been enabled/disabled. | |
| 45 * @param {boolean} enabled HTTP throttling has been enabled. | |
| 46 */ | |
| 47 onHttpThrottlingEnabledPrefChanged: function(enabled) { | |
| 48 this.enableCheckbox_.checked = enabled; | |
| 49 }, | |
| 50 | |
| 51 /** | |
| 52 * Handler for the onclick event of the checkbox. | |
| 53 */ | |
| 54 onEnableCheckboxClicked_: function() { | |
| 55 g_browser.enableHttpThrottling(this.enableCheckbox_.checked); | |
| 56 } | |
| 57 }; | |
| 58 | |
| 59 return HttpThrottlingView; | |
| 60 })(); | |
| OLD | NEW |