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 related to HTTP throttling. | 6 * This view displays information related to HTTP throttling. |
7 */ | 7 */ |
| 8 var HttpThrottlingView = (function() { |
| 9 'use strict'; |
8 | 10 |
9 var HttpThrottlingView = (function() { | |
10 // IDs for special HTML elements in http_throttling_view.html | 11 // IDs for special HTML elements in http_throttling_view.html |
11 const MAIN_BOX_ID = 'http-throttling-view-tab-content'; | 12 var MAIN_BOX_ID = 'http-throttling-view-tab-content'; |
12 const ENABLE_CHECKBOX_ID = 'http-throttling-view-enable-checkbox'; | 13 var ENABLE_CHECKBOX_ID = 'http-throttling-view-enable-checkbox'; |
13 | 14 |
14 // We inherit from DivView. | 15 // We inherit from DivView. |
15 var superClass = DivView; | 16 var superClass = DivView; |
16 | 17 |
| 18 /** |
| 19 * @constructor |
| 20 */ |
17 function HttpThrottlingView() { | 21 function HttpThrottlingView() { |
| 22 assertFirstConstructorCall(HttpThrottlingView); |
| 23 |
18 // Call superclass's constructor. | 24 // Call superclass's constructor. |
19 superClass.call(this, MAIN_BOX_ID); | 25 superClass.call(this, MAIN_BOX_ID); |
20 | 26 |
21 this.enableCheckbox_ = $(ENABLE_CHECKBOX_ID); | 27 this.enableCheckbox_ = $(ENABLE_CHECKBOX_ID); |
22 this.enableCheckbox_.onclick = this.onEnableCheckboxClicked_.bind(this); | 28 this.enableCheckbox_.onclick = this.onEnableCheckboxClicked_.bind(this); |
23 | 29 |
24 g_browser.addHttpThrottlingObserver(this); | 30 g_browser.addHttpThrottlingObserver(this); |
25 } | 31 } |
26 | 32 |
27 cr.addSingletonGetter(HttpThrottlingView); | 33 cr.addSingletonGetter(HttpThrottlingView); |
(...skipping 13 matching lines...) Expand all Loading... |
41 /** | 47 /** |
42 * Handler for the onclick event of the checkbox. | 48 * Handler for the onclick event of the checkbox. |
43 */ | 49 */ |
44 onEnableCheckboxClicked_: function() { | 50 onEnableCheckboxClicked_: function() { |
45 g_browser.enableHttpThrottling(this.enableCheckbox_.checked); | 51 g_browser.enableHttpThrottling(this.enableCheckbox_.checked); |
46 } | 52 } |
47 }; | 53 }; |
48 | 54 |
49 return HttpThrottlingView; | 55 return HttpThrottlingView; |
50 })(); | 56 })(); |
OLD | NEW |