Chromium Code Reviews| 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(); |
|
gab
2013/03/26 15:55:25
No longer required since the profile isn't created
|
| - |
| return (import_runner.exit_code() == content::RESULT_CODE_NORMAL_EXIT); |
| } |
| @@ -364,59 +358,10 @@ void DoPostImportPlatformSpecificTasks() { |
| } |
| } |
| -bool ImportSettings(Profile* profile, |
|
gab
2013/03/26 15:55:25
Was only called from AutoImport which was made non
|
| - 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( |
|
gab
2013/03/26 15:55:25
Renamed to LaunchInitialImport() and moved out of
|
| - 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; |