OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CHROME_BROWSER_CHROMEOS_NET_CONNECTIVITY_STATE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_NET_CONNECTIVITY_STATE_HELPER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_NET_CONNECTIVITY_STATE_HELPER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_NET_CONNECTIVITY_STATE_HELPER_H_ |
7 | 7 |
8 #include "base/observer_list.h" | |
8 #include "chrome/browser/chromeos/cros/network_library.h" | 9 #include "chrome/browser/chromeos/cros/network_library.h" |
10 #include "chrome/browser/chromeos/net/connectivity_state_helper_observer.h" | |
9 #include "chromeos/network/network_state_handler.h" | 11 #include "chromeos/network/network_state_handler.h" |
10 #include "chromeos/network/network_state_handler_observer.h" | |
11 | 12 |
12 namespace chromeos { | 13 namespace chromeos { |
13 | 14 |
14 // This class provides an interface for consumers to query the connectivity | 15 // This class provides an interface for consumers to query the connectivity |
15 // state on Chrome OS. Subclasses must implement the query methods using an | 16 // state on Chrome OS. Subclasses must implement the query methods using an |
16 // appropriate source (e.g. NetworkStateHandler). | 17 // appropriate source (e.g. NetworkStateHandler). |
17 class ConnectivityStateHelper { | 18 class ConnectivityStateHelper { |
18 public: | 19 public: |
19 virtual ~ConnectivityStateHelper() {} | 20 virtual ~ConnectivityStateHelper() {} |
20 | 21 |
(...skipping 21 matching lines...) Expand all Loading... | |
42 // Get the name for the primary network of type |type| which is not | 43 // Get the name for the primary network of type |type| which is not |
43 // in non-idle state (i.e. connecting or connected state). | 44 // in non-idle state (i.e. connecting or connected state). |
44 virtual std::string NetworkNameForType(const std::string& type) = 0; | 45 virtual std::string NetworkNameForType(const std::string& type) = 0; |
45 | 46 |
46 // Returns the name of the default network. | 47 // Returns the name of the default network. |
47 virtual std::string DefaultNetworkName() = 0; | 48 virtual std::string DefaultNetworkName() = 0; |
48 | 49 |
49 // Returns true if we have a default network and are in online state. | 50 // Returns true if we have a default network and are in online state. |
50 virtual bool DefaultNetworkOnline() = 0; | 51 virtual bool DefaultNetworkOnline() = 0; |
51 | 52 |
53 // Add/remove observers for listening to connection manager changes. | |
54 virtual void AddNetworkManagerObserver( | |
55 ConnectivityStateHelperObserver* observer); | |
56 virtual void RemoveNetworkManagerObserver( | |
57 ConnectivityStateHelperObserver* observer); | |
stevenjb
2013/03/11 23:11:05
I wonder if this would be better as just "Add/Remo
gauravsh
2013/03/12 00:30:25
I did this to keep things simple and match current
stevenjb
2013/03/12 15:53:34
I guess the question is whether or not it makes se
| |
58 | |
52 protected: | 59 protected: |
53 ConnectivityStateHelper() {} | 60 ConnectivityStateHelper() {} |
61 ObserverList<ConnectivityStateHelperObserver> network_manager_observers_; | |
54 }; | 62 }; |
55 | 63 |
56 } // namespace chromeos | 64 } // namespace chromeos |
57 | 65 |
58 #endif // CHROME_BROWSER_CHROMEOS_NET_CONNECTIVITY_STATE_HELPER_H_ | 66 #endif // CHROME_BROWSER_CHROMEOS_NET_CONNECTIVITY_STATE_HELPER_H_ |
OLD | NEW |