| 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 21 matching lines...) Expand all Loading... |
| 32 managed_network_configuration_handler_.reset( | 32 managed_network_configuration_handler_.reset( |
| 33 new ManagedNetworkConfigurationHandler()); | 33 new ManagedNetworkConfigurationHandler()); |
| 34 network_connection_handler_.reset(new NetworkConnectionHandler()); | 34 network_connection_handler_.reset(new NetworkConnectionHandler()); |
| 35 geolocation_handler_.reset(new GeolocationHandler()); | 35 geolocation_handler_.reset(new GeolocationHandler()); |
| 36 } | 36 } |
| 37 | 37 |
| 38 NetworkHandler::~NetworkHandler() { | 38 NetworkHandler::~NetworkHandler() { |
| 39 network_event_log::Shutdown(); | 39 network_event_log::Shutdown(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void NetworkHandler::Init() { | 42 void NetworkHandler::Init( |
| 43 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner) { |
| 44 cert_loader_->Init(io_task_runner); |
| 43 network_state_handler_->InitShillPropertyHandler(); | 45 network_state_handler_->InitShillPropertyHandler(); |
| 44 network_configuration_handler_->Init(network_state_handler_.get()); | 46 network_configuration_handler_->Init(network_state_handler_.get()); |
| 45 managed_network_configuration_handler_->Init( | 47 managed_network_configuration_handler_->Init( |
| 46 network_state_handler_.get(), | 48 network_state_handler_.get(), |
| 47 network_profile_handler_.get(), | 49 network_profile_handler_.get(), |
| 48 network_configuration_handler_.get()); | 50 network_configuration_handler_.get()); |
| 49 network_connection_handler_->Init(network_state_handler_.get(), | 51 network_connection_handler_->Init(network_state_handler_.get(), |
| 50 network_configuration_handler_.get()); | 52 network_configuration_handler_.get()); |
| 51 geolocation_handler_->Init(); | 53 geolocation_handler_->Init(); |
| 52 } | 54 } |
| 53 | 55 |
| 54 // static | 56 // static |
| 55 void NetworkHandler::Initialize() { | 57 void NetworkHandler::Initialize( |
| 58 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner) { |
| 56 CHECK(!g_network_handler); | 59 CHECK(!g_network_handler); |
| 57 g_network_handler = new NetworkHandler(); | 60 g_network_handler = new NetworkHandler(); |
| 58 g_network_handler->Init(); | 61 g_network_handler->Init(io_task_runner); |
| 59 } | 62 } |
| 60 | 63 |
| 61 // static | 64 // static |
| 65 void NetworkHandler::InitializeForTest() { |
| 66 CHECK(!g_network_handler); |
| 67 g_network_handler = new NetworkHandler(); |
| 68 // For Test, run IO operations on the curent thread. |
| 69 scoped_refptr<base::SequencedTaskRunner> io_task_runner = |
| 70 base::MessageLoopProxy::current(); |
| 71 g_network_handler->Init(io_task_runner); |
| 72 } |
| 73 |
| 74 // static |
| 62 void NetworkHandler::Shutdown() { | 75 void NetworkHandler::Shutdown() { |
| 63 CHECK(g_network_handler); | 76 CHECK(g_network_handler); |
| 64 delete g_network_handler; | 77 delete g_network_handler; |
| 65 g_network_handler = NULL; | 78 g_network_handler = NULL; |
| 66 } | 79 } |
| 67 | 80 |
| 68 // static | 81 // static |
| 69 NetworkHandler* NetworkHandler::Get() { | 82 NetworkHandler* NetworkHandler::Get() { |
| 70 CHECK(g_network_handler) | 83 CHECK(g_network_handler) |
| 71 << "NetworkHandler::Get() called before Initialize()"; | 84 << "NetworkHandler::Get() called before Initialize()"; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 100 | 113 |
| 101 NetworkConnectionHandler* NetworkHandler::network_connection_handler() { | 114 NetworkConnectionHandler* NetworkHandler::network_connection_handler() { |
| 102 return network_connection_handler_.get(); | 115 return network_connection_handler_.get(); |
| 103 } | 116 } |
| 104 | 117 |
| 105 GeolocationHandler* NetworkHandler::geolocation_handler() { | 118 GeolocationHandler* NetworkHandler::geolocation_handler() { |
| 106 return geolocation_handler_.get(); | 119 return geolocation_handler_.get(); |
| 107 } | 120 } |
| 108 | 121 |
| 109 } // namespace chromeos | 122 } // namespace chromeos |
| OLD | NEW |