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

Side by Side Diff: components/pairing/bluetooth_controller_pairing_controller.cc

Issue 626633002: Convert a couple loops to range based iterators. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review fix Created 6 years, 2 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
« no previous file with comments | « no previous file | components/pairing/fake_controller_pairing_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/pairing/bluetooth_controller_pairing_controller.h" 5 #include "components/pairing/bluetooth_controller_pairing_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 ptr_factory_.GetWeakPtr())); 130 ptr_factory_.GetWeakPtr()));
131 } 131 }
132 } 132 }
133 133
134 void BluetoothControllerPairingController::OnStartDiscoverySession( 134 void BluetoothControllerPairingController::OnStartDiscoverySession(
135 scoped_ptr<device::BluetoothDiscoverySession> discovery_session) { 135 scoped_ptr<device::BluetoothDiscoverySession> discovery_session) {
136 DCHECK(thread_checker_.CalledOnValidThread()); 136 DCHECK(thread_checker_.CalledOnValidThread());
137 discovery_session_ = discovery_session.Pass(); 137 discovery_session_ = discovery_session.Pass();
138 ChangeStage(STAGE_DEVICES_DISCOVERY); 138 ChangeStage(STAGE_DEVICES_DISCOVERY);
139 139
140 device::BluetoothAdapter::DeviceList device_list = adapter_->GetDevices(); 140 for (const auto& device : adapter_->GetDevices())
141 for (device::BluetoothAdapter::DeviceList::iterator ix = device_list.begin(); 141 DeviceFound(device);
142 ix != device_list.end(); ++ix) {
143 DeviceFound(*ix);
144 }
145 } 142 }
146 143
147 void BluetoothControllerPairingController::OnConnect() { 144 void BluetoothControllerPairingController::OnConnect() {
148 DCHECK(thread_checker_.CalledOnValidThread()); 145 DCHECK(thread_checker_.CalledOnValidThread());
149 device::BluetoothDevice* device = GetController(); 146 device::BluetoothDevice* device = GetController();
150 if (device) { 147 if (device) {
151 device->ConnectToService( 148 device->ConnectToService(
152 device::BluetoothUUID(kPairingServiceUUID), 149 device::BluetoothUUID(kPairingServiceUUID),
153 base::Bind(&BluetoothControllerPairingController::OnConnectToService, 150 base::Bind(&BluetoothControllerPairingController::OnConnectToService,
154 ptr_factory_.GetWeakPtr()), 151 ptr_factory_.GetWeakPtr()),
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION); 455 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION);
459 } 456 }
460 457
461 void BluetoothControllerPairingController::AuthorizePairing( 458 void BluetoothControllerPairingController::AuthorizePairing(
462 device::BluetoothDevice* device) { 459 device::BluetoothDevice* device) {
463 // Disallow unknown device. 460 // Disallow unknown device.
464 device->RejectPairing(); 461 device->RejectPairing();
465 } 462 }
466 463
467 } // namespace pairing_chromeos 464 } // namespace pairing_chromeos
OLDNEW
« no previous file with comments | « no previous file | components/pairing/fake_controller_pairing_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698