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

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

Issue 574513002: Remove implicit conversions from scoped_refptr to T* in components/pairing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/bluetooth_host_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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 current_stage_ = new_stage; 49 current_stage_ = new_stage;
50 FOR_EACH_OBSERVER(ControllerPairingController::Observer, observers_, 50 FOR_EACH_OBSERVER(ControllerPairingController::Observer, observers_,
51 PairingStageChanged(new_stage)); 51 PairingStageChanged(new_stage));
52 } 52 }
53 53
54 void BluetoothControllerPairingController::Reset() { 54 void BluetoothControllerPairingController::Reset() {
55 got_initial_status_ = false; 55 got_initial_status_ = false;
56 controller_device_id_.clear(); 56 controller_device_id_.clear();
57 discovery_session_.reset(); 57 discovery_session_.reset();
58 58
59 if (socket_) { 59 if (socket_.get()) {
60 socket_->Close(); 60 socket_->Close();
61 socket_ = NULL; 61 socket_ = NULL;
62 } 62 }
63 63
64 if (adapter_) { 64 if (adapter_.get()) {
65 adapter_->RemoveObserver(this); 65 adapter_->RemoveObserver(this);
66 adapter_ = NULL; 66 adapter_ = NULL;
67 } 67 }
68 } 68 }
69 69
70 void BluetoothControllerPairingController::DeviceFound( 70 void BluetoothControllerPairingController::DeviceFound(
71 device::BluetoothDevice* device) { 71 device::BluetoothDevice* device) {
72 DCHECK_EQ(current_stage_, STAGE_DEVICES_DISCOVERY); 72 DCHECK_EQ(current_stage_, STAGE_DEVICES_DISCOVERY);
73 DCHECK(thread_checker_.CalledOnValidThread()); 73 DCHECK(thread_checker_.CalledOnValidThread());
74 if (StartsWith(device->GetName(), base::ASCIIToUTF16(kDeviceNamePrefix), 74 if (StartsWith(device->GetName(), base::ASCIIToUTF16(kDeviceNamePrefix),
(...skipping 22 matching lines...) Expand all
97 adapter_->StartDiscoverySession( 97 adapter_->StartDiscoverySession(
98 base::Bind(&BluetoothControllerPairingController::OnStartDiscoverySession, 98 base::Bind(&BluetoothControllerPairingController::OnStartDiscoverySession,
99 ptr_factory_.GetWeakPtr()), 99 ptr_factory_.GetWeakPtr()),
100 base::Bind(&BluetoothControllerPairingController::OnError, 100 base::Bind(&BluetoothControllerPairingController::OnError,
101 ptr_factory_.GetWeakPtr())); 101 ptr_factory_.GetWeakPtr()));
102 } 102 }
103 103
104 void BluetoothControllerPairingController::OnGetAdapter( 104 void BluetoothControllerPairingController::OnGetAdapter(
105 scoped_refptr<device::BluetoothAdapter> adapter) { 105 scoped_refptr<device::BluetoothAdapter> adapter) {
106 DCHECK(thread_checker_.CalledOnValidThread()); 106 DCHECK(thread_checker_.CalledOnValidThread());
107 DCHECK(!adapter_); 107 DCHECK(!adapter_.get());
108 adapter_ = adapter; 108 adapter_ = adapter;
109 adapter_->AddObserver(this); 109 adapter_->AddObserver(this);
110 110
111 if (adapter_->IsPowered()) { 111 if (adapter_->IsPowered()) {
112 OnSetPowered(); 112 OnSetPowered();
113 } else { 113 } else {
114 adapter_->SetPowered( 114 adapter_->SetPowered(
115 true, 115 true,
116 base::Bind(&BluetoothControllerPairingController::OnSetPowered, 116 base::Bind(&BluetoothControllerPairingController::OnSetPowered,
117 ptr_factory_.GetWeakPtr()), 117 ptr_factory_.GetWeakPtr()),
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION); 447 ChangeStage(STAGE_WAITING_FOR_CODE_CONFIRMATION);
448 } 448 }
449 449
450 void BluetoothControllerPairingController::AuthorizePairing( 450 void BluetoothControllerPairingController::AuthorizePairing(
451 device::BluetoothDevice* device) { 451 device::BluetoothDevice* device) {
452 // Disallow unknown device. 452 // Disallow unknown device.
453 device->RejectPairing(); 453 device->RejectPairing();
454 } 454 }
455 455
456 } // namespace pairing_chromeos 456 } // namespace pairing_chromeos
OLDNEW
« no previous file with comments | « no previous file | components/pairing/bluetooth_host_pairing_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698