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

Unified Diff: chrome/browser/ui/android/bluetooth_chooser_android.cc

Issue 1710443002: bluetooth: Add URLs for Web Bluetooth help links. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Address tedchoc's comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/android/bluetooth_chooser_android.h ('k') | chrome/common/url_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 */));
+}
« no previous file with comments | « chrome/browser/ui/android/bluetooth_chooser_android.h ('k') | chrome/common/url_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698