| 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 #include "content/browser/net/browser_online_state_observer.h" | 5 #include "content/browser/net/browser_online_state_observer.h" |
| 6 | 6 |
| 7 #include "content/common/view_messages.h" | 7 #include "content/common/view_messages.h" |
| 8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 9 | 9 |
| 10 BrowserOnlineStateObserver::BrowserOnlineStateObserver() { | 10 BrowserOnlineStateObserver::BrowserOnlineStateObserver() { |
| 11 net::NetworkChangeNotifier::AddOnlineStateObserver(this); | 11 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); |
| 12 } | 12 } |
| 13 | 13 |
| 14 BrowserOnlineStateObserver::~BrowserOnlineStateObserver() { | 14 BrowserOnlineStateObserver::~BrowserOnlineStateObserver() { |
| 15 net::NetworkChangeNotifier::RemoveOnlineStateObserver(this); | 15 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); |
| 16 } | 16 } |
| 17 | 17 |
| 18 void BrowserOnlineStateObserver::OnOnlineStateChanged(bool online) { | 18 void BrowserOnlineStateObserver::OnConnectionTypeChanged( |
| 19 net::NetworkChangeNotifier::ConnectionType type) { |
| 19 for (content::RenderProcessHost::iterator it( | 20 for (content::RenderProcessHost::iterator it( |
| 20 content::RenderProcessHost::AllHostsIterator()); | 21 content::RenderProcessHost::AllHostsIterator()); |
| 21 !it.IsAtEnd(); it.Advance()) { | 22 !it.IsAtEnd(); it.Advance()) { |
| 22 it.GetCurrentValue()->Send(new ViewMsg_NetworkStateChanged(online)); | 23 it.GetCurrentValue()->Send(new ViewMsg_NetworkStateChanged( |
| 24 type != net::NetworkChangeNotifier::CONNECTION_NONE)); |
| 23 } | 25 } |
| 24 } | 26 } |
| OLD | NEW |