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

Unified Diff: chrome/app/chrome_main_delegate.cc

Issue 2867063002: Stability instrumentation Crashpad integration (Closed)
Patch Set: merge Created 3 years, 7 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_exe_main_win.cc ('k') | chrome/install_static/install_details.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/chrome_main_delegate.cc
diff --git a/chrome/app/chrome_main_delegate.cc b/chrome/app/chrome_main_delegate.cc
index 7f4aebbc6dbc2e2ee9bcc15ad8c5f658cf198d85..d105144bb2c1d3e8c697a85189cdee73519c86ba 100644
--- a/chrome/app/chrome_main_delegate.cc
+++ b/chrome/app/chrome_main_delegate.cc
@@ -72,6 +72,7 @@
#include "chrome/browser/downgrade/user_data_downgrade.h"
#include "chrome/child/v8_breakpad_support_win.h"
#include "chrome/common/child_process_logging.h"
+#include "chrome/install_static/install_util.h"
#include "sandbox/win/src/sandbox.h"
#include "ui/base/resource/resource_bundle_win.h"
#endif
@@ -386,23 +387,18 @@ struct MainFunction {
// Initializes the user data dir. Must be called before InitializeLocalState().
void InitializeUserDataDir(base::CommandLine* command_line) {
#if defined(OS_WIN)
- wchar_t user_data_dir_buf[MAX_PATH], invalid_user_data_dir_buf[MAX_PATH];
-
- using GetUserDataDirectoryThunkFunction =
- void (*)(wchar_t*, size_t, wchar_t*, size_t);
HMODULE elf_module = GetModuleHandle(chrome::kChromeElfDllName);
if (elf_module) {
// If we're in a test, chrome_elf won't be loaded.
- GetUserDataDirectoryThunkFunction get_user_data_directory_thunk =
- reinterpret_cast<GetUserDataDirectoryThunkFunction>(
- GetProcAddress(elf_module, "GetUserDataDirectoryThunk"));
- get_user_data_directory_thunk(
- user_data_dir_buf, arraysize(user_data_dir_buf),
- invalid_user_data_dir_buf, arraysize(invalid_user_data_dir_buf));
- base::FilePath user_data_dir(user_data_dir_buf);
- if (invalid_user_data_dir_buf[0] != 0) {
- chrome::SetInvalidSpecifiedUserDataDir(
- base::FilePath(invalid_user_data_dir_buf));
+
+ base::FilePath user_data_dir(install_static::GetUserDataDirectory());
+ // An empty user data directory means a failure (no fallback/default could
+ // be retrieved either).
+ CHECK(!user_data_dir.empty());
+ base::FilePath invalid_user_data_dir(
+ install_static::GetInvalidUserDataDirectory());
+ if (!invalid_user_data_dir.empty()) {
+ chrome::SetInvalidSpecifiedUserDataDir(invalid_user_data_dir);
command_line->AppendSwitchPath(switches::kUserDataDir, user_data_dir);
}
CHECK(PathService::OverrideAndCreateIfNeeded(chrome::DIR_USER_DATA,
« no previous file with comments | « chrome/app/chrome_exe_main_win.cc ('k') | chrome/install_static/install_details.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698