| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 #include "chrome/common/v8_breakpad_support_win.h" | 65 #include "chrome/common/v8_breakpad_support_win.h" |
| 66 #include "components/crash/content/app/crashpad.h" | 66 #include "components/crash/content/app/crashpad.h" |
| 67 #include "sandbox/win/src/sandbox.h" | 67 #include "sandbox/win/src/sandbox.h" |
| 68 #include "ui/base/resource/resource_bundle_win.h" | 68 #include "ui/base/resource/resource_bundle_win.h" |
| 69 #endif | 69 #endif |
| 70 | 70 |
| 71 #if defined(OS_MACOSX) | 71 #if defined(OS_MACOSX) |
| 72 #include "base/mac/foundation_util.h" | 72 #include "base/mac/foundation_util.h" |
| 73 #include "chrome/app/chrome_main_mac.h" | 73 #include "chrome/app/chrome_main_mac.h" |
| 74 #include "chrome/browser/mac/relauncher.h" | 74 #include "chrome/browser/mac/relauncher.h" |
| 75 #include "chrome/browser/shell_integration.h" |
| 75 #include "chrome/common/mac/cfbundle_blocker.h" | 76 #include "chrome/common/mac/cfbundle_blocker.h" |
| 76 #include "components/crash/content/app/crashpad.h" | 77 #include "components/crash/content/app/crashpad.h" |
| 77 #include "components/crash/core/common/objc_zombie.h" | 78 #include "components/crash/core/common/objc_zombie.h" |
| 78 #include "ui/base/l10n/l10n_util_mac.h" | 79 #include "ui/base/l10n/l10n_util_mac.h" |
| 79 #endif | 80 #endif |
| 80 | 81 |
| 81 #if defined(OS_POSIX) | 82 #if defined(OS_POSIX) |
| 82 #include <locale.h> | 83 #include <locale.h> |
| 83 #include <signal.h> | 84 #include <signal.h> |
| 84 #include "chrome/app/chrome_crash_reporter_client.h" | 85 #include "chrome/app/chrome_crash_reporter_client.h" |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 if (base::mac::IsBackgroundOnlyProcess()) { | 689 if (base::mac::IsBackgroundOnlyProcess()) { |
| 689 CHECK(command_line.HasSwitch(switches::kProcessType) && | 690 CHECK(command_line.HasSwitch(switches::kProcessType) && |
| 690 !process_type.empty()) | 691 !process_type.empty()) |
| 691 << "Helper application requires --type."; | 692 << "Helper application requires --type."; |
| 692 } else { | 693 } else { |
| 693 CHECK(!command_line.HasSwitch(switches::kProcessType) && | 694 CHECK(!command_line.HasSwitch(switches::kProcessType) && |
| 694 process_type.empty()) | 695 process_type.empty()) |
| 695 << "Main application forbids --type, saw " << process_type; | 696 << "Main application forbids --type, saw " << process_type; |
| 696 } | 697 } |
| 697 } | 698 } |
| 699 |
| 700 void ChromeMainDelegate::SetUpInstallerPreferences( |
| 701 const base::CommandLine& command_line) { |
| 702 const bool uma_setting = command_line.HasSwitch(switches::kEnableUserMetrics); |
| 703 const bool default_browser_setting = |
| 704 command_line.HasSwitch(switches::kMakeChromeDefault); |
| 705 |
| 706 if (uma_setting) |
| 707 crash_reporter::SetUploadConsent(uma_setting); |
| 708 if (default_browser_setting) |
| 709 shell_integration::SetAsDefaultBrowser(); |
| 710 } |
| 698 #endif // defined(OS_MACOSX) | 711 #endif // defined(OS_MACOSX) |
| 699 | 712 |
| 700 void ChromeMainDelegate::PreSandboxStartup() { | 713 void ChromeMainDelegate::PreSandboxStartup() { |
| 701 const base::CommandLine& command_line = | 714 const base::CommandLine& command_line = |
| 702 *base::CommandLine::ForCurrentProcess(); | 715 *base::CommandLine::ForCurrentProcess(); |
| 703 std::string process_type = | 716 std::string process_type = |
| 704 command_line.GetSwitchValueASCII(switches::kProcessType); | 717 command_line.GetSwitchValueASCII(switches::kProcessType); |
| 705 | 718 |
| 706 #if defined(OS_POSIX) | 719 #if defined(OS_POSIX) |
| 707 crash_reporter::SetCrashReporterClient(g_chrome_crash_client.Pointer()); | 720 crash_reporter::SetCrashReporterClient(g_chrome_crash_client.Pointer()); |
| 708 #endif | 721 #endif |
| 709 | 722 |
| 710 #if defined(OS_MACOSX) | 723 #if defined(OS_MACOSX) |
| 711 // On the Mac, the child executable lives at a predefined location within | 724 // On the Mac, the child executable lives at a predefined location within |
| 712 // the app bundle's versioned directory. | 725 // the app bundle's versioned directory. |
| 713 PathService::Override(content::CHILD_PROCESS_EXE, | 726 PathService::Override(content::CHILD_PROCESS_EXE, |
| 714 chrome::GetVersionedDirectory(). | 727 chrome::GetVersionedDirectory(). |
| 715 Append(chrome::kHelperProcessExecutablePath)); | 728 Append(chrome::kHelperProcessExecutablePath)); |
| 716 | 729 |
| 717 InitMacCrashReporter(command_line, process_type); | 730 InitMacCrashReporter(command_line, process_type); |
| 731 SetUpInstallerPreferences(command_line); |
| 718 #endif | 732 #endif |
| 719 | 733 |
| 720 #if defined(OS_WIN) | 734 #if defined(OS_WIN) |
| 721 child_process_logging::Init(); | 735 child_process_logging::Init(); |
| 722 #endif | 736 #endif |
| 723 #if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) | 737 #if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) |
| 724 // Create an instance of the CPU class to parse /proc/cpuinfo and cache | 738 // Create an instance of the CPU class to parse /proc/cpuinfo and cache |
| 725 // cpu_brand info. | 739 // cpu_brand info. |
| 726 base::CPU cpu_info; | 740 base::CPU cpu_info; |
| 727 #endif | 741 #endif |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 case version_info::Channel::CANARY: | 1052 case version_info::Channel::CANARY: |
| 1039 return true; | 1053 return true; |
| 1040 case version_info::Channel::DEV: | 1054 case version_info::Channel::DEV: |
| 1041 case version_info::Channel::BETA: | 1055 case version_info::Channel::BETA: |
| 1042 case version_info::Channel::STABLE: | 1056 case version_info::Channel::STABLE: |
| 1043 default: | 1057 default: |
| 1044 // Don't enable instrumentation. | 1058 // Don't enable instrumentation. |
| 1045 return false; | 1059 return false; |
| 1046 } | 1060 } |
| 1047 } | 1061 } |
| OLD | NEW |