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

Side by Side Diff: chrome/app/chrome_main_delegate.cc

Issue 2270083002: Added in switches for the Mac Installer to send preferences to Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cl5_review
Patch Set: Created 4 years, 3 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
« no previous file with comments | « chrome/app/chrome_main_delegate.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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
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::kSetDefaultBrowser);
705
706 if (uma_setting) {
grt (UTC plus 2) 2016/08/24 22:11:55 nit: omit braces for single-line conditionals like
Anna Zeng 2016/08/30 20:29:30 Done.
707 crash_reporter::SetUploadsEnabled(uma_setting);
708 }
709
710 if (default_browser_setting) {
711 shell_integration::SetAsDefaultBrowser();
712 }
713 }
698 #endif // defined(OS_MACOSX) 714 #endif // defined(OS_MACOSX)
699 715
700 void ChromeMainDelegate::PreSandboxStartup() { 716 void ChromeMainDelegate::PreSandboxStartup() {
701 const base::CommandLine& command_line = 717 const base::CommandLine& command_line =
702 *base::CommandLine::ForCurrentProcess(); 718 *base::CommandLine::ForCurrentProcess();
703 std::string process_type = 719 std::string process_type =
704 command_line.GetSwitchValueASCII(switches::kProcessType); 720 command_line.GetSwitchValueASCII(switches::kProcessType);
705 721
706 #if defined(OS_POSIX) 722 #if defined(OS_POSIX)
707 crash_reporter::SetCrashReporterClient(g_chrome_crash_client.Pointer()); 723 crash_reporter::SetCrashReporterClient(g_chrome_crash_client.Pointer());
708 #endif 724 #endif
709 725
710 #if defined(OS_MACOSX) 726 #if defined(OS_MACOSX)
711 // On the Mac, the child executable lives at a predefined location within 727 // On the Mac, the child executable lives at a predefined location within
712 // the app bundle's versioned directory. 728 // the app bundle's versioned directory.
713 PathService::Override(content::CHILD_PROCESS_EXE, 729 PathService::Override(content::CHILD_PROCESS_EXE,
714 chrome::GetVersionedDirectory(). 730 chrome::GetVersionedDirectory().
715 Append(chrome::kHelperProcessExecutablePath)); 731 Append(chrome::kHelperProcessExecutablePath));
716 732
717 InitMacCrashReporter(command_line, process_type); 733 InitMacCrashReporter(command_line, process_type);
734 SetUpInstallerPreferences(command_line);
718 #endif 735 #endif
719 736
720 #if defined(OS_WIN) 737 #if defined(OS_WIN)
721 child_process_logging::Init(); 738 child_process_logging::Init();
722 #endif 739 #endif
723 #if defined(ARCH_CPU_ARM_FAMILY) && (defined(OS_ANDROID) || defined(OS_LINUX)) 740 #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 741 // Create an instance of the CPU class to parse /proc/cpuinfo and cache
725 // cpu_brand info. 742 // cpu_brand info.
726 base::CPU cpu_info; 743 base::CPU cpu_info;
727 #endif 744 #endif
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 case version_info::Channel::CANARY: 1055 case version_info::Channel::CANARY:
1039 return true; 1056 return true;
1040 case version_info::Channel::DEV: 1057 case version_info::Channel::DEV:
1041 case version_info::Channel::BETA: 1058 case version_info::Channel::BETA:
1042 case version_info::Channel::STABLE: 1059 case version_info::Channel::STABLE:
1043 default: 1060 default:
1044 // Don't enable instrumentation. 1061 // Don't enable instrumentation.
1045 return false; 1062 return false;
1046 } 1063 }
1047 } 1064 }
OLDNEW
« no previous file with comments | « chrome/app/chrome_main_delegate.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698