summaryrefslogtreecommitdiffstats
path: root/chrome/browser/importer/toolbar_importer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/importer/toolbar_importer.cc')
-rw-r--r--chrome/browser/importer/toolbar_importer.cc35
1 files changed, 15 insertions, 20 deletions
diff --git a/chrome/browser/importer/toolbar_importer.cc b/chrome/browser/importer/toolbar_importer.cc
index 20e10da..a215fd8 100644
--- a/chrome/browser/importer/toolbar_importer.cc
+++ b/chrome/browser/importer/toolbar_importer.cc
@@ -10,6 +10,7 @@
#include "base/string_util.h"
#include "base/rand_util.h"
#include "chrome/browser/first_run.h"
+#include "chrome/browser/importer/importer_bridge.h"
#include "chrome/common/libxml_utils.h"
#include "grit/generated_resources.h"
#include "net/base/cookie_monster.h"
@@ -90,19 +91,14 @@ Toolbar5Importer::~Toolbar5Importer() {
void Toolbar5Importer::StartImport(ProfileInfo profile_info,
uint16 items,
- ProfileWriter* writer,
- MessageLoop* delagate_loop,
- ImporterHost* host) {
- DCHECK(writer);
- DCHECK(host);
-
- importer_host_ = host;
- delagate_loop_ = delagate_loop;
- writer_ = writer;
+ ImporterBridge* bridge) {
+ DCHECK(bridge);
+
+ bridge_ = bridge;
items_to_import_ = items;
state_ = INITIALIZED;
- NotifyStarted();
+ bridge_->NotifyStarted();
ContinueImport();
}
@@ -117,9 +113,9 @@ void Toolbar5Importer::Cancel() {
// If we are conducting network operations, post a message to the importer
// thread for synchronization.
- if (NULL != delagate_loop_) {
- if (delagate_loop_ != MessageLoop::current()) {
- delagate_loop_->PostTask(
+ if (NULL != bridge_->delegate_loop_) {
+ if (bridge_->delegate_loop_ != MessageLoop::current()) {
+ bridge_->delegate_loop_->PostTask(
FROM_HERE,
NewRunnableMethod(this, &Toolbar5Importer::Cancel));
} else {
@@ -201,17 +197,17 @@ void Toolbar5Importer::EndImport() {
data_fetcher_ = NULL;
}
- NotifyEnded();
+ bridge_->NotifyEnded();
}
}
void Toolbar5Importer::BeginImportBookmarks() {
- NotifyItemStarted(FAVORITES);
+ bridge_->NotifyItemStarted(FAVORITES);
GetAuthenticationFromServer();
}
void Toolbar5Importer::EndImportBookmarks() {
- NotifyItemEnded(FAVORITES);
+ bridge_->NotifyItemEnded(FAVORITES);
ContinueImport();
}
@@ -582,11 +578,10 @@ bool Toolbar5Importer::ExtractFoldersFromXmlReader(
void Toolbar5Importer::AddBookmarksToChrome(
const std::vector<ProfileWriter::BookmarkEntry>& bookmarks) {
if (!bookmarks.empty() && !cancelled()) {
+ const std::wstring& first_folder_name =
+ l10n_util::GetString(IDS_BOOKMARK_GROUP_FROM_GOOGLE_TOOLBAR);
int options = ProfileWriter::ADD_IF_UNIQUE |
(import_to_bookmark_bar() ? ProfileWriter::IMPORT_TO_BOOKMARK_BAR : 0);
- main_loop_->PostTask(FROM_HERE, NewRunnableMethod(writer_,
- &ProfileWriter::AddBookmarkEntry, bookmarks,
- l10n_util::GetString(IDS_BOOKMARK_GROUP_FROM_GOOGLE_TOOLBAR),
- options));
+ bridge_->AddBookmarkEntries(bookmarks, first_folder_name, options);
}
}