Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Side by Side Diff: chromeos/network/network_handler.cc

Issue 14729017: Add NetworkHandler to own network handlers in src/chromeos/network (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix chromeos_unittests Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chromeos/network/network_handler.h ('k') | chromeos/network/network_profile_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #include "chromeos/network/network_handler.h"
6
7 #include "chromeos/dbus/dbus_thread_manager.h"
8 #include "chromeos/network/cert_loader.h"
9 #include "chromeos/network/geolocation_handler.h"
10 #include "chromeos/network/managed_network_configuration_handler.h"
11 #include "chromeos/network/network_configuration_handler.h"
12 #include "chromeos/network/network_connection_handler.h"
13 #include "chromeos/network/network_event_log.h"
14 #include "chromeos/network/network_profile_handler.h"
15 #include "chromeos/network/network_profile_observer.h"
16 #include "chromeos/network/network_state_handler.h"
17 #include "chromeos/network/network_state_handler_observer.h"
18
19 namespace chromeos {
20
21 static NetworkHandler* g_network_handler = NULL;
22
23 NetworkHandler::NetworkHandler() {
24 CHECK(DBusThreadManager::IsInitialized());
25
26 network_event_log::Initialize();
27
28 cert_loader_.reset(new CertLoader);
29 network_state_handler_.reset(new NetworkStateHandler());
30 network_profile_handler_.reset(new NetworkProfileHandler());
31 network_configuration_handler_.reset(new NetworkConfigurationHandler());
32 managed_network_configuration_handler_.reset(
33 new ManagedNetworkConfigurationHandler());
34 network_connection_handler_.reset(new NetworkConnectionHandler());
35 geolocation_handler_.reset(new GeolocationHandler());
36 }
37
38 NetworkHandler::~NetworkHandler() {
39 network_event_log::Shutdown();
40 }
41
42 void NetworkHandler::Init() {
43 network_state_handler_->InitShillPropertyHandler();
44 network_configuration_handler_->Init(network_state_handler_.get());
45 managed_network_configuration_handler_->Init(
46 network_state_handler_.get(),
47 network_profile_handler_.get(),
48 network_configuration_handler_.get());
49 network_connection_handler_->Init(network_state_handler_.get(),
50 network_configuration_handler_.get());
51 geolocation_handler_->Init();
52 }
53
54 // static
55 void NetworkHandler::Initialize() {
56 CHECK(!g_network_handler);
57 g_network_handler = new NetworkHandler();
58 g_network_handler->Init();
59 }
60
61 // static
62 void NetworkHandler::Shutdown() {
63 CHECK(g_network_handler);
64 delete g_network_handler;
65 g_network_handler = NULL;
66 }
67
68 // static
69 NetworkHandler* NetworkHandler::Get() {
70 CHECK(g_network_handler)
71 << "NetworkHandler::Get() called before Initialize()";
72 return g_network_handler;
73 }
74
75 // static
76 bool NetworkHandler::IsInitialized() {
77 return g_network_handler;
78 }
79
80 CertLoader* NetworkHandler::cert_loader() {
81 return cert_loader_.get();
82 }
83
84 NetworkStateHandler* NetworkHandler::network_state_handler() {
85 return network_state_handler_.get();
86 }
87
88 NetworkProfileHandler* NetworkHandler::network_profile_handler() {
89 return network_profile_handler_.get();
90 }
91
92 NetworkConfigurationHandler* NetworkHandler::network_configuration_handler() {
93 return network_configuration_handler_.get();
94 }
95
96 ManagedNetworkConfigurationHandler*
97 NetworkHandler::managed_network_configuration_handler() {
98 return managed_network_configuration_handler_.get();
99 }
100
101 NetworkConnectionHandler* NetworkHandler::network_connection_handler() {
102 return network_connection_handler_.get();
103 }
104
105 GeolocationHandler* NetworkHandler::geolocation_handler() {
106 return geolocation_handler_.get();
107 }
108
109 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_handler.h ('k') | chromeos/network/network_profile_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698