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

Side by Side 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: Fix chromium style warning: inline virtual method with non-empty bodies. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/browser_process_impl.cc ('k') | chrome/browser/user_data_dir_extractor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/chrome_browser_main.h" 5 #include "chrome/browser/chrome_browser_main.h"
6 6
7 #if defined(TOOLKIT_GTK) 7 #if defined(TOOLKIT_GTK)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 #include "chrome/browser/translate/translate_manager.h" 96 #include "chrome/browser/translate/translate_manager.h"
97 #include "chrome/browser/ui/app_list/app_list_service.h" 97 #include "chrome/browser/ui/app_list/app_list_service.h"
98 #include "chrome/browser/ui/browser.h" 98 #include "chrome/browser/ui/browser.h"
99 #include "chrome/browser/ui/browser_finder.h" 99 #include "chrome/browser/ui/browser_finder.h"
100 #include "chrome/browser/ui/host_desktop.h" 100 #include "chrome/browser/ui/host_desktop.h"
101 #include "chrome/browser/ui/startup/default_browser_prompt.h" 101 #include "chrome/browser/ui/startup/default_browser_prompt.h"
102 #include "chrome/browser/ui/startup/startup_browser_creator.h" 102 #include "chrome/browser/ui/startup/startup_browser_creator.h"
103 #include "chrome/browser/ui/uma_browsing_activity_observer.h" 103 #include "chrome/browser/ui/uma_browsing_activity_observer.h"
104 #include "chrome/browser/ui/user_data_dir_dialog.h" 104 #include "chrome/browser/ui/user_data_dir_dialog.h"
105 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" 105 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
106 #include "chrome/browser/user_data_dir_extractor.h"
106 #include "chrome/common/child_process_logging.h" 107 #include "chrome/common/child_process_logging.h"
107 #include "chrome/common/chrome_constants.h" 108 #include "chrome/common/chrome_constants.h"
108 #include "chrome/common/chrome_paths.h" 109 #include "chrome/common/chrome_paths.h"
109 #include "chrome/common/chrome_result_codes.h" 110 #include "chrome/common/chrome_result_codes.h"
110 #include "chrome/common/chrome_switches.h" 111 #include "chrome/common/chrome_switches.h"
111 #include "chrome/common/env_vars.h" 112 #include "chrome/common/env_vars.h"
112 #include "chrome/common/logging_chrome.h" 113 #include "chrome/common/logging_chrome.h"
113 #include "chrome/common/metrics/variations/variations_util.h" 114 #include "chrome/common/metrics/variations/variations_util.h"
114 #include "chrome/common/net/net_resource_provider.h" 115 #include "chrome/common/net/net_resource_provider.h"
115 #include "chrome/common/pref_names.h" 116 #include "chrome/common/pref_names.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 user_data_dir); 380 user_data_dir);
380 #else 381 #else
381 base::FilePath profile_path = 382 base::FilePath profile_path =
382 GetStartupProfilePath(user_data_dir, parsed_command_line); 383 GetStartupProfilePath(user_data_dir, parsed_command_line);
383 profile = g_browser_process->profile_manager()->GetProfile( 384 profile = g_browser_process->profile_manager()->GetProfile(
384 profile_path); 385 profile_path);
385 #endif 386 #endif
386 if (profile) 387 if (profile)
387 return profile; 388 return profile;
388 389
389 #if defined(OS_WIN)
390 #if defined(USE_AURA)
391 // TODO(beng):
392 NOTIMPLEMENTED();
393 #else
394 // Ideally, we should be able to run w/o access to disk. For now, we
395 // prompt the user to pick a different user-data-dir and restart chrome
396 // with the new dir.
397 // http://code.google.com/p/chromium/issues/detail?id=11510
398 base::FilePath new_user_data_dir =
399 chrome::ShowUserDataDirDialog(user_data_dir);
400
401 if (!new_user_data_dir.empty()) {
402 // Because of the way CommandLine parses, it's sufficient to append a new
403 // --user-data-dir switch. The last flag of the same name wins.
404 // TODO(tc): It would be nice to remove the flag we don't want, but that
405 // sounds risky if we parse differently than CommandLineToArgvW.
406 CommandLine new_command_line = parameters.command_line;
407 new_command_line.AppendSwitchPath(switches::kUserDataDir,
408 new_user_data_dir);
409 base::LaunchProcess(new_command_line, base::LaunchOptions(), NULL);
410 }
411 #endif
412 #else
413 // TODO(port): fix this. See comments near the definition of 390 // TODO(port): fix this. See comments near the definition of
414 // user_data_dir. It is better to CHECK-fail here than it is to 391 // user_data_dir. It is better to CHECK-fail here than it is to
415 // silently exit because of missing code in the above test. 392 // silently exit because of missing code in the above test.
416 CHECK(profile) << "Cannot get default profile."; 393 CHECK(profile) << "Cannot get default profile.";
417 #endif
418 394
419 return NULL; 395 return NULL;
420 } 396 }
421 397
422 #if defined(OS_MACOSX) 398 #if defined(OS_MACOSX)
423 OSStatus KeychainCallback(SecKeychainEvent keychain_event, 399 OSStatus KeychainCallback(SecKeychainEvent keychain_event,
424 SecKeychainCallbackInfo* info, void* context) { 400 SecKeychainCallbackInfo* info, void* context) {
425 return noErr; 401 return noErr;
426 } 402 }
427 #endif 403 #endif
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 // These members must be initialized before returning from this function. 777 // These members must be initialized before returning from this function.
802 DCHECK(master_prefs_.get()); 778 DCHECK(master_prefs_.get());
803 #if !defined(OS_ANDROID) 779 #if !defined(OS_ANDROID)
804 DCHECK(browser_creator_.get()); 780 DCHECK(browser_creator_.get());
805 #endif 781 #endif
806 return result_code_; 782 return result_code_;
807 } 783 }
808 784
809 int ChromeBrowserMainParts::PreCreateThreadsImpl() { 785 int ChromeBrowserMainParts::PreCreateThreadsImpl() {
810 run_message_loop_ = false; 786 run_message_loop_ = false;
811 #if defined(OS_WIN) 787 user_data_dir_ = chrome::GetUserDataDir(parameters());
812 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_);
813 #else
814 // Getting the user data dir can fail if the directory isn't
815 // creatable, for example; on Windows in code below we bring up a
816 // dialog prompting the user to pick a different directory.
817 // However, ProcessSingleton needs a real user_data_dir on Mac/Linux,
818 // so it's better to fail here than fail mysteriously elsewhere.
819 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_))
820 << "Must be able to get user data directory!";
821 #endif
822 788
823 // Whether this is First Run. |do_first_run_tasks_| should be prefered to this 789 // Whether this is First Run. |do_first_run_tasks_| should be prefered to this
824 // unless the desire is actually to know whether this is really First Run 790 // unless the desire is actually to know whether this is really First Run
825 // (i.e., even if --no-first-run is passed). 791 // (i.e., even if --no-first-run is passed).
826 bool is_first_run = false; 792 bool is_first_run = false;
827 // Android's first run is done in Java instead of native. 793 // Android's first run is done in Java instead of native.
828 #if !defined(OS_ANDROID) 794 #if !defined(OS_ANDROID)
829 795
830 process_singleton_.reset(new ProcessSingleton(user_data_dir_)); 796 process_singleton_.reset(new ProcessSingleton(user_data_dir_));
831 // Ensure ProcessSingleton won't process messages too early. It will be 797 // Ensure ProcessSingleton won't process messages too early. It will be
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
1814 if (base::win::GetVersion() <= base::win::VERSION_XP) 1780 if (base::win::GetVersion() <= base::win::VERSION_XP)
1815 uma_name += "_XP"; 1781 uma_name += "_XP";
1816 1782
1817 uma_name += "_PreRead_"; 1783 uma_name += "_PreRead_";
1818 uma_name += pre_read_percentage; 1784 uma_name += pre_read_percentage;
1819 AddPreReadHistogramTime(uma_name.c_str(), time); 1785 AddPreReadHistogramTime(uma_name.c_str(), time);
1820 } 1786 }
1821 #endif 1787 #endif
1822 #endif 1788 #endif
1823 } 1789 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_process_impl.cc ('k') | chrome/browser/user_data_dir_extractor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698