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

Side by Side Diff: chrome/browser/chromeos/net/connectivity_state_helper.h

Issue 14179007: Move cryptohome_library to src/chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
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 "base/observer_list.h"
9 #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" 10 #include "chrome/browser/chromeos/net/connectivity_state_helper_observer.h"
11 #include "chromeos/network/network_state_handler.h" 11 #include "chromeos/network/network_state_handler.h"
12 12
13 namespace chromeos { 13 namespace chromeos {
14 14
15 // This class provides an interface for consumers to query the connectivity 15 // This class provides an interface for consumers to query the connectivity
16 // 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
17 // appropriate source (e.g. NetworkStateHandler). 17 // appropriate source (e.g. NetworkStateHandler).
18 class ConnectivityStateHelper { 18 class ConnectivityStateHelper {
19 public: 19 public:
20 virtual ~ConnectivityStateHelper(); 20 virtual ~ConnectivityStateHelper();
21 21
22 // Initializes the state helper singleton to use the default (network state 22 // Initializes the state helper singleton to use the default (network state
23 // handler) implementation or the network library implementation based 23 // handler) implementation or the network library implementation based
24 // on the value of command line flag. 24 // on the value of command line flag.
25 static void Initialize(); 25 static void Initialize();
26
27 // Similar to initialize, but can be used to inject an alternative
28 // (say,a MockConnectivityStateHelper) implementation.
29 static void InitializeForTesting(ConnectivityStateHelper* csh);
30
31 // Returns true if the global instance has been initialized.
32 static bool IsInitialized(); 26 static bool IsInitialized();
33
34 static void Shutdown(); 27 static void Shutdown();
35 static ConnectivityStateHelper* Get(); 28 static ConnectivityStateHelper* Get();
36 29
30 // Sets up Get() to return |impl| for testing (e.g. with a mock
31 // implementation). Call SetForTest(NUL) when |impl| is deleted.
32 static void SetForTest(ConnectivityStateHelper* impl);
33
37 // Returns true if we are in a connected state. 34 // Returns true if we are in a connected state.
38 virtual bool IsConnected() = 0; 35 virtual bool IsConnected() = 0;
39 36
40 // Returns true if there's a network of |type| in connected state. 37 // Returns true if there's a network of |type| in connected state.
41 virtual bool IsConnectedType(const std::string& type) = 0; 38 virtual bool IsConnectedType(const std::string& type) = 0;
42 39
43 // Returns true if there's a network of |type| in connecting state. 40 // Returns true if there's a network of |type| in connecting state.
44 virtual bool IsConnectingType(const std::string& type) = 0; 41 virtual bool IsConnectingType(const std::string& type) = 0;
45 42
46 // 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
(...skipping 16 matching lines...) Expand all
63 ConnectivityStateHelperObserver* observer); 60 ConnectivityStateHelperObserver* observer);
64 61
65 protected: 62 protected:
66 ConnectivityStateHelper(); 63 ConnectivityStateHelper();
67 ObserverList<ConnectivityStateHelperObserver> network_manager_observers_; 64 ObserverList<ConnectivityStateHelperObserver> network_manager_observers_;
68 }; 65 };
69 66
70 } // namespace chromeos 67 } // namespace chromeos
71 68
72 #endif // CHROME_BROWSER_CHROMEOS_NET_CONNECTIVITY_STATE_HELPER_H_ 69 #endif // CHROME_BROWSER_CHROMEOS_NET_CONNECTIVITY_STATE_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698