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

Unified Diff: chrome/app/chrome_crash_reporter_client_win.cc

Issue 2031833002: Remove FilePath usage from the CrashReporterClient interface on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused constant to fix clang Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/app/chrome_crash_reporter_client_win.h ('k') | chrome/install_static/install_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/chrome_crash_reporter_client_win.cc
diff --git a/chrome/app/chrome_crash_reporter_client_win.cc b/chrome/app/chrome_crash_reporter_client_win.cc
index edc2551c74cb4f00c6f92b08ad03be608d4da2a6..6cd77d62cb9bd13497d0ffc52ee761cc416d05ce 100644
--- a/chrome/app/chrome_crash_reporter_client_win.cc
+++ b/chrome/app/chrome_crash_reporter_client_win.cc
@@ -6,110 +6,89 @@
// Add test coverage for Crashpad.
#include "chrome/app/chrome_crash_reporter_client_win.h"
+#include <assert.h>
#include <windows.h>
#include <memory>
#include <string>
-#include "base/command_line.h"
-#include "base/files/file_path.h"
-#include "base/logging.h"
-#include "base/path_service.h"
-#include "base/strings/string_split.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/version.h"
#include "build/build_config.h"
#include "chrome/common/chrome_result_codes.h"
#include "chrome/common/crash_keys.h"
-#include "chrome/common/env_vars.h"
#include "chrome/install_static/install_util.h"
-#include "content/public/common/content_switches.h"
-
-namespace {
-
-// This is the minimum version of google update that is required for deferred
-// crash uploads to work.
-const char kMinUpdateVersion[] = "1.3.21.115";
-
-} // namespace
ChromeCrashReporterClient::ChromeCrashReporterClient() {}
ChromeCrashReporterClient::~ChromeCrashReporterClient() {}
bool ChromeCrashReporterClient::GetAlternativeCrashDumpLocation(
- base::FilePath* crash_dir) {
+ base::string16* crash_dir) {
// By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate
// location to write breakpad crash dumps can be set.
- std::string alternate_crash_dump_location =
- install_static::GetEnvironmentString("BREAKPAD_DUMP_LOCATION");
- if (!alternate_crash_dump_location.empty()) {
- *crash_dir = base::FilePath::FromUTF8Unsafe(alternate_crash_dump_location);
- return true;
- }
- return false;
+ *crash_dir =
+ install_static::GetEnvironmentString16(L"BREAKPAD_DUMP_LOCATION");
+ return !crash_dir->empty();
}
void ChromeCrashReporterClient::GetProductNameAndVersion(
- const base::FilePath& exe_path,
+ const base::string16& exe_path,
base::string16* product_name,
base::string16* version,
base::string16* special_build,
base::string16* channel_name) {
- DCHECK(product_name);
- DCHECK(version);
- DCHECK(special_build);
- DCHECK(channel_name);
+ assert(product_name);
+ assert(version);
+ assert(special_build);
+ assert(channel_name);
install_static::GetExecutableVersionDetails(
- exe_path.value(), product_name, version, special_build, channel_name);
+ exe_path, product_name, version, special_build, channel_name);
}
bool ChromeCrashReporterClient::ShouldShowRestartDialog(base::string16* title,
base::string16* message,
bool* is_rtl_locale) {
- if (!install_static::HasEnvironmentVariable(env_vars::kShowRestart) ||
- !install_static::HasEnvironmentVariable(env_vars::kRestartInfo) ||
- install_static::HasEnvironmentVariable(env_vars::kMetroConnected)) {
+ if (!install_static::HasEnvironmentVariable16(
+ install_static::kShowRestart) ||
+ !install_static::HasEnvironmentVariable16(
+ install_static::kRestartInfo)) {
return false;
}
- std::string restart_info =
- install_static::GetEnvironmentString(env_vars::kRestartInfo);
+ base::string16 restart_info =
+ install_static::GetEnvironmentString16(install_static::kRestartInfo);
// The CHROME_RESTART var contains the dialog strings separated by '|'.
// See ChromeBrowserMainPartsWin::PrepareRestartOnCrashEnviroment()
// for details.
- std::vector<std::string> dlg_strings = base::SplitString(
- restart_info, "|", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
+ std::vector<base::string16> dlg_strings = install_static::TokenizeString16(
+ restart_info, L'|', true); // true = Trim whitespace.
if (dlg_strings.size() < 3)
return false;
- *title = base::UTF8ToUTF16(dlg_strings[0]);
- *message = base::UTF8ToUTF16(dlg_strings[1]);
- *is_rtl_locale = dlg_strings[2] == env_vars::kRtlLocale;
+ *title = dlg_strings[0];
+ *message = dlg_strings[1];
+ *is_rtl_locale = dlg_strings[2] == install_static::kRtlLocale;
return true;
}
bool ChromeCrashReporterClient::AboutToRestart() {
- if (!install_static::HasEnvironmentVariable(env_vars::kRestartInfo))
+ if (!install_static::HasEnvironmentVariable16(install_static::kRestartInfo))
return false;
- install_static::SetEnvironmentString(env_vars::kShowRestart, "1");
+ install_static::SetEnvironmentString16(install_static::kShowRestart, L"1");
return true;
}
bool ChromeCrashReporterClient::GetDeferredUploadsSupported(
bool is_per_user_install) {
- Version update_version(install_static::GetGoogleUpdateVersion());
- return update_version.IsValid() &&
- update_version >= base::Version(kMinUpdateVersion);
+ return false;
}
bool ChromeCrashReporterClient::GetIsPerUserInstall(
- const base::FilePath& exe_path) {
- return !install_static::IsSystemInstall(exe_path.value().c_str());
+ const base::string16& exe_path) {
+ return !install_static::IsSystemInstall(exe_path.c_str());
}
bool ChromeCrashReporterClient::GetShouldDumpLargerDumps(
@@ -143,7 +122,7 @@ bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy(
bool ChromeCrashReporterClient::GetCrashDumpLocation(
- base::FilePath* crash_dir) {
+ base::string16* crash_dir) {
// By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate
// location to write breakpad crash dumps can be set.
// If this environment variable exists, then for the time being,
@@ -155,11 +134,7 @@ bool ChromeCrashReporterClient::GetCrashDumpLocation(
// TODO(scottmg): Consider supporting --user-data-dir. See
// https://crbug.com/565446.
- base::string16 crash_dump_location;
- if (!install_static::GetDefaultCrashDumpLocation(&crash_dump_location))
- return false;
- *crash_dir = base::FilePath(crash_dump_location);
- return true;
+ return install_static::GetDefaultCrashDumpLocation(crash_dir);
}
size_t ChromeCrashReporterClient::RegisterCrashKeys() {
@@ -167,7 +142,7 @@ size_t ChromeCrashReporterClient::RegisterCrashKeys() {
}
bool ChromeCrashReporterClient::IsRunningUnattended() {
- return install_static::HasEnvironmentVariable(env_vars::kHeadless);
+ return install_static::HasEnvironmentVariable16(install_static::kHeadless);
}
bool ChromeCrashReporterClient::GetCollectStatsConsent() {
@@ -176,8 +151,7 @@ bool ChromeCrashReporterClient::GetCollectStatsConsent() {
bool ChromeCrashReporterClient::EnableBreakpadForProcess(
const std::string& process_type) {
- return process_type == switches::kRendererProcess ||
- process_type == switches::kPpapiPluginProcess ||
- process_type == switches::kZygoteProcess ||
- process_type == switches::kGpuProcess;
+ return process_type == install_static::kRendererProcess ||
+ process_type == install_static::kPpapiPluginProcess ||
+ process_type == install_static::kGpuProcess;
}
« no previous file with comments | « chrome/app/chrome_crash_reporter_client_win.h ('k') | chrome/install_static/install_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698