From ae46c8c689131bcbb15cec249e543dc91d8a606c Mon Sep 17 00:00:00 2001 From: "jhawkins@chromium.org" Date: Thu, 3 Feb 2011 00:24:02 +0000 Subject: 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 --- .../automation/testing_automation_provider.cc | 26 ++++++++++++---------- .../automation/testing_automation_provider.h | 5 ++--- 2 files changed, 16 insertions(+), 15 deletions(-) (limited to 'chrome/browser/automation') diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 2d86dda..5690dfc 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -166,16 +166,16 @@ TestingAutomationProvider::~TestingAutomationProvider() { } void TestingAutomationProvider::SourceProfilesLoaded() { - DCHECK_NE(static_cast(NULL), importer_host_.get()); + DCHECK_NE(static_cast(NULL), importer_list_.get()); // Get the correct ProfileInfo based on the browser the user provided. importer::ProfileInfo profile_info; - int num_browsers = importer_host_->GetAvailableProfileCount(); + int num_browsers = importer_list_->GetAvailableProfileCount(); int i = 0; for ( ; i < num_browsers; i++) { - string16 name = WideToUTF16Hack(importer_host_->GetSourceProfileNameAt(i)); + string16 name = WideToUTF16Hack(importer_list_->GetSourceProfileNameAt(i)); if (name == import_settings_data_.browser_name) { - profile_info = importer_host_->GetSourceProfileInfoAt(i); + profile_info = importer_list_->GetSourceProfileInfoAt(i); break; } } @@ -186,16 +186,17 @@ void TestingAutomationProvider::SourceProfilesLoaded() { return; } - importer_host_->SetObserver( + scoped_refptr importer_host(new ImporterHost); + importer_host->SetObserver( new AutomationProviderImportSettingsObserver( this, import_settings_data_.reply_message)); Profile* profile = import_settings_data_.browser->profile(); - importer_host_->StartImportSettings(profile_info, - profile, - import_settings_data_.import_items, - new ProfileWriter(profile), - import_settings_data_.first_run); + importer_host->StartImportSettings(profile_info, + profile, + import_settings_data_.import_items, + new ProfileWriter(profile), + import_settings_data_.first_run); } void TestingAutomationProvider::Observe(NotificationType type, @@ -3166,9 +3167,10 @@ void TestingAutomationProvider::ImportSettings(Browser* browser, import_settings_data_.reply_message = reply_message; // The remaining functionality of importing settings is in - // SourceProfilesLoaded(), which is called by |importer_host_| once the source + // SourceProfilesLoaded(), which is called by |importer_list_| once the source // profiles are loaded. - importer_host_ = new ImporterHost(this); + importer_list_ = new ImporterList; + importer_list_->DetectSourceProfiles(this); } namespace { diff --git a/chrome/browser/automation/testing_automation_provider.h b/chrome/browser/automation/testing_automation_provider.h index 01d2fdc..e4a690c 100644 --- a/chrome/browser/automation/testing_automation_provider.h +++ b/chrome/browser/automation/testing_automation_provider.h @@ -17,7 +17,6 @@ #include "chrome/common/page_type.h" class DictionaryValue; -class ImporterHost; class TemplateURLModel; // This is an automation provider containing testing calls. @@ -830,8 +829,8 @@ class TestingAutomationProvider : public AutomationProvider, NotificationRegistrar registrar_; - // Used to import settings from browser profiles. - scoped_refptr importer_host_; + // Used to enumerate browser profiles. + scoped_refptr importer_list_; // The stored data for the ImportSettings operation. ImportSettingsData import_settings_data_; -- cgit v1.1