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