OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 CHROMEOS_NETWORK_NETWORK_HANDLER_H_ | 5 #ifndef CHROMEOS_NETWORK_NETWORK_HANDLER_H_ |
6 #define CHROMEOS_NETWORK_NETWORK_HANDLER_H_ | 6 #define CHROMEOS_NETWORK_NETWORK_HANDLER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chromeos/chromeos_export.h" | 10 #include "chromeos/chromeos_export.h" |
11 | 11 |
12 namespace chromeos { | 12 namespace chromeos { |
13 | 13 |
14 class CertLoader; | |
15 class GeolocationHandler; | 14 class GeolocationHandler; |
16 class ManagedNetworkConfigurationHandler; | 15 class ManagedNetworkConfigurationHandler; |
17 class NetworkConfigurationHandler; | 16 class NetworkConfigurationHandler; |
18 class NetworkConnectionHandler; | 17 class NetworkConnectionHandler; |
19 class NetworkDeviceHandler; | 18 class NetworkDeviceHandler; |
20 class NetworkProfileHandler; | 19 class NetworkProfileHandler; |
21 class NetworkStateHandler; | 20 class NetworkStateHandler; |
22 | 21 |
23 // Class for handling initialization and access to chromeos network handlers. | 22 // Class for handling initialization and access to chromeos network handlers. |
24 // This class should NOT be used in unit tests. Instead, construct individual | 23 // This class should NOT be used in unit tests. Instead, construct individual |
25 // classes independently. | 24 // classes independently. |
26 class CHROMEOS_EXPORT NetworkHandler { | 25 class CHROMEOS_EXPORT NetworkHandler { |
27 public: | 26 public: |
28 // Sets the global instance. Must be called before any calls to Get(). | 27 // Sets the global instance. Must be called before any calls to Get(). |
29 static void Initialize(); | 28 static void Initialize(); |
30 | 29 |
31 // Destroys the global instance. | 30 // Destroys the global instance. |
32 static void Shutdown(); | 31 static void Shutdown(); |
33 | 32 |
34 // Gets the global instance. Initialize() must be called first. | 33 // Gets the global instance. Initialize() must be called first. |
35 static NetworkHandler* Get(); | 34 static NetworkHandler* Get(); |
36 | 35 |
37 // Returns true if the global instance has been initialized. | 36 // Returns true if the global instance has been initialized. |
38 static bool IsInitialized(); | 37 static bool IsInitialized(); |
39 | 38 |
40 // Do not use these accessors within this module; all dependencies should be | 39 // Do not use these accessors within this module; all dependencies should be |
41 // explicit so that classes can be constructed explicitly in tests without | 40 // explicit so that classes can be constructed explicitly in tests without |
42 // NetworkHandler. | 41 // NetworkHandler. |
43 CertLoader* cert_loader(); | |
44 NetworkStateHandler* network_state_handler(); | 42 NetworkStateHandler* network_state_handler(); |
45 NetworkDeviceHandler* network_device_handler(); | 43 NetworkDeviceHandler* network_device_handler(); |
46 NetworkProfileHandler* network_profile_handler(); | 44 NetworkProfileHandler* network_profile_handler(); |
47 NetworkConfigurationHandler* network_configuration_handler(); | 45 NetworkConfigurationHandler* network_configuration_handler(); |
48 ManagedNetworkConfigurationHandler* managed_network_configuration_handler(); | 46 ManagedNetworkConfigurationHandler* managed_network_configuration_handler(); |
49 NetworkConnectionHandler* network_connection_handler(); | 47 NetworkConnectionHandler* network_connection_handler(); |
50 GeolocationHandler* geolocation_handler(); | 48 GeolocationHandler* geolocation_handler(); |
51 | 49 |
52 private: | 50 private: |
53 NetworkHandler(); | 51 NetworkHandler(); |
54 virtual ~NetworkHandler(); | 52 virtual ~NetworkHandler(); |
55 | 53 |
56 void Init(); | 54 void Init(); |
57 | 55 |
58 // The order of these determines the (inverse) destruction order. | 56 // The order of these determines the (inverse) destruction order. |
59 scoped_ptr<CertLoader> cert_loader_; | |
60 scoped_ptr<NetworkStateHandler> network_state_handler_; | 57 scoped_ptr<NetworkStateHandler> network_state_handler_; |
61 scoped_ptr<NetworkDeviceHandler> network_device_handler_; | 58 scoped_ptr<NetworkDeviceHandler> network_device_handler_; |
62 scoped_ptr<NetworkProfileHandler> network_profile_handler_; | 59 scoped_ptr<NetworkProfileHandler> network_profile_handler_; |
63 scoped_ptr<NetworkConfigurationHandler> network_configuration_handler_; | 60 scoped_ptr<NetworkConfigurationHandler> network_configuration_handler_; |
64 scoped_ptr<ManagedNetworkConfigurationHandler> | 61 scoped_ptr<ManagedNetworkConfigurationHandler> |
65 managed_network_configuration_handler_; | 62 managed_network_configuration_handler_; |
66 scoped_ptr<NetworkConnectionHandler> network_connection_handler_; | 63 scoped_ptr<NetworkConnectionHandler> network_connection_handler_; |
67 scoped_ptr<GeolocationHandler> geolocation_handler_; | 64 scoped_ptr<GeolocationHandler> geolocation_handler_; |
68 | 65 |
69 DISALLOW_COPY_AND_ASSIGN(NetworkHandler); | 66 DISALLOW_COPY_AND_ASSIGN(NetworkHandler); |
70 }; | 67 }; |
71 | 68 |
72 } // namespace chromeos | 69 } // namespace chromeos |
73 | 70 |
74 #endif // CHROMEOS_NETWORK_NETWORK_HANDLER_H_ | 71 #endif // CHROMEOS_NETWORK_NETWORK_HANDLER_H_ |
OLD | NEW |