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

Side by Side Diff: chrome/browser/chromeos/cros/network_library_impl_cros.h

Issue 23618026: NOT FOR SUBMIT: Remove NetworkLibrary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 3 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
OLDNEW
(Empty)
1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_IMPL_CROS_H_
6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_IMPL_CROS_H_
7
8 #include "base/time/time.h"
9 #include "chrome/browser/chromeos/cros/network_library_impl_base.h"
10
11 namespace chromeos {
12
13 class CrosNetworkWatcher;
14
15 class NetworkLibraryImplCros : public NetworkLibraryImplBase {
16 public:
17 NetworkLibraryImplCros();
18 virtual ~NetworkLibraryImplCros();
19
20 virtual void Init() OVERRIDE;
21 virtual bool IsCros() const OVERRIDE;
22
23 //////////////////////////////////////////////////////////////////////////////
24 // NetworkLibraryImplBase implementation.
25
26 virtual void MonitorNetworkStart(const std::string& service_path) OVERRIDE;
27 virtual void MonitorNetworkStop(const std::string& service_path) OVERRIDE;
28 virtual void MonitorNetworkDeviceStart(
29 const std::string& device_path) OVERRIDE;
30 virtual void MonitorNetworkDeviceStop(
31 const std::string& device_path) OVERRIDE;
32
33 virtual void CallConfigureService(const std::string& identifier,
34 const base::DictionaryValue* info) OVERRIDE;
35 virtual void CallConnectToNetwork(Network* network) OVERRIDE;
36 virtual void CallRequestWifiNetworkAndConnect(
37 const std::string& ssid, ConnectionSecurity security) OVERRIDE;
38 virtual void CallRequestVirtualNetworkAndConnect(
39 const std::string& service_name,
40 const std::string& server_hostname,
41 ProviderType provider_type) OVERRIDE;
42 virtual void CallDeleteRememberedNetwork(
43 const std::string& profile_path,
44 const std::string& service_path) OVERRIDE;
45
46 //////////////////////////////////////////////////////////////////////////////
47 // NetworkLibrary implementation.
48
49 virtual void ChangePin(const std::string& old_pin,
50 const std::string& new_pin) OVERRIDE;
51 virtual void ChangeRequirePin(bool require_pin,
52 const std::string& pin) OVERRIDE;
53 virtual void EnterPin(const std::string& pin) OVERRIDE;
54 virtual void UnblockPin(const std::string& puk,
55 const std::string& new_pin) OVERRIDE;
56 virtual void RequestCellularScan() OVERRIDE;
57 virtual void RequestCellularRegister(const std::string& network_id) OVERRIDE;
58 virtual void SetCellularDataRoamingAllowed(bool new_value) OVERRIDE;
59 virtual void SetCarrier(const std::string& carrier,
60 const NetworkOperationCallback& completed) OVERRIDE;
61 virtual bool IsCellularAlwaysInRoaming() OVERRIDE;
62 virtual void RequestNetworkScan() OVERRIDE;
63
64 virtual void DisconnectFromNetwork(const Network* network) OVERRIDE;
65 virtual void CallEnableNetworkDeviceType(
66 ConnectionType device, bool enable) OVERRIDE;
67 virtual void CallRemoveNetwork(const Network* network) OVERRIDE;
68
69 virtual void GetIPConfigs(
70 const std::string& device_path,
71 HardwareAddressFormat format,
72 const NetworkGetIPConfigsCallback& callback) OVERRIDE;
73 virtual void SetIPParameters(const std::string& service_path,
74 const std::string& address,
75 const std::string& netmask,
76 const std::string& gateway,
77 const std::string& name_servers,
78 int dhcp_usage_mask) OVERRIDE;
79 virtual void RequestNetworkServiceProperties(
80 const std::string& service_path,
81 const NetworkServicePropertiesCallback& callback) OVERRIDE;
82
83 //////////////////////////////////////////////////////////////////////////////
84 // Callbacks.
85 void UpdateNetworkStatus(
86 const std::string& path, const std::string& key, const Value& value);
87
88 void UpdateNetworkDeviceStatus(
89 const std::string& path, const std::string& key, const Value& value);
90 // Cellular specific updates. Returns false if update was ignored / reverted
91 // and notification should be skipped.
92 bool UpdateCellularDeviceStatus(NetworkDevice* device, PropertyIndex index);
93
94 void GetIPConfigsCallback(const NetworkGetIPConfigsCallback& callback,
95 HardwareAddressFormat format,
96 const NetworkIPConfigVector& ipconfig_vector,
97 const std::string& hardware_address);
98
99 void PinOperationCallback(const std::string& path,
100 NetworkMethodErrorType error,
101 const std::string& error_message);
102
103 void CellularRegisterCallback(const std::string& path,
104 NetworkMethodErrorType error,
105 const std::string& error_message);
106
107 void NetworkConnectCallback(const std::string& service_path,
108 NetworkMethodErrorType error,
109 const std::string& error_message);
110
111 void WifiServiceUpdateAndConnect(const std::string& service_path,
112 const base::DictionaryValue* properties);
113 void VPNServiceUpdateAndConnect(const std::string& service_path,
114 const base::DictionaryValue* properties);
115
116 void NetworkManagerStatusChangedHandler(const std::string& path,
117 const std::string& key,
118 const base::Value& value);
119 void NetworkManagerUpdate(const std::string& manager_path,
120 const base::DictionaryValue* properties);
121
122 void NetworkServiceUpdate(const std::string& service_path,
123 const base::DictionaryValue* properties);
124 void RememberedNetworkServiceUpdate(const std::string& profile_path,
125 const std::string& service_path,
126 const base::DictionaryValue* properties);
127 void NetworkDeviceUpdate(const std::string& device_path,
128 const base::DictionaryValue* properties);
129
130 private:
131 // Structure used to pass IP parameter info to a DoSetIPParameters callback,
132 // since Bind only takes up to six parameters.
133 struct IPParameterInfo;
134
135 // Refresh the IP configuration of the given network after changes. Puts
136 // newly configured properties into effect and renews DHCP lease.
137 void RefreshIPConfig(Network* network);
138
139 // Second half of setting IP Parameters. SetIPParameters above kicks off
140 // an async information fetch, and this completes the operation when that
141 // fetch is complete.
142 void SetIPParametersCallback(const IPParameterInfo& info,
143 const std::string& service_path,
144 const base::DictionaryValue* properties);
145
146 // Second half of refreshing IPConfig for a network. Refreshes all IP config
147 // paths found in properties.
148 void RefreshIPConfigCallback(const std::string& device_path,
149 const base::DictionaryValue* properties);
150
151 // This processes all Manager update messages.
152 bool NetworkManagerStatusChanged(const std::string& key, const Value* value);
153 void ParseNetworkManager(const base::DictionaryValue& dict);
154 void UpdateTechnologies(const base::ListValue* technologies, int* bitfieldp);
155 void UpdateAvailableTechnologies(const base::ListValue* technologies);
156 void UpdateEnabledTechnologies(const base::ListValue* technologies);
157
158 // Update network lists.
159 void UpdateNetworkServiceList(const base::ListValue* services);
160 void UpdateWatchedNetworkServiceList(const base::ListValue* services);
161 Network* ParseNetwork(const std::string& service_path,
162 const base::DictionaryValue& info);
163
164 void UpdateRememberedNetworks(const base::ListValue* profiles);
165 void RequestRememberedNetworksUpdate();
166 void UpdateProfile(const std::string& profile_path,
167 const base::DictionaryValue* properties);
168 Network* ParseRememberedNetwork(const std::string& profile_path,
169 const std::string& service_path,
170 const base::DictionaryValue& info);
171
172 // NetworkDevice list management functions.
173 void UpdateNetworkDeviceList(const base::ListValue* devices);
174 void ParseNetworkDevice(const std::string& device_path,
175 const base::DictionaryValue& info);
176
177 // Compare two network profiles by their path.
178 static bool AreProfilePathsEqual(const NetworkProfile& a,
179 const NetworkProfile& b);
180
181 // Empty device observer to ensure that device property updates are received.
182 class NetworkLibraryDeviceObserver : public NetworkDeviceObserver {
183 public:
184 virtual ~NetworkLibraryDeviceObserver() {}
185 };
186
187 typedef std::map<std::string, CrosNetworkWatcher*> NetworkWatcherMap;
188
189 base::WeakPtrFactory<NetworkLibraryImplCros> weak_ptr_factory_;
190
191 // For monitoring network manager status changes.
192 scoped_ptr<CrosNetworkWatcher> network_manager_watcher_;
193
194 // Network device observer.
195 scoped_ptr<NetworkLibraryDeviceObserver> network_device_observer_;
196
197 // Map of monitored networks.
198 NetworkWatcherMap monitored_networks_;
199
200 // Map of monitored devices.
201 NetworkWatcherMap monitored_devices_;
202
203 DISALLOW_COPY_AND_ASSIGN(NetworkLibraryImplCros);
204 };
205
206 } // namespace chromeos
207
208 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_IMPL_CROS_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/network_library_impl_base.cc ('k') | chrome/browser/chromeos/cros/network_library_impl_cros.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698