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/app/chrome_main_delegate.h" | 5 #include "chrome/app/chrome_main_delegate.h" |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/cpu.h" | 9 #include "base/cpu.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 g_chrome_content_utility_client = LAZY_INSTANCE_INITIALIZER; | 139 g_chrome_content_utility_client = LAZY_INSTANCE_INITIALIZER; |
140 base::LazyInstance<ChromeContentPluginClient> | 140 base::LazyInstance<ChromeContentPluginClient> |
141 g_chrome_content_plugin_client = LAZY_INSTANCE_INITIALIZER; | 141 g_chrome_content_plugin_client = LAZY_INSTANCE_INITIALIZER; |
142 #endif | 142 #endif |
143 | 143 |
144 #if !defined(CHROME_MULTIPLE_DLL_CHILD) | 144 #if !defined(CHROME_MULTIPLE_DLL_CHILD) |
145 base::LazyInstance<ChromeContentBrowserClient> g_chrome_content_browser_client = | 145 base::LazyInstance<ChromeContentBrowserClient> g_chrome_content_browser_client = |
146 LAZY_INSTANCE_INITIALIZER; | 146 LAZY_INSTANCE_INITIALIZER; |
147 #endif | 147 #endif |
148 | 148 |
149 #if defined(OS_POSIX) || defined(OS_WIN) | 149 #if defined(OS_POSIX) |
150 base::LazyInstance<ChromeCrashReporterClient>::Leaky g_chrome_crash_client = | 150 base::LazyInstance<ChromeCrashReporterClient>::Leaky g_chrome_crash_client = |
151 LAZY_INSTANCE_INITIALIZER; | 151 LAZY_INSTANCE_INITIALIZER; |
152 #endif | 152 #endif |
153 | 153 |
154 extern int NaClMain(const content::MainFunctionParams&); | 154 extern int NaClMain(const content::MainFunctionParams&); |
155 extern int ServiceProcessMain(const content::MainFunctionParams&); | 155 extern int ServiceProcessMain(const content::MainFunctionParams&); |
156 | 156 |
157 namespace { | 157 namespace { |
158 | 158 |
159 #if defined(OS_WIN) | 159 #if defined(OS_WIN) |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 #if defined(OS_WIN) | 491 #if defined(OS_WIN) |
492 // Must do this before any other usage of command line! | 492 // Must do this before any other usage of command line! |
493 if (HasDeprecatedArguments(command_line.GetCommandLineString())) { | 493 if (HasDeprecatedArguments(command_line.GetCommandLineString())) { |
494 *exit_code = 1; | 494 *exit_code = 1; |
495 return true; | 495 return true; |
496 } | 496 } |
497 | 497 |
498 InstallHandleHooks(); | 498 InstallHandleHooks(); |
499 #endif | 499 #endif |
500 | 500 |
| 501 #if !defined(OS_WIN) |
| 502 // This is done earlier in chrome.exe on Windows. |
501 chrome::RegisterPathProvider(); | 503 chrome::RegisterPathProvider(); |
| 504 #endif |
502 #if defined(OS_CHROMEOS) | 505 #if defined(OS_CHROMEOS) |
503 chromeos::RegisterPathProvider(); | 506 chromeos::RegisterPathProvider(); |
504 #endif | 507 #endif |
505 #if !defined(DISABLE_NACL) && defined(OS_LINUX) | 508 #if !defined(DISABLE_NACL) && defined(OS_LINUX) |
506 nacl::RegisterPathProvider(); | 509 nacl::RegisterPathProvider(); |
507 #endif | 510 #endif |
508 | 511 |
509 ContentSettingsPattern::SetNonWildcardDomainNonPortScheme( | 512 ContentSettingsPattern::SetNonWildcardDomainNonPortScheme( |
510 extensions::kExtensionScheme); | 513 extensions::kExtensionScheme); |
511 | 514 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 } | 661 } |
659 } | 662 } |
660 #endif // defined(OS_MACOSX) | 663 #endif // defined(OS_MACOSX) |
661 | 664 |
662 void ChromeMainDelegate::PreSandboxStartup() { | 665 void ChromeMainDelegate::PreSandboxStartup() { |
663 const base::CommandLine& command_line = | 666 const base::CommandLine& command_line = |
664 *base::CommandLine::ForCurrentProcess(); | 667 *base::CommandLine::ForCurrentProcess(); |
665 std::string process_type = | 668 std::string process_type = |
666 command_line.GetSwitchValueASCII(switches::kProcessType); | 669 command_line.GetSwitchValueASCII(switches::kProcessType); |
667 | 670 |
668 #if defined(OS_POSIX) || defined(OS_WIN) | 671 #if defined(OS_POSIX) |
669 crash_reporter::SetCrashReporterClient(g_chrome_crash_client.Pointer()); | 672 crash_reporter::SetCrashReporterClient(g_chrome_crash_client.Pointer()); |
670 #endif | 673 #endif |
671 | 674 |
672 #if defined(OS_MACOSX) | 675 #if defined(OS_MACOSX) |
673 // On the Mac, the child executable lives at a predefined location within | 676 // On the Mac, the child executable lives at a predefined location within |
674 // the app bundle's versioned directory. | 677 // the app bundle's versioned directory. |
675 PathService::Override(content::CHILD_PROCESS_EXE, | 678 PathService::Override(content::CHILD_PROCESS_EXE, |
676 chrome::GetVersionedDirectory(). | 679 chrome::GetVersionedDirectory(). |
677 Append(chrome::kHelperProcessExecutablePath)); | 680 Append(chrome::kHelperProcessExecutablePath)); |
678 | 681 |
679 InitMacCrashReporter(command_line, process_type); | 682 InitMacCrashReporter(command_line, process_type); |
680 #endif | 683 #endif |
681 | 684 |
682 #if defined(OS_WIN) | 685 #if defined(OS_WIN) |
683 // TODO(scottmg): It would be nice to do this earlier to catch early crashes, | |
684 // perhaps as early as WinMain in chrome.exe. This would require some code | |
685 // restructuring to have paths and command lines set up, and also to handle | |
686 // having some of the code live in chrome.exe, while having the database be | |
687 // accessed by browser code in chrome.dll (to get a list of uploaded crashes | |
688 // for chrome://crashes). | |
689 crash_reporter::InitializeCrashpad(process_type.empty(), process_type); | |
690 #endif // OS_WIN | |
691 | |
692 #if defined(OS_WIN) | |
693 child_process_logging::Init(); | 686 child_process_logging::Init(); |
694 #endif | 687 #endif |
695 #if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) | 688 #if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) |
696 // Create an instance of the CPU class to parse /proc/cpuinfo and cache | 689 // Create an instance of the CPU class to parse /proc/cpuinfo and cache |
697 // cpu_brand info. | 690 // cpu_brand info. |
698 base::CPU cpu_info; | 691 base::CPU cpu_info; |
699 #endif | 692 #endif |
700 | 693 |
701 // Initialize the user data dir for any process type that needs it. | 694 // Initialize the user data dir for any process type that needs it. |
702 if (chrome::ProcessNeedsProfileDir(process_type)) | 695 if (chrome::ProcessNeedsProfileDir(process_type)) |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 case version_info::Channel::CANARY: | 983 case version_info::Channel::CANARY: |
991 return true; | 984 return true; |
992 case version_info::Channel::DEV: | 985 case version_info::Channel::DEV: |
993 case version_info::Channel::BETA: | 986 case version_info::Channel::BETA: |
994 case version_info::Channel::STABLE: | 987 case version_info::Channel::STABLE: |
995 default: | 988 default: |
996 // Don't enable instrumentation. | 989 // Don't enable instrumentation. |
997 return false; | 990 return false; |
998 } | 991 } |
999 } | 992 } |
OLD | NEW |