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

Side by Side Diff: chrome/browser/chromeos/net/network_change_notifier_chromeos.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: Fixed a typo Created 8 years, 7 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) 2012 The Chromium Authors. All rights reserved. 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 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 "chrome/browser/chromeos/net/network_change_notifier_chromeos.h" 5 #include "chrome/browser/chromeos/net/network_change_notifier_chromeos.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/chromeos/cros/cros_library.h" 8 #include "chrome/browser/chromeos/cros/cros_library.h"
9 #include "chromeos/dbus/dbus_thread_manager.h" 9 #include "chromeos/dbus/dbus_thread_manager.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 base::Bind( 76 base::Bind(
77 &NetworkChangeNotifier::NotifyObserversOfIPAddressChange)); 77 &NetworkChangeNotifier::NotifyObserversOfIPAddressChange));
78 } 78 }
79 79
80 80
81 void NetworkChangeNotifierChromeos::OnNetworkManagerChanged( 81 void NetworkChangeNotifierChromeos::OnNetworkManagerChanged(
82 chromeos::NetworkLibrary* cros) { 82 chromeos::NetworkLibrary* cros) {
83 UpdateNetworkState(cros); 83 UpdateNetworkState(cros);
84 } 84 }
85 85
86 bool NetworkChangeNotifierChromeos::IsCurrentlyOffline() const { 86 net::NetworkChangeNotifier::ConnectionType
87 return !IsOnline(connection_state_); 87 NetworkChangeNotifierChromeos::GetCurrentConnectionType() const {
88 // TODO(droger): Return something more detailed than CONNECTION_UNKNOWN.
89 return IsOnline(connection_state_) ?
90 net::NetworkChangeNotifier::CONNECTION_UNKNOWN :
91 net::NetworkChangeNotifier::CONNECTION_NONE;
88 } 92 }
89 93
90 void NetworkChangeNotifierChromeos::OnNetworkChanged( 94 void NetworkChangeNotifierChromeos::OnNetworkChanged(
91 chromeos::NetworkLibrary* cros, 95 chromeos::NetworkLibrary* cros,
92 const chromeos::Network* network) { 96 const chromeos::Network* network) {
93 CHECK(network); 97 CHECK(network);
94 98
95 // Active network changed? 99 // Active network changed?
96 if (network->service_path() != service_path_) 100 if (network->service_path() != service_path_)
97 UpdateNetworkState(cros); 101 UpdateNetworkState(cros);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 weak_factory_.GetWeakPtr()), 202 weak_factory_.GetWeakPtr()),
199 base::TimeDelta::FromMilliseconds(kOnlineNotificationDelayMS)); 203 base::TimeDelta::FromMilliseconds(kOnlineNotificationDelayMS));
200 } 204 }
201 205
202 void NetworkChangeNotifierChromeos::ReportOnlineStateChangeOnUIThread() { 206 void NetworkChangeNotifierChromeos::ReportOnlineStateChangeOnUIThread() {
203 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 207 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
204 208
205 BrowserThread::PostTask( 209 BrowserThread::PostTask(
206 BrowserThread::IO, FROM_HERE, 210 BrowserThread::IO, FROM_HERE,
207 base::Bind( 211 base::Bind(
208 &NetworkChangeNotifierChromeos::NotifyObserversOfOnlineStateChange)); 212 &NetworkChangeNotifierChromeos::
213 NotifyObserversOfConnectionTypeChange));
209 } 214 }
210 215
211 // static 216 // static
212 void NetworkChangeNotifierChromeos::UpdateInitialState( 217 void NetworkChangeNotifierChromeos::UpdateInitialState(
213 NetworkChangeNotifierChromeos* self) { 218 NetworkChangeNotifierChromeos* self) {
214 chromeos::NetworkLibrary* net = 219 chromeos::NetworkLibrary* net =
215 chromeos::CrosLibrary::Get()->GetNetworkLibrary(); 220 chromeos::CrosLibrary::Get()->GetNetworkLibrary();
216 self->UpdateNetworkState(net); 221 self->UpdateNetworkState(net);
217 } 222 }
218 223
219 } // namespace chromeos 224 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/net/network_change_notifier_chromeos.h ('k') | chrome/browser/chromeos/offline/offline_load_page.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698