Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / net / quic / network_connection.h
blobe4fde102a051e1964c005dcea63b16c9fc92282e
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_QUIC_NETWORK_CONNECTION_H_
6 #define NET_QUIC_NETWORK_CONNECTION_H_
8 #include "base/basictypes.h"
9 #include "net/base/net_export.h"
10 #include "net/base/network_change_notifier.h"
12 namespace net {
14 namespace test {
15 class NetworkConnectionPeer;
16 } // namespace test
18 // This class returns the current network's connection description. It also
19 // cache's the connection description to fix crbug.com/422516.
20 class NET_EXPORT NetworkConnection
21 : public NetworkChangeNotifier::IPAddressObserver,
22 public NetworkChangeNotifier::ConnectionTypeObserver {
23 public:
24 NetworkConnection();
25 ~NetworkConnection() override {}
27 // Return a string equivalent of current connection type. Callers don't need
28 // to make a copy of the returned C-string value. If the connection type is
29 // CONNECTION_WIFI, then we'll tease out some details when we are on WiFi, and
30 // hopefully leave only ethernet (with no WiFi available) in the
31 // CONNECTION_UNKNOWN category. This *might* err if there is both ethernet,
32 // as well as WiFi, where WiFi was not being used that much. Most platforms
33 // don't distinguish Wifi vs Etherenet, and call everything CONNECTION_UNKNOWN
34 // :-(. Fo non CONNECTIION_WIFI, this returns the C-string returned by
35 // NetworkChangeNotifier::ConnectionTypeToString.
36 const char* GetDescription();
38 // It clears the cached connection_type_ and connection_description_.
39 void Clear();
41 // NetworkChangeNotifier::IPAddressObserver methods:
42 void OnIPAddressChanged() override;
44 // NetworkChangeNotifier::ConnectionTypeObserver methods:
45 void OnConnectionTypeChanged(
46 NetworkChangeNotifier::ConnectionType type) override;
48 private:
49 friend class test::NetworkConnectionPeer;
51 // Cache the connection_type and the connection description string to avoid
52 // calling expensive GetWifiPHYLayerProtocol() function.
53 NetworkChangeNotifier::ConnectionType connection_type_;
54 const char* connection_description_;
56 DISALLOW_COPY_AND_ASSIGN(NetworkConnection);
59 } // namespace net
61 #endif // NET_QUIC_NETWORK_CONNECTION_H_