summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/android/chrome_jni_registrar.cc3
-rw-r--r--chrome/browser/android/chromium_application.cc25
-rw-r--r--chrome/browser/android/chromium_application.h35
-rw-r--r--chrome/browser/media/protected_media_identifier_infobar_delegate.cc24
-rw-r--r--chrome/browser/media/protected_media_identifier_infobar_delegate.h2
5 files changed, 89 insertions, 0 deletions
diff --git a/chrome/browser/android/chrome_jni_registrar.cc b/chrome/browser/android/chrome_jni_registrar.cc
index ddd000a..68e3f9bc 100644
--- a/chrome/browser/android/chrome_jni_registrar.cc
+++ b/chrome/browser/android/chrome_jni_registrar.cc
@@ -9,6 +9,7 @@
#include "base/debug/trace_event.h"
#include "chrome/browser/android/bookmarks_bridge.h"
#include "chrome/browser/android/chrome_web_contents_delegate_android.h"
+#include "chrome/browser/android/chromium_application.h"
#include "chrome/browser/android/content_view_util.h"
#include "chrome/browser/android/dev_tools_server.h"
#include "chrome/browser/android/favicon_helper.h"
@@ -82,6 +83,8 @@ static base::android::RegistrationMethod kChromeRegisteredMethods[] = {
ChromeHttpAuthHandler::RegisterChromeHttpAuthHandler },
{ "ChromeWebContentsDelegateAndroid",
RegisterChromeWebContentsDelegateAndroid },
+ { "ChromiumApplication",
+ ChromiumApplication::RegisterBindings },
{"ConfirmInfoBarDelegate", RegisterConfirmInfoBarDelegate},
{ "ContentViewUtil", RegisterContentViewUtil },
{ "DevToolsServer", RegisterDevToolsServer },
diff --git a/chrome/browser/android/chromium_application.cc b/chrome/browser/android/chromium_application.cc
new file mode 100644
index 0000000..c6e64ca
--- /dev/null
+++ b/chrome/browser/android/chromium_application.cc
@@ -0,0 +1,25 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/android/chromium_application.h"
+
+#include "base/android/jni_android.h"
+#include "jni/ChromiumApplication_jni.h"
+
+namespace chrome {
+namespace android {
+
+// static
+bool ChromiumApplication::RegisterBindings(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+void ChromiumApplication::OpenProtectedContentSettings() {
+ Java_ChromiumApplication_openProtectedContentSettings(
+ base::android::AttachCurrentThread(),
+ base::android::GetApplicationContext());
+}
+
+} // namespace android
+} // namespace chrome
diff --git a/chrome/browser/android/chromium_application.h b/chrome/browser/android/chromium_application.h
new file mode 100644
index 0000000..3c43273
--- /dev/null
+++ b/chrome/browser/android/chromium_application.h
@@ -0,0 +1,35 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_ANDROID_CHROMIUM_APPLICATION_H_
+#define CHROME_BROWSER_ANDROID_CHROMIUM_APPLICATION_H_
+
+#include <jni.h>
+
+#include "base/basictypes.h"
+
+namespace chrome {
+namespace android {
+
+// Represents Android Chromium Application. This is a singleton and
+// provides functions to request browser side actions, such as opening a
+// settings page.
+class ChromiumApplication {
+ public:
+ static bool RegisterBindings(JNIEnv* env);
+
+ // Opens a protected content settings page, if available.
+ static void OpenProtectedContentSettings();
+
+ private:
+ ChromiumApplication() {}
+ ~ChromiumApplication() {}
+
+ DISALLOW_COPY_AND_ASSIGN(ChromiumApplication);
+};
+
+} // namespace android
+} // namespace chrome
+
+#endif // CHROME_BROWSER_ANDROID_CHROMIUM_APPLICATION_H_
diff --git a/chrome/browser/media/protected_media_identifier_infobar_delegate.cc b/chrome/browser/media/protected_media_identifier_infobar_delegate.cc
index bde3fbf..1670a31 100644
--- a/chrome/browser/media/protected_media_identifier_infobar_delegate.cc
+++ b/chrome/browser/media/protected_media_identifier_infobar_delegate.cc
@@ -12,6 +12,10 @@
#include "net/base/net_util.h"
#include "ui/base/l10n/l10n_util.h"
+#if defined(OS_ANDROID)
+#include "chrome/browser/android/chromium_application.h"
+#endif
+
// static
InfoBarDelegate* ProtectedMediaIdentifierInfoBarDelegate::Create(
InfoBarService* infobar_service,
@@ -106,3 +110,23 @@ bool ProtectedMediaIdentifierInfoBarDelegate::Cancel() {
SetPermission(true, false);
return true;
}
+
+string16 ProtectedMediaIdentifierInfoBarDelegate::GetLinkText() const {
+#if defined(OS_ANDROID)
+ return l10n_util::GetStringUTF16(
+ IDS_PROTECTED_MEDIA_IDENTIFIER_SETTINGS_LINK);
+#else
+ NOTIMPLEMENTED();
+ return string16();
+#endif
+}
+
+bool ProtectedMediaIdentifierInfoBarDelegate::LinkClicked(
+ WindowOpenDisposition disposition) {
+#if defined(OS_ANDROID)
+ chrome::android::ChromiumApplication::OpenProtectedContentSettings();
+#else
+ NOTIMPLEMENTED();
+#endif
+ return false; // Do not dismiss the info bar.
+}
diff --git a/chrome/browser/media/protected_media_identifier_infobar_delegate.h b/chrome/browser/media/protected_media_identifier_infobar_delegate.h
index 9510772..4050a87 100644
--- a/chrome/browser/media/protected_media_identifier_infobar_delegate.h
+++ b/chrome/browser/media/protected_media_identifier_infobar_delegate.h
@@ -47,6 +47,8 @@ class ProtectedMediaIdentifierInfoBarDelegate : public ConfirmInfoBarDelegate {
virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
virtual bool Accept() OVERRIDE;
virtual bool Cancel() OVERRIDE;
+ virtual string16 GetLinkText() const OVERRIDE;
+ virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
PermissionQueueController* controller_;
const PermissionRequestID id_;