diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-03 00:24:02 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-03 00:24:02 +0000 |
commit | ae46c8c689131bcbb15cec249e543dc91d8a606c (patch) | |
tree | 2bf2793799e45875ad5f9681549c4d0982546d12 /chrome/browser/first_run | |
parent | c37683da5aa951af68da88e7cfa8c779fd2864a2 (diff) | |
download | chromium_src-ae46c8c689131bcbb15cec249e543dc91d8a606c.zip chromium_src-ae46c8c689131bcbb15cec249e543dc91d8a606c.tar.gz chromium_src-ae46c8c689131bcbb15cec249e543dc91d8a606c.tar.bz2 |
Importer: Remove ImporterList from ImporterHost and the pass-through methods.
Make callers of ImporterHost that need to enumerate source profiles create
ImporterList directly.
BUG=65638
TEST=none
Review URL: http://codereview.chromium.org/6334060
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73556 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/first_run')
-rw-r--r-- | chrome/browser/first_run/first_run.cc | 18 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run.h | 3 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run_win.cc | 10 |
3 files changed, 21 insertions, 10 deletions
diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc index 5b7033e..e8514b8 100644 --- a/chrome/browser/first_run/first_run.cc +++ b/chrome/browser/first_run/first_run.cc @@ -281,9 +281,10 @@ bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, 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<ImporterHost> importer_host = new ImporterHost(); + scoped_refptr<ImporterList> importer_list(new ImporterList); + importer_list->DetectSourceProfilesHack(); if (!FirstRun::ImportSettings(NULL, - importer_host->GetSourceProfileInfoAt(0).browser_type, + importer_list->GetSourceProfileInfoAt(0).browser_type, out_prefs->do_import_items, FilePath::FromWStringHack(UTF8ToWide(import_bookmarks_path)), true, NULL)) { @@ -422,7 +423,7 @@ int FirstRun::ImportFromFile(Profile* profile, const CommandLine& cmdline) { NOTREACHED(); return false; } - scoped_refptr<ImporterHost> importer_host(new ImporterHost()); + scoped_refptr<ImporterHost> importer_host(new ImporterHost); FirstRunImportObserver observer; importer_host->set_headless(); @@ -556,8 +557,12 @@ void FirstRun::AutoImport( #else importer_host = new ImporterHost; #endif + + scoped_refptr<ImporterList> importer_list(new ImporterList); + importer_list->DetectSourceProfilesHack(); + // Do import if there is an available profile for us to import. - if (importer_host->GetAvailableProfileCount() > 0) { + if (importer_list->GetAvailableProfileCount() > 0) { // Don't show the warning dialog if import fails. importer_host->set_headless(); int items = 0; @@ -590,7 +595,7 @@ void FirstRun::AutoImport( if (import_items & importer::FAVORITES) items = items | importer::FAVORITES; - ImportSettings(profile, importer_host, items); + ImportSettings(profile, importer_host, importer_list, items); } UserMetrics::RecordAction(UserMetricsAction("FirstRunDef_Accept")); @@ -666,8 +671,9 @@ class ImportEndedObserver : public ImporterHost::Observer { // static bool FirstRun::ImportSettings(Profile* profile, scoped_refptr<ImporterHost> importer_host, + scoped_refptr<ImporterList> importer_list, int items_to_import) { - const ProfileInfo& source_profile = importer_host->GetSourceProfileInfoAt(0); + const ProfileInfo& source_profile = importer_list->GetSourceProfileInfoAt(0); // Ensure that importers aren't requested to import items that they do not // support. diff --git a/chrome/browser/first_run/first_run.h b/chrome/browser/first_run/first_run.h index 415753f..c0a31ba 100644 --- a/chrome/browser/first_run/first_run.h +++ b/chrome/browser/first_run/first_run.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -122,6 +122,7 @@ class FirstRun { // success. static bool ImportSettings(Profile* profile, scoped_refptr<ImporterHost> importer_host, + scoped_refptr<ImporterList> importer_list, int items_to_import); // Sets the kShouldShowFirstRunBubble local state pref so that the browser diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc index 635882e..b25f7ac 100644 --- a/chrome/browser/first_run/first_run_win.cc +++ b/chrome/browser/first_run/first_run_win.cc @@ -524,10 +524,11 @@ bool FirstRun::ImportSettings(Profile* profile, int browser_type, // static bool FirstRun::ImportSettings(Profile* profile, scoped_refptr<ImporterHost> importer_host, + scoped_refptr<ImporterList> importer_list, int items_to_import) { return ImportSettings( profile, - importer_host->GetSourceProfileInfoAt(0).browser_type, + importer_list->GetSourceProfileInfoAt(0).browser_type, items_to_import, FilePath(), false, NULL); } @@ -548,9 +549,12 @@ int FirstRun::ImportFromBrowser(Profile* profile, NOTREACHED(); return false; } - scoped_refptr<ImporterHost> importer_host = new ImporterHost(); + scoped_refptr<ImporterHost> importer_host(new ImporterHost); FirstRunImportObserver observer; + scoped_refptr<ImporterList> importer_list(new ImporterList); + importer_list->DetectSourceProfilesHack(); + // If |skip_first_run_ui|, we run in headless mode. This means that if // there is user action required the import is automatically canceled. if (skip_first_run_ui > 0) @@ -560,7 +564,7 @@ int FirstRun::ImportFromBrowser(Profile* profile, parent_window, static_cast<uint16>(items_to_import), importer_host, - importer_host->GetSourceProfileInfoForBrowserType(browser_type), + importer_list->GetSourceProfileInfoForBrowserType(browser_type), profile, &observer, true); |