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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 2411483002: Enable win32k lockdown for ppapi processes. (Closed)
Patch Set: readd entry Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <map> 7 #include <map>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 2869 matching lines...) Expand 10 before | Expand all | Expand 10 after
2880 // namespace so that it cannot impersonate other system or other chrome 2880 // namespace so that it cannot impersonate other system or other chrome
2881 // service pipes. 2881 // service pipes.
2882 sandbox::ResultCode result = policy->AddRule( 2882 sandbox::ResultCode result = policy->AddRule(
2883 sandbox::TargetPolicy::SUBSYS_NAMED_PIPES, 2883 sandbox::TargetPolicy::SUBSYS_NAMED_PIPES,
2884 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY, 2884 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY,
2885 L"\\\\.\\pipe\\chrome.nacl.*"); 2885 L"\\\\.\\pipe\\chrome.nacl.*");
2886 if (result != sandbox::SBOX_ALL_OK) 2886 if (result != sandbox::SBOX_ALL_OK)
2887 return false; 2887 return false;
2888 return result == sandbox::SBOX_ALL_OK; 2888 return result == sandbox::SBOX_ALL_OK;
2889 } 2889 }
2890
2891 bool ChromeContentBrowserClient::IsWin32kLockdownEnabledForMimeType(
2892 const std::string& mime_type) const {
2893 // We don't support PPAPI win32k lockdown prior to Windows 10.
2894 if (base::win::GetVersion() < base::win::VERSION_WIN10)
2895 return false;
2896 // First, check if any variation parameters have enabled or disabled this
2897 // mime type either specifically or globally.
2898 std::map<std::string, std::string> mime_params;
2899 if (variations::GetVariationParams("EnableWin32kLockDownMimeTypes",
2900 &mime_params)) {
2901 bool enabled = false;
2902 for (const auto& param : mime_params) {
2903 if (param.first == mime_type || param.first == "*") {
2904 // Disabled entries take precedence over Enabled entries.
2905 if (base::StartsWith(param.second, "Disabled",
2906 base::CompareCase::INSENSITIVE_ASCII)) {
2907 return false;
2908 }
2909 if (base::StartsWith(param.second, "Enabled",
2910 base::CompareCase::INSENSITIVE_ASCII)) {
2911 enabled = true;
2912 }
2913 }
2914 }
2915 return enabled;
2916 }
2917
2918 // Second, check the command line to see if this mime type is enabled
2919 // either specifically or globally.
2920 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
2921
2922 if (!cmd_line->HasSwitch(switches::kEnableWin32kLockDownMimeTypes))
2923 return false;
2924
2925 std::string mime_types =
2926 cmd_line->GetSwitchValueASCII(switches::kEnableWin32kLockDownMimeTypes);
2927
2928 // Consider the value * to enable all mime types for lockdown.
2929 if (mime_types == "*")
2930 return true;
2931
2932 base::StringTokenizer tokenizer(mime_types, ",");
2933 tokenizer.set_quote_chars("\"");
2934 while (tokenizer.GetNext()) {
2935 if (tokenizer.token() == mime_type)
2936 return true;
2937 }
2938
2939 return false;
2940 }
2941 #endif // defined(OS_WIN) 2890 #endif // defined(OS_WIN)
2942 2891
2943 void ChromeContentBrowserClient::ExposeInterfacesToRenderer( 2892 void ChromeContentBrowserClient::ExposeInterfacesToRenderer(
2944 shell::InterfaceRegistry* registry, 2893 shell::InterfaceRegistry* registry,
2945 content::RenderProcessHost* render_process_host) { 2894 content::RenderProcessHost* render_process_host) {
2946 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner = 2895 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner =
2947 content::BrowserThread::GetTaskRunnerForThread( 2896 content::BrowserThread::GetTaskRunnerForThread(
2948 content::BrowserThread::UI); 2897 content::BrowserThread::UI);
2949 registry->AddInterface( 2898 registry->AddInterface(
2950 base::Bind(&startup_metric_utils::StartupMetricHostImpl::Create), 2899 base::Bind(&startup_metric_utils::StartupMetricHostImpl::Create),
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
3293 if (channel <= kMaxDisableEncryptionChannel) { 3242 if (channel <= kMaxDisableEncryptionChannel) {
3294 static const char* const kWebRtcDevSwitchNames[] = { 3243 static const char* const kWebRtcDevSwitchNames[] = {
3295 switches::kDisableWebRtcEncryption, 3244 switches::kDisableWebRtcEncryption,
3296 }; 3245 };
3297 to_command_line->CopySwitchesFrom(from_command_line, 3246 to_command_line->CopySwitchesFrom(from_command_line,
3298 kWebRtcDevSwitchNames, 3247 kWebRtcDevSwitchNames,
3299 arraysize(kWebRtcDevSwitchNames)); 3248 arraysize(kWebRtcDevSwitchNames));
3300 } 3249 }
3301 } 3250 }
3302 #endif // defined(ENABLE_WEBRTC) 3251 #endif // defined(ENABLE_WEBRTC)
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698