OLD | NEW |
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_BASE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_IMPL_BASE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_IMPL_BASE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_IMPL_BASE_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "chrome/browser/chromeos/cros/network_library.h" | 11 #include "chrome/browser/chromeos/cros/network_library.h" |
| 12 #include "chromeos/network/onc/onc_constants.h" |
12 | 13 |
13 namespace chromeos { | 14 namespace chromeos { |
14 | 15 |
15 class NetworkLoginObserver; | 16 class NetworkLoginObserver; |
16 | 17 |
17 class NetworkLibraryImplBase : public NetworkLibrary { | 18 class NetworkLibraryImplBase : public NetworkLibrary { |
18 public: | 19 public: |
19 NetworkLibraryImplBase(); | 20 NetworkLibraryImplBase(); |
20 virtual ~NetworkLibraryImplBase(); | 21 virtual ~NetworkLibraryImplBase(); |
21 | 22 |
(...skipping 14 matching lines...) Expand all Loading... |
36 // Calls ConnectToVirtualNetworkUsingConnectData if network request succeeds. | 37 // Calls ConnectToVirtualNetworkUsingConnectData if network request succeeds. |
37 virtual void CallRequestVirtualNetworkAndConnect( | 38 virtual void CallRequestVirtualNetworkAndConnect( |
38 const std::string& service_name, | 39 const std::string& service_name, |
39 const std::string& server_hostname, | 40 const std::string& server_hostname, |
40 ProviderType provider_type) = 0; | 41 ProviderType provider_type) = 0; |
41 // Call to configure a wifi service. The identifier is either a service_path | 42 // Call to configure a wifi service. The identifier is either a service_path |
42 // or a GUID. |info| is a dictionary of property values. | 43 // or a GUID. |info| is a dictionary of property values. |
43 virtual void CallConfigureService(const std::string& identifier, | 44 virtual void CallConfigureService(const std::string& identifier, |
44 const DictionaryValue* info) = 0; | 45 const DictionaryValue* info) = 0; |
45 // Called from NetworkConnectStart. | 46 // Called from NetworkConnectStart. |
46 // Calls NetworkConnectCompleted when the connection attept completes. | 47 // Calls NetworkConnectCompleted when the connection attempt completes. |
47 virtual void CallConnectToNetwork(Network* network) = 0; | 48 virtual void CallConnectToNetwork(Network* network) = 0; |
48 // Called from DeleteRememberedNetwork. | 49 // Called from DeleteRememberedNetwork. |
49 virtual void CallDeleteRememberedNetwork( | 50 virtual void CallDeleteRememberedNetwork( |
50 const std::string& profile_path, const std::string& service_path) = 0; | 51 const std::string& profile_path, const std::string& service_path) = 0; |
51 | 52 |
52 // Called from Enable*NetworkDevice. | 53 // Called from Enable*NetworkDevice. |
53 // Asynchronously enables or disables the specified device type. | 54 // Asynchronously enables or disables the specified device type. |
54 virtual void CallEnableNetworkDeviceType( | 55 virtual void CallEnableNetworkDeviceType( |
55 ConnectionType device, bool enable) = 0; | 56 ConnectionType device, bool enable) = 0; |
56 | 57 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 virtual void EnableWifiNetworkDevice(bool enable) OVERRIDE; | 227 virtual void EnableWifiNetworkDevice(bool enable) OVERRIDE; |
227 virtual void EnableMobileNetworkDevice(bool enable) OVERRIDE; | 228 virtual void EnableMobileNetworkDevice(bool enable) OVERRIDE; |
228 virtual void EnableWimaxNetworkDevice(bool enable) OVERRIDE; | 229 virtual void EnableWimaxNetworkDevice(bool enable) OVERRIDE; |
229 virtual void EnableCellularNetworkDevice(bool enable) OVERRIDE; | 230 virtual void EnableCellularNetworkDevice(bool enable) OVERRIDE; |
230 // virtual EnableOfflineMode implemented in derived classes. | 231 // virtual EnableOfflineMode implemented in derived classes. |
231 // virtual GetIPConfigs implemented in derived classes. | 232 // virtual GetIPConfigs implemented in derived classes. |
232 // virtual SetIPConfig implemented in derived classes. | 233 // virtual SetIPConfig implemented in derived classes. |
233 virtual void SwitchToPreferredNetwork() OVERRIDE; | 234 virtual void SwitchToPreferredNetwork() OVERRIDE; |
234 virtual bool LoadOncNetworks(const std::string& onc_blob, | 235 virtual bool LoadOncNetworks(const std::string& onc_blob, |
235 const std::string& passphrase, | 236 const std::string& passphrase, |
236 NetworkUIData::ONCSource source, | 237 onc::ONCSource source, |
237 bool allow_web_trust_from_policy, | 238 bool allow_web_trust_from_policy, |
238 std::string* error) OVERRIDE; | 239 std::string* error) OVERRIDE; |
239 virtual bool SetActiveNetwork(ConnectionType type, | 240 virtual bool SetActiveNetwork(ConnectionType type, |
240 const std::string& service_path) OVERRIDE; | 241 const std::string& service_path) OVERRIDE; |
241 | 242 |
242 protected: | 243 protected: |
243 typedef ObserverList<NetworkObserver> NetworkObserverList; | 244 typedef ObserverList<NetworkObserver> NetworkObserverList; |
244 typedef std::map<std::string, NetworkObserverList*> NetworkObserverMap; | 245 typedef std::map<std::string, NetworkObserverList*> NetworkObserverMap; |
245 | 246 |
246 typedef ObserverList<NetworkDeviceObserver> NetworkDeviceObserverList; | 247 typedef ObserverList<NetworkDeviceObserver> NetworkDeviceObserverList; |
247 typedef std::map<std::string, NetworkDeviceObserverList*> | 248 typedef std::map<std::string, NetworkDeviceObserverList*> |
248 NetworkDeviceObserverMap; | 249 NetworkDeviceObserverMap; |
249 | 250 |
250 typedef std::map<std::string, Network*> NetworkMap; | 251 typedef std::map<std::string, Network*> NetworkMap; |
251 typedef std::map<std::string, int> PriorityMap; | 252 typedef std::map<std::string, int> PriorityMap; |
252 typedef std::map<std::string, NetworkDevice*> NetworkDeviceMap; | 253 typedef std::map<std::string, NetworkDevice*> NetworkDeviceMap; |
253 typedef std::map<std::string, const base::DictionaryValue*> NetworkOncMap; | 254 typedef std::map<std::string, const base::DictionaryValue*> NetworkOncMap; |
254 typedef std::map<NetworkUIData::ONCSource, | 255 typedef std::map<onc::ONCSource, |
255 std::set<std::string> > NetworkSourceMap; | 256 std::set<std::string> > NetworkSourceMap; |
256 | 257 |
257 struct NetworkProfile { | 258 struct NetworkProfile { |
258 NetworkProfile(const std::string& p, NetworkProfileType t); | 259 NetworkProfile(const std::string& p, NetworkProfileType t); |
259 ~NetworkProfile(); | 260 ~NetworkProfile(); |
260 std::string path; | 261 std::string path; |
261 NetworkProfileType type; | 262 NetworkProfileType type; |
262 typedef std::set<std::string> ServiceList; | 263 typedef std::set<std::string> ServiceList; |
263 ServiceList services; | 264 ServiceList services; |
264 }; | 265 }; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 // Network list management functions. | 311 // Network list management functions. |
311 void ClearActiveNetwork(ConnectionType type); | 312 void ClearActiveNetwork(ConnectionType type); |
312 void UpdateActiveNetwork(Network* network); | 313 void UpdateActiveNetwork(Network* network); |
313 void AddNetwork(Network* network); | 314 void AddNetwork(Network* network); |
314 void DeleteNetwork(Network* network); | 315 void DeleteNetwork(Network* network); |
315 | 316 |
316 // Calls ForgetNetwork for remembered wifi and virtual networks based on id. | 317 // Calls ForgetNetwork for remembered wifi and virtual networks based on id. |
317 // When |if_found| is true, then it forgets networks that appear in |ids|. | 318 // When |if_found| is true, then it forgets networks that appear in |ids|. |
318 // When |if_found| is false, it removes networks that do NOT appear in |ids|. | 319 // When |if_found| is false, it removes networks that do NOT appear in |ids|. |
319 // |source| is the import source of the data. | 320 // |source| is the import source of the data. |
320 void ForgetNetworksById(NetworkUIData::ONCSource source, | 321 void ForgetNetworksById(onc::ONCSource source, |
321 std::set<std::string> ids, | 322 std::set<std::string> ids, |
322 bool if_found); | 323 bool if_found); |
323 | 324 |
324 // Checks whether |network| has meanwhile been pruned by ONC policy. If so, | 325 // Checks whether |network| has meanwhile been pruned by ONC policy. If so, |
325 // instructs shill to remove the network, deletes |network| and returns | 326 // instructs shill to remove the network, deletes |network| and returns |
326 // false. | 327 // false. |
327 bool ValidateRememberedNetwork(Network* network); | 328 bool ValidateRememberedNetwork(Network* network); |
328 | 329 |
329 // Adds |network| to the remembered networks data structures and returns true | 330 // Adds |network| to the remembered networks data structures and returns true |
330 // if ValidateRememberedNetwork(network) returns true. Returns false | 331 // if ValidateRememberedNetwork(network) returns true. Returns false |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 // stray networks that shill still has on file, but are not known on the | 487 // stray networks that shill still has on file, but are not known on the |
487 // Chrome side. | 488 // Chrome side. |
488 NetworkSourceMap network_source_map_; | 489 NetworkSourceMap network_source_map_; |
489 | 490 |
490 DISALLOW_COPY_AND_ASSIGN(NetworkLibraryImplBase); | 491 DISALLOW_COPY_AND_ASSIGN(NetworkLibraryImplBase); |
491 }; | 492 }; |
492 | 493 |
493 } // namespace chromeos | 494 } // namespace chromeos |
494 | 495 |
495 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_IMPL_BASE_H_ | 496 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_IMPL_BASE_H_ |
OLD | NEW |