| Index: chrome/browser/chrome_browser_main.cc
|
| diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
|
| index 6db886d01903b2f3558fc061d07414acacbd76e7..0ba249133da9d65467254a6ada38fa7e94dd7873 100644
|
| --- a/chrome/browser/chrome_browser_main.cc
|
| +++ b/chrome/browser/chrome_browser_main.cc
|
| @@ -466,6 +466,7 @@ void RegisterComponentsForUpdate(const CommandLine& command_line) {
|
| cus->Start();
|
| }
|
|
|
| +#if !defined(OS_ANDROID)
|
| bool ProcessSingletonNotificationCallback(
|
| const CommandLine& command_line,
|
| const base::FilePath& current_directory) {
|
| @@ -505,6 +506,7 @@ bool ProcessSingletonNotificationCallback(
|
| command_line, current_directory, startup_profile_dir);
|
| return true;
|
| }
|
| +#endif
|
|
|
| void LaunchDevToolsHandlerIfNeeded(Profile* profile,
|
| const CommandLine& command_line) {
|
| @@ -580,6 +582,10 @@ ChromeBrowserMainParts::ChromeBrowserMainParts(
|
| shutdown_watcher_(new ShutdownWatcherHelper()),
|
| startup_timer_(new performance_monitor::StartupTimer()),
|
| browser_field_trials_(parameters.command_line),
|
| +#if !defined(OS_ANDROID)
|
| + startup_lock_(base::Bind(&ProcessSingletonNotificationCallback)),
|
| + modal_dialog_lock_(startup_lock_.AsNotificationCallback()),
|
| +#endif
|
| record_search_engine_(false),
|
| translate_manager_(NULL),
|
| profile_(NULL),
|
| @@ -793,11 +799,10 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() {
|
| // Android's first run is done in Java instead of native.
|
| #if !defined(OS_ANDROID)
|
|
|
| + // Pass command-line invocations through modal_dialog_lock_ and
|
| + // startup_lock_ before handling them ourselves.
|
| process_singleton_.reset(new ProcessSingleton(
|
| - user_data_dir_, base::Bind(&ProcessSingletonNotificationCallback)));
|
| - // Ensure ProcessSingleton won't process messages too early. It will be
|
| - // unlocked in PostBrowserStart().
|
| - process_singleton_->Lock(NULL);
|
| + user_data_dir_, modal_dialog_lock_.AsNotificationCallback()));
|
|
|
| bool force_first_run =
|
| parsed_command_line().HasSwitch(switches::kForceFirstRun);
|
| @@ -1047,7 +1052,7 @@ void ChromeBrowserMainParts::PostBrowserStart() {
|
| chrome_extra_parts_[i]->PostBrowserStart();
|
| #if !defined(OS_ANDROID)
|
| // Allow ProcessSingleton to process messages.
|
| - process_singleton_->Unlock();
|
| + startup_lock_.Unlock();
|
| #endif
|
| }
|
|
|
| @@ -1222,8 +1227,11 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
| // sucessfully grabbed above.
|
| int try_chrome_int;
|
| base::StringToInt(try_chrome, &try_chrome_int);
|
| - TryChromeDialogView::Result answer =
|
| - TryChromeDialogView::Show(try_chrome_int, process_singleton_.get());
|
| + TryChromeDialogView::Result answer = TryChromeDialogView::Show(
|
| + try_chrome_int,
|
| + base::Bind(
|
| + &ProcessSingletonModalDialogLock::SetActiveModalDialog,
|
| + base::Unretained(&modal_dialog_lock_)));
|
| if (answer == TryChromeDialogView::NOT_NOW)
|
| return chrome::RESULT_CODE_NORMAL_EXIT_CANCEL;
|
| if (answer == TryChromeDialogView::UNINSTALL_CHROME)
|
| @@ -1325,8 +1333,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
|
| first_run::AutoImport(profile_,
|
| master_prefs_->homepage_defined,
|
| master_prefs_->do_import_items,
|
| - master_prefs_->dont_import_items,
|
| - process_singleton_.get());
|
| + master_prefs_->dont_import_items);
|
| // Note: this can pop the first run consent dialog on linux.
|
| first_run::DoPostImportTasks(profile_, master_prefs_->make_chrome_default);
|
|
|
|
|