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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 #if defined(OS_MACOSX) | 562 #if defined(OS_MACOSX) |
563 void ChromeMainDelegate::InitMacCrashReporter( | 563 void ChromeMainDelegate::InitMacCrashReporter( |
564 const base::CommandLine& command_line, | 564 const base::CommandLine& command_line, |
565 const std::string& process_type) { | 565 const std::string& process_type) { |
566 // TODO(mark): Right now, InitializeCrashpad() needs to be called after | 566 // TODO(mark): Right now, InitializeCrashpad() needs to be called after |
567 // CommandLine::Init() and chrome::RegisterPathProvider(). Ideally, Crashpad | 567 // CommandLine::Init() and chrome::RegisterPathProvider(). Ideally, Crashpad |
568 // initialization could occur sooner, preferably even before the framework | 568 // initialization could occur sooner, preferably even before the framework |
569 // dylib is even loaded, to catch potential early crashes. | 569 // dylib is even loaded, to catch potential early crashes. |
570 crash_reporter::InitializeCrashpad(process_type); | 570 crash_reporter::InitializeCrashpad(process_type); |
571 | 571 |
| 572 const bool browser_process = process_type.empty(); |
| 573 if (!browser_process) { |
| 574 std::string metrics_client_id = |
| 575 command_line.GetSwitchValueASCII(switches::kMetricsClientID); |
| 576 crash_keys::SetMetricsClientIdFromGUID(metrics_client_id); |
| 577 } |
| 578 |
572 // Mac Chrome is packaged with a main app bundle and a helper app bundle. | 579 // Mac Chrome is packaged with a main app bundle and a helper app bundle. |
573 // The main app bundle should only be used for the browser process, so it | 580 // The main app bundle should only be used for the browser process, so it |
574 // should never see a --type switch (switches::kProcessType). Likewise, | 581 // should never see a --type switch (switches::kProcessType). Likewise, |
575 // the helper should always have a --type switch. | 582 // the helper should always have a --type switch. |
576 // | 583 // |
577 // This check is done this late so there is already a call to | 584 // This check is done this late so there is already a call to |
578 // base::mac::IsBackgroundOnlyProcess(), so there is no change in | 585 // base::mac::IsBackgroundOnlyProcess(), so there is no change in |
579 // startup/initialization order. | 586 // startup/initialization order. |
580 | 587 |
581 // The helper's Info.plist marks it as a background only app. | 588 // The helper's Info.plist marks it as a background only app. |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 case chrome::VersionInfo::CHANNEL_CANARY: | 960 case chrome::VersionInfo::CHANNEL_CANARY: |
954 return true; | 961 return true; |
955 case chrome::VersionInfo::CHANNEL_DEV: | 962 case chrome::VersionInfo::CHANNEL_DEV: |
956 case chrome::VersionInfo::CHANNEL_BETA: | 963 case chrome::VersionInfo::CHANNEL_BETA: |
957 case chrome::VersionInfo::CHANNEL_STABLE: | 964 case chrome::VersionInfo::CHANNEL_STABLE: |
958 default: | 965 default: |
959 // Don't enable instrumentation. | 966 // Don't enable instrumentation. |
960 return false; | 967 return false; |
961 } | 968 } |
962 } | 969 } |
OLD | NEW |