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