| Index: chrome/app/chrome_crash_reporter_client_win.cc
|
| diff --git a/chrome/app/chrome_crash_reporter_client.cc b/chrome/app/chrome_crash_reporter_client_win.cc
|
| similarity index 76%
|
| copy from chrome/app/chrome_crash_reporter_client.cc
|
| copy to chrome/app/chrome_crash_reporter_client_win.cc
|
| index 849e57563d7f7931d6637f2dc20d5a8fae034154..1250741914a73718add2e1e3440bdd9c08a469eb 100644
|
| --- a/chrome/app/chrome_crash_reporter_client.cc
|
| +++ b/chrome/app/chrome_crash_reporter_client_win.cc
|
| @@ -2,63 +2,41 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "chrome/app/chrome_crash_reporter_client.h"
|
| +#include "chrome/app/chrome_crash_reporter_client_win.h"
|
| +
|
| +#include <windows.h>
|
|
|
| #include "base/command_line.h"
|
| #include "base/environment.h"
|
| +#include "base/file_version_info.h"
|
| #include "base/files/file_path.h"
|
| #include "base/logging.h"
|
| +#include "base/memory/scoped_ptr.h"
|
| #include "base/path_service.h"
|
| #include "base/strings/string_split.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| +#include "base/win/registry.h"
|
| #include "build/build_config.h"
|
| #include "chrome/common/chrome_paths.h"
|
| #include "chrome/common/chrome_paths_internal.h"
|
| #include "chrome/common/chrome_result_codes.h"
|
| #include "chrome/common/crash_keys.h"
|
| #include "chrome/common/env_vars.h"
|
| -#include "chrome/installer/util/google_update_settings.h"
|
| -#include "content/public/common/content_switches.h"
|
| -
|
| -#if defined(OS_WIN)
|
| -#include <windows.h>
|
| -
|
| -#include "base/file_version_info.h"
|
| -#include "base/win/registry.h"
|
| #include "chrome/common/metrics_constants_util_win.h"
|
| #include "chrome/installer/util/google_chrome_sxs_distribution.h"
|
| +#include "chrome/installer/util/google_update_settings.h"
|
| #include "chrome/installer/util/install_util.h"
|
| #include "chrome/installer/util/util_constants.h"
|
| #include "components/browser_watcher/crash_reporting_metrics_win.h"
|
| +#include "content/public/common/content_switches.h"
|
| #include "policy/policy_constants.h"
|
| -#endif
|
| -
|
| -#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
| -#include "components/upload_list/crash_upload_list.h"
|
| -#include "components/version_info/version_info_values.h"
|
| -#endif
|
| -
|
| -#if defined(OS_POSIX)
|
| -#include "base/debug/dump_without_crashing.h"
|
| -#endif
|
| -
|
| -#if defined(OS_ANDROID)
|
| -#include "chrome/common/descriptors_android.h"
|
| -#endif
|
|
|
| -#if defined(OS_CHROMEOS)
|
| -#include "chrome/common/channel_info.h"
|
| -#include "chromeos/chromeos_switches.h"
|
| -#include "components/version_info/version_info.h"
|
| -#endif
|
|
|
| namespace {
|
|
|
| -#if defined(OS_WIN)
|
| // This is the minimum version of google update that is required for deferred
|
| // crash uploads to work.
|
| const char kMinUpdateVersion[] = "1.3.21.115";
|
| -#endif
|
|
|
| } // namespace
|
|
|
| @@ -66,14 +44,6 @@ ChromeCrashReporterClient::ChromeCrashReporterClient() {}
|
|
|
| ChromeCrashReporterClient::~ChromeCrashReporterClient() {}
|
|
|
| -#if !defined(OS_MACOSX) && !defined(OS_WIN)
|
| -void ChromeCrashReporterClient::SetCrashReporterClientIdFromGUID(
|
| - const std::string& client_guid) {
|
| - crash_keys::SetMetricsClientIdFromGUID(client_guid);
|
| -}
|
| -#endif
|
| -
|
| -#if defined(OS_WIN)
|
| bool ChromeCrashReporterClient::GetAlternativeCrashDumpLocation(
|
| base::FilePath* crash_dir) {
|
| // By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate
|
| @@ -99,7 +69,7 @@ void ChromeCrashReporterClient::GetProductNameAndVersion(
|
| DCHECK(special_build);
|
| DCHECK(channel_name);
|
|
|
| - std::unique_ptr<FileVersionInfo> version_info(
|
| + scoped_ptr<FileVersionInfo> version_info(
|
| FileVersionInfo::CreateFileVersionInfo(exe_path));
|
|
|
| if (version_info.get()) {
|
| @@ -123,7 +93,7 @@ void ChromeCrashReporterClient::GetProductNameAndVersion(
|
| bool ChromeCrashReporterClient::ShouldShowRestartDialog(base::string16* title,
|
| base::string16* message,
|
| bool* is_rtl_locale) {
|
| - std::unique_ptr<base::Environment> env(base::Environment::Create());
|
| + scoped_ptr<base::Environment> env(base::Environment::Create());
|
| if (!env->HasVar(env_vars::kShowRestart) ||
|
| !env->HasVar(env_vars::kRestartInfo) ||
|
| env->HasVar(env_vars::kMetroConnected)) {
|
| @@ -149,7 +119,7 @@ bool ChromeCrashReporterClient::ShouldShowRestartDialog(base::string16* title,
|
| }
|
|
|
| bool ChromeCrashReporterClient::AboutToRestart() {
|
| - std::unique_ptr<base::Environment> env(base::Environment::Create());
|
| + scoped_ptr<base::Environment> env(base::Environment::Create());
|
| if (!env->HasVar(env_vars::kRestartInfo))
|
| return false;
|
|
|
| @@ -250,63 +220,29 @@ bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy(
|
|
|
| return false;
|
| }
|
| -#endif // defined(OS_WIN)
|
| -
|
| -#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
| -void ChromeCrashReporterClient::GetProductNameAndVersion(
|
| - const char** product_name,
|
| - const char** version) {
|
| - DCHECK(product_name);
|
| - DCHECK(version);
|
| -#if defined(OS_ANDROID)
|
| - *product_name = "Chrome_Android";
|
| -#elif defined(OS_CHROMEOS)
|
| - *product_name = "Chrome_ChromeOS";
|
| -#else // OS_LINUX
|
| -#if !defined(ADDRESS_SANITIZER)
|
| - *product_name = "Chrome_Linux";
|
| -#else
|
| - *product_name = "Chrome_Linux_ASan";
|
| -#endif
|
| -#endif
|
| -
|
| - *version = PRODUCT_VERSION;
|
| -}
|
|
|
| -base::FilePath ChromeCrashReporterClient::GetReporterLogFilename() {
|
| - return base::FilePath(CrashUploadList::kReporterLogFilename);
|
| -}
|
| -#endif
|
|
|
| bool ChromeCrashReporterClient::GetCrashDumpLocation(
|
| base::FilePath* crash_dir) {
|
| // By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate
|
| // location to write breakpad crash dumps can be set.
|
| - std::unique_ptr<base::Environment> env(base::Environment::Create());
|
| + scoped_ptr<base::Environment> env(base::Environment::Create());
|
| std::string alternate_crash_dump_location;
|
| if (env->GetVar("BREAKPAD_DUMP_LOCATION", &alternate_crash_dump_location)) {
|
| base::FilePath crash_dumps_dir_path =
|
| base::FilePath::FromUTF8Unsafe(alternate_crash_dump_location);
|
|
|
| -#if defined(OS_WIN)
|
| // If this environment variable exists, then for the time being,
|
| // short-circuit how it's handled on Windows. Honoring this
|
| // variable is required in order to symbolize stack traces in
|
| // Telemetry based tests: http://crbug.com/561763.
|
| *crash_dir = crash_dumps_dir_path;
|
| return true;
|
| -#else
|
| - PathService::Override(chrome::DIR_CRASH_DUMPS, crash_dumps_dir_path);
|
| -#endif
|
| }
|
|
|
| -#if defined(OS_WIN)
|
| // TODO(scottmg): Consider supporting --user-data-dir. See
|
| // https://crbug.com/565446.
|
| return chrome::GetDefaultCrashDumpLocation(crash_dir);
|
| -#else
|
| - return PathService::Get(chrome::DIR_CRASH_DUMPS, crash_dir);
|
| -#endif
|
| }
|
|
|
| size_t ChromeCrashReporterClient::RegisterCrashKeys() {
|
| @@ -314,7 +250,7 @@ size_t ChromeCrashReporterClient::RegisterCrashKeys() {
|
| }
|
|
|
| bool ChromeCrashReporterClient::IsRunningUnattended() {
|
| - std::unique_ptr<base::Environment> env(base::Environment::Create());
|
| + scoped_ptr<base::Environment> env(base::Environment::Create());
|
| return env->HasVar(env_vars::kHeadless);
|
| }
|
|
|
| @@ -325,33 +261,10 @@ bool ChromeCrashReporterClient::GetCollectStatsConsent() {
|
| bool is_official_chrome_build = false;
|
| #endif
|
|
|
| -#if defined(OS_CHROMEOS)
|
| - bool is_guest_session = base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| - chromeos::switches::kGuestSession);
|
| - bool is_stable_channel =
|
| - chrome::GetChannel() == version_info::Channel::STABLE;
|
| -
|
| - if (is_guest_session && is_stable_channel)
|
| - return false;
|
| -#endif // defined(OS_CHROMEOS)
|
| -
|
| -#if defined(OS_ANDROID)
|
| - // TODO(jcivelli): we should not initialize the crash-reporter when it was not
|
| - // enabled. Right now if it is disabled we still generate the minidumps but we
|
| - // do not upload them.
|
| - return is_official_chrome_build;
|
| -#else // !defined(OS_ANDROID)
|
| return is_official_chrome_build &&
|
| GoogleUpdateSettings::GetCollectStatsConsent();
|
| -#endif // defined(OS_ANDROID)
|
| }
|
|
|
| -#if defined(OS_ANDROID)
|
| -int ChromeCrashReporterClient::GetAndroidMinidumpDescriptor() {
|
| - return kAndroidMinidumpDescriptor;
|
| -}
|
| -#endif
|
| -
|
| bool ChromeCrashReporterClient::EnableBreakpadForProcess(
|
| const std::string& process_type) {
|
| return process_type == switches::kRendererProcess ||
|
|
|