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

Unified Diff: chrome/browser/first_run/first_run_win.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/first_run/first_run_posix.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/first_run/first_run_win.cc
diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc
index c3242a2efe102ca8348f84bfb0682a6645fd646f..de456a98360a20f6b033b52364aff31b085db1f5 100644
--- a/chrome/browser/first_run/first_run_win.cc
+++ b/chrome/browser/first_run/first_run_win.cc
@@ -274,8 +274,7 @@ int ImportFromBrowser(Profile* profile,
}
#endif // !defined(USE_AURA)
-bool ImportSettingsWin(Profile* profile,
- int importer_type,
+bool ImportSettingsWin(int importer_type,
int items_to_import,
const base::FilePath& import_bookmarks_path,
bool skip_first_run_ui) {
@@ -333,11 +332,6 @@ bool ImportSettingsWin(Profile* profile,
// importer process ends.
ImportProcessRunner import_runner(import_process);
- // Import process finished. Reload the prefs, because importer may set
- // the pref value.
- if (profile)
- profile->GetPrefs()->ReloadPersistentPrefs();
-
return (import_runner.exit_code() == content::RESULT_CODE_NORMAL_EXIT);
}
@@ -364,59 +358,10 @@ void DoPostImportPlatformSpecificTasks() {
}
}
-bool ImportSettings(Profile* profile,
- scoped_refptr<ImporterHost> importer_host,
- scoped_refptr<ImporterList> importer_list,
- int items_to_import) {
- return ImportSettingsWin(
- profile,
- importer_list->GetSourceProfileAt(0).importer_type,
- items_to_import,
- base::FilePath(),
- false);
-}
-
bool GetFirstRunSentinelFilePath(base::FilePath* path) {
return GetSentinelFilePath(chrome::kFirstRunSentinel, path);
}
-void SetImportPreferencesAndLaunchImport(
- MasterPrefs* out_prefs,
- installer::MasterPreferences* install_prefs) {
- std::string import_bookmarks_path;
- install_prefs->GetString(
- installer::master_preferences::kDistroImportBookmarksFromFilePref,
- &import_bookmarks_path);
-
- if (!IsOrganicFirstRun()) {
- // If search engines aren't explicitly imported, don't import.
- if (!(out_prefs->do_import_items & importer::SEARCH_ENGINES)) {
- out_prefs->dont_import_items |= importer::SEARCH_ENGINES;
- }
- // If home page isn't explicitly imported, don't import.
- if (!(out_prefs->do_import_items & importer::HOME_PAGE)) {
- out_prefs->dont_import_items |= importer::HOME_PAGE;
- }
- // If history isn't explicitly forbidden, do import.
- if (!(out_prefs->dont_import_items & importer::HISTORY)) {
- out_prefs->do_import_items |= importer::HISTORY;
- }
- }
-
- if (out_prefs->do_import_items || !import_bookmarks_path.empty()) {
- // There is something to import from the default browser. This launches
- // the importer process and blocks until done or until it fails.
- scoped_refptr<ImporterList> importer_list(new ImporterList(NULL));
- importer_list->DetectSourceProfilesHack();
- if (!ImportSettingsWin(
- NULL, importer_list->GetSourceProfileAt(0).importer_type,
- out_prefs->do_import_items, base::FilePath::FromWStringHack(UTF8ToWide(
- import_bookmarks_path)), true)) {
- LOG(WARNING) << "silent import failed";
- }
- }
-}
-
bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs) {
if (IsEULANotAccepted(install_prefs)) {
// Show the post-installation EULA. This is done by setup.exe and the
@@ -463,6 +408,41 @@ int ImportNow(Profile* profile, const CommandLine& cmdline) {
return return_code;
}
+// On Windows this is the complete import (i.e., AutoImport() is skipped).
+// TODO(gab): Merge this into AutoImport() as part of http://crbug.com/22142
+void LaunchInitialImport(MasterPrefs* out_prefs) {
+ if (!internal::IsOrganicFirstRun()) {
+ // If search engines aren't explicitly imported, don't import.
+ if (!(out_prefs->do_import_items & importer::SEARCH_ENGINES)) {
+ out_prefs->dont_import_items |= importer::SEARCH_ENGINES;
+ }
+ // If home page isn't explicitly imported, don't import.
+ if (!(out_prefs->do_import_items & importer::HOME_PAGE)) {
+ out_prefs->dont_import_items |= importer::HOME_PAGE;
+ }
+ // If history isn't explicitly forbidden, do import.
+ if (!(out_prefs->dont_import_items & importer::HISTORY)) {
+ out_prefs->do_import_items |= importer::HISTORY;
+ }
+ }
+
+ if (out_prefs->do_import_items || !out_prefs->import_bookmarks_path.empty()) {
+ // There is something to import from the default browser. This launches
+ // the importer process and blocks until done or until it fails.
+ scoped_refptr<ImporterList> importer_list(new ImporterList(NULL));
+ importer_list->DetectSourceProfilesHack();
+ internal::g_profile_import_exited_successfully = ImportSettingsWin(
+ importer_list->GetSourceProfileAt(0).importer_type,
+ out_prefs->do_import_items,
+ base::FilePath::FromWStringHack(UTF8ToWide(
+ out_prefs->import_bookmarks_path)),
+ true);
+ if (!internal::g_profile_import_exited_successfully)
+ LOG(WARNING) << "silent import failed";
+ }
+ internal::g_did_perform_profile_import = true;
+}
+
base::FilePath MasterPrefsPath() {
// The standard location of the master prefs is next to the chrome binary.
base::FilePath master_prefs;
« no previous file with comments | « chrome/browser/first_run/first_run_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698