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

Unified Diff: chrome/browser/content_settings/permission_context_base.cc

Issue 864753007: media: Use PlatformVerificationDialog in PermissionContextBase on ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « chrome/browser/content_settings/permission_context_base.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/content_settings/permission_context_base.cc
diff --git a/chrome/browser/content_settings/permission_context_base.cc b/chrome/browser/content_settings/permission_context_base.cc
index 1ccea9728a198a3a2860d2e472e8b83aaa00446f..ff8a0e6da532e1c4a947bae372a638a87015070f 100644
--- a/chrome/browser/content_settings/permission_context_base.cc
+++ b/chrome/browser/content_settings/permission_context_base.cc
@@ -18,6 +18,12 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
+#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/attestation/platform_verification_dialog.h"
+using chromeos::attestation::PlatformVerificationDialog;
+using chromeos::attestation::PlatformVerificationFlow;
+#endif
+
PermissionContextBase::PermissionContextBase(
Profile* profile,
const ContentSettingsType permission_type)
@@ -117,6 +123,21 @@ void PermissionContextBase::DecidePermission(
PermissionContextUmaUtil::PermissionRequested(
permission_type_, requesting_origin);
+#if defined(OS_CHROMEOS)
+ // TODO(xhwang): This is to use the existing platform verification UI. Remove
+ // it when the infobar/bubble UI can satisfy our requirements.
+ if (permission_type_ == CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER) {
+ PlatformVerificationDialog::ShowDialog(
+ web_contents,
+ base::Bind(&PermissionContextBase::OnPlatformVerificationResult,
+ weak_factory_.GetWeakPtr(),
+ base::Bind(&PermissionContextBase::PermissionDecided,
Bernhard Bauer 2015/02/02 10:59:40 Do you need to pass this in as a callback? If you
xhwang 2015/02/02 21:24:25 Done.
+ weak_factory_.GetWeakPtr(), id, requesting_origin,
+ embedding_origin, callback)));
+ return;
+ }
+#endif
+
if (PermissionBubbleManager::Enabled()) {
if (pending_bubbles_.get(id.ToString()) != NULL)
return;
@@ -220,3 +241,19 @@ void PermissionContextBase::UpdateContentSetting(const GURL& requesting_origin,
ContentSettingsPattern::FromURLNoWildcard(embedding_origin),
permission_type_, std::string(), content_setting);
}
+
+#if defined(OS_CHROMEOS)
+void PermissionContextBase::OnPlatformVerificationResult(
+ const PermissionCallback& permission_callback,
+ PlatformVerificationFlow::ConsentResponse response) {
+ if (response == PlatformVerificationFlow::CONSENT_RESPONSE_NONE) {
+ // Deny request and do not save to content settings.
+ permission_callback.Run(false, false);
+ return;
+ }
+
+ permission_callback.Run(
+ true, // Save to content settings.
+ response == PlatformVerificationFlow::CONSENT_RESPONSE_ALLOW);
+}
+#endif
« no previous file with comments | « chrome/browser/content_settings/permission_context_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698