| 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_CROS_NETWORK_FUNCTIONS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_CROS_NETWORK_FUNCTIONS_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_CROS_CROS_NETWORK_FUNCTIONS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CROS_CROS_NETWORK_FUNCTIONS_H_ |
| 7 | 7 |
| 8 // This header is introduced to make it easy to switch from chromeos_network.cc | 8 // This header is introduced to make it easy to switch from chromeos_network.cc |
| 9 // to Chrome's own DBus code. crosbug.com/16557 | 9 // to Chrome's own DBus code. crosbug.com/16557 |
| 10 // All calls to functions in chromeos_network.h should be made through | 10 // All calls to functions in chromeos_network.h should be made through |
| 11 // functions provided by this header. | 11 // functions provided by this header. |
| 12 | 12 |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/callback.h" | 15 #include "base/callback.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "chrome/browser/chromeos/cros/cellular_data_plan.h" |
| 17 #include "third_party/cros/chromeos_network.h" | 18 #include "third_party/cros/chromeos_network.h" |
| 18 | 19 |
| 19 namespace base { | 20 namespace base { |
| 20 | 21 |
| 21 class DictionaryValue; | 22 class DictionaryValue; |
| 22 class Value; | 23 class Value; |
| 23 | 24 |
| 24 } // namespace base | 25 } // namespace base |
| 25 | 26 |
| 26 namespace chromeos { | 27 namespace chromeos { |
| 27 | 28 |
| 28 // Callback for asynchronous getters. | 29 // Callback for asynchronous getters. |
| 29 typedef base::Callback<void( | 30 typedef base::Callback<void( |
| 30 const std::string& path, | 31 const std::string& path, |
| 31 const base::DictionaryValue* properties)> NetworkPropertiesCallback; | 32 const base::DictionaryValue* properties)> NetworkPropertiesCallback; |
| 32 | 33 |
| 33 // Callback for network properties watchers. | 34 // Callback for network properties watchers. |
| 34 typedef base::Callback<void( | 35 typedef base::Callback<void( |
| 35 const std::string& path, | 36 const std::string& path, |
| 36 const std::string& key, | 37 const std::string& key, |
| 37 const base::Value& value)> NetworkPropertiesWatcherCallback; | 38 const base::Value& value)> NetworkPropertiesWatcherCallback; |
| 38 | 39 |
| 40 // Callback for data plan update watchers. |
| 41 typedef base::Callback<void( |
| 42 const std::string& modem_service_path, |
| 43 CellularDataPlanVector* data_plan_vector)> DataPlanUpdateWatcherCallback; |
| 44 |
| 39 // Base class of signal watchers. | 45 // Base class of signal watchers. |
| 40 class CrosNetworkWatcher { | 46 class CrosNetworkWatcher { |
| 41 public: | 47 public: |
| 42 virtual ~CrosNetworkWatcher() {} | 48 virtual ~CrosNetworkWatcher() {} |
| 43 | 49 |
| 44 protected: | 50 protected: |
| 45 CrosNetworkWatcher() {} | 51 CrosNetworkWatcher() {} |
| 46 }; | 52 }; |
| 47 | 53 |
| 48 struct WifiAccessPoint { | 54 struct WifiAccessPoint { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 const NetworkPropertiesWatcherCallback& callback, | 121 const NetworkPropertiesWatcherCallback& callback, |
| 116 const std::string& service_path); | 122 const std::string& service_path); |
| 117 | 123 |
| 118 // Similar to MonitorNetworkManagerProperties for a specified network device. | 124 // Similar to MonitorNetworkManagerProperties for a specified network device. |
| 119 CrosNetworkWatcher* CrosMonitorNetworkDeviceProperties( | 125 CrosNetworkWatcher* CrosMonitorNetworkDeviceProperties( |
| 120 const NetworkPropertiesWatcherCallback& callback, | 126 const NetworkPropertiesWatcherCallback& callback, |
| 121 const std::string& device_path); | 127 const std::string& device_path); |
| 122 | 128 |
| 123 // Sets up monitoring of the cellular data plan updates from Cashew. | 129 // Sets up monitoring of the cellular data plan updates from Cashew. |
| 124 CrosNetworkWatcher* CrosMonitorCellularDataPlan( | 130 CrosNetworkWatcher* CrosMonitorCellularDataPlan( |
| 125 MonitorDataPlanCallback callback, void* object); | 131 const DataPlanUpdateWatcherCallback& callback); |
| 126 | 132 |
| 127 // Similar to MonitorNetworkManagerProperties for a specified network device. | 133 // Similar to MonitorNetworkManagerProperties for a specified network device. |
| 128 CrosNetworkWatcher* CrosMonitorSMS(const std::string& modem_device_path, | 134 CrosNetworkWatcher* CrosMonitorSMS(const std::string& modem_device_path, |
| 129 MonitorSMSCallback callback, | 135 MonitorSMSCallback callback, |
| 130 void* object); | 136 void* object); |
| 131 | 137 |
| 132 // Connects to the service with the |service_path|. | 138 // Connects to the service with the |service_path|. |
| 133 // Service parameters such as authentication must already be configured. | 139 // Service parameters such as authentication must already be configured. |
| 134 // Note, a successful invocation of the callback only indicates that | 140 // Note, a successful invocation of the callback only indicates that |
| 135 // the connection process has started. You will have to query the | 141 // the connection process has started. You will have to query the |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 // a true return code only indicates the result set was successfully read, | 262 // a true return code only indicates the result set was successfully read, |
| 257 // it does not imply a scan has successfully completed yet. | 263 // it does not imply a scan has successfully completed yet. |
| 258 bool CrosGetWifiAccessPoints(WifiAccessPointVector* result); | 264 bool CrosGetWifiAccessPoints(WifiAccessPointVector* result); |
| 259 | 265 |
| 260 // Configures the network service specified by |properties|. | 266 // Configures the network service specified by |properties|. |
| 261 void CrosConfigureService(const base::DictionaryValue& properties); | 267 void CrosConfigureService(const base::DictionaryValue& properties); |
| 262 | 268 |
| 263 } // namespace chromeos | 269 } // namespace chromeos |
| 264 | 270 |
| 265 #endif // CHROME_BROWSER_CHROMEOS_CROS_CROS_NETWORK_FUNCTIONS_H_ | 271 #endif // CHROME_BROWSER_CHROMEOS_CROS_CROS_NETWORK_FUNCTIONS_H_ |
| OLD | NEW |