| 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 CHROMEOS_NETWORK_NETWORK_UTIL_H_ | 5 #ifndef CHROMEOS_NETWORK_NETWORK_UTIL_H_ |
| 6 #define CHROMEOS_NETWORK_NETWORK_UTIL_H_ | 6 #define CHROMEOS_NETWORK_NETWORK_UTIL_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 <string> | 13 #include <string> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
| 17 #include "base/callback.h" | 17 #include "base/callback.h" |
| 18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "base/values.h" | 20 #include "base/values.h" |
| 21 #include "chromeos/chromeos_export.h" | 21 #include "chromeos/chromeos_export.h" |
| 22 | 22 |
| 23 namespace base { | 23 namespace base { |
| 24 class ListValue; | 24 class ListValue; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace chromeos { | 27 namespace chromeos { |
| 28 | 28 |
| 29 class FavoriteState; | 29 class NetworkState; |
| 30 class NetworkTypePattern; | 30 class NetworkTypePattern; |
| 31 | 31 |
| 32 // Struct for passing wifi access point data. | 32 // Struct for passing wifi access point data. |
| 33 struct CHROMEOS_EXPORT WifiAccessPoint { | 33 struct CHROMEOS_EXPORT WifiAccessPoint { |
| 34 WifiAccessPoint(); | 34 WifiAccessPoint(); |
| 35 ~WifiAccessPoint(); | 35 ~WifiAccessPoint(); |
| 36 std::string ssid; // The ssid of the WiFi node if available. | 36 std::string ssid; // The ssid of the WiFi node if available. |
| 37 std::string mac_address; // The mac address of the WiFi node. | 37 std::string mac_address; // The mac address of the WiFi node. |
| 38 base::Time timestamp; // Timestamp when this AP was detected. | 38 base::Time timestamp; // Timestamp when this AP was detected. |
| 39 int signal_strength; // Radio signal strength measured in dBm. | 39 int signal_strength; // Radio signal strength measured in dBm. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // Returns |shill_mac_address| in aa:bb format. | 84 // Returns |shill_mac_address| in aa:bb format. |
| 85 CHROMEOS_EXPORT std::string FormattedMacAddress( | 85 CHROMEOS_EXPORT std::string FormattedMacAddress( |
| 86 const std::string& shill_mac_address); | 86 const std::string& shill_mac_address); |
| 87 | 87 |
| 88 // Parses |list|, which contains DictionaryValues and returns a vector of | 88 // Parses |list|, which contains DictionaryValues and returns a vector of |
| 89 // CellularScanResult in |scan_results|. Returns false if parsing fails, | 89 // CellularScanResult in |scan_results|. Returns false if parsing fails, |
| 90 // in which case the contents of |scan_results| will be undefined. | 90 // in which case the contents of |scan_results| will be undefined. |
| 91 CHROMEOS_EXPORT bool ParseCellularScanResults( | 91 CHROMEOS_EXPORT bool ParseCellularScanResults( |
| 92 const base::ListValue& list, std::vector<CellularScanResult>* scan_results); | 92 const base::ListValue& list, std::vector<CellularScanResult>* scan_results); |
| 93 | 93 |
| 94 // Retrieves the ONC state dictionary for |favorite| using GetStateProperties. | 94 // Retrieves the ONC state dictionary for |network| using GetStateProperties. |
| 95 // This includes properties from the corresponding NetworkState if it exists. | 95 // This includes properties from the corresponding NetworkState if it exists. |
| 96 CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> TranslateFavoriteStateToONC( | 96 CHROMEOS_EXPORT scoped_ptr<base::DictionaryValue> TranslateNetworkStateToONC( |
| 97 const FavoriteState* favorite); | 97 const NetworkState* network); |
| 98 | 98 |
| 99 // Retrieves the list of network services by passing |pattern|, | 99 // Retrieves the list of network services by passing |pattern|, |
| 100 // |configured_only|, and |visible_only| to NetworkStateHandler:: | 100 // |configured_only|, and |visible_only| to NetworkStateHandler:: |
| 101 // GetNetworkListByType(). Translates the result into a list of ONC | 101 // GetNetworkListByType(). Translates the result into a list of ONC |
| 102 // dictionaries using TranslateShillServiceToONCPart. |limit| is used to limit | 102 // dictionaries using TranslateShillServiceToONCPart. |limit| is used to limit |
| 103 // the number of results. If |debugging_properties| is true then also include | 103 // the number of results. If |debugging_properties| is true then also include |
| 104 // additional debugging properties (used in release code for chrome://network). | 104 // additional debugging properties (used in release code for chrome://network). |
| 105 CHROMEOS_EXPORT scoped_ptr<base::ListValue> TranslateNetworkListToONC( | 105 CHROMEOS_EXPORT scoped_ptr<base::ListValue> TranslateNetworkListToONC( |
| 106 NetworkTypePattern pattern, | 106 NetworkTypePattern pattern, |
| 107 bool configured_only, | 107 bool configured_only, |
| 108 bool visible_only, | 108 bool visible_only, |
| 109 int limit, | 109 int limit, |
| 110 bool debugging_properties); | 110 bool debugging_properties); |
| 111 | 111 |
| 112 } // namespace network_util | 112 } // namespace network_util |
| 113 } // namespace chromeos | 113 } // namespace chromeos |
| 114 | 114 |
| 115 #endif // CHROMEOS_NETWORK_NETWORK_UTIL_H_ | 115 #endif // CHROMEOS_NETWORK_NETWORK_UTIL_H_ |
| OLD | NEW |