OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h" | 5 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 GetBrowser()->OpenURL(content::OpenURLParams( | 100 GetBrowser()->OpenURL(content::OpenURLParams( |
101 GURL(chrome::kBluetoothAdapterOffHelpURL), content::Referrer(), | 101 GURL(chrome::kBluetoothAdapterOffHelpURL), content::Referrer(), |
102 WindowOpenDisposition::NEW_FOREGROUND_TAB, | 102 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
103 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initialized */)); | 103 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initialized */)); |
104 } | 104 } |
105 | 105 |
106 base::string16 BluetoothChooserController::GetStatus() const { | 106 base::string16 BluetoothChooserController::GetStatus() const { |
107 return status_text_; | 107 return status_text_; |
108 } | 108 } |
109 | 109 |
110 void BluetoothChooserController::Select(size_t index) { | 110 void BluetoothChooserController::Select(const std::vector<size_t>& indices) { |
111 DCHECK(indices.size() == 1); | |
Reilly Grant (use Gerrit)
2016/11/22 20:55:27
DCHECK_EQ(indices.size(), 1)
juncai
2016/11/22 23:12:06
Done.
| |
112 size_t index = indices[0]; | |
111 RecordInteractionWithChooser(event_handler_.is_null()); | 113 RecordInteractionWithChooser(event_handler_.is_null()); |
112 if (event_handler_.is_null()) { | 114 if (event_handler_.is_null()) { |
113 return; | 115 return; |
114 } | 116 } |
115 DCHECK_LT(index, devices_.size()); | 117 DCHECK_LT(index, devices_.size()); |
116 event_handler_.Run(content::BluetoothChooser::Event::SELECTED, | 118 event_handler_.Run(content::BluetoothChooser::Event::SELECTED, |
117 devices_[index].id); | 119 devices_[index].id); |
118 } | 120 } |
119 | 121 |
120 void BluetoothChooserController::Cancel() { | 122 void BluetoothChooserController::Cancel() { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 | 271 |
270 void BluetoothChooserController::ResetEventHandler() { | 272 void BluetoothChooserController::ResetEventHandler() { |
271 event_handler_.Reset(); | 273 event_handler_.Reset(); |
272 } | 274 } |
273 | 275 |
274 void BluetoothChooserController::ClearAllDevices() { | 276 void BluetoothChooserController::ClearAllDevices() { |
275 devices_.clear(); | 277 devices_.clear(); |
276 device_id_to_name_map_.clear(); | 278 device_id_to_name_map_.clear(); |
277 device_name_counts_.clear(); | 279 device_name_counts_.clear(); |
278 } | 280 } |
OLD | NEW |