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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 RecordInteractionWithChooser(event_handler_.is_null()); | 115 RecordInteractionWithChooser(event_handler_.is_null()); |
116 if (event_handler_.is_null()) | 116 if (event_handler_.is_null()) |
117 return; | 117 return; |
118 event_handler_.Run(content::BluetoothChooser::Event::CANCELLED, | 118 event_handler_.Run(content::BluetoothChooser::Event::CANCELLED, |
119 std::string()); | 119 std::string()); |
120 } | 120 } |
121 | 121 |
122 void BluetoothChooserController::OpenHelpCenterUrl() const { | 122 void BluetoothChooserController::OpenHelpCenterUrl() const { |
123 GetBrowser()->OpenURL(content::OpenURLParams( | 123 GetBrowser()->OpenURL(content::OpenURLParams( |
124 GURL(chrome::kChooserBluetoothOverviewURL), content::Referrer(), | 124 GURL(chrome::kChooserBluetoothOverviewURL), content::Referrer(), |
125 NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | 125 WindowOpenDisposition::NEW_FOREGROUND_TAB, |
126 false /* is_renderer_initialized */)); | 126 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initialized */)); |
127 } | 127 } |
128 | 128 |
129 void BluetoothChooserController::OnAdapterPresenceChanged( | 129 void BluetoothChooserController::OnAdapterPresenceChanged( |
130 content::BluetoothChooser::AdapterPresence presence) { | 130 content::BluetoothChooser::AdapterPresence presence) { |
131 ClearAllDevices(); | 131 ClearAllDevices(); |
132 switch (presence) { | 132 switch (presence) { |
133 case content::BluetoothChooser::AdapterPresence::ABSENT: | 133 case content::BluetoothChooser::AdapterPresence::ABSENT: |
134 NOTREACHED(); | 134 NOTREACHED(); |
135 break; | 135 break; |
136 case content::BluetoothChooser::AdapterPresence::POWERED_OFF: | 136 case content::BluetoothChooser::AdapterPresence::POWERED_OFF: |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 257 |
258 void BluetoothChooserController::ResetEventHandler() { | 258 void BluetoothChooserController::ResetEventHandler() { |
259 event_handler_.Reset(); | 259 event_handler_.Reset(); |
260 } | 260 } |
261 | 261 |
262 void BluetoothChooserController::ClearAllDevices() { | 262 void BluetoothChooserController::ClearAllDevices() { |
263 devices_.clear(); | 263 devices_.clear(); |
264 device_id_to_name_map_.clear(); | 264 device_id_to_name_map_.clear(); |
265 device_name_counts_.clear(); | 265 device_name_counts_.clear(); |
266 } | 266 } |
OLD | NEW |