Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: content/browser/net/browser_online_state_observer.cc

Issue 9147026: API for connection type (Ethernet/WIFI/WWAN ...) in NetworkChangeNotifier. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "net/base/network_change_notifier.h" 9 #include "net/base/network_change_notifier.h"
10 10
11 BrowserOnlineStateObserver::BrowserOnlineStateObserver() { 11 BrowserOnlineStateObserver::BrowserOnlineStateObserver() {
12 net::NetworkChangeNotifier::AddOnlineStateObserver(this); 12 net::NetworkChangeNotifier::AddConnectionStateObserver(this);
13 } 13 }
14 14
15 BrowserOnlineStateObserver::~BrowserOnlineStateObserver() { 15 BrowserOnlineStateObserver::~BrowserOnlineStateObserver() {
16 net::NetworkChangeNotifier::RemoveOnlineStateObserver(this); 16 net::NetworkChangeNotifier::RemoveConnectionStateObserver(this);
17 } 17 }
18 18
19 void BrowserOnlineStateObserver::OnOnlineStateChanged(bool online) { 19 void BrowserOnlineStateObserver::OnConnectionStateChanged(
20 net::NetworkChangeNotifier::ConnectionState state) {
20 for (content::RenderProcessHost::iterator it( 21 for (content::RenderProcessHost::iterator it(
21 content::RenderProcessHost::AllHostsIterator()); 22 content::RenderProcessHost::AllHostsIterator());
22 !it.IsAtEnd(); it.Advance()) { 23 !it.IsAtEnd(); it.Advance()) {
23 it.GetCurrentValue()->Send(new ViewMsg_NetworkStateChanged(online)); 24 it.GetCurrentValue()->Send(new ViewMsg_NetworkStateChanged(
25 state != net::NetworkChangeNotifier::NONE));
24 } 26 }
25 } 27 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698