OLD | NEW |
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 <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 #include "net/cookies/cookie_options.h" | 118 #include "net/cookies/cookie_options.h" |
119 #include "net/ssl/ssl_cert_request_info.h" | 119 #include "net/ssl/ssl_cert_request_info.h" |
120 #include "ppapi/host/ppapi_host.h" | 120 #include "ppapi/host/ppapi_host.h" |
121 #include "ui/base/l10n/l10n_util.h" | 121 #include "ui/base/l10n/l10n_util.h" |
122 #include "ui/base/resource/resource_bundle.h" | 122 #include "ui/base/resource/resource_bundle.h" |
123 #include "webkit/glue/webpreferences.h" | 123 #include "webkit/glue/webpreferences.h" |
124 #include "webkit/plugins/plugin_switches.h" | 124 #include "webkit/plugins/plugin_switches.h" |
125 | 125 |
126 #if defined(OS_WIN) | 126 #if defined(OS_WIN) |
127 #include "chrome/browser/chrome_browser_main_win.h" | 127 #include "chrome/browser/chrome_browser_main_win.h" |
| 128 #include "sandbox/win/src/sandbox_policy.h" |
128 #elif defined(OS_MACOSX) | 129 #elif defined(OS_MACOSX) |
129 #include "chrome/browser/chrome_browser_main_mac.h" | 130 #include "chrome/browser/chrome_browser_main_mac.h" |
130 #include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h" | 131 #include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h" |
131 #elif defined(OS_CHROMEOS) | 132 #elif defined(OS_CHROMEOS) |
132 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" | 133 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" |
133 #include "chrome/browser/chromeos/login/user_manager.h" | 134 #include "chrome/browser/chromeos/login/user_manager.h" |
134 #elif defined(OS_LINUX) | 135 #elif defined(OS_LINUX) |
135 #include "chrome/browser/chrome_browser_main_linux.h" | 136 #include "chrome/browser/chrome_browser_main_linux.h" |
136 #elif defined(OS_ANDROID) | 137 #elif defined(OS_ANDROID) |
137 #include "chrome/browser/android/crash_dump_manager.h" | 138 #include "chrome/browser/android/crash_dump_manager.h" |
(...skipping 1948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2086 false))); | 2087 false))); |
2087 } | 2088 } |
2088 #endif // defined(OS_ANDROID) | 2089 #endif // defined(OS_ANDROID) |
2089 } | 2090 } |
2090 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) | 2091 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) |
2091 | 2092 |
2092 #if defined(OS_WIN) | 2093 #if defined(OS_WIN) |
2093 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() { | 2094 const wchar_t* ChromeContentBrowserClient::GetResourceDllName() { |
2094 return chrome::kBrowserResourcesDll; | 2095 return chrome::kBrowserResourcesDll; |
2095 } | 2096 } |
| 2097 |
| 2098 void ChromeContentBrowserClient::PreSpawnRenderer( |
| 2099 sandbox::TargetPolicy* policy, |
| 2100 bool* success) { |
| 2101 // This code is duplicated in nacl_exe_win_64.cc. |
| 2102 // Allow the server side of a pipe restricted to the "chrome.nacl." |
| 2103 // namespace so that it cannot impersonate other system or other chrome |
| 2104 // service pipes. |
| 2105 sandbox::ResultCode result = policy->AddRule( |
| 2106 sandbox::TargetPolicy::SUBSYS_NAMED_PIPES, |
| 2107 sandbox::TargetPolicy::NAMEDPIPES_ALLOW_ANY, |
| 2108 L"\\\\.\\pipe\\chrome.nacl.*"); |
| 2109 if (result != sandbox::SBOX_ALL_OK) { |
| 2110 *success = false; |
| 2111 return; |
| 2112 } |
| 2113 |
| 2114 // Renderers need to send named pipe handles and shared memory |
| 2115 // segment handles to NaCl loader processes. |
| 2116 result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_HANDLES, |
| 2117 sandbox::TargetPolicy::HANDLES_DUP_ANY, |
| 2118 L"File"); |
| 2119 if (result != sandbox::SBOX_ALL_OK) { |
| 2120 *success = false; |
| 2121 return; |
| 2122 } |
| 2123 } |
2096 #endif | 2124 #endif |
2097 | 2125 |
2098 #if defined(USE_NSS) | 2126 #if defined(USE_NSS) |
2099 crypto::CryptoModuleBlockingPasswordDelegate* | 2127 crypto::CryptoModuleBlockingPasswordDelegate* |
2100 ChromeContentBrowserClient::GetCryptoPasswordDelegate( | 2128 ChromeContentBrowserClient::GetCryptoPasswordDelegate( |
2101 const GURL& url) { | 2129 const GURL& url) { |
2102 return chrome::NewCryptoModuleBlockingDialogDelegate( | 2130 return chrome::NewCryptoModuleBlockingDialogDelegate( |
2103 chrome::kCryptoModulePasswordKeygen, url.host()); | 2131 chrome::kCryptoModulePasswordKeygen, url.host()); |
2104 } | 2132 } |
2105 #endif | 2133 #endif |
(...skipping 17 matching lines...) Expand all Loading... |
2123 io_thread_application_locale_ = locale; | 2151 io_thread_application_locale_ = locale; |
2124 } | 2152 } |
2125 | 2153 |
2126 void ChromeContentBrowserClient::SetApplicationLocaleOnIOThread( | 2154 void ChromeContentBrowserClient::SetApplicationLocaleOnIOThread( |
2127 const std::string& locale) { | 2155 const std::string& locale) { |
2128 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 2156 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
2129 io_thread_application_locale_ = locale; | 2157 io_thread_application_locale_ = locale; |
2130 } | 2158 } |
2131 | 2159 |
2132 } // namespace chrome | 2160 } // namespace chrome |
OLD | NEW |