Chromium Code Reviews| 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 NetworkProfileHandler; | |
| 19 class NetworkStateHandler; | |
| 20 | |
| 21 // Class for handling initialization and access to chromeos network handlers. | |
| 22 | |
|
pneubeck (no reviews)
2013/05/13 09:17:06
nit: remove empty line.
stevenjb
2013/05/13 23:49:35
Done.
| |
| 23 class CHROMEOS_EXPORT NetworkHandler { | |
| 24 public: | |
| 25 // Sets the global instance. Must be called before any calls to Get(). | |
| 26 static void Initialize(); | |
| 27 | |
| 28 // Destroys the global instance. | |
| 29 static void Shutdown(); | |
| 30 | |
| 31 // Gets the global instance. Initialize() must be called first. | |
| 32 static NetworkHandler* Get(); | |
| 33 | |
| 34 // Returns true if the global instance has been initialized. | |
| 35 static bool IsInitialized(); | |
| 36 | |
| 37 CertLoader* cert_loader(); | |
| 38 NetworkStateHandler* network_state_handler(); | |
|
pneubeck (no reviews)
2013/05/13 09:17:06
I thought you proposed state()?
I'd at least drop
stevenjb
2013/05/13 23:49:35
I decided I prefer the name matching the class (cl
pneubeck (no reviews)
2013/05/22 14:02:53
I don't feel strong about that, so NIT:
That migh
stevenjb
2013/05/22 17:09:27
I don't think we should need to rename the other c
| |
| 39 NetworkProfileHandler* network_profile_handler(); | |
| 40 NetworkConfigurationHandler* network_configuration_handler(); | |
| 41 ManagedNetworkConfigurationHandler* managed_network_configuration_handler(); | |
| 42 GeolocationHandler* geolocation_handler(); | |
| 43 | |
| 44 void SetCertLoaderForTest(CertLoader* cert_loader); | |
|
pneubeck (no reviews)
2013/05/13 09:17:06
Since none of these are called yet, we could leave
stevenjb
2013/05/13 23:49:35
I added them specifically to make setting future m
| |
| 45 void SetNetworkStateHandlerForTest( | |
| 46 NetworkStateHandler* network_state_handler); | |
| 47 void SetNetworkProfileHandlerForTest( | |
| 48 NetworkProfileHandler* network_profile_handler); | |
| 49 void SetNetworkConfigurationHandlerForTest( | |
| 50 NetworkConfigurationHandler* network_configuration_handler); | |
| 51 void SetManagedNetworkConfigurationHandlerForTest( | |
| 52 ManagedNetworkConfigurationHandler* | |
| 53 managed_network_configuration_handler); | |
| 54 void SetGeolocationHandlerForTest( | |
| 55 GeolocationHandler* geolocation_handler); | |
| 56 | |
| 57 private: | |
| 58 class LoginStateInitializer; | |
| 59 | |
| 60 NetworkHandler(); | |
| 61 virtual ~NetworkHandler(); | |
| 62 | |
| 63 void Init(); | |
| 64 | |
| 65 // Initialize LoginState for tests so they do not have to do so explicitly. | |
|
pneubeck (no reviews)
2013/05/13 09:17:06
I'm not convinced that this belongs into this clas
stevenjb
2013/05/13 23:49:35
Requiring any test that initializes NetworkHandler
pneubeck (no reviews)
2013/05/22 14:02:53
Tedious or not. It don't see an argument why it be
stevenjb
2013/05/22 17:09:27
I went ahead and eliminated this and made CertLoad
| |
| 66 scoped_ptr<LoginStateInitializer> login_state_initializer_; | |
| 67 | |
| 68 // The order of these determines the (inverse) destruction order. | |
| 69 scoped_ptr<CertLoader> cert_loader_; | |
| 70 scoped_ptr<NetworkStateHandler> network_state_handler_; | |
| 71 scoped_ptr<NetworkProfileHandler> network_profile_handler_; | |
| 72 scoped_ptr<NetworkConfigurationHandler> network_configuration_handler_; | |
| 73 scoped_ptr<ManagedNetworkConfigurationHandler> | |
| 74 managed_network_configuration_handler_; | |
| 75 scoped_ptr<GeolocationHandler> geolocation_handler_; | |
| 76 | |
| 77 // Unowned test implementations. If non-NULL these will be used instead of | |
| 78 // the owned implementations. The test is responsible for destroying these. | |
| 79 CertLoader* test_cert_loader_; | |
| 80 NetworkStateHandler* test_network_state_handler_; | |
| 81 NetworkProfileHandler* test_network_profile_handler_; | |
| 82 NetworkConfigurationHandler* test_network_configuration_handler_; | |
| 83 ManagedNetworkConfigurationHandler* | |
| 84 test_managed_network_configuration_handler_; | |
| 85 GeolocationHandler* test_geolocation_handler_; | |
| 86 | |
| 87 DISALLOW_COPY_AND_ASSIGN(NetworkHandler); | |
| 88 }; | |
| 89 | |
| 90 } // namespace chromeos | |
| 91 | |
| 92 #endif // CHROMEOS_NETWORK_NETWORK_HANDLER_H_ | |
| OLD | NEW |