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

Side by Side Diff: net/base/network_change_notifier.h

Issue 11115009: Helper functions in NetworkChangeNotifier related to WWAN use (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove whitespace Created 8 years, 1 month 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
« no previous file with comments | « chrome/browser/chromeos/drive/drive_sync_client.cc ('k') | net/base/network_change_notifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ 5 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_H_
6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ 6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/observer_list_threadsafe.h" 9 #include "base/observer_list_threadsafe.h"
10 #include "net/base/net_export.h" 10 #include "net/base/net_export.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 #endif 123 #endif
124 124
125 // Convenience method to determine if the user is offline. 125 // Convenience method to determine if the user is offline.
126 // Returns true if there is currently no internet connection. 126 // Returns true if there is currently no internet connection.
127 // 127 //
128 // A return value of |true| is a pretty strong indicator that the user 128 // A return value of |true| is a pretty strong indicator that the user
129 // won't be able to connect to remote sites. However, a return value of 129 // won't be able to connect to remote sites. However, a return value of
130 // |false| is inconclusive; even if some link is up, it is uncertain 130 // |false| is inconclusive; even if some link is up, it is uncertain
131 // whether a particular connection attempt to a particular remote site 131 // whether a particular connection attempt to a particular remote site
132 // will be successfully. 132 // will be successfully.
133 static bool IsOffline() { 133 static bool IsOffline();
134 return GetConnectionType() == CONNECTION_NONE; 134
135 } 135 // Returns true if |type| is a cellular connection.
136 // Returns false if |type| is CONNECTION_UNKNOWN., and thus, depending on the
pauljensen 2012/10/22 15:33:36 I think ".," is a typo
137 // implementation of GetConnectionType(), it is possible that
138 // IsConnectionCellular(GetConnectionType()) returns false even if the
139 // current connection is cellular.
140 static bool IsConnectionCellular(ConnectionType type);
136 141
137 // Like Create(), but for use in tests. The mock object doesn't monitor any 142 // Like Create(), but for use in tests. The mock object doesn't monitor any
138 // events, it merely rebroadcasts notifications when requested. 143 // events, it merely rebroadcasts notifications when requested.
139 static NetworkChangeNotifier* CreateMock(); 144 static NetworkChangeNotifier* CreateMock();
140 145
141 // Registers |observer| to receive notifications of network changes. The 146 // Registers |observer| to receive notifications of network changes. The
142 // thread on which this is called is the thread on which |observer| will be 147 // thread on which this is called is the thread on which |observer| will be
143 // called back with notifications. This is safe to call if Create() has not 148 // called back with notifications. This is safe to call if Create() has not
144 // been called (as long as it doesn't race the Create() call on another 149 // been called (as long as it doesn't race the Create() call on another
145 // thread), in which case it will simply do nothing. 150 // thread), in which case it will simply do nothing.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 234
230 // A little-piggy-back observer that simply logs UMA histogram data. 235 // A little-piggy-back observer that simply logs UMA histogram data.
231 scoped_ptr<HistogramWatcher> histogram_watcher_; 236 scoped_ptr<HistogramWatcher> histogram_watcher_;
232 237
233 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); 238 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier);
234 }; 239 };
235 240
236 } // namespace net 241 } // namespace net
237 242
238 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ 243 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_sync_client.cc ('k') | net/base/network_change_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698