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 #include "chromeos/network/network_handler.h" | 5 #include "chromeos/network/network_handler.h" |
6 | 6 |
7 #include "chromeos/dbus/dbus_thread_manager.h" | 7 #include "chromeos/dbus/dbus_thread_manager.h" |
8 #include "chromeos/network/cert_loader.h" | 8 #include "chromeos/network/cert_loader.h" |
9 #include "chromeos/network/geolocation_handler.h" | 9 #include "chromeos/network/geolocation_handler.h" |
10 #include "chromeos/network/managed_network_configuration_handler.h" | 10 #include "chromeos/network/managed_network_configuration_handler.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 network_event_log::Shutdown(); | 39 network_event_log::Shutdown(); |
40 } | 40 } |
41 | 41 |
42 void NetworkHandler::Init() { | 42 void NetworkHandler::Init() { |
43 network_state_handler_->InitShillPropertyHandler(); | 43 network_state_handler_->InitShillPropertyHandler(); |
44 network_configuration_handler_->Init(network_state_handler_.get()); | 44 network_configuration_handler_->Init(network_state_handler_.get()); |
45 managed_network_configuration_handler_->Init( | 45 managed_network_configuration_handler_->Init( |
46 network_state_handler_.get(), | 46 network_state_handler_.get(), |
47 network_profile_handler_.get(), | 47 network_profile_handler_.get(), |
48 network_configuration_handler_.get()); | 48 network_configuration_handler_.get()); |
49 network_connection_handler_->Init(network_state_handler_.get(), | 49 network_connection_handler_->Init(cert_loader_.get(), |
| 50 network_state_handler_.get(), |
50 network_configuration_handler_.get()); | 51 network_configuration_handler_.get()); |
51 geolocation_handler_->Init(); | 52 geolocation_handler_->Init(); |
52 } | 53 } |
53 | 54 |
54 // static | 55 // static |
55 void NetworkHandler::Initialize() { | 56 void NetworkHandler::Initialize() { |
56 CHECK(!g_network_handler); | 57 CHECK(!g_network_handler); |
57 g_network_handler = new NetworkHandler(); | 58 g_network_handler = new NetworkHandler(); |
58 g_network_handler->Init(); | 59 g_network_handler->Init(); |
59 } | 60 } |
60 | 61 |
61 // static | 62 // static |
| 63 void NetworkHandler::InitializeForTest() { |
| 64 CHECK(!g_network_handler); |
| 65 if (!LoginState::IsInitialized()) |
| 66 LoginState::Initialize(); // OK not to shutdown LoginState for tests. |
| 67 g_network_handler = new NetworkHandler(); |
| 68 g_network_handler->Init(); |
| 69 } |
| 70 |
| 71 // static |
62 void NetworkHandler::Shutdown() { | 72 void NetworkHandler::Shutdown() { |
63 CHECK(g_network_handler); | 73 CHECK(g_network_handler); |
64 delete g_network_handler; | 74 delete g_network_handler; |
65 g_network_handler = NULL; | 75 g_network_handler = NULL; |
66 } | 76 } |
67 | 77 |
68 // static | 78 // static |
69 NetworkHandler* NetworkHandler::Get() { | 79 NetworkHandler* NetworkHandler::Get() { |
70 CHECK(g_network_handler) | 80 CHECK(g_network_handler) |
71 << "NetworkHandler::Get() called before Initialize()"; | 81 << "NetworkHandler::Get() called before Initialize()"; |
(...skipping 28 matching lines...) Expand all Loading... |
100 | 110 |
101 NetworkConnectionHandler* NetworkHandler::network_connection_handler() { | 111 NetworkConnectionHandler* NetworkHandler::network_connection_handler() { |
102 return network_connection_handler_.get(); | 112 return network_connection_handler_.get(); |
103 } | 113 } |
104 | 114 |
105 GeolocationHandler* NetworkHandler::geolocation_handler() { | 115 GeolocationHandler* NetworkHandler::geolocation_handler() { |
106 return geolocation_handler_.get(); | 116 return geolocation_handler_.get(); |
107 } | 117 } |
108 | 118 |
109 } // namespace chromeos | 119 } // namespace chromeos |
OLD | NEW |