Index: content/common/content_switches_internal.cc |
diff --git a/content/common/content_switches_internal.cc b/content/common/content_switches_internal.cc |
index 76871e4d4f856fd439f3a5bfaeeb2bb76dbe259c..aa34ca1891396b26dffa3e51ee1f8253b86c3815 100644 |
--- a/content/common/content_switches_internal.cc |
+++ b/content/common/content_switches_internal.cc |
@@ -11,6 +11,7 @@ |
#include "content/public/common/content_switches.h" |
#if defined(OS_WIN) |
+#include "base/strings/string_tokenizer.h" |
#include "base/win/windows_version.h" |
#include "ui/gfx/win/direct_write.h" |
#endif |
@@ -61,6 +62,34 @@ bool IsWin32kRendererLockdownEnabled() { |
return false; |
return true; |
} |
+ |
+bool IsWin32kLockdownEnabledForMimeType(const std::string& mime_type) { |
+ // Consider PPAPI lockdown a superset of renderer lockdown. |
+ if (!IsWin32kRendererLockdownEnabled()) |
+ return false; |
+ const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
+ |
+ std::string mime_types = |
+ cmd_line->GetSwitchValueASCII(switches::kEnableWin32kLockDownMimeTypes); |
+ |
+ if (mime_types.empty()) { |
+ mime_types = |
+ base::FieldTrialList::FindFullName("EnableWin32kLockDownMimeTypes"); |
+ } |
+ |
+ // Consider the value * to enable all mime types for lockdown. |
+ if (mime_types == "*") |
+ return true; |
+ |
+ base::StringTokenizer tokenizer(mime_types, ","); |
+ tokenizer.set_quote_chars("\""); |
+ while (tokenizer.GetNext()) { |
+ if (tokenizer.token() == mime_type) |
+ return true; |
+ } |
+ |
+ return false; |
+} |
#endif |
V8CacheOptions GetV8CacheOptions() { |