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

Unified Diff: chrome/browser/media/protected_media_identifier_permission_context.cc

Issue 2816773002: Added switch for bypassing protected media identifier permission (Closed)
Patch Set: Added switch for by-passing permissions Created 3 years, 8 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 | « no previous file | media/base/media_switches.h » ('j') | media/base/media_switches.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | media/base/media_switches.h » ('j') | media/base/media_switches.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698