| 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_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 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 // NetworkLibraryImplBase implementation. | 21 // NetworkLibraryImplBase implementation. |
| 22 | 22 |
| 23 virtual void MonitorNetworkStart(const std::string& service_path) OVERRIDE; | 23 virtual void MonitorNetworkStart(const std::string& service_path) OVERRIDE; |
| 24 virtual void MonitorNetworkStop(const std::string& service_path) OVERRIDE; | 24 virtual void MonitorNetworkStop(const std::string& service_path) OVERRIDE; |
| 25 virtual void MonitorNetworkDeviceStart( | 25 virtual void MonitorNetworkDeviceStart( |
| 26 const std::string& device_path) OVERRIDE; | 26 const std::string& device_path) OVERRIDE; |
| 27 virtual void MonitorNetworkDeviceStop( | 27 virtual void MonitorNetworkDeviceStop( |
| 28 const std::string& device_path) OVERRIDE; | 28 const std::string& device_path) OVERRIDE; |
| 29 | 29 |
| 30 virtual void CallConfigureService(const std::string& identifier, | 30 virtual void CallConfigureService(const std::string& identifier, |
| 31 const DictionaryValue* info) OVERRIDE; | 31 const base::DictionaryValue* info) OVERRIDE; |
| 32 virtual void CallConnectToNetwork(Network* network) OVERRIDE; | 32 virtual void CallConnectToNetwork(Network* network) OVERRIDE; |
| 33 virtual void CallRequestWifiNetworkAndConnect( | 33 virtual void CallRequestWifiNetworkAndConnect( |
| 34 const std::string& ssid, ConnectionSecurity security) OVERRIDE; | 34 const std::string& ssid, ConnectionSecurity security) OVERRIDE; |
| 35 virtual void CallRequestVirtualNetworkAndConnect( | 35 virtual void CallRequestVirtualNetworkAndConnect( |
| 36 const std::string& service_name, | 36 const std::string& service_name, |
| 37 const std::string& server_hostname, | 37 const std::string& server_hostname, |
| 38 ProviderType provider_type) OVERRIDE; | 38 ProviderType provider_type) OVERRIDE; |
| 39 virtual void CallDeleteRememberedNetwork( | 39 virtual void CallDeleteRememberedNetwork( |
| 40 const std::string& profile_path, | 40 const std::string& profile_path, |
| 41 const std::string& service_path) OVERRIDE; | 41 const std::string& service_path) OVERRIDE; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 66 virtual void CallEnableNetworkDeviceType( | 66 virtual void CallEnableNetworkDeviceType( |
| 67 ConnectionType device, bool enable) OVERRIDE; | 67 ConnectionType device, bool enable) OVERRIDE; |
| 68 virtual void CallRemoveNetwork(const Network* network) OVERRIDE; | 68 virtual void CallRemoveNetwork(const Network* network) OVERRIDE; |
| 69 | 69 |
| 70 virtual void EnableOfflineMode(bool enable) OVERRIDE; | 70 virtual void EnableOfflineMode(bool enable) OVERRIDE; |
| 71 | 71 |
| 72 virtual NetworkIPConfigVector GetIPConfigs( | 72 virtual NetworkIPConfigVector GetIPConfigs( |
| 73 const std::string& device_path, | 73 const std::string& device_path, |
| 74 std::string* hardware_address, | 74 std::string* hardware_address, |
| 75 HardwareAddressFormat format) OVERRIDE; | 75 HardwareAddressFormat format) OVERRIDE; |
| 76 virtual void SetIPConfig(const NetworkIPConfig& ipconfig) OVERRIDE; | 76 virtual void SetIPParameters(const std::string& service_path, |
| 77 const std::string& address, |
| 78 const std::string& netmask, |
| 79 const std::string& gateway, |
| 80 const std::string& name_servers, |
| 81 int dhcp_usage_mask) OVERRIDE; |
| 77 | 82 |
| 78 ////////////////////////////////////////////////////////////////////////////// | 83 ////////////////////////////////////////////////////////////////////////////// |
| 79 // Callbacks. | 84 // Callbacks. |
| 80 void UpdateNetworkStatus( | 85 void UpdateNetworkStatus( |
| 81 const std::string& path, const std::string& key, const Value& value); | 86 const std::string& path, const std::string& key, const Value& value); |
| 82 | 87 |
| 83 void UpdateNetworkDeviceStatus( | 88 void UpdateNetworkDeviceStatus( |
| 84 const std::string& path, const std::string& key, const Value& value); | 89 const std::string& path, const std::string& key, const Value& value); |
| 85 // Cellular specific updates. Returns false if update was ignored / reverted | 90 // Cellular specific updates. Returns false if update was ignored / reverted |
| 86 // and notification should be skipped. | 91 // and notification should be skipped. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 109 void NetworkManagerUpdate(const std::string& manager_path, | 114 void NetworkManagerUpdate(const std::string& manager_path, |
| 110 const base::DictionaryValue* properties); | 115 const base::DictionaryValue* properties); |
| 111 | 116 |
| 112 void NetworkServiceUpdate(const std::string& service_path, | 117 void NetworkServiceUpdate(const std::string& service_path, |
| 113 const base::DictionaryValue* properties); | 118 const base::DictionaryValue* properties); |
| 114 void RememberedNetworkServiceUpdate(const std::string& service_path, | 119 void RememberedNetworkServiceUpdate(const std::string& service_path, |
| 115 const base::DictionaryValue* properties); | 120 const base::DictionaryValue* properties); |
| 116 void NetworkDeviceUpdate(const std::string& device_path, | 121 void NetworkDeviceUpdate(const std::string& device_path, |
| 117 const base::DictionaryValue* properties); | 122 const base::DictionaryValue* properties); |
| 118 | 123 |
| 124 private: |
| 125 // Structure used to pass IP parameter info to a DoSetIPParameters callback, |
| 126 // since Bind only takes up to six parameters. |
| 127 struct IPParameterInfo; |
| 128 |
| 129 // Second half of setting IP Parameters. SetIPParameters above kicks off |
| 130 // an async information fetch, and this completes the operation when that |
| 131 // fetch is complete. |
| 132 void SetIPParametersCallback(const IPParameterInfo& info, |
| 133 const std::string& service_path, |
| 134 const base::DictionaryValue* properties); |
| 135 |
| 119 // Second half of refreshing IPConfig for a network. Refreshes all IP config | 136 // Second half of refreshing IPConfig for a network. Refreshes all IP config |
| 120 // paths found in properties. | 137 // paths found in properties. |
| 121 void RefreshIPConfigCallback(const std::string& device_path, | 138 void RefreshIPConfigCallback(const std::string& device_path, |
| 122 const base::DictionaryValue* properties); | 139 const base::DictionaryValue* properties); |
| 123 | 140 |
| 124 private: | |
| 125 // This processes all Manager update messages. | 141 // This processes all Manager update messages. |
| 126 bool NetworkManagerStatusChanged(const std::string& key, const Value* value); | 142 bool NetworkManagerStatusChanged(const std::string& key, const Value* value); |
| 127 void ParseNetworkManager(const DictionaryValue& dict); | 143 void ParseNetworkManager(const base::DictionaryValue& dict); |
| 128 void UpdateTechnologies(const ListValue* technologies, int* bitfieldp); | 144 void UpdateTechnologies(const base::ListValue* technologies, int* bitfieldp); |
| 129 void UpdateAvailableTechnologies(const ListValue* technologies); | 145 void UpdateAvailableTechnologies(const base::ListValue* technologies); |
| 130 void UpdateEnabledTechnologies(const ListValue* technologies); | 146 void UpdateEnabledTechnologies(const base::ListValue* technologies); |
| 131 void UpdateConnectedTechnologies(const ListValue* technologies); | 147 void UpdateConnectedTechnologies(const base::ListValue* technologies); |
| 132 | 148 |
| 133 // Update network lists. | 149 // Update network lists. |
| 134 void UpdateNetworkServiceList(const ListValue* services); | 150 void UpdateNetworkServiceList(const base::ListValue* services); |
| 135 void UpdateWatchedNetworkServiceList(const ListValue* services); | 151 void UpdateWatchedNetworkServiceList(const base::ListValue* services); |
| 136 Network* ParseNetwork(const std::string& service_path, | 152 Network* ParseNetwork(const std::string& service_path, |
| 137 const DictionaryValue& info); | 153 const base::DictionaryValue& info); |
| 138 | 154 |
| 139 void UpdateRememberedNetworks(const ListValue* profiles); | 155 void UpdateRememberedNetworks(const base::ListValue* profiles); |
| 140 void RequestRememberedNetworksUpdate(); | 156 void RequestRememberedNetworksUpdate(); |
| 141 void UpdateProfile(const std::string& profile_path, | 157 void UpdateProfile(const std::string& profile_path, |
| 142 const DictionaryValue* properties); | 158 const base::DictionaryValue* properties); |
| 143 Network* ParseRememberedNetwork(const std::string& service_path, | 159 Network* ParseRememberedNetwork(const std::string& service_path, |
| 144 const DictionaryValue& info); | 160 const base::DictionaryValue& info); |
| 145 | 161 |
| 146 // NetworkDevice list management functions. | 162 // NetworkDevice list management functions. |
| 147 void UpdateNetworkDeviceList(const ListValue* devices); | 163 void UpdateNetworkDeviceList(const base::ListValue* devices); |
| 148 void ParseNetworkDevice(const std::string& device_path, | 164 void ParseNetworkDevice(const std::string& device_path, |
| 149 const DictionaryValue& info); | 165 const base::DictionaryValue& info); |
| 150 | 166 |
| 151 // Empty device observer to ensure that device property updates are received. | 167 // Empty device observer to ensure that device property updates are received. |
| 152 class NetworkLibraryDeviceObserver : public NetworkDeviceObserver { | 168 class NetworkLibraryDeviceObserver : public NetworkDeviceObserver { |
| 153 public: | 169 public: |
| 154 virtual ~NetworkLibraryDeviceObserver() {} | 170 virtual ~NetworkLibraryDeviceObserver() {} |
| 155 virtual void OnNetworkDeviceChanged( | 171 virtual void OnNetworkDeviceChanged( |
| 156 NetworkLibrary* cros, const NetworkDevice* device) OVERRIDE {} | 172 NetworkLibrary* cros, const NetworkDevice* device) OVERRIDE {} |
| 157 }; | 173 }; |
| 158 | 174 |
| 159 typedef std::map<std::string, CrosNetworkWatcher*> NetworkWatcherMap; | 175 typedef std::map<std::string, CrosNetworkWatcher*> NetworkWatcherMap; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 174 | 190 |
| 175 // Map of monitored devices. | 191 // Map of monitored devices. |
| 176 NetworkWatcherMap monitored_devices_; | 192 NetworkWatcherMap monitored_devices_; |
| 177 | 193 |
| 178 DISALLOW_COPY_AND_ASSIGN(NetworkLibraryImplCros); | 194 DISALLOW_COPY_AND_ASSIGN(NetworkLibraryImplCros); |
| 179 }; | 195 }; |
| 180 | 196 |
| 181 } // namespace chromeos | 197 } // namespace chromeos |
| 182 | 198 |
| 183 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_IMPL_CROS_H_ | 199 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_IMPL_CROS_H_ |
| OLD | NEW |