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

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

Issue 1560263002: Store Bluetooth permissions in website settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address reillyg@'s comments Created 4 years, 11 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/bluetooth_chooser_bubble_delegate.cc
diff --git a/chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.cc b/chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.cc
index 8ca66407287cfea142d9fb79fb54da8fa20a6832..19d93680799b711a60ded6bf8f8ccd02cc8a9a89 100644
--- a/chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.cc
+++ b/chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.cc
@@ -5,11 +5,22 @@
#include "chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_delegate.h"
#include "base/stl_util.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/bluetooth/bluetooth_chooser_context.h"
+#include "chrome/browser/ui/bluetooth/bluetooth_chooser_context_factory.h"
#include "chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h"
#include "components/bubble/bubble_controller.h"
+#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/web_contents.h"
-BluetoothChooserBubbleDelegate::BluetoothChooserBubbleDelegate(Browser* browser)
- : ChooserBubbleDelegate(browser), bluetooth_chooser_(nullptr) {}
+BluetoothChooserBubbleDelegate::BluetoothChooserBubbleDelegate(
+ Browser* browser,
+ content::WebContents* web_contents,
+ const GURL& origin)
+ : ChooserBubbleDelegate(browser),
+ web_contents_(web_contents),
+ origin_(origin),
+ bluetooth_chooser_(nullptr) {}
BluetoothChooserBubbleDelegate::~BluetoothChooserBubbleDelegate() {
if (bluetooth_chooser_)
@@ -34,6 +45,15 @@ void BluetoothChooserBubbleDelegate::Select(size_t index) {
device_names_and_ids_[index].second);
}
+ GURL embedding_origin =
+ web_contents_->GetMainFrame()->GetLastCommittedURL().GetOrigin();
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents_->GetBrowserContext());
+ BluetoothChooserContext* chooser_context =
+ BluetoothChooserContextFactory::GetForProfile(profile);
+ chooser_context->GrantDevicePermission(origin_, embedding_origin,
Jeffrey Yasskin 2016/01/06 19:23:45 After looking at your Android patch, I think this
juncai 2016/01/11 21:55:16 Done.
+ device_names_and_ids_[index].second);
+
if (bubble_controller_)
bubble_controller_->CloseBubble(BUBBLE_CLOSE_ACCEPTED);
}

Powered by Google App Engine
This is Rietveld 408576698