OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/installer/setup/installer_crash_reporter_client.h" | 5 #include "chrome/installer/setup/installer_crash_reporter_client.h" |
6 | 6 |
7 #include "base/debug/crash_logging.h" | 7 #include "base/debug/crash_logging.h" |
8 #include "base/environment.h" | 8 #include "base/environment.h" |
9 #include "base/file_version_info.h" | 9 #include "base/file_version_info.h" |
| 10 #include "base/files/file_path.h" |
10 #include "base/path_service.h" | 11 #include "base/path_service.h" |
11 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
12 #include "base/win/registry.h" | 13 #include "base/win/registry.h" |
13 #include "chrome/common/chrome_paths.h" | 14 #include "chrome/common/chrome_paths.h" |
14 #include "chrome/common/chrome_version.h" | 15 #include "chrome/common/chrome_version.h" |
15 #include "chrome/common/env_vars.h" | 16 #include "chrome/common/env_vars.h" |
16 #include "chrome/installer/setup/installer_crash_reporting.h" | 17 #include "chrome/installer/setup/installer_crash_reporting.h" |
17 #include "chrome/installer/util/google_update_settings.h" | 18 #include "chrome/installer/util/google_update_settings.h" |
18 | 19 |
19 InstallerCrashReporterClient::InstallerCrashReporterClient( | 20 InstallerCrashReporterClient::InstallerCrashReporterClient( |
20 bool is_per_user_install) | 21 bool is_per_user_install) |
21 : is_per_user_install_(is_per_user_install) { | 22 : is_per_user_install_(is_per_user_install) { |
22 } | 23 } |
23 | 24 |
24 InstallerCrashReporterClient::~InstallerCrashReporterClient() = default; | 25 InstallerCrashReporterClient::~InstallerCrashReporterClient() = default; |
25 | 26 |
26 bool InstallerCrashReporterClient::ShouldCreatePipeName( | 27 bool InstallerCrashReporterClient::ShouldCreatePipeName( |
27 const base::string16& process_type) { | 28 const base::string16& process_type) { |
28 return true; | 29 return true; |
29 } | 30 } |
30 | 31 |
31 bool InstallerCrashReporterClient::GetAlternativeCrashDumpLocation( | 32 bool InstallerCrashReporterClient::GetAlternativeCrashDumpLocation( |
32 base::FilePath* crash_dir) { | 33 base::string16* crash_dir) { |
33 return false; | 34 return false; |
34 } | 35 } |
35 | 36 |
36 void InstallerCrashReporterClient::GetProductNameAndVersion( | 37 void InstallerCrashReporterClient::GetProductNameAndVersion( |
37 const base::FilePath& exe_path, | 38 const base::string16& exe_path, |
38 base::string16* product_name, | 39 base::string16* product_name, |
39 base::string16* version, | 40 base::string16* version, |
40 base::string16* special_build, | 41 base::string16* special_build, |
41 base::string16* channel_name) { | 42 base::string16* channel_name) { |
42 // Report crashes under the same product name as the browser. This string | 43 // Report crashes under the same product name as the browser. This string |
43 // MUST match server-side configuration. | 44 // MUST match server-side configuration. |
44 *product_name = base::ASCIIToUTF16(PRODUCT_SHORTNAME_STRING); | 45 *product_name = base::ASCIIToUTF16(PRODUCT_SHORTNAME_STRING); |
45 | 46 |
46 std::unique_ptr<FileVersionInfo> version_info( | 47 std::unique_ptr<FileVersionInfo> version_info( |
47 FileVersionInfo::CreateFileVersionInfo(exe_path)); | 48 FileVersionInfo::CreateFileVersionInfo(base::FilePath(exe_path))); |
48 if (version_info) { | 49 if (version_info) { |
49 *version = version_info->product_version(); | 50 *version = version_info->product_version(); |
50 *special_build = version_info->special_build(); | 51 *special_build = version_info->special_build(); |
51 } else { | 52 } else { |
52 *version = L"0.0.0.0-devel"; | 53 *version = L"0.0.0.0-devel"; |
53 } | 54 } |
54 | 55 |
55 GoogleUpdateSettings::GetChromeChannelAndModifiers( | 56 GoogleUpdateSettings::GetChromeChannelAndModifiers( |
56 !GetIsPerUserInstall(exe_path), channel_name); | 57 !GetIsPerUserInstall(exe_path), channel_name); |
57 } | 58 } |
(...skipping 11 matching lines...) Expand all Loading... |
69 return false; | 70 return false; |
70 } | 71 } |
71 | 72 |
72 bool InstallerCrashReporterClient::GetDeferredUploadsSupported( | 73 bool InstallerCrashReporterClient::GetDeferredUploadsSupported( |
73 bool is_per_user_install) { | 74 bool is_per_user_install) { |
74 // Copy Chrome's impl? | 75 // Copy Chrome's impl? |
75 return false; | 76 return false; |
76 } | 77 } |
77 | 78 |
78 bool InstallerCrashReporterClient::GetIsPerUserInstall( | 79 bool InstallerCrashReporterClient::GetIsPerUserInstall( |
79 const base::FilePath& exe_path) { | 80 const base::string16& exe_path) { |
80 return is_per_user_install_; | 81 return is_per_user_install_; |
81 } | 82 } |
82 | 83 |
83 bool InstallerCrashReporterClient::GetShouldDumpLargerDumps( | 84 bool InstallerCrashReporterClient::GetShouldDumpLargerDumps( |
84 bool is_per_user_install) { | 85 bool is_per_user_install) { |
85 DCHECK_EQ(is_per_user_install_, is_per_user_install); | 86 DCHECK_EQ(is_per_user_install_, is_per_user_install); |
86 base::string16 channel = | 87 base::string16 channel = |
87 GoogleUpdateSettings::GetChromeChannel(!is_per_user_install); | 88 GoogleUpdateSettings::GetChromeChannel(!is_per_user_install); |
88 // Use large dumps for all but the stable channel. | 89 // Use large dumps for all but the stable channel. |
89 return !channel.empty(); | 90 return !channel.empty(); |
90 } | 91 } |
91 | 92 |
92 int InstallerCrashReporterClient::GetResultCodeRespawnFailed() { | 93 int InstallerCrashReporterClient::GetResultCodeRespawnFailed() { |
93 // The restart dialog is never shown for the installer. | 94 // The restart dialog is never shown for the installer. |
94 NOTREACHED(); | 95 NOTREACHED(); |
95 return 0; | 96 return 0; |
96 } | 97 } |
97 | 98 |
98 bool InstallerCrashReporterClient::GetCrashDumpLocation( | 99 bool InstallerCrashReporterClient::GetCrashDumpLocation( |
99 base::FilePath* crash_dir) { | 100 base::string16* crash_dir) { |
100 return PathService::Get(chrome::DIR_CRASH_DUMPS, crash_dir); | 101 base::FilePath crash_directory_path; |
| 102 bool ret = PathService::Get(chrome::DIR_CRASH_DUMPS, &crash_directory_path); |
| 103 if (ret) |
| 104 *crash_dir = crash_directory_path.value(); |
| 105 return ret; |
101 } | 106 } |
102 | 107 |
103 size_t InstallerCrashReporterClient::RegisterCrashKeys() { | 108 size_t InstallerCrashReporterClient::RegisterCrashKeys() { |
104 return installer::RegisterCrashKeys(); | 109 return installer::RegisterCrashKeys(); |
105 } | 110 } |
106 | 111 |
107 bool InstallerCrashReporterClient::IsRunningUnattended() { | 112 bool InstallerCrashReporterClient::IsRunningUnattended() { |
108 std::unique_ptr<base::Environment> env(base::Environment::Create()); | 113 std::unique_ptr<base::Environment> env(base::Environment::Create()); |
109 return env->HasVar(env_vars::kHeadless); | 114 return env->HasVar(env_vars::kHeadless); |
110 } | 115 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 } | 152 } |
148 } | 153 } |
149 | 154 |
150 return false; | 155 return false; |
151 } | 156 } |
152 | 157 |
153 bool InstallerCrashReporterClient::EnableBreakpadForProcess( | 158 bool InstallerCrashReporterClient::EnableBreakpadForProcess( |
154 const std::string& process_type) { | 159 const std::string& process_type) { |
155 return true; | 160 return true; |
156 } | 161 } |
OLD | NEW |