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

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

Issue 10827283: This updates the StaticIP configuration UI to match new mocks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup for review Created 8 years, 4 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 #ifndef CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_IMPL_CROS_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_IMPL_CROS_H_
6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_IMPL_CROS_H_ 6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_IMPL_CROS_H_
7 7
8 #include "chrome/browser/chromeos/cros/network_library_impl_base.h" 8 #include "chrome/browser/chromeos/cros/network_library_impl_base.h"
9 9
10 namespace chromeos { 10 namespace chromeos {
11 11
12 class NetworkLibraryImplCros : public NetworkLibraryImplBase { 12 class NetworkLibraryImplCros : public NetworkLibraryImplBase {
13 public: 13 public:
14 NetworkLibraryImplCros(); 14 NetworkLibraryImplCros();
15 virtual ~NetworkLibraryImplCros(); 15 virtual ~NetworkLibraryImplCros();
16 16
17 // Structure used to pass IP parameter info to a DoSetIPParameters callback,
18 // since Bind only takes up to six parameters.
19 struct IPParameterInfo {
20 std::string address;
21 std::string netmask;
22 std::string gateway;
23 std::string name_servers;
24 int dhcp_usage_mask;
25 };
26
17 virtual void Init() OVERRIDE; 27 virtual void Init() OVERRIDE;
18 virtual bool IsCros() const OVERRIDE; 28 virtual bool IsCros() const OVERRIDE;
19 29
20 ////////////////////////////////////////////////////////////////////////////// 30 //////////////////////////////////////////////////////////////////////////////
21 // NetworkLibraryImplBase implementation. 31 // NetworkLibraryImplBase implementation.
22 32
23 virtual void MonitorNetworkStart(const std::string& service_path) OVERRIDE; 33 virtual void MonitorNetworkStart(const std::string& service_path) OVERRIDE;
24 virtual void MonitorNetworkStop(const std::string& service_path) OVERRIDE; 34 virtual void MonitorNetworkStop(const std::string& service_path) OVERRIDE;
25 virtual void MonitorNetworkDeviceStart( 35 virtual void MonitorNetworkDeviceStart(
26 const std::string& device_path) OVERRIDE; 36 const std::string& device_path) OVERRIDE;
27 virtual void MonitorNetworkDeviceStop( 37 virtual void MonitorNetworkDeviceStop(
28 const std::string& device_path) OVERRIDE; 38 const std::string& device_path) OVERRIDE;
29 39
30 virtual void CallConfigureService(const std::string& identifier, 40 virtual void CallConfigureService(const std::string& identifier,
31 const DictionaryValue* info) OVERRIDE; 41 const base::DictionaryValue* info) OVERRIDE;
32 virtual void CallConnectToNetwork(Network* network) OVERRIDE; 42 virtual void CallConnectToNetwork(Network* network) OVERRIDE;
33 virtual void CallRequestWifiNetworkAndConnect( 43 virtual void CallRequestWifiNetworkAndConnect(
34 const std::string& ssid, ConnectionSecurity security) OVERRIDE; 44 const std::string& ssid, ConnectionSecurity security) OVERRIDE;
35 virtual void CallRequestVirtualNetworkAndConnect( 45 virtual void CallRequestVirtualNetworkAndConnect(
36 const std::string& service_name, 46 const std::string& service_name,
37 const std::string& server_hostname, 47 const std::string& server_hostname,
38 ProviderType provider_type) OVERRIDE; 48 ProviderType provider_type) OVERRIDE;
39 virtual void CallDeleteRememberedNetwork( 49 virtual void CallDeleteRememberedNetwork(
40 const std::string& profile_path, 50 const std::string& profile_path,
41 const std::string& service_path) OVERRIDE; 51 const std::string& service_path) OVERRIDE;
(...skipping 24 matching lines...) Expand all
66 virtual void CallEnableNetworkDeviceType( 76 virtual void CallEnableNetworkDeviceType(
67 ConnectionType device, bool enable) OVERRIDE; 77 ConnectionType device, bool enable) OVERRIDE;
68 virtual void CallRemoveNetwork(const Network* network) OVERRIDE; 78 virtual void CallRemoveNetwork(const Network* network) OVERRIDE;
69 79
70 virtual void EnableOfflineMode(bool enable) OVERRIDE; 80 virtual void EnableOfflineMode(bool enable) OVERRIDE;
71 81
72 virtual NetworkIPConfigVector GetIPConfigs( 82 virtual NetworkIPConfigVector GetIPConfigs(
73 const std::string& device_path, 83 const std::string& device_path,
74 std::string* hardware_address, 84 std::string* hardware_address,
75 HardwareAddressFormat format) OVERRIDE; 85 HardwareAddressFormat format) OVERRIDE;
76 virtual void SetIPConfig(const NetworkIPConfig& ipconfig) OVERRIDE; 86 virtual void SetIPParameters(const std::string& service_path,
87 const std::string& address,
88 const std::string& netmask,
89 const std::string& gateway,
90 const std::string& name_servers,
91 int dhcp_usage_mask) OVERRIDE;
77 92
78 ////////////////////////////////////////////////////////////////////////////// 93 //////////////////////////////////////////////////////////////////////////////
79 // Callbacks. 94 // Callbacks.
80 void UpdateNetworkStatus( 95 void UpdateNetworkStatus(
81 const std::string& path, const std::string& key, const Value& value); 96 const std::string& path, const std::string& key, const Value& value);
82 97
83 void UpdateNetworkDeviceStatus( 98 void UpdateNetworkDeviceStatus(
84 const std::string& path, const std::string& key, const Value& value); 99 const std::string& path, const std::string& key, const Value& value);
85 // Cellular specific updates. Returns false if update was ignored / reverted 100 // Cellular specific updates. Returns false if update was ignored / reverted
86 // and notification should be skipped. 101 // and notification should be skipped.
(...skipping 22 matching lines...) Expand all
109 void NetworkManagerUpdate(const std::string& manager_path, 124 void NetworkManagerUpdate(const std::string& manager_path,
110 const base::DictionaryValue* properties); 125 const base::DictionaryValue* properties);
111 126
112 void NetworkServiceUpdate(const std::string& service_path, 127 void NetworkServiceUpdate(const std::string& service_path,
113 const base::DictionaryValue* properties); 128 const base::DictionaryValue* properties);
114 void RememberedNetworkServiceUpdate(const std::string& service_path, 129 void RememberedNetworkServiceUpdate(const std::string& service_path,
115 const base::DictionaryValue* properties); 130 const base::DictionaryValue* properties);
116 void NetworkDeviceUpdate(const std::string& device_path, 131 void NetworkDeviceUpdate(const std::string& device_path,
117 const base::DictionaryValue* properties); 132 const base::DictionaryValue* properties);
118 133
134 // Second half of setting IP Parameters. SetIPParameters above kicks off
135 // an async information fetch, and this completes the operation when that
136 // fetch is complete.
137 void SetIPParametersCallback(const IPParameterInfo& info,
138 const std::string& service_path,
139 const base::DictionaryValue* properties);
stevenjb 2012/08/13 17:43:44 Does this need to be part of the public API? If so
Greg Spencer (Chromium) 2012/08/13 23:53:44 No, I guess it doesn't. I had thought that it nee
140
119 // Second half of refreshing IPConfig for a network. Refreshes all IP config 141 // Second half of refreshing IPConfig for a network. Refreshes all IP config
120 // paths found in properties. 142 // paths found in properties.
121 void RefreshIPConfigCallback(const std::string& device_path, 143 void RefreshIPConfigCallback(const std::string& device_path,
122 const base::DictionaryValue* properties); 144 const base::DictionaryValue* properties);
123 145
124 private: 146 private:
125 // This processes all Manager update messages. 147 // This processes all Manager update messages.
126 bool NetworkManagerStatusChanged(const std::string& key, const Value* value); 148 bool NetworkManagerStatusChanged(const std::string& key, const Value* value);
127 void ParseNetworkManager(const DictionaryValue& dict); 149 void ParseNetworkManager(const base::DictionaryValue& dict);
128 void UpdateTechnologies(const ListValue* technologies, int* bitfieldp); 150 void UpdateTechnologies(const base::ListValue* technologies, int* bitfieldp);
129 void UpdateAvailableTechnologies(const ListValue* technologies); 151 void UpdateAvailableTechnologies(const base::ListValue* technologies);
130 void UpdateEnabledTechnologies(const ListValue* technologies); 152 void UpdateEnabledTechnologies(const base::ListValue* technologies);
131 void UpdateConnectedTechnologies(const ListValue* technologies); 153 void UpdateConnectedTechnologies(const base::ListValue* technologies);
132 154
133 // Update network lists. 155 // Update network lists.
134 void UpdateNetworkServiceList(const ListValue* services); 156 void UpdateNetworkServiceList(const base::ListValue* services);
135 void UpdateWatchedNetworkServiceList(const ListValue* services); 157 void UpdateWatchedNetworkServiceList(const base::ListValue* services);
136 Network* ParseNetwork(const std::string& service_path, 158 Network* ParseNetwork(const std::string& service_path,
137 const DictionaryValue& info); 159 const base::DictionaryValue& info);
138 160
139 void UpdateRememberedNetworks(const ListValue* profiles); 161 void UpdateRememberedNetworks(const base::ListValue* profiles);
140 void RequestRememberedNetworksUpdate(); 162 void RequestRememberedNetworksUpdate();
141 void UpdateProfile(const std::string& profile_path, 163 void UpdateProfile(const std::string& profile_path,
142 const DictionaryValue* properties); 164 const base::DictionaryValue* properties);
143 Network* ParseRememberedNetwork(const std::string& service_path, 165 Network* ParseRememberedNetwork(const std::string& service_path,
144 const DictionaryValue& info); 166 const base::DictionaryValue& info);
145 167
146 // NetworkDevice list management functions. 168 // NetworkDevice list management functions.
147 void UpdateNetworkDeviceList(const ListValue* devices); 169 void UpdateNetworkDeviceList(const base::ListValue* devices);
148 void ParseNetworkDevice(const std::string& device_path, 170 void ParseNetworkDevice(const std::string& device_path,
149 const DictionaryValue& info); 171 const base::DictionaryValue& info);
150 172
151 // Empty device observer to ensure that device property updates are received. 173 // Empty device observer to ensure that device property updates are received.
152 class NetworkLibraryDeviceObserver : public NetworkDeviceObserver { 174 class NetworkLibraryDeviceObserver : public NetworkDeviceObserver {
153 public: 175 public:
154 virtual ~NetworkLibraryDeviceObserver() {} 176 virtual ~NetworkLibraryDeviceObserver() {}
155 virtual void OnNetworkDeviceChanged( 177 virtual void OnNetworkDeviceChanged(
156 NetworkLibrary* cros, const NetworkDevice* device) OVERRIDE {} 178 NetworkLibrary* cros, const NetworkDevice* device) OVERRIDE {}
157 }; 179 };
158 180
159 typedef std::map<std::string, CrosNetworkWatcher*> NetworkWatcherMap; 181 typedef std::map<std::string, CrosNetworkWatcher*> NetworkWatcherMap;
(...skipping 14 matching lines...) Expand all
174 196
175 // Map of monitored devices. 197 // Map of monitored devices.
176 NetworkWatcherMap monitored_devices_; 198 NetworkWatcherMap monitored_devices_;
177 199
178 DISALLOW_COPY_AND_ASSIGN(NetworkLibraryImplCros); 200 DISALLOW_COPY_AND_ASSIGN(NetworkLibraryImplCros);
179 }; 201 };
180 202
181 } // namespace chromeos 203 } // namespace chromeos
182 204
183 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_IMPL_CROS_H_ 205 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_IMPL_CROS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698