Chromium Code Reviews| Index: chrome/browser/ui/android/bluetooth_chooser_android.cc |
| diff --git a/chrome/browser/ui/android/bluetooth_chooser_android.cc b/chrome/browser/ui/android/bluetooth_chooser_android.cc |
| index bbc794a2ca6d5becb2daf879d506fcce3cf20253..1b5567df7cd8ad033ada313ef72168f1c2a07bb6 100644 |
| --- a/chrome/browser/ui/android/bluetooth_chooser_android.cc |
| +++ b/chrome/browser/ui/android/bluetooth_chooser_android.cc |
| @@ -9,6 +9,7 @@ |
| #include "base/strings/utf_string_conversions.h" |
| #include "chrome/browser/ssl/chrome_security_state_model_client.h" |
| #include "chrome/browser/ui/android/view_android_helper.h" |
| +#include "chrome/common/url_constants.h" |
| #include "content/public/browser/android/content_view_core.h" |
| #include "content/public/browser/render_frame_host.h" |
| #include "jni/BluetoothChooserDialog_jni.h" |
| @@ -23,17 +24,18 @@ using base::android::ScopedJavaLocalRef; |
| BluetoothChooserAndroid::BluetoothChooserAndroid( |
| content::RenderFrameHost* frame, |
| const EventHandler& event_handler) |
| - : event_handler_(event_handler) { |
| + : web_contents_(content::WebContents::FromRenderFrameHost(frame)), |
| + event_handler_(event_handler) { |
| const url::Origin origin = frame->GetLastCommittedOrigin(); |
| DCHECK(!origin.unique()); |
| - content::WebContents* web_contents = |
| - content::WebContents::FromRenderFrameHost(frame); |
| + |
| base::android::ScopedJavaLocalRef<jobject> window_android = |
| - content::ContentViewCore::FromWebContents( |
| - web_contents)->GetWindowAndroid()->GetJavaObject(); |
| + content::ContentViewCore::FromWebContents(web_contents_) |
| + ->GetWindowAndroid() |
| + ->GetJavaObject(); |
| ChromeSecurityStateModelClient* security_model_client = |
| - ChromeSecurityStateModelClient::FromWebContents(web_contents); |
| + ChromeSecurityStateModelClient::FromWebContents(web_contents_); |
| DCHECK(security_model_client); |
| // Create (and show) the BluetoothChooser dialog. |
| @@ -133,24 +135,21 @@ void BluetoothChooserAndroid::RestartSearch(JNIEnv* env, |
| void BluetoothChooserAndroid::ShowBluetoothOverviewLink( |
| JNIEnv* env, |
| const JavaParamRef<jobject>& obj) { |
| + OpenURL(chrome::kChooserBluetoothOverviewURL); |
| event_handler_.Run(Event::SHOW_OVERVIEW_HELP, ""); |
| } |
| -void BluetoothChooserAndroid::ShowBluetoothPairingLink( |
| - JNIEnv* env, |
| - const JavaParamRef<jobject>& obj) { |
| - event_handler_.Run(Event::SHOW_PAIRING_HELP, ""); |
| -} |
| - |
| void BluetoothChooserAndroid::ShowBluetoothAdapterOffLink( |
| JNIEnv* env, |
| const JavaParamRef<jobject>& obj) { |
| + OpenURL(chrome::kChooserBluetoothOverviewURL); |
| event_handler_.Run(Event::SHOW_ADAPTER_OFF_HELP, ""); |
| } |
| void BluetoothChooserAndroid::ShowNeedLocationPermissionLink( |
| JNIEnv* env, |
| const JavaParamRef<jobject>& obj) { |
| + OpenURL(chrome::kChooserBluetoothOverviewURL); |
| event_handler_.Run(Event::SHOW_NEED_LOCATION_HELP, ""); |
| } |
| @@ -158,3 +157,9 @@ void BluetoothChooserAndroid::ShowNeedLocationPermissionLink( |
| bool BluetoothChooserAndroid::Register(JNIEnv* env) { |
| return RegisterNativesImpl(env); |
| } |
| + |
| +void BluetoothChooserAndroid::OpenURL(const char* url) { |
| + web_contents_->OpenURL(content::OpenURLParams( |
| + GURL(url), content::Referrer(), NEW_FOREGROUND_TAB, |
| + ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false /* is_renderer_initiated */)); |
|
Ted C
2016/02/19 17:54:01
Out of curiosity, what happens if the page that tr
ortuno
2016/02/19 18:26:28
Right now the dialog would stay on top. The issue
|
| +} |