summaryrefslogtreecommitdiffstats
path: root/chrome/browser/importer/importer.h
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-07 22:55:30 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-07 22:55:30 +0000
commit111ca63cacf4cedb65be41fd4cabfa5ad7bb6b86 (patch)
tree19bfebe83f96b4db5b78bb86f989667a11d04554 /chrome/browser/importer/importer.h
parente8d82c6124232e1678eb242e5c7369bd20ac949d (diff)
downloadchromium_src-111ca63cacf4cedb65be41fd4cabfa5ad7bb6b86.zip
chromium_src-111ca63cacf4cedb65be41fd4cabfa5ad7bb6b86.tar.gz
chromium_src-111ca63cacf4cedb65be41fd4cabfa5ad7bb6b86.tar.bz2
Importer: Fix ImporterList::DetectSourceProfiles to run on the FILE thread, as
it access the file system. Fix up a few call sites. BUG=60825 TEST=none Review URL: http://codereview.chromium.org/5566003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68533 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/importer/importer.h')
-rw-r--r--chrome/browser/importer/importer.h67
1 files changed, 42 insertions, 25 deletions
diff --git a/chrome/browser/importer/importer.h b/chrome/browser/importer/importer.h
index 1cb9db7..d8cecac 100644
--- a/chrome/browser/importer/importer.h
+++ b/chrome/browser/importer/importer.h
@@ -55,9 +55,37 @@ class ImporterHost : public base::RefCountedThreadSafe<ImporterHost>,
public BookmarkModelObserver,
public NotificationObserver {
public:
+ // An interface which an object can implement to be notified of events during
+ // the import process.
+ class Observer {
+ public:
+ // Invoked when data for the specified item is about to be collected.
+ virtual void ImportItemStarted(importer::ImportItem item) = 0;
+
+ // Invoked when data for the specified item has been collected from the
+ // source profile and is now ready for further processing.
+ virtual void ImportItemEnded(importer::ImportItem item) = 0;
+
+ // Invoked when the import begins.
+ virtual void ImportStarted() = 0;
+
+ // Invoked when the source profile has been imported.
+ virtual void ImportEnded() = 0;
+
+ protected:
+ virtual ~Observer() {}
+ };
+
+ // DEPRECATED: Calls the synchronous version of
+ // ImporterList::DetectSourceProfiles.
+ // TODO(jhawkins): Remove this constructor once all callers are fixed.
+ // See http://crbug.com/65633 and http://crbug.com/65638.
ImporterHost();
- // BookmarkModelObserver methods.
+ // |observer| must not be NULL.
+ explicit ImporterHost(ImporterList::Observer* observer);
+
+ // BookmarkModelObserver implementation.
virtual void Loaded(BookmarkModel* model);
virtual void BookmarkNodeMoved(BookmarkModel* model,
const BookmarkNode* old_parent,
@@ -79,7 +107,8 @@ class ImporterHost : public base::RefCountedThreadSafe<ImporterHost>,
const BookmarkNode* node) {}
virtual void BookmarkModelBeingDeleted(BookmarkModel* model);
- // NotificationObserver method. Called when TemplateURLModel has been loaded.
+ // NotificationObserver implementation. Called when TemplateURLModel has been
+ // loaded.
void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details);
@@ -122,24 +151,6 @@ class ImporterHost : public base::RefCountedThreadSafe<ImporterHost>,
parent_window_ = parent_window;
}
- // An interface which an object can implement to be notified of events during
- // the import process.
- class Observer {
- public:
- virtual ~Observer() {}
- // Invoked when data for the specified item is about to be collected.
- virtual void ImportItemStarted(importer::ImportItem item) = 0;
-
- // Invoked when data for the specified item has been collected from the
- // source profile and is now ready for further processing.
- virtual void ImportItemEnded(importer::ImportItem item) = 0;
-
- // Invoked when the import begins.
- virtual void ImportStarted() = 0;
-
- // Invoked when the source profile has been imported.
- virtual void ImportEnded() = 0;
- };
void SetObserver(Observer* observer);
// A series of functions invoked at the start, during and end of the end
@@ -152,25 +163,25 @@ class ImporterHost : public base::RefCountedThreadSafe<ImporterHost>,
virtual void ImportEnded();
int GetAvailableProfileCount() const {
- return importer_list_.GetAvailableProfileCount();
+ return importer_list_->GetAvailableProfileCount();
}
// Returns the name of the profile at the 'index' slot. The profiles are
// ordered such that the profile at index 0 is the likely default browser.
std::wstring GetSourceProfileNameAt(int index) const {
- return importer_list_.GetSourceProfileNameAt(index);
+ return importer_list_->GetSourceProfileNameAt(index);
}
// Returns the ProfileInfo at the specified index. The ProfileInfo should be
// passed to StartImportSettings().
const importer::ProfileInfo& GetSourceProfileInfoAt(int index) const {
- return importer_list_.GetSourceProfileInfoAt(index);
+ return importer_list_->GetSourceProfileInfoAt(index);
}
// Returns the ProfileInfo with the given browser type.
const importer::ProfileInfo& GetSourceProfileInfoForBrowserType(
int browser_type) const {
- return importer_list_.GetSourceProfileInfoForBrowserType(browser_type);
+ return importer_list_->GetSourceProfileInfoForBrowserType(browser_type);
}
protected:
@@ -240,7 +251,7 @@ class ImporterHost : public base::RefCountedThreadSafe<ImporterHost>,
virtual void InvokeTaskIfDone();
// Used to create an importer of the appropriate type.
- ImporterList importer_list_;
+ scoped_refptr<ImporterList> importer_list_;
DISALLOW_COPY_AND_ASSIGN(ImporterHost);
};
@@ -249,8 +260,14 @@ class ImporterHost : public base::RefCountedThreadSafe<ImporterHost>,
// the importer bridge and the external process importer client.
class ExternalProcessImporterHost : public ImporterHost {
public:
+ // DEPRECATED: Calls the deprecated ImporterHost constructor.
+ // TODO(jhawkins): Remove this constructor once all callers are fixed.
+ // See http://crbug.com/65633 and http://crbug.com/65638.
ExternalProcessImporterHost();
+ // |observer| must not be NULL.
+ explicit ExternalProcessImporterHost(ImporterList::Observer* observer);
+
// Called when the BookmarkModel has finished loading. Calls InvokeTaskIfDone
// to start importing.
virtual void Loaded(BookmarkModel* model);