diff options
author | hshi@chromium.org <hshi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-27 06:44:44 +0000 |
---|---|---|
committer | hshi@chromium.org <hshi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-27 06:44:44 +0000 |
commit | 16951ead98ddef7943bf162c7b33512b9e947d22 (patch) | |
tree | d0ae9980bbfe0d727c17029e54e3fe64c62d9d7c /chrome/browser/chrome_browser_main.cc | |
parent | 1761fcc08c01fec1a792befa3da8b98ca04743df (diff) | |
download | chromium_src-16951ead98ddef7943bf162c7b33512b9e947d22.zip chromium_src-16951ead98ddef7943bf162c7b33512b9e947d22.tar.gz chromium_src-16951ead98ddef7943bf162c7b33512b9e947d22.tar.bz2 |
Show user data dialog earlier on Windows.
On Windows if the user data directory does not exist, we must show the user
data dir picker dialog prior to creating the local state to avoid a CHECK
failure. After obtaining the new dir we will restart chrome with the switch
--user-data-dir appended to the command line.
BUG=196301
TEST=CQ
Review URL: https://chromiumcodereview.appspot.com/12662033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190833 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chrome_browser_main.cc')
-rw-r--r-- | chrome/browser/chrome_browser_main.cc | 38 |
1 files changed, 2 insertions, 36 deletions
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 4df00b0..7a5747a 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -103,6 +103,7 @@ #include "chrome/browser/ui/uma_browsing_activity_observer.h" #include "chrome/browser/ui/user_data_dir_dialog.h" #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" +#include "chrome/browser/user_data_dir_extractor.h" #include "chrome/common/child_process_logging.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" @@ -386,35 +387,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; } @@ -806,17 +782,7 @@ int ChromeBrowserMainParts::PreCreateThreads() { int ChromeBrowserMainParts::PreCreateThreadsImpl() { run_message_loop_ = false; -#if defined(OS_WIN) - PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_); -#else - // Getting the user data dir can fail if the directory isn't - // creatable, for example; on Windows in code below we bring up a - // dialog prompting the user to pick a different directory. - // However, ProcessSingleton needs a real user_data_dir on Mac/Linux, - // so it's better to fail here than fail mysteriously elsewhere. - CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_)) - << "Must be able to get user data directory!"; -#endif + user_data_dir_ = chrome::GetUserDataDir(parameters()); // Whether this is First Run. |do_first_run_tasks_| should be prefered to this // unless the desire is actually to know whether this is really First Run |