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 |