| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/chrome_extension_bluetooth_chooser.h" | 5 #include "chrome/browser/ui/bluetooth/chrome_extension_bluetooth_chooser.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/chrome_extension_chooser_dialog.h" | 7 #include "chrome/browser/extensions/chrome_extension_chooser_dialog.h" |
| 8 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h" | 8 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h" |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 | 10 |
| 11 ChromeExtensionBluetoothChooser::ChromeExtensionBluetoothChooser( | 11 ChromeExtensionBluetoothChooser::ChromeExtensionBluetoothChooser( |
| 12 content::RenderFrameHost* frame, | 12 content::RenderFrameHost* frame, |
| 13 const content::BluetoothChooser::EventHandler& event_handler) { | 13 const content::BluetoothChooser::EventHandler& event_handler, |
| 14 bool accept_all_devices) { |
| 14 std::unique_ptr<BluetoothChooserController> bluetooth_chooser_controller( | 15 std::unique_ptr<BluetoothChooserController> bluetooth_chooser_controller( |
| 15 new BluetoothChooserController(frame, event_handler)); | 16 new BluetoothChooserController(frame, event_handler, accept_all_devices)); |
| 16 // Since ChromeExtensionBluetoothChooser object is destroyed before the | 17 // Since ChromeExtensionBluetoothChooser object is destroyed before the |
| 17 // view object which owns |bluetooth_chooser_controller_| when the chooser | 18 // view object which owns |bluetooth_chooser_controller_| when the chooser |
| 18 // bubble/dialog closes, it is safe to store and use the raw pointer here. | 19 // bubble/dialog closes, it is safe to store and use the raw pointer here. |
| 19 bluetooth_chooser_controller_ = bluetooth_chooser_controller.get(); | 20 bluetooth_chooser_controller_ = bluetooth_chooser_controller.get(); |
| 20 chooser_dialog_.reset(new ChromeExtensionChooserDialog( | 21 chooser_dialog_.reset(new ChromeExtensionChooserDialog( |
| 21 content::WebContents::FromRenderFrameHost(frame))); | 22 content::WebContents::FromRenderFrameHost(frame))); |
| 22 chooser_dialog_->ShowDialog(std::move(bluetooth_chooser_controller)); | 23 chooser_dialog_->ShowDialog(std::move(bluetooth_chooser_controller)); |
| 23 } | 24 } |
| 24 | 25 |
| 25 ChromeExtensionBluetoothChooser::~ChromeExtensionBluetoothChooser() {} | 26 ChromeExtensionBluetoothChooser::~ChromeExtensionBluetoothChooser() {} |
| (...skipping 16 matching lines...) Expand all Loading... |
| 42 int signal_strength_level) { | 43 int signal_strength_level) { |
| 43 bluetooth_chooser_controller_->AddOrUpdateDevice( | 44 bluetooth_chooser_controller_->AddOrUpdateDevice( |
| 44 device_id, should_update_name, device_name, is_gatt_connected, is_paired, | 45 device_id, should_update_name, device_name, is_gatt_connected, is_paired, |
| 45 signal_strength_level); | 46 signal_strength_level); |
| 46 } | 47 } |
| 47 | 48 |
| 48 void ChromeExtensionBluetoothChooser::RemoveDevice( | 49 void ChromeExtensionBluetoothChooser::RemoveDevice( |
| 49 const std::string& device_id) { | 50 const std::string& device_id) { |
| 50 bluetooth_chooser_controller_->RemoveDevice(device_id); | 51 bluetooth_chooser_controller_->RemoveDevice(device_id); |
| 51 } | 52 } |
| OLD | NEW |