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

Side by Side Diff: chrome/browser/ui/android/bluetooth_chooser_android.cc

Issue 1672103002: Pass the frame instead of the WebContents through RunBluetoothChooser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@doc-bubble-lifetimes
Patch Set: Fix Android Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/android/bluetooth_chooser_android.h ('k') | chrome/browser/ui/browser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/android/bluetooth_chooser_android.h" 5 #include "chrome/browser/ui/android/bluetooth_chooser_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/ssl/chrome_security_state_model_client.h" 10 #include "chrome/browser/ssl/chrome_security_state_model_client.h"
11 #include "chrome/browser/ui/android/view_android_helper.h" 11 #include "chrome/browser/ui/android/view_android_helper.h"
12 #include "content/public/browser/android/content_view_core.h" 12 #include "content/public/browser/android/content_view_core.h"
13 #include "content/public/browser/render_frame_host.h"
13 #include "jni/BluetoothChooserDialog_jni.h" 14 #include "jni/BluetoothChooserDialog_jni.h"
14 #include "ui/android/window_android.h" 15 #include "ui/android/window_android.h"
15 #include "url/origin.h" 16 #include "url/origin.h"
16 17
17 using base::android::AttachCurrentThread; 18 using base::android::AttachCurrentThread;
18 using base::android::ConvertUTF8ToJavaString; 19 using base::android::ConvertUTF8ToJavaString;
19 using base::android::ConvertUTF16ToJavaString; 20 using base::android::ConvertUTF16ToJavaString;
20 using base::android::ScopedJavaLocalRef; 21 using base::android::ScopedJavaLocalRef;
21 22
22 BluetoothChooserAndroid::BluetoothChooserAndroid( 23 BluetoothChooserAndroid::BluetoothChooserAndroid(
23 content::WebContents* web_contents, 24 content::RenderFrameHost* frame,
24 const EventHandler& event_handler, 25 const EventHandler& event_handler)
25 const url::Origin& origin)
26 : event_handler_(event_handler) { 26 : event_handler_(event_handler) {
27 const url::Origin origin = frame->GetLastCommittedOrigin();
27 DCHECK(!origin.unique()); 28 DCHECK(!origin.unique());
29 content::WebContents* web_contents =
30 content::WebContents::FromRenderFrameHost(frame);
28 base::android::ScopedJavaLocalRef<jobject> window_android = 31 base::android::ScopedJavaLocalRef<jobject> window_android =
29 content::ContentViewCore::FromWebContents( 32 content::ContentViewCore::FromWebContents(
30 web_contents)->GetWindowAndroid()->GetJavaObject(); 33 web_contents)->GetWindowAndroid()->GetJavaObject();
31 34
32 ChromeSecurityStateModelClient* security_model_client = 35 ChromeSecurityStateModelClient* security_model_client =
33 ChromeSecurityStateModelClient::FromWebContents(web_contents); 36 ChromeSecurityStateModelClient::FromWebContents(web_contents);
34 DCHECK(security_model_client); 37 DCHECK(security_model_client);
35 38
36 // Create (and show) the BluetoothChooser dialog. 39 // Create (and show) the BluetoothChooser dialog.
37 JNIEnv* env = AttachCurrentThread(); 40 JNIEnv* env = AttachCurrentThread();
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 void BluetoothChooserAndroid::ShowNeedLocationPermissionLink( 151 void BluetoothChooserAndroid::ShowNeedLocationPermissionLink(
149 JNIEnv* env, 152 JNIEnv* env,
150 const JavaParamRef<jobject>& obj) { 153 const JavaParamRef<jobject>& obj) {
151 event_handler_.Run(Event::SHOW_NEED_LOCATION_HELP, ""); 154 event_handler_.Run(Event::SHOW_NEED_LOCATION_HELP, "");
152 } 155 }
153 156
154 // static 157 // static
155 bool BluetoothChooserAndroid::Register(JNIEnv* env) { 158 bool BluetoothChooserAndroid::Register(JNIEnv* env) {
156 return RegisterNativesImpl(env); 159 return RegisterNativesImpl(env);
157 } 160 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/android/bluetooth_chooser_android.h ('k') | chrome/browser/ui/browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698