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

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

Issue 899573002: Add WiFi SSID getter to NetworkChangeNotifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build Created 5 years, 10 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
« no previous file with comments | « net/base/address_tracker_linux_unittest.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 <string>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/basictypes.h" 11 #include "base/basictypes.h"
11 #include "base/observer_list_threadsafe.h" 12 #include "base/observer_list_threadsafe.h"
12 #include "base/time/time.h" 13 #include "base/time/time.h"
13 #include "net/base/net_export.h" 14 #include "net/base/net_export.h"
14 15
15 class GURL; 16 class GURL;
16 17
17 namespace net { 18 namespace net {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 DISALLOW_COPY_AND_ASSIGN(MaxBandwidthObserver); 198 DISALLOW_COPY_AND_ASSIGN(MaxBandwidthObserver);
198 }; 199 };
199 200
200 virtual ~NetworkChangeNotifier(); 201 virtual ~NetworkChangeNotifier();
201 202
202 // See the description of NetworkChangeNotifier::GetConnectionType(). 203 // See the description of NetworkChangeNotifier::GetConnectionType().
203 // Implementations must be thread-safe. Implementations must also be 204 // Implementations must be thread-safe. Implementations must also be
204 // cheap as it is called often. 205 // cheap as it is called often.
205 virtual ConnectionType GetCurrentConnectionType() const = 0; 206 virtual ConnectionType GetCurrentConnectionType() const = 0;
206 207
208 // See the description of NetworkChangeNotifier::GetConnectionType.
209 // Implementations must be thread-safe.
210 virtual std::string GetCurrentWiFiSSID() const = 0;
211
207 // Replaces the default class factory instance of NetworkChangeNotifier class. 212 // Replaces the default class factory instance of NetworkChangeNotifier class.
208 // The method will take over the ownership of |factory| object. 213 // The method will take over the ownership of |factory| object.
209 static void SetFactory(NetworkChangeNotifierFactory* factory); 214 static void SetFactory(NetworkChangeNotifierFactory* factory);
210 215
211 // Creates the process-wide, platform-specific NetworkChangeNotifier. The 216 // Creates the process-wide, platform-specific NetworkChangeNotifier. The
212 // caller owns the returned pointer. You may call this on any thread. You 217 // caller owns the returned pointer. You may call this on any thread. You
213 // may also avoid creating this entirely (in which case nothing will be 218 // may also avoid creating this entirely (in which case nothing will be
214 // monitored), but if you do create it, you must do so before any other 219 // monitored), but if you do create it, you must do so before any other
215 // threads try to access the API below, and it must outlive all other threads 220 // threads try to access the API below, and it must outlive all other threads
216 // which might try to use it. 221 // which might try to use it.
217 static NetworkChangeNotifier* Create(); 222 static NetworkChangeNotifier* Create();
218 223
219 // Returns the connection type. 224 // Returns the connection type.
220 // A return value of |CONNECTION_NONE| is a pretty strong indicator that the 225 // A return value of |CONNECTION_NONE| is a pretty strong indicator that the
221 // user won't be able to connect to remote sites. However, another return 226 // user won't be able to connect to remote sites. However, another return
222 // value doesn't imply that the user will be able to connect to remote sites; 227 // value doesn't imply that the user will be able to connect to remote sites;
223 // even if some link is up, it is uncertain whether a particular connection 228 // even if some link is up, it is uncertain whether a particular connection
224 // attempt to a particular remote site will be successful. 229 // attempt to a particular remote site will be successful.
225 // The returned value only describes the connection currently used by the 230 // The returned value only describes the connection currently used by the
226 // device, and does not take into account other machines on the network. For 231 // device, and does not take into account other machines on the network. For
227 // example, if the device is connected using Wifi to a 3G gateway to access 232 // example, if the device is connected using Wifi to a 3G gateway to access
228 // the internet, the connection type is CONNECTION_WIFI. 233 // the internet, the connection type is CONNECTION_WIFI.
229 static ConnectionType GetConnectionType(); 234 static ConnectionType GetConnectionType();
230 235
236 // Returns the SSID of the current Wi-Fi connection.
237 // A non empty string return value means that the current connection is a
238 // Wi-Fi connection. However, an empty string doesn't necessarily mean the
239 // connection isn't Wi-Fi, any error getting the SSID results in an empty
240 // string.
241 static std::string GetWiFiSSID();
242
231 // Returns a theoretical upper limit on download bandwidth, potentially based 243 // Returns a theoretical upper limit on download bandwidth, potentially based
232 // on underlying connection type, signal strength, or some other signal. The 244 // on underlying connection type, signal strength, or some other signal. The
233 // default mapping of connection type to maximum bandwidth is provided in the 245 // default mapping of connection type to maximum bandwidth is provided in the
234 // NetInfo spec: http://w3c.github.io/netinfo/. Host-specific application 246 // NetInfo spec: http://w3c.github.io/netinfo/. Host-specific application
235 // permissions may be required, please see host-specific declaration for more 247 // permissions may be required, please see host-specific declaration for more
236 // information. 248 // information.
237 static double GetMaxBandwidth(); 249 static double GetMaxBandwidth();
238 250
239 // Retrieve the last read DnsConfig. This could be expensive if the system has 251 // Retrieve the last read DnsConfig. This could be expensive if the system has
240 // a large HOSTS file. 252 // a large HOSTS file.
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 452
441 // Set true to disable non-test notifications (to prevent flakes in tests). 453 // Set true to disable non-test notifications (to prevent flakes in tests).
442 bool test_notifications_only_; 454 bool test_notifications_only_;
443 455
444 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier); 456 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifier);
445 }; 457 };
446 458
447 } // namespace net 459 } // namespace net
448 460
449 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_ 461 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_H_
OLDNEW
« no previous file with comments | « net/base/address_tracker_linux_unittest.cc ('k') | net/base/network_change_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698