| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/common/content_switches_internal.h" | 5 #include "content/common/content_switches_internal.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 return true; | 63 return true; |
| 64 } | 64 } |
| 65 | 65 |
| 66 bool IsWin32kLockdownEnabledForMimeType(const std::string& mime_type) { | 66 bool IsWin32kLockdownEnabledForMimeType(const std::string& mime_type) { |
| 67 // Consider PPAPI lockdown a superset of renderer lockdown. | 67 // Consider PPAPI lockdown a superset of renderer lockdown. |
| 68 if (!IsWin32kRendererLockdownEnabled()) | 68 if (!IsWin32kRendererLockdownEnabled()) |
| 69 return false; | 69 return false; |
| 70 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 70 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 71 | 71 |
| 72 std::string mime_types = | 72 std::string mime_types = |
| 73 cmd_line->GetSwitchValueASCII(switches::kEnableWin32kLockDownMimeTypes); | 73 base::FieldTrialList::FindFullName("EnableWin32kLockDownMimeTypes"); |
| 74 | 74 if (cmd_line->HasSwitch(switches::kEnableWin32kLockDownMimeTypes)) { |
| 75 if (mime_types.empty()) { | |
| 76 mime_types = | 75 mime_types = |
| 77 base::FieldTrialList::FindFullName("EnableWin32kLockDownMimeTypes"); | 76 cmd_line->GetSwitchValueASCII(switches::kEnableWin32kLockDownMimeTypes); |
| 78 } | 77 } |
| 79 | 78 |
| 80 // Consider the value * to enable all mime types for lockdown. | 79 // Consider the value * to enable all mime types for lockdown. |
| 81 if (mime_types == "*") | 80 if (mime_types == "*") |
| 82 return true; | 81 return true; |
| 83 | 82 |
| 84 base::StringTokenizer tokenizer(mime_types, ","); | 83 base::StringTokenizer tokenizer(mime_types, ","); |
| 85 tokenizer.set_quote_chars("\""); | 84 tokenizer.set_quote_chars("\""); |
| 86 while (tokenizer.GetNext()) { | 85 while (tokenizer.GetNext()) { |
| 87 if (tokenizer.token() == mime_type) | 86 if (tokenizer.token() == mime_type) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 104 } else if (v8_cache_options == "parse") { | 103 } else if (v8_cache_options == "parse") { |
| 105 return V8_CACHE_OPTIONS_PARSE; | 104 return V8_CACHE_OPTIONS_PARSE; |
| 106 } else if (v8_cache_options == "code") { | 105 } else if (v8_cache_options == "code") { |
| 107 return V8_CACHE_OPTIONS_CODE; | 106 return V8_CACHE_OPTIONS_CODE; |
| 108 } else { | 107 } else { |
| 109 return V8_CACHE_OPTIONS_DEFAULT; | 108 return V8_CACHE_OPTIONS_DEFAULT; |
| 110 } | 109 } |
| 111 } | 110 } |
| 112 | 111 |
| 113 } // namespace content | 112 } // namespace content |
| OLD | NEW |