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