Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: device/geolocation/wifi_data_provider_common.cc

Issue 2200483002: Geolocation cleanup: run clang-format (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "device/geolocation/wifi_data_provider_common.h" 5 #include "device/geolocation/wifi_data_provider_common.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 12
13 namespace device { 13 namespace device {
14 14
15 base::string16 MacAddressAsString16(const uint8_t mac_as_int[6]) { 15 base::string16 MacAddressAsString16(const uint8_t mac_as_int[6]) {
16 // mac_as_int is big-endian. Write in byte chunks. 16 // mac_as_int is big-endian. Write in byte chunks.
17 // Format is XX-XX-XX-XX-XX-XX. 17 // Format is XX-XX-XX-XX-XX-XX.
18 static const char* const kMacFormatString = 18 static const char* const kMacFormatString = "%02x-%02x-%02x-%02x-%02x-%02x";
19 "%02x-%02x-%02x-%02x-%02x-%02x"; 19 return base::ASCIIToUTF16(base::StringPrintf(
20 return base::ASCIIToUTF16(base::StringPrintf(kMacFormatString, 20 kMacFormatString, mac_as_int[0], mac_as_int[1], mac_as_int[2],
21 mac_as_int[0], 21 mac_as_int[3], mac_as_int[4], mac_as_int[5]));
22 mac_as_int[1],
23 mac_as_int[2],
24 mac_as_int[3],
25 mac_as_int[4],
26 mac_as_int[5]));
27 } 22 }
28 23
29 WifiDataProviderCommon::WifiDataProviderCommon() 24 WifiDataProviderCommon::WifiDataProviderCommon()
30 : is_first_scan_complete_(false), 25 : is_first_scan_complete_(false), weak_factory_(this) {}
31 weak_factory_(this) {
32 }
33 26
34 WifiDataProviderCommon::~WifiDataProviderCommon() { 27 WifiDataProviderCommon::~WifiDataProviderCommon() {}
35 }
36 28
37 void WifiDataProviderCommon::StartDataProvider() { 29 void WifiDataProviderCommon::StartDataProvider() {
38 DCHECK(wlan_api_ == NULL); 30 DCHECK(wlan_api_ == NULL);
39 wlan_api_.reset(NewWlanApi()); 31 wlan_api_.reset(NewWlanApi());
40 if (wlan_api_ == NULL) { 32 if (wlan_api_ == NULL) {
41 // Error! Can't do scans, so don't try and schedule one. 33 // Error! Can't do scans, so don't try and schedule one.
42 is_first_scan_complete_ = true; 34 is_first_scan_complete_ = true;
43 return; 35 return;
44 } 36 }
45 37
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 74 }
83 75
84 void WifiDataProviderCommon::ScheduleNextScan(int interval) { 76 void WifiDataProviderCommon::ScheduleNextScan(int interval) {
85 client_task_runner()->PostDelayedTask( 77 client_task_runner()->PostDelayedTask(
86 FROM_HERE, base::Bind(&WifiDataProviderCommon::DoWifiScanTask, 78 FROM_HERE, base::Bind(&WifiDataProviderCommon::DoWifiScanTask,
87 weak_factory_.GetWeakPtr()), 79 weak_factory_.GetWeakPtr()),
88 base::TimeDelta::FromMilliseconds(interval)); 80 base::TimeDelta::FromMilliseconds(interval));
89 } 81 }
90 82
91 } // namespace device 83 } // namespace device
OLDNEW
« no previous file with comments | « device/geolocation/wifi_data_provider_chromeos_unittest.cc ('k') | device/geolocation/wifi_data_provider_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698