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

Unified Diff: chrome/browser/ui/bluetooth/chrome_extension_bluetooth_chooser.cc

Issue 2086663003: Change ChooserController ownership model (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed temporary unique ptr at ChooserBubbleUiCocoa Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/bluetooth/chrome_extension_bluetooth_chooser.cc
diff --git a/chrome/browser/ui/bluetooth/chrome_extension_bluetooth_chooser.cc b/chrome/browser/ui/bluetooth/chrome_extension_bluetooth_chooser.cc
index bb653096282127a0834a23019250b6b20dbb1b07..b1962b9af9884a9abbb66754b9d25faf4a0776ea 100644
--- a/chrome/browser/ui/bluetooth/chrome_extension_bluetooth_chooser.cc
+++ b/chrome/browser/ui/bluetooth/chrome_extension_bluetooth_chooser.cc
@@ -11,11 +11,15 @@
ChromeExtensionBluetoothChooser::ChromeExtensionBluetoothChooser(
content::RenderFrameHost* frame,
const content::BluetoothChooser::EventHandler& event_handler) {
- bluetooth_chooser_controller_.reset(
+ std::unique_ptr<BluetoothChooserController> bluetooth_chooser_controller(
new BluetoothChooserController(frame, event_handler));
+ // Since ChromeExtensionBluetoothChooser object is destroyed before the
+ // view object which owns |bluetooth_chooser_controller_| when the chooser
+ // bubble/dialog closes, it is safe to store and use the raw pointer here.
+ bluetooth_chooser_controller_ = bluetooth_chooser_controller.get();
chooser_dialog_.reset(new ChromeExtensionChooserDialog(
content::WebContents::FromRenderFrameHost(frame)));
- chooser_dialog_->ShowDialog(bluetooth_chooser_controller_.get());
+ chooser_dialog_->ShowDialog(std::move(bluetooth_chooser_controller));
}
ChromeExtensionBluetoothChooser::~ChromeExtensionBluetoothChooser() {}
« no previous file with comments | « chrome/browser/ui/bluetooth/chrome_extension_bluetooth_chooser.h ('k') | chrome/browser/ui/cocoa/chooser_content_view_cocoa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698