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 #include "content/browser/geolocation/network_location_provider.h" | 5 #include "content/browser/geolocation/network_location_provider.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "content/public/browser/access_token_store.h" | 10 #include "content/public/browser/access_token_store.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // | 70 // |
71 // static | 71 // static |
72 bool NetworkLocationProvider::PositionCache::MakeKey( | 72 bool NetworkLocationProvider::PositionCache::MakeKey( |
73 const WifiData& wifi_data, | 73 const WifiData& wifi_data, |
74 base::string16* key) { | 74 base::string16* key) { |
75 // Currently we use only WiFi data and base the key only on the MAC addresses. | 75 // Currently we use only WiFi data and base the key only on the MAC addresses. |
76 DCHECK(key); | 76 DCHECK(key); |
77 key->clear(); | 77 key->clear(); |
78 const size_t kCharsPerMacAddress = 6 * 3 + 1; // e.g. "11:22:33:44:55:66|" | 78 const size_t kCharsPerMacAddress = 6 * 3 + 1; // e.g. "11:22:33:44:55:66|" |
79 key->reserve(wifi_data.access_point_data.size() * kCharsPerMacAddress); | 79 key->reserve(wifi_data.access_point_data.size() * kCharsPerMacAddress); |
80 const base::string16 separator(ASCIIToUTF16("|")); | 80 const base::string16 separator(base::ASCIIToUTF16("|")); |
81 for (WifiData::AccessPointDataSet::const_iterator iter = | 81 for (WifiData::AccessPointDataSet::const_iterator iter = |
82 wifi_data.access_point_data.begin(); | 82 wifi_data.access_point_data.begin(); |
83 iter != wifi_data.access_point_data.end(); | 83 iter != wifi_data.access_point_data.end(); |
84 iter++) { | 84 iter++) { |
85 *key += separator; | 85 *key += separator; |
86 *key += iter->mac_address; | 86 *key += iter->mac_address; |
87 *key += separator; | 87 *key += separator; |
88 } | 88 } |
89 // If the key is the empty string, return false, as we don't want to cache a | 89 // If the key is the empty string, return false, as we don't want to cache a |
90 // position for such data. | 90 // position for such data. |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 } | 266 } |
267 request_->MakeRequest(access_token_, wifi_data_, | 267 request_->MakeRequest(access_token_, wifi_data_, |
268 wifi_data_updated_timestamp_); | 268 wifi_data_updated_timestamp_); |
269 } | 269 } |
270 | 270 |
271 bool NetworkLocationProvider::IsStarted() const { | 271 bool NetworkLocationProvider::IsStarted() const { |
272 return wifi_data_provider_ != NULL; | 272 return wifi_data_provider_ != NULL; |
273 } | 273 } |
274 | 274 |
275 } // namespace content | 275 } // namespace content |
OLD | NEW |