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

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

Issue 18254010: IPC fuzzer child process component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missed some files Created 7 years, 5 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 | Annotate | Revision Log
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 <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 #include "chrome/common/chrome_paths.h" 92 #include "chrome/common/chrome_paths.h"
93 #include "chrome/common/chrome_switches.h" 93 #include "chrome/common/chrome_switches.h"
94 #include "chrome/common/extensions/background_info.h" 94 #include "chrome/common/extensions/background_info.h"
95 #include "chrome/common/extensions/extension.h" 95 #include "chrome/common/extensions/extension.h"
96 #include "chrome/common/extensions/extension_process_policy.h" 96 #include "chrome/common/extensions/extension_process_policy.h"
97 #include "chrome/common/extensions/extension_set.h" 97 #include "chrome/common/extensions/extension_set.h"
98 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h" 98 #include "chrome/common/extensions/manifest_handlers/app_isolation_info.h"
99 #include "chrome/common/extensions/manifest_handlers/shared_module_info.h" 99 #include "chrome/common/extensions/manifest_handlers/shared_module_info.h"
100 #include "chrome/common/extensions/permissions/permissions_data.h" 100 #include "chrome/common/extensions/permissions/permissions_data.h"
101 #include "chrome/common/extensions/permissions/socket_permission.h" 101 #include "chrome/common/extensions/permissions/socket_permission.h"
102 #include "chrome/common/ipc_fuzzer_messages.h"
Tom Sepez 2013/07/12 18:47:20 #if defined(EABLE_IPC_FUZZER) and move down lower.
aedla 2013/07/15 16:12:08 Oh, the include wasn't necessary actually.
102 #include "chrome/common/logging_chrome.h" 103 #include "chrome/common/logging_chrome.h"
103 #include "chrome/common/pepper_permission_util.h" 104 #include "chrome/common/pepper_permission_util.h"
104 #include "chrome/common/pref_names.h" 105 #include "chrome/common/pref_names.h"
105 #include "chrome/common/render_messages.h" 106 #include "chrome/common/render_messages.h"
106 #include "chrome/common/url_constants.h" 107 #include "chrome/common/url_constants.h"
107 #include "chromeos/chromeos_constants.h" 108 #include "chromeos/chromeos_constants.h"
108 #include "components/nacl/common/nacl_process_type.h" 109 #include "components/nacl/common/nacl_process_type.h"
109 #include "components/user_prefs/pref_registry_syncable.h" 110 #include "components/user_prefs/pref_registry_syncable.h"
110 #include "content/public/browser/browser_child_process_host.h" 111 #include "content/public/browser/browser_child_process_host.h"
111 #include "content/public/browser/browser_main_parts.h" 112 #include "content/public/browser/browser_main_parts.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 #endif 196 #endif
196 197
197 #if defined(ENABLE_INPUT_SPEECH) 198 #if defined(ENABLE_INPUT_SPEECH)
198 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate_bubbl e_ui.h" 199 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate_bubbl e_ui.h"
199 #endif 200 #endif
200 201
201 #if defined(FILE_MANAGER_EXTENSION) 202 #if defined(FILE_MANAGER_EXTENSION)
202 #include "chrome/browser/chromeos/extensions/file_manager/file_manager_util.h" 203 #include "chrome/browser/chromeos/extensions/file_manager/file_manager_util.h"
203 #endif 204 #endif
204 205
206 #if defined(ENABLE_IPC_FUZZER)
207 #include "chrome/browser/ipc_fuzzer_host.h"
208 #endif
209
205 using base::FileDescriptor; 210 using base::FileDescriptor;
206 using content::AccessTokenStore; 211 using content::AccessTokenStore;
207 using content::BrowserChildProcessHostIterator; 212 using content::BrowserChildProcessHostIterator;
208 using content::BrowserThread; 213 using content::BrowserThread;
209 using content::BrowserURLHandler; 214 using content::BrowserURLHandler;
210 using content::ChildProcessSecurityPolicy; 215 using content::ChildProcessSecurityPolicy;
211 using content::FileDescriptorInfo; 216 using content::FileDescriptorInfo;
212 using content::QuotaPermissionContext; 217 using content::QuotaPermissionContext;
213 using content::RenderViewHost; 218 using content::RenderViewHost;
214 using content::SiteInstance; 219 using content::SiteInstance;
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 #endif 824 #endif
820 825
821 host->Send(new ChromeViewMsg_SetIsIncognitoProcess( 826 host->Send(new ChromeViewMsg_SetIsIncognitoProcess(
822 profile->IsOffTheRecord())); 827 profile->IsOffTheRecord()));
823 828
824 host->Send(new ChromeViewMsg_SetExtensionActivityLogEnabled( 829 host->Send(new ChromeViewMsg_SetExtensionActivityLogEnabled(
825 IsExtensionActivityLogEnabledForProfile(profile))); 830 IsExtensionActivityLogEnabledForProfile(profile)));
826 831
827 SendExtensionWebRequestStatusToHost(host); 832 SendExtensionWebRequestStatusToHost(host);
828 833
834 #if defined(ENABLE_IPC_FUZZER)
835 SendTestcaseToIpcFuzzer(host);
836 #endif
837
829 RendererContentSettingRules rules; 838 RendererContentSettingRules rules;
830 GetRendererContentSettingRules(profile->GetHostContentSettingsMap(), &rules); 839 GetRendererContentSettingRules(profile->GetHostContentSettingsMap(), &rules);
831 host->Send(new ChromeViewMsg_SetContentSettingRules(rules)); 840 host->Send(new ChromeViewMsg_SetContentSettingRules(rules));
832 } 841 }
833 842
834 GURL ChromeContentBrowserClient::GetPossiblyPrivilegedURL( 843 GURL ChromeContentBrowserClient::GetPossiblyPrivilegedURL(
835 content::BrowserContext* browser_context, 844 content::BrowserContext* browser_context,
836 const GURL& url, 845 const GURL& url,
837 bool is_renderer_initiated, 846 bool is_renderer_initiated,
838 content::SiteInstance* current_instance) { 847 content::SiteInstance* current_instance) {
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); 1298 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess();
1290 1299
1291 if (browser_command_line.HasSwitch(switches::kChromeFrame)) 1300 if (browser_command_line.HasSwitch(switches::kChromeFrame))
1292 command_line->AppendSwitch(switches::kChromeFrame); 1301 command_line->AppendSwitch(switches::kChromeFrame);
1293 1302
1294 if (process_type == switches::kRendererProcess) { 1303 if (process_type == switches::kRendererProcess) {
1295 base::FilePath user_data_dir = 1304 base::FilePath user_data_dir =
1296 browser_command_line.GetSwitchValuePath(switches::kUserDataDir); 1305 browser_command_line.GetSwitchValuePath(switches::kUserDataDir);
1297 if (!user_data_dir.empty()) 1306 if (!user_data_dir.empty())
1298 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir); 1307 command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir);
1308
1309 #if defined(ENABLE_IPC_FUZZER)
1310 if (browser_command_line.HasSwitch(switches::kIpcFuzzerTestcase))
1311 command_line->AppendSwitch(switches::kIpcFuzzerOverride);
1312 #endif
1313
1299 #if defined(OS_CHROMEOS) 1314 #if defined(OS_CHROMEOS)
1300 const std::string& login_profile = 1315 const std::string& login_profile =
1301 browser_command_line.GetSwitchValueASCII( 1316 browser_command_line.GetSwitchValueASCII(
1302 chromeos::switches::kLoginProfile); 1317 chromeos::switches::kLoginProfile);
1303 if (!login_profile.empty()) 1318 if (!login_profile.empty())
1304 command_line->AppendSwitchASCII( 1319 command_line->AppendSwitchASCII(
1305 chromeos::switches::kLoginProfile, login_profile); 1320 chromeos::switches::kLoginProfile, login_profile);
1306 #endif 1321 #endif
1307 1322
1308 content::RenderProcessHost* process = 1323 content::RenderProcessHost* process =
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
2324 new drive::FileSystemBackendDelegate(external_mount_points), 2339 new drive::FileSystemBackendDelegate(external_mount_points),
2325 special_storage_policy, 2340 special_storage_policy,
2326 external_mount_points, 2341 external_mount_points,
2327 fileapi::ExternalMountPoints::GetSystemInstance()); 2342 fileapi::ExternalMountPoints::GetSystemInstance());
2328 backend->AddSystemMountPoints(); 2343 backend->AddSystemMountPoints();
2329 DCHECK(backend->CanHandleType(fileapi::kFileSystemTypeExternal)); 2344 DCHECK(backend->CanHandleType(fileapi::kFileSystemTypeExternal));
2330 additional_backends->push_back(backend); 2345 additional_backends->push_back(backend);
2331 #endif 2346 #endif
2332 } 2347 }
2333 2348
2349 bool ChromeContentBrowserClient::ShouldKillChildOnBadMessage() {
2350 #if defined(ENABLE_IPC_FUZZER)
2351 // Don't kill the IPC fuzzer process, if it sends a bad message.
2352 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kIpcFuzzerTestcase))
2353 return false;
2354 #endif
2355
2356 return true;
2357 }
2358
2334 #if defined(OS_POSIX) && !defined(OS_MACOSX) 2359 #if defined(OS_POSIX) && !defined(OS_MACOSX)
2335 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( 2360 void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
2336 const CommandLine& command_line, 2361 const CommandLine& command_line,
2337 int child_process_id, 2362 int child_process_id,
2338 std::vector<FileDescriptorInfo>* mappings) { 2363 std::vector<FileDescriptorInfo>* mappings) {
2339 #if defined(OS_ANDROID) 2364 #if defined(OS_ANDROID)
2340 base::FilePath data_path; 2365 base::FilePath data_path;
2341 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); 2366 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path);
2342 DCHECK(!data_path.empty()); 2367 DCHECK(!data_path.empty());
2343 2368
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
2431 #if defined(USE_NSS) 2456 #if defined(USE_NSS)
2432 crypto::CryptoModuleBlockingPasswordDelegate* 2457 crypto::CryptoModuleBlockingPasswordDelegate*
2433 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 2458 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
2434 const GURL& url) { 2459 const GURL& url) {
2435 return chrome::NewCryptoModuleBlockingDialogDelegate( 2460 return chrome::NewCryptoModuleBlockingDialogDelegate(
2436 chrome::kCryptoModulePasswordKeygen, url.host()); 2461 chrome::kCryptoModulePasswordKeygen, url.host());
2437 } 2462 }
2438 #endif 2463 #endif
2439 2464
2440 } // namespace chrome 2465 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698