Chromium Code Reviews| Index: chrome/browser/first_run/first_run_posix.cc |
| diff --git a/chrome/browser/first_run/first_run_posix.cc b/chrome/browser/first_run/first_run_posix.cc |
| index f71cf8170dc9cf5a1cef080a978363c3a9543540..117bc609b18a36ba6e96569b66b264f5d04e23be 100644 |
| --- a/chrome/browser/first_run/first_run_posix.cc |
| +++ b/chrome/browser/first_run/first_run_posix.cc |
| @@ -9,10 +9,6 @@ |
| #include "base/utf_string_conversions.h" |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/first_run/first_run_internal.h" |
| -#include "chrome/browser/importer/importer_host.h" |
| -#include "chrome/browser/importer/importer_list.h" |
| -#include "chrome/browser/importer/importer_progress_dialog.h" |
| -#include "chrome/browser/importer/importer_progress_observer.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| #include "chrome/common/chrome_constants.h" |
| #include "chrome/common/chrome_paths.h" |
| @@ -21,47 +17,6 @@ |
| #include "chrome/installer/util/master_preferences.h" |
| #include "chrome/installer/util/master_preferences_constants.h" |
| -namespace { |
| - |
| -// This class acts as an observer for the ImporterProgressObserver::ImportEnded |
| -// callback. When the import process is started, certain errors may cause |
| -// ImportEnded() to be called synchronously, but the typical case is that |
| -// ImportEnded() is called asynchronously. Thus we have to handle both cases. |
| -class ImportEndedObserver : public importer::ImporterProgressObserver { |
|
gab
2013/03/26 15:55:25
Moved to first_run.cc
|
| - public: |
| - ImportEndedObserver() : ended_(false), |
| - should_quit_message_loop_(false) {} |
| - virtual ~ImportEndedObserver() {} |
| - |
| - // importer::ImporterProgressObserver: |
| - virtual void ImportStarted() OVERRIDE {} |
| - virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {} |
| - virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {} |
| - virtual void ImportEnded() OVERRIDE { |
| - ended_ = true; |
| - if (should_quit_message_loop_) |
| - MessageLoop::current()->Quit(); |
| - } |
| - |
| - void set_should_quit_message_loop() { |
| - should_quit_message_loop_ = true; |
| - } |
| - |
| - bool ended() { |
| - return ended_; |
| - } |
| - |
| - private: |
| - // Set if the import has ended. |
| - bool ended_; |
| - |
| - // Set by the client (via set_should_quit_message_loop) if, when the import |
| - // ends, this class should quit the message loop. |
| - bool should_quit_message_loop_; |
| -}; |
| - |
| -} // namespace |
| - |
| namespace first_run { |
| namespace internal { |
| @@ -87,53 +42,6 @@ bool GetFirstRunSentinelFilePath(base::FilePath* path) { |
| return true; |
| } |
| -bool ImportSettings(Profile* profile, |
|
gab
2013/03/26 15:55:25
Moved to first_run.cc
|
| - scoped_refptr<ImporterHost> importer_host, |
| - scoped_refptr<ImporterList> importer_list, |
| - int items_to_import) { |
| - const importer::SourceProfile& source_profile = |
| - importer_list->GetSourceProfileAt(0); |
| - |
| - // Ensure that importers aren't requested to import items that they do not |
| - // support. If there is no overlap, skip. |
| - items_to_import &= source_profile.services_supported; |
| - if (items_to_import == 0) |
| - return true; |
| - |
| - scoped_ptr<ImportEndedObserver> observer(new ImportEndedObserver); |
| - importer_host->SetObserver(observer.get()); |
| - importer_host->StartImportSettings(source_profile, |
| - profile, |
| - items_to_import, |
| - new ProfileWriter(profile), |
| - true); |
| - // If the import process has not errored out, block on it. |
| - if (!observer->ended()) { |
| - observer->set_should_quit_message_loop(); |
| - MessageLoop::current()->Run(); |
| - } |
| - |
| - // Unfortunately there's no success/fail signal in ImporterHost. |
| - return true; |
| -} |
| - |
| -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 (!import_bookmarks_path.empty()) { |
| - // There are bookmarks to import from a file. |
| - base::FilePath path = base::FilePath::FromWStringHack(UTF8ToWide( |
| - import_bookmarks_path)); |
| - if (!ImportBookmarks(path)) { |
| - LOG(WARNING) << "silent bookmark import failed"; |
| - } |
| - } |
| -} |
| - |
| bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs) { |
| // The EULA is only handled on Windows. |
| return true; |
| @@ -151,4 +59,15 @@ int ImportNow(Profile* profile, const CommandLine& cmdline) { |
| return internal::ImportBookmarkFromFileIfNeeded(profile, cmdline); |
| } |
| +void LaunchInitialImport(MasterPrefs* out_prefs) { |
| + if (!out_prefs->import_bookmarks_path.empty()) { |
| + // There are bookmarks to import from a file. |
| + base::FilePath path = base::FilePath::FromWStringHack(UTF8ToWide( |
| + out_prefs->import_bookmarks_path)); |
| + if (!ImportBookmarks(path)) { |
| + LOG(WARNING) << "silent bookmark import failed"; |
| + } |
| + } |
| +} |
| + |
| } // namespace first_run |