OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/importer/in_process_importer_bridge.h" | 5 #include "chrome/browser/importer/in_process_importer_bridge.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/browser/importer/external_process_importer_host.h" | 11 #include "chrome/browser/importer/external_process_importer_host.h" |
12 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" | 12 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" |
13 #include "chrome/common/importer/imported_bookmark_entry.h" | 13 #include "chrome/common/importer/imported_bookmark_entry.h" |
14 #include "chrome/common/importer/imported_favicon_usage.h" | 14 #include "chrome/common/importer/imported_favicon_usage.h" |
15 #include "chrome/common/importer/importer_autofill_form_data_entry.h" | |
Ilya Sherman
2014/08/20 20:47:23
nit: Please alphabetize.
Nikhil
2014/08/21 07:35:36
Hmm, this looks to be correct.
c/c/i/imported_*
c
| |
16 #include "components/autofill/core/browser/webdata/autofill_entry.h" | |
15 #include "components/autofill/core/common/password_form.h" | 17 #include "components/autofill/core/common/password_form.h" |
16 #include "components/search_engines/template_url.h" | 18 #include "components/search_engines/template_url.h" |
17 #include "components/search_engines/template_url_parser.h" | 19 #include "components/search_engines/template_url_parser.h" |
18 #include "components/search_engines/template_url_prepopulate_data.h" | 20 #include "components/search_engines/template_url_prepopulate_data.h" |
19 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
20 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
21 | 23 |
22 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
23 #include "components/os_crypt/ie7_password_win.h" | 25 #include "components/os_crypt/ie7_password_win.h" |
24 #endif | 26 #endif |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 base::Passed(&owned_template_urls), true)); | 249 base::Passed(&owned_template_urls), true)); |
248 } | 250 } |
249 | 251 |
250 void InProcessImporterBridge::SetPasswordForm( | 252 void InProcessImporterBridge::SetPasswordForm( |
251 const autofill::PasswordForm& form) { | 253 const autofill::PasswordForm& form) { |
252 BrowserThread::PostTask( | 254 BrowserThread::PostTask( |
253 BrowserThread::UI, FROM_HERE, | 255 BrowserThread::UI, FROM_HERE, |
254 base::Bind(&ProfileWriter::AddPasswordForm, writer_, form)); | 256 base::Bind(&ProfileWriter::AddPasswordForm, writer_, form)); |
255 } | 257 } |
256 | 258 |
259 void InProcessImporterBridge::SetAutofillFormData( | |
260 const std::vector<ImporterAutofillFormDataEntry>& entries) { | |
261 std::vector<autofill::AutofillEntry> autofill_entries; | |
262 for (size_t i = 0; i < entries.size(); ++i) { | |
263 autofill_entries.push_back(autofill::AutofillEntry( | |
264 autofill::AutofillKey(entries[i].name, entries[i].value), | |
265 entries[i].first_used, | |
266 entries[i].last_used)); | |
267 } | |
268 | |
269 BrowserThread::PostTask(BrowserThread::UI, | |
270 FROM_HERE, | |
271 base::Bind(&ProfileWriter::AddAutofillFormDataEntries, | |
272 writer_, | |
273 autofill_entries)); | |
274 } | |
275 | |
257 void InProcessImporterBridge::NotifyStarted() { | 276 void InProcessImporterBridge::NotifyStarted() { |
258 BrowserThread::PostTask( | 277 BrowserThread::PostTask( |
259 BrowserThread::UI, FROM_HERE, | 278 BrowserThread::UI, FROM_HERE, |
260 base::Bind(&ExternalProcessImporterHost::NotifyImportStarted, host_)); | 279 base::Bind(&ExternalProcessImporterHost::NotifyImportStarted, host_)); |
261 } | 280 } |
262 | 281 |
263 void InProcessImporterBridge::NotifyItemStarted(importer::ImportItem item) { | 282 void InProcessImporterBridge::NotifyItemStarted(importer::ImportItem item) { |
264 BrowserThread::PostTask( | 283 BrowserThread::PostTask( |
265 BrowserThread::UI, FROM_HERE, | 284 BrowserThread::UI, FROM_HERE, |
266 base::Bind(&ExternalProcessImporterHost::NotifyImportItemStarted, | 285 base::Bind(&ExternalProcessImporterHost::NotifyImportItemStarted, |
(...skipping 11 matching lines...) Expand all Loading... | |
278 BrowserThread::PostTask( | 297 BrowserThread::PostTask( |
279 BrowserThread::UI, FROM_HERE, | 298 BrowserThread::UI, FROM_HERE, |
280 base::Bind(&ExternalProcessImporterHost::NotifyImportEnded, host_)); | 299 base::Bind(&ExternalProcessImporterHost::NotifyImportEnded, host_)); |
281 } | 300 } |
282 | 301 |
283 base::string16 InProcessImporterBridge::GetLocalizedString(int message_id) { | 302 base::string16 InProcessImporterBridge::GetLocalizedString(int message_id) { |
284 return l10n_util::GetStringUTF16(message_id); | 303 return l10n_util::GetStringUTF16(message_id); |
285 } | 304 } |
286 | 305 |
287 InProcessImporterBridge::~InProcessImporterBridge() {} | 306 InProcessImporterBridge::~InProcessImporterBridge() {} |
OLD | NEW |