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 50c2dc51ec53a1f4269eff81c038c44fc6eb40bc..8c48e757b1d9f0ddf706e863423050d2840a6c0f 100644 |
--- a/chrome/browser/media/protected_media_identifier_permission_context.cc |
+++ b/chrome/browser/media/protected_media_identifier_permission_context.cc |
@@ -15,7 +15,10 @@ |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/render_frame_host.h" |
#include "content/public/browser/web_contents.h" |
-#if defined(OS_CHROMEOS) |
+#if defined(OS_ANDROID) |
+#include "media/base/media_switches.h" |
+#include "net/base/url_util.h" |
+#elif defined(OS_CHROMEOS) |
#include <utility> |
#include "chrome/browser/chromeos/attestation/platform_verification_dialog.h" |
@@ -25,7 +28,7 @@ |
#include "components/pref_registry/pref_registry_syncable.h" |
#include "components/user_prefs/user_prefs.h" |
#include "ui/views/widget/widget.h" |
-#elif !defined(OS_ANDROID) |
+#else |
#error This file currently only supports Chrome OS and Android. |
#endif |
@@ -101,6 +104,21 @@ ProtectedMediaIdentifierPermissionContext::GetPermissionStatusInternal( |
content_setting == CONTENT_SETTING_BLOCK || |
content_setting == CONTENT_SETTING_ASK); |
+ #if defined(OS_ANDROID) |
raymes
2017/04/19 01:24:19
nit: these should have no identation
|
+ const bool isLocal = net::IsLocalHost(requesting_origin.host()) && |
+ net::IsLoaclHost(embedding_origin.host()); |
raymes
2017/04/19 01:24:19
nit: localhost is misspelt.
|
+ |
+ // For testing of protected content, always allow content from localhost |
+ // if the switch has been set. |
+ const bool allowLocalContent = |
+ base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kDisableInfobarForProtectedMediaIdentifierForLocalhost); |
raymes
2017/04/17 22:10:11
Could you elaborate on what kind of test is this n
Joey Parrish
2017/04/17 22:49:37
This is for automated testing of protected content
raymes
2017/04/19 01:24:19
Thanks for explaining. I think this is ok because
|
+ |
+ if (allowLocalContent && isLocal && content_setting == CONTENT_SETTING_ASK) { |
+ content_setting = CONTENT_SETTING_ALLOW; |
+ } |
+ #endif |
+ |
return content_setting; |
} |