1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
// 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.
#include "chrome/browser/importer/in_process_importer_bridge.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/importer/importer_host.h"
#include "content/browser/browser_thread.h"
#include "ui/base/l10n/l10n_util.h"
#include "webkit/glue/password_form.h"
#if defined(OS_WIN)
#include "chrome/browser/password_manager/ie7_password.h"
#endif
InProcessImporterBridge::InProcessImporterBridge(ProfileWriter* writer,
ImporterHost* host)
: writer_(writer),
host_(host) {
}
void InProcessImporterBridge::AddBookmarkEntries(
const std::vector<ProfileWriter::BookmarkEntry>& bookmarks,
const string16& first_folder_name,
int options) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(
writer_, &ProfileWriter::AddBookmarkEntry, bookmarks,
first_folder_name, options));
}
void InProcessImporterBridge::AddHomePage(const GURL &home_page) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(writer_, &ProfileWriter::AddHomepage, home_page));
}
#if defined(OS_WIN)
void InProcessImporterBridge::AddIE7PasswordInfo(
const IE7PasswordInfo& password_info) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(writer_, &ProfileWriter::AddIE7PasswordInfo,
password_info));
}
#endif // OS_WIN
void InProcessImporterBridge::SetFavicons(
const std::vector<history::ImportedFaviconUsage>& favicons) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(writer_, &ProfileWriter::AddFavicons, favicons));
}
void InProcessImporterBridge::SetHistoryItems(
const std::vector<history::URLRow> &rows,
history::VisitSource visit_source) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(writer_, &ProfileWriter::AddHistoryPage,
rows, visit_source));
}
void InProcessImporterBridge::SetKeywords(
const std::vector<TemplateURL*>& template_urls,
int default_keyword_index,
bool unique_on_host_and_path) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(
writer_, &ProfileWriter::AddKeywords, template_urls,
default_keyword_index, unique_on_host_and_path));
}
void InProcessImporterBridge::SetPasswordForm(
const webkit_glue::PasswordForm& form) {
LOG(ERROR) << "InProcessImporterBridge::SetPasswordForm";
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(writer_, &ProfileWriter::AddPasswordForm, form));
}
void InProcessImporterBridge::NotifyStarted() {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(host_, &ImporterHost::NotifyImportStarted));
}
void InProcessImporterBridge::NotifyItemStarted(importer::ImportItem item) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(host_, &ImporterHost::NotifyImportItemStarted, item));
}
void InProcessImporterBridge::NotifyItemEnded(importer::ImportItem item) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(host_, &ImporterHost::NotifyImportItemEnded, item));
}
void InProcessImporterBridge::NotifyEnded() {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(host_, &ImporterHost::NotifyImportEnded));
}
string16 InProcessImporterBridge::GetLocalizedString(int message_id) {
return l10n_util::GetStringUTF16(message_id);
}
InProcessImporterBridge::~InProcessImporterBridge() {}
|