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" | |
9 #include "chromeos/network/geolocation_handler.h" | 8 #include "chromeos/network/geolocation_handler.h" |
10 #include "chromeos/network/managed_network_configuration_handler.h" | 9 #include "chromeos/network/managed_network_configuration_handler.h" |
11 #include "chromeos/network/network_configuration_handler.h" | 10 #include "chromeos/network/network_configuration_handler.h" |
12 #include "chromeos/network/network_connection_handler.h" | 11 #include "chromeos/network/network_connection_handler.h" |
13 #include "chromeos/network/network_device_handler.h" | 12 #include "chromeos/network/network_device_handler.h" |
14 #include "chromeos/network/network_event_log.h" | 13 #include "chromeos/network/network_event_log.h" |
15 #include "chromeos/network/network_profile_handler.h" | 14 #include "chromeos/network/network_profile_handler.h" |
16 #include "chromeos/network/network_profile_observer.h" | 15 #include "chromeos/network/network_profile_observer.h" |
17 #include "chromeos/network/network_state_handler.h" | 16 #include "chromeos/network/network_state_handler.h" |
18 #include "chromeos/network/network_state_handler_observer.h" | 17 #include "chromeos/network/network_state_handler_observer.h" |
19 | 18 |
20 namespace chromeos { | 19 namespace chromeos { |
21 | 20 |
22 static NetworkHandler* g_network_handler = NULL; | 21 static NetworkHandler* g_network_handler = NULL; |
23 | 22 |
24 NetworkHandler::NetworkHandler() { | 23 NetworkHandler::NetworkHandler() { |
25 CHECK(DBusThreadManager::IsInitialized()); | 24 CHECK(DBusThreadManager::IsInitialized()); |
26 | 25 |
27 network_event_log::Initialize(); | 26 network_event_log::Initialize(); |
28 | 27 |
29 cert_loader_.reset(new CertLoader); | |
30 network_state_handler_.reset(new NetworkStateHandler()); | 28 network_state_handler_.reset(new NetworkStateHandler()); |
31 network_device_handler_.reset(new NetworkDeviceHandler()); | 29 network_device_handler_.reset(new NetworkDeviceHandler()); |
32 network_profile_handler_.reset(new NetworkProfileHandler()); | 30 network_profile_handler_.reset(new NetworkProfileHandler()); |
33 network_configuration_handler_.reset(new NetworkConfigurationHandler()); | 31 network_configuration_handler_.reset(new NetworkConfigurationHandler()); |
34 managed_network_configuration_handler_.reset( | 32 managed_network_configuration_handler_.reset( |
35 new ManagedNetworkConfigurationHandler()); | 33 new ManagedNetworkConfigurationHandler()); |
36 network_connection_handler_.reset(new NetworkConnectionHandler()); | 34 network_connection_handler_.reset(new NetworkConnectionHandler()); |
37 geolocation_handler_.reset(new GeolocationHandler()); | 35 geolocation_handler_.reset(new GeolocationHandler()); |
38 } | 36 } |
39 | 37 |
40 NetworkHandler::~NetworkHandler() { | 38 NetworkHandler::~NetworkHandler() { |
41 network_event_log::Shutdown(); | 39 network_event_log::Shutdown(); |
42 } | 40 } |
43 | 41 |
44 void NetworkHandler::Init() { | 42 void NetworkHandler::Init() { |
45 network_state_handler_->InitShillPropertyHandler(); | 43 network_state_handler_->InitShillPropertyHandler(); |
46 network_profile_handler_->Init(network_state_handler_.get()); | 44 network_profile_handler_->Init(network_state_handler_.get()); |
47 network_configuration_handler_->Init(network_state_handler_.get()); | 45 network_configuration_handler_->Init(network_state_handler_.get()); |
48 managed_network_configuration_handler_->Init( | 46 managed_network_configuration_handler_->Init( |
49 network_state_handler_.get(), | 47 network_state_handler_.get(), |
50 network_profile_handler_.get(), | 48 network_profile_handler_.get(), |
51 network_configuration_handler_.get()); | 49 network_configuration_handler_.get()); |
52 network_connection_handler_->Init(cert_loader_.get(), | 50 network_connection_handler_->Init(network_state_handler_.get(), |
53 network_state_handler_.get(), | |
54 network_configuration_handler_.get()); | 51 network_configuration_handler_.get()); |
55 geolocation_handler_->Init(); | 52 geolocation_handler_->Init(); |
56 } | 53 } |
57 | 54 |
58 // static | 55 // static |
59 void NetworkHandler::Initialize() { | 56 void NetworkHandler::Initialize() { |
60 CHECK(!g_network_handler); | 57 CHECK(!g_network_handler); |
61 g_network_handler = new NetworkHandler(); | 58 g_network_handler = new NetworkHandler(); |
62 g_network_handler->Init(); | 59 g_network_handler->Init(); |
63 } | 60 } |
(...skipping 10 matching lines...) Expand all Loading... |
74 CHECK(g_network_handler) | 71 CHECK(g_network_handler) |
75 << "NetworkHandler::Get() called before Initialize()"; | 72 << "NetworkHandler::Get() called before Initialize()"; |
76 return g_network_handler; | 73 return g_network_handler; |
77 } | 74 } |
78 | 75 |
79 // static | 76 // static |
80 bool NetworkHandler::IsInitialized() { | 77 bool NetworkHandler::IsInitialized() { |
81 return g_network_handler; | 78 return g_network_handler; |
82 } | 79 } |
83 | 80 |
84 CertLoader* NetworkHandler::cert_loader() { | |
85 return cert_loader_.get(); | |
86 } | |
87 | |
88 NetworkStateHandler* NetworkHandler::network_state_handler() { | 81 NetworkStateHandler* NetworkHandler::network_state_handler() { |
89 return network_state_handler_.get(); | 82 return network_state_handler_.get(); |
90 } | 83 } |
91 | 84 |
92 NetworkDeviceHandler* NetworkHandler::network_device_handler() { | 85 NetworkDeviceHandler* NetworkHandler::network_device_handler() { |
93 return network_device_handler_.get(); | 86 return network_device_handler_.get(); |
94 } | 87 } |
95 | 88 |
96 NetworkProfileHandler* NetworkHandler::network_profile_handler() { | 89 NetworkProfileHandler* NetworkHandler::network_profile_handler() { |
97 return network_profile_handler_.get(); | 90 return network_profile_handler_.get(); |
(...skipping 10 matching lines...) Expand all Loading... |
108 | 101 |
109 NetworkConnectionHandler* NetworkHandler::network_connection_handler() { | 102 NetworkConnectionHandler* NetworkHandler::network_connection_handler() { |
110 return network_connection_handler_.get(); | 103 return network_connection_handler_.get(); |
111 } | 104 } |
112 | 105 |
113 GeolocationHandler* NetworkHandler::geolocation_handler() { | 106 GeolocationHandler* NetworkHandler::geolocation_handler() { |
114 return geolocation_handler_.get(); | 107 return geolocation_handler_.get(); |
115 } | 108 } |
116 | 109 |
117 } // namespace chromeos | 110 } // namespace chromeos |
OLD | NEW |