1 // Copyright (c) 2012 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.
5 #include "content/browser/net/browser_online_state_observer.h"
7 #include "content/common/view_messages.h"
8 #include "content/browser/renderer_host/render_process_host_impl.h"
12 BrowserOnlineStateObserver::BrowserOnlineStateObserver() {
13 net::NetworkChangeNotifier::AddMaxBandwidthObserver(this);
16 BrowserOnlineStateObserver::~BrowserOnlineStateObserver() {
17 net::NetworkChangeNotifier::RemoveMaxBandwidthObserver(this);
20 void BrowserOnlineStateObserver::OnMaxBandwidthChanged(
21 double max_bandwidth_mbps
,
22 net::NetworkChangeNotifier::ConnectionType type
) {
23 for (RenderProcessHost::iterator
it(RenderProcessHost::AllHostsIterator());
24 !it
.IsAtEnd(); it
.Advance()) {
25 it
.GetCurrentValue()->Send(
26 new ViewMsg_NetworkConnectionChanged(type
, max_bandwidth_mbps
));
30 } // namespace content