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 "base/threading/worker_pool.h" | 7 #include "base/threading/worker_pool.h" |
8 #include "chromeos/dbus/dbus_thread_manager.h" | 8 #include "chromeos/dbus/dbus_thread_manager.h" |
| 9 #include "chromeos/network/client_cert_resolver.h" |
9 #include "chromeos/network/geolocation_handler.h" | 10 #include "chromeos/network/geolocation_handler.h" |
10 #include "chromeos/network/managed_network_configuration_handler.h" | 11 #include "chromeos/network/managed_network_configuration_handler.h" |
11 #include "chromeos/network/network_cert_migrator.h" | 12 #include "chromeos/network/network_cert_migrator.h" |
12 #include "chromeos/network/network_configuration_handler.h" | 13 #include "chromeos/network/network_configuration_handler.h" |
13 #include "chromeos/network/network_connection_handler.h" | 14 #include "chromeos/network/network_connection_handler.h" |
14 #include "chromeos/network/network_device_handler.h" | 15 #include "chromeos/network/network_device_handler.h" |
15 #include "chromeos/network/network_event_log.h" | 16 #include "chromeos/network/network_event_log.h" |
16 #include "chromeos/network/network_profile_handler.h" | 17 #include "chromeos/network/network_profile_handler.h" |
17 #include "chromeos/network/network_profile_observer.h" | 18 #include "chromeos/network/network_profile_observer.h" |
18 #include "chromeos/network/network_sms_handler.h" | 19 #include "chromeos/network/network_sms_handler.h" |
19 #include "chromeos/network/network_state_handler.h" | 20 #include "chromeos/network/network_state_handler.h" |
20 #include "chromeos/network/network_state_handler_observer.h" | 21 #include "chromeos/network/network_state_handler_observer.h" |
21 | 22 |
22 namespace chromeos { | 23 namespace chromeos { |
23 | 24 |
24 static NetworkHandler* g_network_handler = NULL; | 25 static NetworkHandler* g_network_handler = NULL; |
25 | 26 |
26 NetworkHandler::NetworkHandler() { | 27 NetworkHandler::NetworkHandler() { |
27 CHECK(DBusThreadManager::IsInitialized()); | 28 CHECK(DBusThreadManager::IsInitialized()); |
28 | 29 |
29 network_event_log::Initialize(); | 30 network_event_log::Initialize(); |
30 | 31 |
31 network_state_handler_.reset(new NetworkStateHandler()); | 32 network_state_handler_.reset(new NetworkStateHandler()); |
32 network_device_handler_.reset(new NetworkDeviceHandler()); | 33 network_device_handler_.reset(new NetworkDeviceHandler()); |
33 network_profile_handler_.reset(new NetworkProfileHandler()); | 34 network_profile_handler_.reset(new NetworkProfileHandler()); |
34 if (CertLoader::IsInitialized()) | |
35 network_cert_migrator_.reset(new NetworkCertMigrator()); | |
36 network_configuration_handler_.reset(new NetworkConfigurationHandler()); | 35 network_configuration_handler_.reset(new NetworkConfigurationHandler()); |
37 managed_network_configuration_handler_.reset( | 36 managed_network_configuration_handler_.reset( |
38 new ManagedNetworkConfigurationHandler()); | 37 new ManagedNetworkConfigurationHandler()); |
| 38 if (CertLoader::IsInitialized()) { |
| 39 network_cert_migrator_.reset(new NetworkCertMigrator()); |
| 40 client_cert_resolver_.reset(new ClientCertResolver()); |
| 41 } |
39 network_connection_handler_.reset(new NetworkConnectionHandler()); | 42 network_connection_handler_.reset(new NetworkConnectionHandler()); |
40 network_sms_handler_.reset(new NetworkSmsHandler()); | 43 network_sms_handler_.reset(new NetworkSmsHandler()); |
41 geolocation_handler_.reset(new GeolocationHandler()); | 44 geolocation_handler_.reset(new GeolocationHandler()); |
42 } | 45 } |
43 | 46 |
44 NetworkHandler::~NetworkHandler() { | 47 NetworkHandler::~NetworkHandler() { |
45 network_event_log::Shutdown(); | 48 network_event_log::Shutdown(); |
46 } | 49 } |
47 | 50 |
48 void NetworkHandler::Init() { | 51 void NetworkHandler::Init() { |
49 network_state_handler_->InitShillPropertyHandler(); | 52 network_state_handler_->InitShillPropertyHandler(); |
50 network_profile_handler_->Init(network_state_handler_.get()); | 53 network_profile_handler_->Init(network_state_handler_.get()); |
51 if (network_cert_migrator_) | |
52 network_cert_migrator_->Init(network_state_handler_.get()); | |
53 network_configuration_handler_->Init(network_state_handler_.get()); | 54 network_configuration_handler_->Init(network_state_handler_.get()); |
54 managed_network_configuration_handler_->Init( | 55 managed_network_configuration_handler_->Init( |
55 network_state_handler_.get(), | 56 network_state_handler_.get(), |
56 network_profile_handler_.get(), | 57 network_profile_handler_.get(), |
57 network_configuration_handler_.get()); | 58 network_configuration_handler_.get()); |
58 network_connection_handler_->Init(network_state_handler_.get(), | 59 network_connection_handler_->Init(network_state_handler_.get(), |
59 network_configuration_handler_.get()); | 60 network_configuration_handler_.get()); |
| 61 if (network_cert_migrator_) |
| 62 network_cert_migrator_->Init(network_state_handler_.get()); |
| 63 if (client_cert_resolver_) { |
| 64 client_cert_resolver_->Init(network_state_handler_.get(), |
| 65 managed_network_configuration_handler_.get()); |
| 66 } |
60 network_sms_handler_->Init(); | 67 network_sms_handler_->Init(); |
61 geolocation_handler_->Init(); | 68 geolocation_handler_->Init(); |
62 } | 69 } |
63 | 70 |
64 // static | 71 // static |
65 void NetworkHandler::Initialize() { | 72 void NetworkHandler::Initialize() { |
66 CHECK(!g_network_handler); | 73 CHECK(!g_network_handler); |
67 g_network_handler = new NetworkHandler(); | 74 g_network_handler = new NetworkHandler(); |
68 g_network_handler->Init(); | 75 g_network_handler->Init(); |
69 } | 76 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 121 |
115 NetworkSmsHandler* NetworkHandler::network_sms_handler() { | 122 NetworkSmsHandler* NetworkHandler::network_sms_handler() { |
116 return network_sms_handler_.get(); | 123 return network_sms_handler_.get(); |
117 } | 124 } |
118 | 125 |
119 GeolocationHandler* NetworkHandler::geolocation_handler() { | 126 GeolocationHandler* NetworkHandler::geolocation_handler() { |
120 return geolocation_handler_.get(); | 127 return geolocation_handler_.get(); |
121 } | 128 } |
122 | 129 |
123 } // namespace chromeos | 130 } // namespace chromeos |
OLD | NEW |