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

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

Issue 1917053003: unique_ptr_migration: clean up references to scoped_ptr as of r389721 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_crash_reporter_client_win.h" 5 #include "chrome/app/chrome_crash_reporter_client_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <memory>
10
9 #include "base/command_line.h" 11 #include "base/command_line.h"
10 #include "base/environment.h" 12 #include "base/environment.h"
11 #include "base/file_version_info.h" 13 #include "base/file_version_info.h"
12 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
13 #include "base/logging.h" 15 #include "base/logging.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/path_service.h" 16 #include "base/path_service.h"
16 #include "base/strings/string_split.h" 17 #include "base/strings/string_split.h"
17 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
18 #include "base/win/registry.h" 19 #include "base/win/registry.h"
19 #include "build/build_config.h" 20 #include "build/build_config.h"
20 #include "chrome/common/chrome_paths.h" 21 #include "chrome/common/chrome_paths.h"
21 #include "chrome/common/chrome_paths_internal.h" 22 #include "chrome/common/chrome_paths_internal.h"
22 #include "chrome/common/chrome_result_codes.h" 23 #include "chrome/common/chrome_result_codes.h"
23 #include "chrome/common/crash_keys.h" 24 #include "chrome/common/crash_keys.h"
24 #include "chrome/common/env_vars.h" 25 #include "chrome/common/env_vars.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 const base::FilePath& exe_path, 63 const base::FilePath& exe_path,
63 base::string16* product_name, 64 base::string16* product_name,
64 base::string16* version, 65 base::string16* version,
65 base::string16* special_build, 66 base::string16* special_build,
66 base::string16* channel_name) { 67 base::string16* channel_name) {
67 DCHECK(product_name); 68 DCHECK(product_name);
68 DCHECK(version); 69 DCHECK(version);
69 DCHECK(special_build); 70 DCHECK(special_build);
70 DCHECK(channel_name); 71 DCHECK(channel_name);
71 72
72 scoped_ptr<FileVersionInfo> version_info( 73 std::unique_ptr<FileVersionInfo> version_info(
73 FileVersionInfo::CreateFileVersionInfo(exe_path)); 74 FileVersionInfo::CreateFileVersionInfo(exe_path));
74 75
75 if (version_info.get()) { 76 if (version_info.get()) {
76 // Get the information from the file. 77 // Get the information from the file.
77 *version = version_info->product_version(); 78 *version = version_info->product_version();
78 if (!version_info->is_official_build()) 79 if (!version_info->is_official_build())
79 version->append(base::ASCIIToUTF16("-devel")); 80 version->append(base::ASCIIToUTF16("-devel"));
80 81
81 *product_name = version_info->product_short_name(); 82 *product_name = version_info->product_short_name();
82 *special_build = version_info->special_build(); 83 *special_build = version_info->special_build();
83 } else { 84 } else {
84 // No version info found. Make up the values. 85 // No version info found. Make up the values.
85 *product_name = base::ASCIIToUTF16("Chrome"); 86 *product_name = base::ASCIIToUTF16("Chrome");
86 *version = base::ASCIIToUTF16("0.0.0.0-devel"); 87 *version = base::ASCIIToUTF16("0.0.0.0-devel");
87 } 88 }
88 89
89 GoogleUpdateSettings::GetChromeChannelAndModifiers( 90 GoogleUpdateSettings::GetChromeChannelAndModifiers(
90 !GetIsPerUserInstall(exe_path), channel_name); 91 !GetIsPerUserInstall(exe_path), channel_name);
91 } 92 }
92 93
93 bool ChromeCrashReporterClient::ShouldShowRestartDialog(base::string16* title, 94 bool ChromeCrashReporterClient::ShouldShowRestartDialog(base::string16* title,
94 base::string16* message, 95 base::string16* message,
95 bool* is_rtl_locale) { 96 bool* is_rtl_locale) {
96 scoped_ptr<base::Environment> env(base::Environment::Create()); 97 std::unique_ptr<base::Environment> env(base::Environment::Create());
97 if (!env->HasVar(env_vars::kShowRestart) || 98 if (!env->HasVar(env_vars::kShowRestart) ||
98 !env->HasVar(env_vars::kRestartInfo) || 99 !env->HasVar(env_vars::kRestartInfo) ||
99 env->HasVar(env_vars::kMetroConnected)) { 100 env->HasVar(env_vars::kMetroConnected)) {
100 return false; 101 return false;
101 } 102 }
102 103
103 std::string restart_info; 104 std::string restart_info;
104 env->GetVar(env_vars::kRestartInfo, &restart_info); 105 env->GetVar(env_vars::kRestartInfo, &restart_info);
105 106
106 // The CHROME_RESTART var contains the dialog strings separated by '|'. 107 // The CHROME_RESTART var contains the dialog strings separated by '|'.
107 // See ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment() 108 // See ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment()
108 // for details. 109 // for details.
109 std::vector<std::string> dlg_strings = base::SplitString( 110 std::vector<std::string> dlg_strings = base::SplitString(
110 restart_info, "|", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 111 restart_info, "|", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
111 112
112 if (dlg_strings.size() < 3) 113 if (dlg_strings.size() < 3)
113 return false; 114 return false;
114 115
115 *title = base::UTF8ToUTF16(dlg_strings[0]); 116 *title = base::UTF8ToUTF16(dlg_strings[0]);
116 *message = base::UTF8ToUTF16(dlg_strings[1]); 117 *message = base::UTF8ToUTF16(dlg_strings[1]);
117 *is_rtl_locale = dlg_strings[2] == env_vars::kRtlLocale; 118 *is_rtl_locale = dlg_strings[2] == env_vars::kRtlLocale;
118 return true; 119 return true;
119 } 120 }
120 121
121 bool ChromeCrashReporterClient::AboutToRestart() { 122 bool ChromeCrashReporterClient::AboutToRestart() {
122 scoped_ptr<base::Environment> env(base::Environment::Create()); 123 std::unique_ptr<base::Environment> env(base::Environment::Create());
123 if (!env->HasVar(env_vars::kRestartInfo)) 124 if (!env->HasVar(env_vars::kRestartInfo))
124 return false; 125 return false;
125 126
126 env->SetVar(env_vars::kShowRestart, "1"); 127 env->SetVar(env_vars::kShowRestart, "1");
127 return true; 128 return true;
128 } 129 }
129 130
130 bool ChromeCrashReporterClient::GetDeferredUploadsSupported( 131 bool ChromeCrashReporterClient::GetDeferredUploadsSupported(
131 bool is_per_user_install) { 132 bool is_per_user_install) {
132 Version update_version = GoogleUpdateSettings::GetGoogleUpdateVersion( 133 Version update_version = GoogleUpdateSettings::GetGoogleUpdateVersion(
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 } 220 }
220 221
221 return false; 222 return false;
222 } 223 }
223 224
224 225
225 bool ChromeCrashReporterClient::GetCrashDumpLocation( 226 bool ChromeCrashReporterClient::GetCrashDumpLocation(
226 base::FilePath* crash_dir) { 227 base::FilePath* crash_dir) {
227 // By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate 228 // By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate
228 // location to write breakpad crash dumps can be set. 229 // location to write breakpad crash dumps can be set.
229 scoped_ptr<base::Environment> env(base::Environment::Create()); 230 std::unique_ptr<base::Environment> env(base::Environment::Create());
230 std::string alternate_crash_dump_location; 231 std::string alternate_crash_dump_location;
231 if (env->GetVar("BREAKPAD_DUMP_LOCATION", &alternate_crash_dump_location)) { 232 if (env->GetVar("BREAKPAD_DUMP_LOCATION", &alternate_crash_dump_location)) {
232 base::FilePath crash_dumps_dir_path = 233 base::FilePath crash_dumps_dir_path =
233 base::FilePath::FromUTF8Unsafe(alternate_crash_dump_location); 234 base::FilePath::FromUTF8Unsafe(alternate_crash_dump_location);
234 235
235 // If this environment variable exists, then for the time being, 236 // If this environment variable exists, then for the time being,
236 // short-circuit how it's handled on Windows. Honoring this 237 // short-circuit how it's handled on Windows. Honoring this
237 // variable is required in order to symbolize stack traces in 238 // variable is required in order to symbolize stack traces in
238 // Telemetry based tests: http://crbug.com/561763. 239 // Telemetry based tests: http://crbug.com/561763.
239 *crash_dir = crash_dumps_dir_path; 240 *crash_dir = crash_dumps_dir_path;
240 return true; 241 return true;
241 } 242 }
242 243
243 // TODO(scottmg): Consider supporting --user-data-dir. See 244 // TODO(scottmg): Consider supporting --user-data-dir. See
244 // https://crbug.com/565446. 245 // https://crbug.com/565446.
245 return chrome::GetDefaultCrashDumpLocation(crash_dir); 246 return chrome::GetDefaultCrashDumpLocation(crash_dir);
246 } 247 }
247 248
248 size_t ChromeCrashReporterClient::RegisterCrashKeys() { 249 size_t ChromeCrashReporterClient::RegisterCrashKeys() {
249 return crash_keys::RegisterChromeCrashKeys(); 250 return crash_keys::RegisterChromeCrashKeys();
250 } 251 }
251 252
252 bool ChromeCrashReporterClient::IsRunningUnattended() { 253 bool ChromeCrashReporterClient::IsRunningUnattended() {
253 scoped_ptr<base::Environment> env(base::Environment::Create()); 254 std::unique_ptr<base::Environment> env(base::Environment::Create());
254 return env->HasVar(env_vars::kHeadless); 255 return env->HasVar(env_vars::kHeadless);
255 } 256 }
256 257
257 bool ChromeCrashReporterClient::GetCollectStatsConsent() { 258 bool ChromeCrashReporterClient::GetCollectStatsConsent() {
258 #if defined(GOOGLE_CHROME_BUILD) 259 #if defined(GOOGLE_CHROME_BUILD)
259 bool is_official_chrome_build = true; 260 bool is_official_chrome_build = true;
260 #else 261 #else
261 bool is_official_chrome_build = false; 262 bool is_official_chrome_build = false;
262 #endif 263 #endif
263 264
264 return is_official_chrome_build && 265 return is_official_chrome_build &&
265 GoogleUpdateSettings::GetCollectStatsConsent(); 266 GoogleUpdateSettings::GetCollectStatsConsent();
266 } 267 }
267 268
268 bool ChromeCrashReporterClient::EnableBreakpadForProcess( 269 bool ChromeCrashReporterClient::EnableBreakpadForProcess(
269 const std::string& process_type) { 270 const std::string& process_type) {
270 return process_type == switches::kRendererProcess || 271 return process_type == switches::kRendererProcess ||
271 process_type == switches::kPpapiPluginProcess || 272 process_type == switches::kPpapiPluginProcess ||
272 process_type == switches::kZygoteProcess || 273 process_type == switches::kZygoteProcess ||
273 process_type == switches::kGpuProcess; 274 process_type == switches::kGpuProcess;
274 } 275 }
OLDNEW
« no previous file with comments | « blimp/engine/renderer/engine_image_serialization_processor.h ('k') | chrome/browser/devtools/devtools_sanity_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698