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

Unified Diff: content/common/content_switches_internal.cc

Issue 1306243012: Add command line option to enable PPAPI win32k lockdown. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_render_font_code
Patch Set: Rebased patch. Created 5 years, 3 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 | « content/common/content_switches_internal.h ('k') | content/common/sandbox_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « content/common/content_switches_internal.h ('k') | content/common/sandbox_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698