Index: chrome/browser/media/protected_media_identifier_permission_context.cc |
diff --git a/chrome/browser/media/protected_media_identifier_permission_context.cc b/chrome/browser/media/protected_media_identifier_permission_context.cc |
index 711401422a805c6ad4b9f92dd074cc24c73f0dfa..b93154941ebd90d10d4b5c706589ec6344c794d9 100644 |
--- a/chrome/browser/media/protected_media_identifier_permission_context.cc |
+++ b/chrome/browser/media/protected_media_identifier_permission_context.cc |
@@ -22,8 +22,11 @@ |
#include "components/pref_registry/pref_registry_syncable.h" |
#include "components/user_prefs/user_prefs.h" |
#include "ui/views/widget/widget.h" |
- |
-using chromeos::attestation::PlatformVerificationDialog; |
+#elif defined(OS_ANDROID) |
+#include "base/command_line.h" |
+#include "media/base/media_switches.h" |
+#else |
+#error This file should only be used on ChromeOS or Android. |
ddorwin
2015/03/17 00:43:11
"This file currently only supports Chrome OS and A
xhwang
2015/03/17 01:33:28
Done.
|
#endif |
ProtectedMediaIdentifierPermissionContext:: |
@@ -42,6 +45,8 @@ ProtectedMediaIdentifierPermissionContext:: |
} |
#if defined(OS_CHROMEOS) |
+using chromeos::attestation::PlatformVerificationDialog; |
+ |
// static |
void ProtectedMediaIdentifierPermissionContext::RegisterProfilePrefs( |
user_prefs::PrefRegistrySyncable* prefs) { |
@@ -121,14 +126,20 @@ ContentSetting ProtectedMediaIdentifierPermissionContext::GetPermissionStatus( |
content_setting == CONTENT_SETTING_ASK); |
#if defined(OS_CHROMEOS) |
- if (content_setting == CONTENT_SETTING_ALLOW) { |
- // Check kRAConsentGranted here because it's possible that user dismissed |
- // the dialog triggered by RequestPermission() and the content setting is |
- // set to "allow" by server sync. In this case, we should still "ask". |
- if (profile()->GetPrefs()->GetBoolean(prefs::kRAConsentGranted)) |
- return CONTENT_SETTING_ALLOW; |
- else |
- return CONTENT_SETTING_ASK; |
+ // Check kRAConsentGranted here because it's possible that user dismissed |
+ // the dialog triggered by RequestPermission() and the content setting is |
+ // set to "allow" by server sync. In this case, we should still "ask". |
+ if (content_setting == CONTENT_SETTING_ALLOW && |
+ !profile()->GetPrefs()->GetBoolean(prefs::kRAConsentGranted)) { |
+ content_setting = CONTENT_SETTING_ASK; |
+ } |
+#elif defined(OS_ANDROID) |
+ // When kDisableInfobarForProtectedMediaIdentifier is enabled, do not "ask" |
+ // the user and always "allow". |
+ if (content_setting == CONTENT_SETTING_ASK && |
+ base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kDisableInfobarForProtectedMediaIdentifier)) { |
+ content_setting = CONTENT_SETTING_ALLOW; |
} |
#endif |
@@ -224,8 +235,7 @@ void ProtectedMediaIdentifierPermissionContext:: |
const GURL& requesting_origin, |
const GURL& embedding_origin, |
const BrowserPermissionCallback& callback, |
- chromeos::attestation::PlatformVerificationDialog::ConsentResponse |
- response) { |
+ PlatformVerificationDialog::ConsentResponse response) { |
// The request may have been canceled. Drop the callback in that case. |
PendingRequestMap::iterator request = pending_requests_.find(web_contents); |
if (request == pending_requests_.end()) |