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

Side by Side Diff: chrome/browser/chrome_browser_main.cc

Issue 12463030: Do not do AutoImport on Windows since the import process is already ran earlier as part of ProcessM… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix posix compile 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 | « no previous file | chrome/browser/first_run/first_run.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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_)) 813 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_))
814 << "Must be able to get user data directory!"; 814 << "Must be able to get user data directory!";
815 #endif 815 #endif
816 816
817 // Whether this is First Run. |do_first_run_tasks_| should be prefered to this 817 // Whether this is First Run. |do_first_run_tasks_| should be prefered to this
818 // unless the desire is actually to know whether this is really First Run 818 // unless the desire is actually to know whether this is really First Run
819 // (i.e., even if --no-first-run is passed). 819 // (i.e., even if --no-first-run is passed).
820 bool is_first_run = false; 820 bool is_first_run = false;
821 // Android's first run is done in Java instead of native. 821 // Android's first run is done in Java instead of native.
822 #if !defined(OS_ANDROID) 822 #if !defined(OS_ANDROID)
823
824 process_singleton_.reset(new ProcessSingleton(user_data_dir_)); 823 process_singleton_.reset(new ProcessSingleton(user_data_dir_));
825 // Ensure ProcessSingleton won't process messages too early. It will be 824 // Ensure ProcessSingleton won't process messages too early. It will be
826 // unlocked in PostBrowserStart(). 825 // unlocked in PostBrowserStart().
827 process_singleton_->Lock(NULL); 826 process_singleton_->Lock(NULL);
828 827
829 bool force_first_run = 828 bool force_first_run =
830 parsed_command_line().HasSwitch(switches::kForceFirstRun); 829 parsed_command_line().HasSwitch(switches::kForceFirstRun);
831 bool force_skip_first_run_tasks = 830 bool force_skip_first_run_tasks =
832 (!force_first_run && 831 (!force_first_run &&
833 parsed_command_line().HasSwitch(switches::kNoFirstRun)); 832 parsed_command_line().HasSwitch(switches::kNoFirstRun));
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 if (!master_prefs_->variations_seed.empty()) { 960 if (!master_prefs_->variations_seed.empty()) {
962 local_state_->SetString(prefs::kVariationsSeed, 961 local_state_->SetString(prefs::kVariationsSeed,
963 master_prefs_->variations_seed); 962 master_prefs_->variations_seed);
964 // Set the variation seed date to the current system time. If the user's 963 // Set the variation seed date to the current system time. If the user's
965 // clock is incorrect, this may cause some field trial expiry checks to 964 // clock is incorrect, this may cause some field trial expiry checks to
966 // not do the right thing until the next seed update from the server, 965 // not do the right thing until the next seed update from the server,
967 // when this value will be updated. 966 // when this value will be updated.
968 local_state_->SetInt64(prefs::kVariationsSeedDate, 967 local_state_->SetInt64(prefs::kVariationsSeedDate,
969 base::Time::Now().ToInternalValue()); 968 base::Time::Now().ToInternalValue());
970 } 969 }
971 } else if (parsed_command_line().HasSwitch(switches::kNoFirstRun)) { 970 }
972 // Create the First Run beacon anyways if --no-first-run was passed on the 971
973 // command line. 972 if (do_first_run_tasks_ ||
973 parsed_command_line().HasSwitch(switches::kNoFirstRun)) {
974 // Create the First Run sentinel whether first run tasks are executed
975 // or not.
974 first_run::CreateSentinel(); 976 first_run::CreateSentinel();
975 } 977 }
976 } 978 }
977 #endif 979 #endif
978 980
979 // TODO(viettrungluu): why don't we run this earlier? 981 // TODO(viettrungluu): why don't we run this earlier?
980 if (!parsed_command_line().HasSwitch(switches::kNoErrorDialogs)) 982 if (!parsed_command_line().HasSwitch(switches::kNoErrorDialogs))
981 WarnAboutMinimumSystemRequirements(); 983 WarnAboutMinimumSystemRequirements();
982 984
983 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX) 985 #if defined(OS_LINUX) || defined(OS_OPENBSD) || defined(OS_MACOSX)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 // ... initial setup, including browser_process_ setup. 1031 // ... initial setup, including browser_process_ setup.
1030 // PreProfileInit() 1032 // PreProfileInit()
1031 // ... additional setup, including CreateProfile() 1033 // ... additional setup, including CreateProfile()
1032 // PostProfileInit() 1034 // PostProfileInit()
1033 // ... additional setup 1035 // ... additional setup
1034 // PreBrowserStart() 1036 // PreBrowserStart()
1035 // ... browser_creator_->Start (OR parameters().ui_task->Run()) 1037 // ... browser_creator_->Start (OR parameters().ui_task->Run())
1036 // PostBrowserStart() 1038 // PostBrowserStart()
1037 1039
1038 void ChromeBrowserMainParts::PreProfileInit() { 1040 void ChromeBrowserMainParts::PreProfileInit() {
1041 if (do_first_run_tasks_) {
1042 // Import tasks which launch a process writing to the profile need to happen
1043 // before this process takes control of the profile (but after the process
1044 // singleton was created).
1045 first_run::LaunchInitialImport(master_prefs_.get());
1046 }
1039 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) 1047 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
1040 chrome_extra_parts_[i]->PreProfileInit(); 1048 chrome_extra_parts_[i]->PreProfileInit();
1041 } 1049 }
1042 1050
1043 void ChromeBrowserMainParts::PostProfileInit() { 1051 void ChromeBrowserMainParts::PostProfileInit() {
1044 LaunchDevToolsHandlerIfNeeded(profile(), parsed_command_line()); 1052 LaunchDevToolsHandlerIfNeeded(profile(), parsed_command_line());
1045 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) 1053 for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
1046 chrome_extra_parts_[i]->PostProfileInit(); 1054 chrome_extra_parts_[i]->PostProfileInit();
1047 } 1055 }
1048 1056
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 if (g_browser_process->gl_string_manager()) 1338 if (g_browser_process->gl_string_manager())
1331 g_browser_process->gl_string_manager()->Initialize(); 1339 g_browser_process->gl_string_manager()->Initialize();
1332 1340
1333 #if !defined(OS_ANDROID) 1341 #if !defined(OS_ANDROID)
1334 // Show the First Run UI if this is the first time Chrome has been run on 1342 // Show the First Run UI if this is the first time Chrome has been run on
1335 // this computer, or we're being compelled to do so by a command line flag. 1343 // this computer, or we're being compelled to do so by a command line flag.
1336 // Note that this be done _after_ the PrefService is initialized and all 1344 // Note that this be done _after_ the PrefService is initialized and all
1337 // preferences are registered, since some of the code that the importer 1345 // preferences are registered, since some of the code that the importer
1338 // touches reads preferences. 1346 // touches reads preferences.
1339 if (do_first_run_tasks_) { 1347 if (do_first_run_tasks_) {
1348 // On Windows the import process was already launched from
1349 // PreProfileInit()-->LaunchInitialImport().
1350 // TODO(gab): Windows should really use the OOP import (http://crbug.com/22142),
1351 // but for now let's at least not run the import twice on Windows. It has to run
1352 // before the profile is created because the import process is designed to
1353 // interact with the profile itself (and trying to launch the import process
1354 // from here causes issues like http://crbug.com/180459 and
1355 // http://crbug.com/171475).
1356 #if defined(OS_WIN)
1357 DCHECK(first_run::DidPerformProfileImport(NULL));
1358 #else
1340 first_run::AutoImport(profile_, 1359 first_run::AutoImport(profile_,
1341 master_prefs_->homepage_defined, 1360 master_prefs_->homepage_defined,
1342 master_prefs_->do_import_items, 1361 master_prefs_->do_import_items,
1343 master_prefs_->dont_import_items, 1362 master_prefs_->dont_import_items,
1344 process_singleton_.get()); 1363 process_singleton_.get());
1364 #endif
1345 // Note: this can pop the first run consent dialog on linux. 1365 // Note: this can pop the first run consent dialog on linux.
1346 first_run::DoPostImportTasks(profile_, master_prefs_->make_chrome_default); 1366 first_run::DoPostImportTasks(profile_, master_prefs_->make_chrome_default);
1347 1367
1348 browser_process_->profile_manager()->OnImportFinished(profile_); 1368 browser_process_->profile_manager()->OnImportFinished(profile_);
1349 1369
1350 if (!master_prefs_->suppress_first_run_default_browser_prompt) { 1370 if (!master_prefs_->suppress_first_run_default_browser_prompt) {
1351 browser_creator_->set_show_main_browser_window( 1371 browser_creator_->set_show_main_browser_window(
1352 !chrome::ShowFirstRunDefaultBrowserPrompt(profile_)); 1372 !chrome::ShowFirstRunDefaultBrowserPrompt(profile_));
1353 } else { 1373 } else {
1354 browser_creator_->set_is_default_browser_dialog_suppressed(true); 1374 browser_creator_->set_is_default_browser_dialog_suppressed(true);
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1811 if (base::win::GetVersion() <= base::win::VERSION_XP) 1831 if (base::win::GetVersion() <= base::win::VERSION_XP)
1812 uma_name += "_XP"; 1832 uma_name += "_XP";
1813 1833
1814 uma_name += "_PreRead_"; 1834 uma_name += "_PreRead_";
1815 uma_name += pre_read_percentage; 1835 uma_name += pre_read_percentage;
1816 AddPreReadHistogramTime(uma_name.c_str(), time); 1836 AddPreReadHistogramTime(uma_name.c_str(), time);
1817 } 1837 }
1818 #endif 1838 #endif
1819 #endif 1839 #endif
1820 } 1840 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/first_run/first_run.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698