summaryrefslogtreecommitdiffstats
path: root/chrome/browser/importer/importer.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/importer/importer.h')
-rw-r--r--chrome/browser/importer/importer.h82
1 files changed, 52 insertions, 30 deletions
diff --git a/chrome/browser/importer/importer.h b/chrome/browser/importer/importer.h
index 1cb9db7..e994036 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,10 +107,11 @@ class ImporterHost : public base::RefCountedThreadSafe<ImporterHost>,
const BookmarkNode* node) {}
virtual void BookmarkModelBeingDeleted(BookmarkModel* model);
- // NotificationObserver method. Called when TemplateURLModel has been loaded.
- void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
+ // NotificationObserver implementation. Called when TemplateURLModel has been
+ // loaded.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
// ShowWarningDialog() asks user to close the application that is owning the
// lock. They can retry or skip the importing process.
@@ -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,30 @@ 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);
+ }
+
+ // Returns true if the source profiles have been loaded.
+ bool source_profiles_loaded() const {
+ return importer_list_->source_profiles_loaded();
}
protected:
@@ -240,7 +256,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 +265,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);
@@ -327,7 +349,7 @@ class ExternalProcessImporterClient
void NotifyItemFinishedOnIOThread(importer::ImportItem import_item);
// Cancel import on process crash.
- virtual void OnProcessCrashed();
+ virtual void OnProcessCrashed(int exit_code);
// Notifies the importerhost that import has finished, and calls Release().
void Cleanup();
@@ -447,7 +469,7 @@ class Importer : public base::RefCountedThreadSafe<Importer> {
ImporterBridge* bridge) = 0;
// Cancels the import process.
- virtual void Cancel() { cancelled_ = true; }
+ virtual void Cancel();
void set_import_to_bookmark_bar(bool import_to_bookmark_bar) {
import_to_bookmark_bar_ = import_to_bookmark_bar;