Home | History | Annotate | Download | only in net_internals
      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  * @constructor
      8  */
      9 function HttpThrottlingView(mainBoxId, enableCheckboxId) {
     10   DivView.call(this, mainBoxId);
     11 
     12   this.enableCheckbox_ = document.getElementById(enableCheckboxId);
     13   this.enableCheckbox_.onclick = this.onEnableCheckboxClicked_.bind(this);
     14 
     15   g_browser.addHttpThrottlingObserver(this);
     16 }
     17 
     18 inherits(HttpThrottlingView, DivView);
     19 
     20 /**
     21  * Gets informed that HTTP throttling has been enabled/disabled.
     22  * @param {boolean} enabled HTTP throttling has been enabled.
     23  */
     24 HttpThrottlingView.prototype.onHttpThrottlingEnabledPrefChanged = function(
     25     enabled) {
     26   this.enableCheckbox_.checked = enabled;
     27 };
     28 
     29 /**
     30  * Handler for the onclick event of the checkbox.
     31  */
     32 HttpThrottlingView.prototype.onEnableCheckboxClicked_ = function() {
     33   g_browser.enableHttpThrottling(this.enableCheckbox_.checked);
     34 };