| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/wifi_data_provider_common.h" | 5 #include "content/browser/geolocation/wifi_data_provider_common.h" |
| 6 | 6 |
| 7 #include "base/stringprintf.h" |
| 7 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 8 | 9 |
| 9 string16 MacAddressAsString16(const uint8 mac_as_int[6]) { | 10 string16 MacAddressAsString16(const uint8 mac_as_int[6]) { |
| 10 // mac_as_int is big-endian. Write in byte chunks. | 11 // mac_as_int is big-endian. Write in byte chunks. |
| 11 // Format is XX-XX-XX-XX-XX-XX. | 12 // Format is XX-XX-XX-XX-XX-XX. |
| 12 static const wchar_t* const kMacFormatString = | 13 static const wchar_t* const kMacFormatString = |
| 13 L"%02x-%02x-%02x-%02x-%02x-%02x"; | 14 L"%02x-%02x-%02x-%02x-%02x-%02x"; |
| 14 return WideToUTF16(StringPrintf(kMacFormatString, | 15 return WideToUTF16(base::StringPrintf(kMacFormatString, |
| 15 mac_as_int[0], mac_as_int[1], mac_as_int[2], | 16 mac_as_int[0], |
| 16 mac_as_int[3], mac_as_int[4], mac_as_int[5])); | 17 mac_as_int[1], |
| 18 mac_as_int[2], |
| 19 mac_as_int[3], |
| 20 mac_as_int[4], |
| 21 mac_as_int[5])); |
| 17 } | 22 } |
| 18 | 23 |
| 19 WifiDataProviderCommon::WifiDataProviderCommon() | 24 WifiDataProviderCommon::WifiDataProviderCommon() |
| 20 : Thread("Geolocation_wifi_provider"), | 25 : Thread("Geolocation_wifi_provider"), |
| 21 is_first_scan_complete_(false), | 26 is_first_scan_complete_(false), |
| 22 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) { | 27 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) { |
| 23 } | 28 } |
| 24 | 29 |
| 25 WifiDataProviderCommon::~WifiDataProviderCommon() { | 30 WifiDataProviderCommon::~WifiDataProviderCommon() { |
| 26 // Thread must be stopped before entering destructor chain to avoid race | 31 // Thread must be stopped before entering destructor chain to avoid race |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 NotifyListeners(); | 98 NotifyListeners(); |
| 94 } | 99 } |
| 95 } | 100 } |
| 96 | 101 |
| 97 void WifiDataProviderCommon::ScheduleNextScan(int interval) { | 102 void WifiDataProviderCommon::ScheduleNextScan(int interval) { |
| 98 message_loop()->PostDelayedTask( | 103 message_loop()->PostDelayedTask( |
| 99 FROM_HERE, | 104 FROM_HERE, |
| 100 task_factory_.NewRunnableMethod(&WifiDataProviderCommon::DoWifiScanTask), | 105 task_factory_.NewRunnableMethod(&WifiDataProviderCommon::DoWifiScanTask), |
| 101 interval); | 106 interval); |
| 102 } | 107 } |
| OLD | NEW |