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

Unified Diff: chrome/browser/chrome_browser_main.cc

Issue 12662033: Show user data dialog earlier on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_browser_main.cc
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index d7f2f648b0a65f3465316190b3c67627705da54f..349bf7b87e283be4077ffe8b4083d01680c79066 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -265,6 +265,36 @@ PrefService* InitializeLocalState(
base::SequencedTaskRunner* local_state_task_runner,
const CommandLine& parsed_command_line,
bool is_first_run) {
+#if defined(OS_WIN)
+ // On Windows, we must make sure that the path for USER_DATA_DIR exists,
+ // otherwise we will hit a CHECK failure when in CreateLocalState().
+ // Prompt the user to pick a different user-data-dir and restart chrome with
+ // the new dir.
+ // http://code.google.com/p/chromium/issues/detail?id=11510
+ base::FilePath user_data_path;
+ PathService::Get(chrome::USER_DATA_DIR, &user_data_path);
+ if (!file_util::PathExists(user_data_path)) {
+#if defined(USE_AURA)
+ // TODO(beng):
+ NOTIMPLEMENTED();
+#else
+ base::FilePath new_user_data_dir =
+ chrome::ShowUserDataDirDialog(user_data_dir);
+
+ if (!new_user_data_dir.empty()) {
+ // Because of the way CommandLine parses, it's sufficient to append a new
+ // --user-data-dir switch. The last flag of the same name wins.
+ // TODO(tc): It would be nice to remove the flag we don't want, but that
+ // sounds risky if we parse differently than CommandLineToArgvW.
+ CommandLine new_command_line = parameters.command_line;
+ new_command_line.AppendSwitchPath(switches::kUserDataDir,
+ new_user_data_dir);
+ base::LaunchProcess(new_command_line, base::LaunchOptions(), NULL);
+ }
+#endif
+ }
+#endif // defined(OS_WIN)
+
base::FilePath local_state_path;
PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path);
bool local_state_file_exists = file_util::PathExists(local_state_path);
@@ -386,35 +416,10 @@ Profile* CreateProfile(const content::MainFunctionParams& parameters,
if (profile)
return profile;
-#if defined(OS_WIN)
-#if defined(USE_AURA)
- // TODO(beng):
- NOTIMPLEMENTED();
-#else
- // Ideally, we should be able to run w/o access to disk. For now, we
- // prompt the user to pick a different user-data-dir and restart chrome
- // with the new dir.
- // http://code.google.com/p/chromium/issues/detail?id=11510
- base::FilePath new_user_data_dir =
- chrome::ShowUserDataDirDialog(user_data_dir);
-
- if (!new_user_data_dir.empty()) {
- // Because of the way CommandLine parses, it's sufficient to append a new
- // --user-data-dir switch. The last flag of the same name wins.
- // TODO(tc): It would be nice to remove the flag we don't want, but that
- // sounds risky if we parse differently than CommandLineToArgvW.
- CommandLine new_command_line = parameters.command_line;
- new_command_line.AppendSwitchPath(switches::kUserDataDir,
- new_user_data_dir);
- base::LaunchProcess(new_command_line, base::LaunchOptions(), NULL);
- }
-#endif
-#else
// TODO(port): fix this. See comments near the definition of
// user_data_dir. It is better to CHECK-fail here than it is to
// silently exit because of missing code in the above test.
CHECK(profile) << "Cannot get default profile.";
-#endif
return NULL;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698