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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 #include "ui/message_center/message_center_util.h" | 145 #include "ui/message_center/message_center_util.h" |
146 #include "webkit/browser/fileapi/external_mount_points.h" | 146 #include "webkit/browser/fileapi/external_mount_points.h" |
147 #include "webkit/common/webpreferences.h" | 147 #include "webkit/common/webpreferences.h" |
148 | 148 |
149 #if defined(OS_WIN) | 149 #if defined(OS_WIN) |
150 #include "chrome/browser/chrome_browser_main_win.h" | 150 #include "chrome/browser/chrome_browser_main_win.h" |
151 #include "sandbox/win/src/sandbox_policy.h" | 151 #include "sandbox/win/src/sandbox_policy.h" |
152 #elif defined(OS_MACOSX) | 152 #elif defined(OS_MACOSX) |
153 #include "chrome/browser/chrome_browser_main_mac.h" | 153 #include "chrome/browser/chrome_browser_main_mac.h" |
154 #include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h" | 154 #include "chrome/browser/spellchecker/spellcheck_message_filter_mac.h" |
155 #include "components/breakpad/breakpad_mac.h" | 155 #include "components/breakpad/app/breakpad_mac.h" |
156 #elif defined(OS_CHROMEOS) | 156 #elif defined(OS_CHROMEOS) |
157 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" | 157 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" |
158 #include "chrome/browser/chromeos/drive/file_system_backend_delegate.h" | 158 #include "chrome/browser/chromeos/drive/file_system_backend_delegate.h" |
159 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" | 159 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" |
160 #include "chrome/browser/chromeos/login/startup_utils.h" | 160 #include "chrome/browser/chromeos/login/startup_utils.h" |
161 #include "chrome/browser/chromeos/login/user_manager.h" | 161 #include "chrome/browser/chromeos/login/user_manager.h" |
162 #include "chrome/browser/chromeos/system/input_device_settings.h" | 162 #include "chrome/browser/chromeos/system/input_device_settings.h" |
163 #include "chromeos/chromeos_switches.h" | 163 #include "chromeos/chromeos_switches.h" |
164 #elif defined(OS_LINUX) | 164 #elif defined(OS_LINUX) |
165 #include "chrome/browser/chrome_browser_main_linux.h" | 165 #include "chrome/browser/chrome_browser_main_linux.h" |
166 #elif defined(OS_ANDROID) | 166 #elif defined(OS_ANDROID) |
167 #include "chrome/browser/android/crash_dump_manager.h" | |
168 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" | 167 #include "chrome/browser/android/webapps/single_tab_mode_tab_helper.h" |
169 #include "chrome/browser/chrome_browser_main_android.h" | 168 #include "chrome/browser/chrome_browser_main_android.h" |
170 #include "chrome/browser/media/encrypted_media_message_filter_android.h" | 169 #include "chrome/browser/media/encrypted_media_message_filter_android.h" |
171 #include "chrome/common/descriptors_android.h" | 170 #include "chrome/common/descriptors_android.h" |
| 171 #include "components/breakpad/browser/crash_dump_manager_android.h" |
172 #elif defined(OS_POSIX) | 172 #elif defined(OS_POSIX) |
173 #include "chrome/browser/chrome_browser_main_posix.h" | 173 #include "chrome/browser/chrome_browser_main_posix.h" |
174 #endif | 174 #endif |
175 | 175 |
176 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 176 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
177 #include "base/debug/leak_annotations.h" | 177 #include "base/debug/leak_annotations.h" |
178 #include "base/linux_util.h" | 178 #include "base/linux_util.h" |
179 #include "chrome/app/breakpad_linux.h" | 179 #include "components/breakpad/app/breakpad_linux.h" |
180 #include "chrome/browser/crash_handler_host_linux.h" | 180 #include "components/breakpad/browser/crash_handler_host_linux.h" |
181 #endif | 181 #endif |
182 | 182 |
183 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) | 183 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
184 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" | 184 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" |
185 #endif | 185 #endif |
186 | 186 |
187 #if defined(OS_ANDROID) | 187 #if defined(OS_ANDROID) |
188 #include "ui/base/ui_base_paths.h" | 188 #include "ui/base/ui_base_paths.h" |
189 #endif | 189 #endif |
190 | 190 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 using content::FileDescriptorInfo; | 247 using content::FileDescriptorInfo; |
248 using content::QuotaPermissionContext; | 248 using content::QuotaPermissionContext; |
249 using content::RenderViewHost; | 249 using content::RenderViewHost; |
250 using content::SiteInstance; | 250 using content::SiteInstance; |
251 using content::WebContents; | 251 using content::WebContents; |
252 using extensions::APIPermission; | 252 using extensions::APIPermission; |
253 using extensions::Extension; | 253 using extensions::Extension; |
254 using extensions::Manifest; | 254 using extensions::Manifest; |
255 using message_center::NotifierId; | 255 using message_center::NotifierId; |
256 | 256 |
257 #if defined(OS_MACOSX) | |
258 using breakpad::IsCrashReporterEnabled; | |
259 #endif | |
260 | |
261 namespace { | 257 namespace { |
262 | 258 |
263 // Cached version of the locale so we can return the locale on the I/O | 259 // Cached version of the locale so we can return the locale on the I/O |
264 // thread. | 260 // thread. |
265 base::LazyInstance<std::string> g_io_thread_application_locale; | 261 base::LazyInstance<std::string> g_io_thread_application_locale; |
266 | 262 |
267 #if defined(ENABLE_PLUGINS) | 263 #if defined(ENABLE_PLUGINS) |
268 const char* kPredefinedAllowedSocketOrigins[] = { | 264 const char* kPredefinedAllowedSocketOrigins[] = { |
269 "okddffdblfhhnmhodogpojmfkjmhinfp", // Test SSH Client | 265 "okddffdblfhhnmhodogpojmfkjmhinfp", // Test SSH Client |
270 "pnhechapfaindjhompbnflcldabbghjo", // HTerm App (SSH Client) | 266 "pnhechapfaindjhompbnflcldabbghjo", // HTerm App (SSH Client) |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) { | 484 for (size_t i = 0; i < prefs::kWebKitScriptsForFontFamilyMapsLength; ++i) { |
489 const char* script = prefs::kWebKitScriptsForFontFamilyMaps[i]; | 485 const char* script = prefs::kWebKitScriptsForFontFamilyMaps[i]; |
490 std::string pref_name = base::StringPrintf("%s.%s", map_name, script); | 486 std::string pref_name = base::StringPrintf("%s.%s", map_name, script); |
491 std::string font_family = prefs->GetString(pref_name.c_str()); | 487 std::string font_family = prefs->GetString(pref_name.c_str()); |
492 if (!font_family.empty()) | 488 if (!font_family.empty()) |
493 (*map)[script] = UTF8ToUTF16(font_family); | 489 (*map)[script] = UTF8ToUTF16(font_family); |
494 } | 490 } |
495 } | 491 } |
496 | 492 |
497 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 493 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
498 CrashHandlerHostLinux* CreateCrashHandlerHost(const std::string& process_type) { | 494 breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost( |
| 495 const std::string& process_type) { |
499 base::FilePath dumps_path; | 496 base::FilePath dumps_path; |
500 PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path); | 497 PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path); |
501 { | 498 { |
502 ANNOTATE_SCOPED_MEMORY_LEAK; | 499 ANNOTATE_SCOPED_MEMORY_LEAK; |
503 CrashHandlerHostLinux* crash_handler = new CrashHandlerHostLinux( | 500 breakpad::CrashHandlerHostLinux* crash_handler = |
504 process_type, dumps_path, getenv(env_vars::kHeadless) == NULL); | 501 new breakpad::CrashHandlerHostLinux( |
| 502 process_type, dumps_path, getenv(env_vars::kHeadless) == NULL); |
505 crash_handler->StartUploaderThread(); | 503 crash_handler->StartUploaderThread(); |
506 return crash_handler; | 504 return crash_handler; |
507 } | 505 } |
508 } | 506 } |
509 | 507 |
510 int GetCrashSignalFD(const CommandLine& command_line) { | 508 int GetCrashSignalFD(const CommandLine& command_line) { |
511 if (command_line.HasSwitch(switches::kExtensionProcess)) { | 509 if (command_line.HasSwitch(switches::kExtensionProcess)) { |
512 static CrashHandlerHostLinux* crash_handler = NULL; | 510 static breakpad::CrashHandlerHostLinux* crash_handler = NULL; |
513 if (!crash_handler) | 511 if (!crash_handler) |
514 crash_handler = CreateCrashHandlerHost("extension"); | 512 crash_handler = CreateCrashHandlerHost("extension"); |
515 return crash_handler->GetDeathSignalSocket(); | 513 return crash_handler->GetDeathSignalSocket(); |
516 } | 514 } |
517 | 515 |
518 std::string process_type = | 516 std::string process_type = |
519 command_line.GetSwitchValueASCII(switches::kProcessType); | 517 command_line.GetSwitchValueASCII(switches::kProcessType); |
520 | 518 |
521 if (process_type == switches::kRendererProcess) { | 519 if (process_type == switches::kRendererProcess) { |
522 static CrashHandlerHostLinux* crash_handler = NULL; | 520 static breakpad::CrashHandlerHostLinux* crash_handler = NULL; |
523 if (!crash_handler) | 521 if (!crash_handler) |
524 crash_handler = CreateCrashHandlerHost(process_type); | 522 crash_handler = CreateCrashHandlerHost(process_type); |
525 return crash_handler->GetDeathSignalSocket(); | 523 return crash_handler->GetDeathSignalSocket(); |
526 } | 524 } |
527 | 525 |
528 if (process_type == switches::kPluginProcess) { | 526 if (process_type == switches::kPluginProcess) { |
529 static CrashHandlerHostLinux* crash_handler = NULL; | 527 static breakpad::CrashHandlerHostLinux* crash_handler = NULL; |
530 if (!crash_handler) | 528 if (!crash_handler) |
531 crash_handler = CreateCrashHandlerHost(process_type); | 529 crash_handler = CreateCrashHandlerHost(process_type); |
532 return crash_handler->GetDeathSignalSocket(); | 530 return crash_handler->GetDeathSignalSocket(); |
533 } | 531 } |
534 | 532 |
535 if (process_type == switches::kPpapiPluginProcess) { | 533 if (process_type == switches::kPpapiPluginProcess) { |
536 static CrashHandlerHostLinux* crash_handler = NULL; | 534 static breakpad::CrashHandlerHostLinux* crash_handler = NULL; |
537 if (!crash_handler) | 535 if (!crash_handler) |
538 crash_handler = CreateCrashHandlerHost(process_type); | 536 crash_handler = CreateCrashHandlerHost(process_type); |
539 return crash_handler->GetDeathSignalSocket(); | 537 return crash_handler->GetDeathSignalSocket(); |
540 } | 538 } |
541 | 539 |
542 if (process_type == switches::kGpuProcess) { | 540 if (process_type == switches::kGpuProcess) { |
543 static CrashHandlerHostLinux* crash_handler = NULL; | 541 static breakpad::CrashHandlerHostLinux* crash_handler = NULL; |
544 if (!crash_handler) | 542 if (!crash_handler) |
545 crash_handler = CreateCrashHandlerHost(process_type); | 543 crash_handler = CreateCrashHandlerHost(process_type); |
546 return crash_handler->GetDeathSignalSocket(); | 544 return crash_handler->GetDeathSignalSocket(); |
547 } | 545 } |
548 | 546 |
549 return -1; | 547 return -1; |
550 } | 548 } |
551 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) | 549 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) |
552 | 550 |
553 #if !defined(OS_CHROMEOS) | 551 #if !defined(OS_CHROMEOS) |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 } | 1357 } |
1360 | 1358 |
1361 std::string ChromeContentBrowserClient::GetCanonicalEncodingNameByAliasName( | 1359 std::string ChromeContentBrowserClient::GetCanonicalEncodingNameByAliasName( |
1362 const std::string& alias_name) { | 1360 const std::string& alias_name) { |
1363 return CharacterEncoding::GetCanonicalEncodingNameByAliasName(alias_name); | 1361 return CharacterEncoding::GetCanonicalEncodingNameByAliasName(alias_name); |
1364 } | 1362 } |
1365 | 1363 |
1366 void ChromeContentBrowserClient::AppendExtraCommandLineSwitches( | 1364 void ChromeContentBrowserClient::AppendExtraCommandLineSwitches( |
1367 CommandLine* command_line, int child_process_id) { | 1365 CommandLine* command_line, int child_process_id) { |
1368 #if defined(OS_POSIX) | 1366 #if defined(OS_POSIX) |
1369 if (IsCrashReporterEnabled()) { | 1367 if (breakpad::IsCrashReporterEnabled()) { |
1370 std::string enable_crash_reporter; | 1368 std::string enable_crash_reporter; |
1371 GoogleUpdateSettings::GetMetricsId(&enable_crash_reporter); | 1369 GoogleUpdateSettings::GetMetricsId(&enable_crash_reporter); |
1372 #if !defined(OS_MACOSX) | 1370 #if !defined(OS_MACOSX) |
1373 enable_crash_reporter += "," + base::GetLinuxDistro(); | 1371 enable_crash_reporter += "," + base::GetLinuxDistro(); |
1374 #endif | 1372 #endif |
1375 command_line->AppendSwitchASCII(switches::kEnableCrashReporter, | 1373 command_line->AppendSwitchASCII(switches::kEnableCrashReporter, |
1376 enable_crash_reporter); | 1374 enable_crash_reporter); |
1377 } | 1375 } |
1378 #endif // OS_POSIX | 1376 #endif // OS_POSIX |
1379 | 1377 |
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2523 mappings->push_back(FileDescriptorInfo(kAndroidLocalePakDescriptor, | 2521 mappings->push_back(FileDescriptorInfo(kAndroidLocalePakDescriptor, |
2524 FileDescriptor(f, true))); | 2522 FileDescriptor(f, true))); |
2525 | 2523 |
2526 base::FilePath resources_pack_path; | 2524 base::FilePath resources_pack_path; |
2527 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); | 2525 PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); |
2528 f = base::CreatePlatformFile(resources_pack_path, flags, NULL, NULL); | 2526 f = base::CreatePlatformFile(resources_pack_path, flags, NULL, NULL); |
2529 DCHECK(f != base::kInvalidPlatformFileValue); | 2527 DCHECK(f != base::kInvalidPlatformFileValue); |
2530 mappings->push_back(FileDescriptorInfo(kAndroidUIResourcesPakDescriptor, | 2528 mappings->push_back(FileDescriptorInfo(kAndroidUIResourcesPakDescriptor, |
2531 FileDescriptor(f, true))); | 2529 FileDescriptor(f, true))); |
2532 | 2530 |
2533 if (IsCrashReporterEnabled()) { | 2531 if (breakpad::IsCrashReporterEnabled()) { |
2534 f = CrashDumpManager::GetInstance()->CreateMinidumpFile(child_process_id); | 2532 f = breakpad::CrashDumpManager::GetInstance()->CreateMinidumpFile( |
| 2533 child_process_id); |
2535 if (f == base::kInvalidPlatformFileValue) { | 2534 if (f == base::kInvalidPlatformFileValue) { |
2536 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " | 2535 LOG(ERROR) << "Failed to create file for minidump, crash reporting will " |
2537 "be disabled for this process."; | 2536 "be disabled for this process."; |
2538 } else { | 2537 } else { |
2539 mappings->push_back(FileDescriptorInfo(kAndroidMinidumpDescriptor, | 2538 mappings->push_back(FileDescriptorInfo(kAndroidMinidumpDescriptor, |
2540 FileDescriptor(f, true))); | 2539 FileDescriptor(f, true))); |
2541 } | 2540 } |
2542 } | 2541 } |
2543 | 2542 |
2544 #else | 2543 #else |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2609 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, | 2608 return IsExtensionOrSharedModuleWhitelisted(url, extension_set, |
2610 allowed_file_handle_origins_) || | 2609 allowed_file_handle_origins_) || |
2611 IsHostAllowedByCommandLine(url, extension_set, | 2610 IsHostAllowedByCommandLine(url, extension_set, |
2612 switches::kAllowNaClFileHandleAPI); | 2611 switches::kAllowNaClFileHandleAPI); |
2613 #else | 2612 #else |
2614 return false; | 2613 return false; |
2615 #endif | 2614 #endif |
2616 } | 2615 } |
2617 | 2616 |
2618 } // namespace chrome | 2617 } // namespace chrome |
OLD | NEW |