diff options
Diffstat (limited to 'content/browser/geolocation')
13 files changed, 53 insertions, 52 deletions
diff --git a/content/browser/geolocation/fake_access_token_store.cc b/content/browser/geolocation/fake_access_token_store.cc index 9f9f61b..0e5fe40 100644 --- a/content/browser/geolocation/fake_access_token_store.cc +++ b/content/browser/geolocation/fake_access_token_store.cc @@ -45,7 +45,7 @@ void FakeAccessTokenStore::DefaultLoadAccessTokens( } void FakeAccessTokenStore::DefaultSaveAccessToken( - const GURL& server_url, const string16& access_token) { + const GURL& server_url, const base::string16& access_token) { DCHECK(server_url.is_valid()); access_token_set_[server_url] = access_token; } diff --git a/content/browser/geolocation/fake_access_token_store.h b/content/browser/geolocation/fake_access_token_store.h index 4d0867b..30a0185 100644 --- a/content/browser/geolocation/fake_access_token_store.h +++ b/content/browser/geolocation/fake_access_token_store.h @@ -23,12 +23,13 @@ class FakeAccessTokenStore : public AccessTokenStore { MOCK_METHOD1(LoadAccessTokens, void(const LoadAccessTokensCallbackType& callback)); MOCK_METHOD2(SaveAccessToken, - void(const GURL& server_url, const string16& access_token)); + void(const GURL& server_url, + const base::string16& access_token)); void DefaultLoadAccessTokens(const LoadAccessTokensCallbackType& callback); void DefaultSaveAccessToken(const GURL& server_url, - const string16& access_token); + const base::string16& access_token); AccessTokenSet access_token_set_; LoadAccessTokensCallbackType callback_; diff --git a/content/browser/geolocation/location_arbitrator_impl.cc b/content/browser/geolocation/location_arbitrator_impl.cc index 37c34ee..b8ed8c4 100644 --- a/content/browser/geolocation/location_arbitrator_impl.cc +++ b/content/browser/geolocation/location_arbitrator_impl.cc @@ -149,7 +149,7 @@ LocationProvider* LocationArbitratorImpl::NewNetworkLocationProvider( AccessTokenStore* access_token_store, net::URLRequestContextGetter* context, const GURL& url, - const string16& access_token) { + const base::string16& access_token) { #if defined(OS_ANDROID) // Android uses its own SystemLocationProvider. return NULL; diff --git a/content/browser/geolocation/location_arbitrator_impl.h b/content/browser/geolocation/location_arbitrator_impl.h index 45910552..e756f5e 100644 --- a/content/browser/geolocation/location_arbitrator_impl.h +++ b/content/browser/geolocation/location_arbitrator_impl.h @@ -57,7 +57,7 @@ class CONTENT_EXPORT LocationArbitratorImpl : public LocationArbitrator { AccessTokenStore* access_token_store, net::URLRequestContextGetter* context, const GURL& url, - const string16& access_token); + const base::string16& access_token); virtual LocationProvider* NewSystemLocationProvider(); virtual base::Time GetTimeNow() const; diff --git a/content/browser/geolocation/location_arbitrator_impl_unittest.cc b/content/browser/geolocation/location_arbitrator_impl_unittest.cc index 02df431..81df7a4 100644 --- a/content/browser/geolocation/location_arbitrator_impl_unittest.cc +++ b/content/browser/geolocation/location_arbitrator_impl_unittest.cc @@ -85,7 +85,7 @@ class TestingLocationArbitrator : public LocationArbitratorImpl { AccessTokenStore* access_token_store, net::URLRequestContextGetter* context, const GURL& url, - const string16& access_token) OVERRIDE { + const base::string16& access_token) OVERRIDE { return new MockLocationProvider(&cell_); } diff --git a/content/browser/geolocation/network_location_provider.cc b/content/browser/geolocation/network_location_provider.cc index 678edb2..efc68a7 100644 --- a/content/browser/geolocation/network_location_provider.cc +++ b/content/browser/geolocation/network_location_provider.cc @@ -27,7 +27,7 @@ bool NetworkLocationProvider::PositionCache::CachePosition( const WifiData& wifi_data, const Geoposition& position) { // Check that we can generate a valid key for the wifi data. - string16 key; + base::string16 key; if (!MakeKey(wifi_data, &key)) { return false; } @@ -57,7 +57,7 @@ bool NetworkLocationProvider::PositionCache::CachePosition( // the cached position if available, NULL otherwise. const Geoposition* NetworkLocationProvider::PositionCache::FindPosition( const WifiData& wifi_data) { - string16 key; + base::string16 key; if (!MakeKey(wifi_data, &key)) { return NULL; } @@ -71,13 +71,13 @@ const Geoposition* NetworkLocationProvider::PositionCache::FindPosition( // static bool NetworkLocationProvider::PositionCache::MakeKey( const WifiData& wifi_data, - string16* key) { + base::string16* key) { // Currently we use only WiFi data and base the key only on the MAC addresses. DCHECK(key); key->clear(); const size_t kCharsPerMacAddress = 6 * 3 + 1; // e.g. "11:22:33:44:55:66|" key->reserve(wifi_data.access_point_data.size() * kCharsPerMacAddress); - const string16 separator(ASCIIToUTF16("|")); + const base::string16 separator(ASCIIToUTF16("|")); for (WifiData::AccessPointDataSet::const_iterator iter = wifi_data.access_point_data.begin(); iter != wifi_data.access_point_data.end(); @@ -96,7 +96,7 @@ LocationProviderBase* NewNetworkLocationProvider( AccessTokenStore* access_token_store, net::URLRequestContextGetter* context, const GURL& url, - const string16& access_token) { + const base::string16& access_token) { return new NetworkLocationProvider( access_token_store, context, url, access_token); } @@ -106,7 +106,7 @@ NetworkLocationProvider::NetworkLocationProvider( AccessTokenStore* access_token_store, net::URLRequestContextGetter* url_context_getter, const GURL& url, - const string16& access_token) + const base::string16& access_token) : access_token_store_(access_token_store), wifi_data_provider_(NULL), wifi_data_update_callback_( @@ -163,7 +163,7 @@ void NetworkLocationProvider::WifiDataUpdateAvailable( void NetworkLocationProvider::LocationResponseAvailable( const Geoposition& position, bool server_error, - const string16& access_token, + const base::string16& access_token, const WifiData& wifi_data) { DCHECK(CalledOnValidThread()); // Record the position and update our cache. diff --git a/content/browser/geolocation/network_location_provider.h b/content/browser/geolocation/network_location_provider.h index d5f3e99..710fd3f 100644 --- a/content/browser/geolocation/network_location_provider.h +++ b/content/browser/geolocation/network_location_provider.h @@ -54,12 +54,12 @@ class NetworkLocationProvider // Makes the key for the map of cached positions, using a set of // data. Returns true if a good key was generated, false otherwise. static bool MakeKey(const WifiData& wifi_data, - string16* key); + base::string16* key); // The cache of positions. This is stored as a map keyed on a string that // represents a set of data, and a list to provide // least-recently-added eviction. - typedef std::map<string16, Geoposition> CacheMap; + typedef std::map<base::string16, Geoposition> CacheMap; CacheMap cache_; typedef std::list<CacheMap::iterator> CacheAgeList; CacheAgeList cache_age_list_; // Oldest first. @@ -68,7 +68,7 @@ class NetworkLocationProvider NetworkLocationProvider(AccessTokenStore* access_token_store, net::URLRequestContextGetter* context, const GURL& url, - const string16& access_token); + const base::string16& access_token); virtual ~NetworkLocationProvider(); // LocationProvider implementation @@ -92,7 +92,7 @@ class NetworkLocationProvider void LocationResponseAvailable(const Geoposition& position, bool server_error, - const string16& access_token, + const base::string16& access_token, const WifiData& wifi_data); scoped_refptr<AccessTokenStore> access_token_store_; @@ -111,7 +111,7 @@ class NetworkLocationProvider // Cached value loaded from the token store or set by a previous server // response, and sent in each subsequent network request. - string16 access_token_; + base::string16 access_token_; // The current best position estimate. Geoposition position_; @@ -138,7 +138,7 @@ CONTENT_EXPORT LocationProviderBase* NewNetworkLocationProvider( AccessTokenStore* access_token_store, net::URLRequestContextGetter* context, const GURL& url, - const string16& access_token); + const base::string16& access_token); } // namespace content diff --git a/content/browser/geolocation/network_location_request.cc b/content/browser/geolocation/network_location_request.cc index 2e269b3..3ed7092 100644 --- a/content/browser/geolocation/network_location_request.cc +++ b/content/browser/geolocation/network_location_request.cc @@ -72,7 +72,7 @@ GURL FormRequestURL(const GURL& url); void FormUploadData(const WifiData& wifi_data, const base::Time& timestamp, - const string16& access_token, + const base::string16& access_token, std::string* upload_data); // Attempts to extract a position from the response. Detects and indicates @@ -83,7 +83,7 @@ void GetLocationFromResponse(bool http_post_result, const base::Time& timestamp, const GURL& server_url, Geoposition* position, - string16* access_token); + base::string16* access_token); // Parses the server response body. Returns true if parsing was successful. // Sets |*position| to the parsed location if a valid fix was received, @@ -91,7 +91,7 @@ void GetLocationFromResponse(bool http_post_result, bool ParseServerResponse(const std::string& response_body, const base::Time& timestamp, Geoposition* position, - string16* access_token); + base::string16* access_token); void AddWifiData(const WifiData& wifi_data, int age_milliseconds, base::DictionaryValue* request); @@ -111,7 +111,7 @@ NetworkLocationRequest::NetworkLocationRequest( NetworkLocationRequest::~NetworkLocationRequest() { } -bool NetworkLocationRequest::MakeRequest(const string16& access_token, +bool NetworkLocationRequest::MakeRequest(const base::string16& access_token, const WifiData& wifi_data, const base::Time& timestamp) { RecordUmaEvent(NETWORK_LOCATION_REQUEST_EVENT_REQUEST_START); @@ -150,7 +150,7 @@ void NetworkLocationRequest::OnURLFetchComplete( RecordUmaResponseCode(response_code); Geoposition position; - string16 access_token; + base::string16 access_token; std::string data; source->GetResponseAsString(&data); GetLocationFromResponse(status.is_success(), @@ -207,7 +207,7 @@ GURL FormRequestURL(const GURL& url) { void FormUploadData(const WifiData& wifi_data, const base::Time& timestamp, - const string16& access_token, + const base::string16& access_token, std::string* upload_data) { int age = kint32min; // Invalid so AddInteger() will ignore. if (!timestamp.is_null()) { @@ -291,7 +291,7 @@ void GetLocationFromResponse(bool http_post_result, const base::Time& timestamp, const GURL& server_url, Geoposition* position, - string16* access_token) { + base::string16* access_token) { DCHECK(position); DCHECK(access_token); @@ -351,7 +351,7 @@ bool GetAsDouble(const base::DictionaryValue& object, bool ParseServerResponse(const std::string& response_body, const base::Time& timestamp, Geoposition* position, - string16* access_token) { + base::string16* access_token) { DCHECK(position); DCHECK(!position->Validate()); DCHECK(position->error_code == Geoposition::ERROR_CODE_NONE); diff --git a/content/browser/geolocation/network_location_request.h b/content/browser/geolocation/network_location_request.h index 38aaf3e..6fea08b 100644 --- a/content/browser/geolocation/network_location_request.h +++ b/content/browser/geolocation/network_location_request.h @@ -33,7 +33,7 @@ class NetworkLocationRequest : private net::URLFetcherDelegate { // server or network error - either no response or a 500 error code. typedef base::Callback<void(const Geoposition& /* position */, bool /* server_error */, - const string16& /* access_token */, + const base::string16& /* access_token */, const WifiData& /* wifi_data */)> LocationResponseCallback; @@ -45,7 +45,7 @@ class NetworkLocationRequest : private net::URLFetcherDelegate { // Makes a new request. Returns true if the new request was successfully // started. In all cases, any currently pending request will be canceled. - bool MakeRequest(const string16& access_token, + bool MakeRequest(const base::string16& access_token, const WifiData& wifi_data, const base::Time& timestamp); diff --git a/content/browser/geolocation/wifi_data.h b/content/browser/geolocation/wifi_data.h index a24e42e..72bc306 100644 --- a/content/browser/geolocation/wifi_data.h +++ b/content/browser/geolocation/wifi_data.h @@ -19,11 +19,11 @@ struct CONTENT_EXPORT AccessPointData { ~AccessPointData(); // MAC address, formatted as per MacAddressAsString16. - string16 mac_address; + base::string16 mac_address; int radio_signal_strength; // Measured in dBm int channel; int signal_to_noise; // Ratio in dB - string16 ssid; // Network identifier + base::string16 ssid; // Network identifier }; // This is to allow AccessPointData to be used in std::set. We order diff --git a/content/browser/geolocation/wifi_data_provider_common.cc b/content/browser/geolocation/wifi_data_provider_common.cc index 31f969c..9c2cbae 100644 --- a/content/browser/geolocation/wifi_data_provider_common.cc +++ b/content/browser/geolocation/wifi_data_provider_common.cc @@ -10,7 +10,7 @@ namespace content { -string16 MacAddressAsString16(const uint8 mac_as_int[6]) { +base::string16 MacAddressAsString16(const uint8 mac_as_int[6]) { // mac_as_int is big-endian. Write in byte chunks. // Format is XX-XX-XX-XX-XX-XX. static const char* const kMacFormatString = diff --git a/content/browser/geolocation/wifi_data_provider_common.h b/content/browser/geolocation/wifi_data_provider_common.h index c42b4c2..befdb69 100644 --- a/content/browser/geolocation/wifi_data_provider_common.h +++ b/content/browser/geolocation/wifi_data_provider_common.h @@ -18,7 +18,7 @@ namespace content { // Converts a MAC address stored as an array of uint8 to a string. -string16 MacAddressAsString16(const uint8 mac_as_int[6]); +base::string16 MacAddressAsString16(const uint8 mac_as_int[6]); // Base class to promote code sharing between platform specific wifi data // providers. It's optional for specific platforms to derive this, but if they diff --git a/content/browser/geolocation/wifi_data_provider_win.cc b/content/browser/geolocation/wifi_data_provider_win.cc index 8efb191..ed69865 100644 --- a/content/browser/geolocation/wifi_data_provider_win.cc +++ b/content/browser/geolocation/wifi_data_provider_win.cc @@ -127,15 +127,15 @@ class WindowsNdisApi : public WifiDataProviderCommon::WlanApiInterface { private: static bool GetInterfacesNDIS( - std::vector<string16>* interface_service_names_out); + std::vector<base::string16>* interface_service_names_out); // Swaps in content of the vector passed - explicit WindowsNdisApi(std::vector<string16>* interface_service_names); + explicit WindowsNdisApi(std::vector<base::string16>* interface_service_names); bool GetInterfaceDataNDIS(HANDLE adapter_handle, WifiData::AccessPointDataSet* data); // NDIS variables. - std::vector<string16> interface_service_names_; + std::vector<base::string16> interface_service_names_; // Remembers scan result buffer size across calls. int oid_buffer_size_; @@ -144,9 +144,9 @@ class WindowsNdisApi : public WifiDataProviderCommon::WlanApiInterface { // Extracts data for an access point and converts to Gears format. bool GetNetworkData(const WLAN_BSS_ENTRY& bss_entry, AccessPointData* access_point_data); -bool UndefineDosDevice(const string16& device_name); -bool DefineDosDeviceIfNotExists(const string16& device_name); -HANDLE GetFileHandle(const string16& device_name); +bool UndefineDosDevice(const base::string16& device_name); +bool DefineDosDeviceIfNotExists(const base::string16& device_name); +HANDLE GetFileHandle(const base::string16& device_name); // Makes the OID query and returns a Win32 error code. int PerformQuery(HANDLE adapter_handle, BYTE* buffer, @@ -155,7 +155,7 @@ int PerformQuery(HANDLE adapter_handle, bool ResizeBuffer(int requested_size, scoped_ptr_malloc<BYTE>* buffer); // Gets the system directory and appends a trailing slash if not already // present. -bool GetSystemDirectory(string16* path); +bool GetSystemDirectory(base::string16* path); } // namespace WifiDataProviderImplBase* WifiDataProvider::DefaultFactoryFunction() { @@ -202,12 +202,12 @@ WindowsWlanApi* WindowsWlanApi::Create() { if (base::win::GetVersion() < base::win::VERSION_VISTA) return NULL; // We use an absolute path to load the DLL to avoid DLL preloading attacks. - string16 system_directory; + base::string16 system_directory; if (!GetSystemDirectory(&system_directory)) { return NULL; } DCHECK(!system_directory.empty()); - string16 dll_path = system_directory + L"wlanapi.dll"; + base::string16 dll_path = system_directory + L"wlanapi.dll"; HINSTANCE library = LoadLibraryEx(dll_path.c_str(), NULL, LOAD_WITH_ALTERED_SEARCH_PATH); @@ -359,7 +359,7 @@ int WindowsWlanApi::GetInterfaceDataWLAN( // WindowsNdisApi WindowsNdisApi::WindowsNdisApi( - std::vector<string16>* interface_service_names) + std::vector<base::string16>* interface_service_names) : oid_buffer_size_(kInitialBufferSize) { DCHECK(!interface_service_names->empty()); interface_service_names_.swap(*interface_service_names); @@ -369,7 +369,7 @@ WindowsNdisApi::~WindowsNdisApi() { } WindowsNdisApi* WindowsNdisApi::Create() { - std::vector<string16> interface_service_names; + std::vector<base::string16> interface_service_names; if (GetInterfacesNDIS(&interface_service_names)) { return new WindowsNdisApi(&interface_service_names); } @@ -412,7 +412,7 @@ bool WindowsNdisApi::GetAccessPointData(WifiData::AccessPointDataSet* data) { } bool WindowsNdisApi::GetInterfacesNDIS( - std::vector<string16>* interface_service_names_out) { + std::vector<base::string16>* interface_service_names_out) { HKEY network_cards_key = NULL; if (RegOpenKeyEx( HKEY_LOCAL_MACHINE, @@ -530,18 +530,18 @@ bool GetNetworkData(const WLAN_BSS_ENTRY& bss_entry, return true; } -bool UndefineDosDevice(const string16& device_name) { +bool UndefineDosDevice(const base::string16& device_name) { // We remove only the mapping we use, that is \Device\<device_name>. - string16 target_path = L"\\Device\\" + device_name; + base::string16 target_path = L"\\Device\\" + device_name; return DefineDosDevice( DDD_RAW_TARGET_PATH | DDD_REMOVE_DEFINITION | DDD_EXACT_MATCH_ON_REMOVE, device_name.c_str(), target_path.c_str()) == TRUE; } -bool DefineDosDeviceIfNotExists(const string16& device_name) { +bool DefineDosDeviceIfNotExists(const base::string16& device_name) { // We create a DOS device name for the device at \Device\<device_name>. - string16 target_path = L"\\Device\\" + device_name; + base::string16 target_path = L"\\Device\\" + device_name; TCHAR target[kStringLength]; if (QueryDosDevice(device_name.c_str(), target, kStringLength) > 0 && @@ -565,10 +565,10 @@ bool DefineDosDeviceIfNotExists(const string16& device_name) { target_path.compare(target) == 0; } -HANDLE GetFileHandle(const string16& device_name) { +HANDLE GetFileHandle(const base::string16& device_name) { // We access a device with DOS path \Device\<device_name> at // \\.\<device_name>. - string16 formatted_device_name = L"\\\\.\\" + device_name; + base::string16 formatted_device_name = L"\\\\.\\" + device_name; return CreateFile(formatted_device_name.c_str(), GENERIC_READ, @@ -610,7 +610,7 @@ bool ResizeBuffer(int requested_size, scoped_ptr_malloc<BYTE>* buffer) { return buffer != NULL; } -bool GetSystemDirectory(string16* path) { +bool GetSystemDirectory(base::string16* path) { DCHECK(path); // Return value includes terminating NULL. int buffer_size = ::GetSystemDirectory(NULL, 0); |