Index: chrome/browser/first_run/first_run.cc |
diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc |
index 2049e80d47264df83532de2a928179b37cd09f6c..95c02fbebacb9e17f66f3f840c293eaecb587993 100644 |
--- a/chrome/browser/first_run/first_run.cc |
+++ b/chrome/browser/first_run/first_run.cc |
@@ -22,13 +22,11 @@ |
#include "chrome/browser/extensions/extension_service.h" |
#include "chrome/browser/extensions/updater/extension_updater.h" |
#include "chrome/browser/first_run/first_run_dialog.h" |
-#include "chrome/browser/first_run/first_run_import_observer.h" |
#include "chrome/browser/first_run/first_run_internal.h" |
#include "chrome/browser/google/google_util.h" |
#include "chrome/browser/importer/external_process_importer_host.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/process_singleton.h" |
#include "chrome/browser/profiles/profile_manager.h" |
@@ -203,12 +201,12 @@ void SetImportItem(PrefService* user_prefs, |
// Imports bookmarks from an html file. The path to the file is provided in |
// the command line. |
-int ImportFromFile(Profile* profile, const CommandLine& cmdline) { |
+void ImportFromFile(Profile* profile, const CommandLine& cmdline) { |
base::FilePath file_path = |
cmdline.GetSwitchValuePath(switches::kImportFromFile); |
if (file_path.empty()) { |
NOTREACHED(); |
- return false; |
+ return; |
} |
scoped_refptr<ImporterHost> importer_host(new ImporterHost); |
importer_host->set_headless(); |
@@ -217,16 +215,17 @@ int ImportFromFile(Profile* profile, const CommandLine& cmdline) { |
source_profile.importer_type = importer::TYPE_BOOKMARKS_FILE; |
source_profile.source_path = file_path; |
- FirstRunImportObserver importer_observer; |
- importer::ShowImportProgressDialog(importer::FAVORITES, |
- importer_host, |
- &importer_observer, |
- source_profile, |
- profile, |
- true); |
- |
- importer_observer.RunLoop(); |
- return importer_observer.import_result(); |
+ scoped_ptr<first_run::internal::ImportEndedObserver> observer( |
gab
2013/04/17 02:41:01
Note: This code has the exact same logic as Import
|
+ new first_run::internal::ImportEndedObserver); |
+ importer_host->SetObserver(observer.get()); |
+ importer_host->StartImportSettings( |
+ source_profile, profile, importer::FAVORITES, 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(); |
+ } |
} |
GURL UrlFromString(const std::string& in) { |
@@ -395,13 +394,14 @@ bool IsOrganicFirstRun() { |
int ImportBookmarkFromFileIfNeeded(Profile* profile, |
const CommandLine& cmdline) { |
- int return_code = true; |
if (cmdline.HasSwitch(switches::kImportFromFile)) { |
// Silently import preset bookmarks from file. |
// This is an OEM scenario. |
- return_code = ImportFromFile(profile, cmdline); |
+ ImportFromFile(profile, cmdline); |
} |
- return return_code; |
+ // ImportBookmarkFromFileIfNeeded() will go away as part of |
+ // http://crbug.com/219419, so it is fine to hardcode |true| for now. |
+ return true; |
} |
} // namespace internal |