| 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/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/bookmarks/imported_bookmark_entry.h" |
| 10 #include "chrome/browser/favicon/imported_favicon_usage.h" |
| 9 #include "chrome/browser/importer/importer_host.h" | 11 #include "chrome/browser/importer/importer_host.h" |
| 10 #include "chrome/browser/search_engines/template_url.h" | 12 #include "chrome/browser/search_engines/template_url.h" |
| 11 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 12 #include "content/public/common/password_form.h" | 14 #include "content/public/common/password_form.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
| 14 | 16 |
| 15 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 16 #include "components/webdata/encryptor/ie7_password.h" | 18 #include "components/webdata/encryptor/ie7_password.h" |
| 17 #endif | 19 #endif |
| 18 | 20 |
| 19 #include <iterator> | 21 #include <iterator> |
| 20 | 22 |
| 21 using content::BrowserThread; | 23 using content::BrowserThread; |
| 22 | 24 |
| 23 InProcessImporterBridge::InProcessImporterBridge( | 25 InProcessImporterBridge::InProcessImporterBridge( |
| 24 ProfileWriter* writer, | 26 ProfileWriter* writer, |
| 25 base::WeakPtr<ImporterHost> host) : writer_(writer), | 27 base::WeakPtr<ImporterHost> host) : writer_(writer), |
| 26 host_(host) { | 28 host_(host) { |
| 27 } | 29 } |
| 28 | 30 |
| 29 void InProcessImporterBridge::AddBookmarks( | 31 void InProcessImporterBridge::AddBookmarks( |
| 30 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks, | 32 const std::vector<ImportedBookmarkEntry>& bookmarks, |
| 31 const string16& first_folder_name) { | 33 const string16& first_folder_name) { |
| 32 BrowserThread::PostTask( | 34 BrowserThread::PostTask( |
| 33 BrowserThread::UI, FROM_HERE, | 35 BrowserThread::UI, FROM_HERE, |
| 34 base::Bind(&ProfileWriter::AddBookmarks, writer_, bookmarks, | 36 base::Bind(&ProfileWriter::AddBookmarks, writer_, bookmarks, |
| 35 first_folder_name)); | 37 first_folder_name)); |
| 36 } | 38 } |
| 37 | 39 |
| 38 void InProcessImporterBridge::AddHomePage(const GURL& home_page) { | 40 void InProcessImporterBridge::AddHomePage(const GURL& home_page) { |
| 39 BrowserThread::PostTask( | 41 BrowserThread::PostTask( |
| 40 BrowserThread::UI, FROM_HERE, | 42 BrowserThread::UI, FROM_HERE, |
| 41 base::Bind(&ProfileWriter::AddHomepage, writer_, home_page)); | 43 base::Bind(&ProfileWriter::AddHomepage, writer_, home_page)); |
| 42 } | 44 } |
| 43 | 45 |
| 44 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
| 45 void InProcessImporterBridge::AddIE7PasswordInfo( | 47 void InProcessImporterBridge::AddIE7PasswordInfo( |
| 46 const IE7PasswordInfo& password_info) { | 48 const IE7PasswordInfo& password_info) { |
| 47 BrowserThread::PostTask( | 49 BrowserThread::PostTask( |
| 48 BrowserThread::UI, FROM_HERE, | 50 BrowserThread::UI, FROM_HERE, |
| 49 base::Bind(&ProfileWriter::AddIE7PasswordInfo, writer_, password_info)); | 51 base::Bind(&ProfileWriter::AddIE7PasswordInfo, writer_, password_info)); |
| 50 } | 52 } |
| 51 #endif // OS_WIN | 53 #endif // OS_WIN |
| 52 | 54 |
| 53 void InProcessImporterBridge::SetFavicons( | 55 void InProcessImporterBridge::SetFavicons( |
| 54 const std::vector<history::ImportedFaviconUsage>& favicons) { | 56 const std::vector<ImportedFaviconUsage>& favicons) { |
| 55 BrowserThread::PostTask( | 57 BrowserThread::PostTask( |
| 56 BrowserThread::UI, FROM_HERE, | 58 BrowserThread::UI, FROM_HERE, |
| 57 base::Bind(&ProfileWriter::AddFavicons, writer_, favicons)); | 59 base::Bind(&ProfileWriter::AddFavicons, writer_, favicons)); |
| 58 } | 60 } |
| 59 | 61 |
| 60 void InProcessImporterBridge::SetHistoryItems( | 62 void InProcessImporterBridge::SetHistoryItems( |
| 61 const history::URLRows &rows, | 63 const history::URLRows &rows, |
| 62 history::VisitSource visit_source) { | 64 history::VisitSource visit_source) { |
| 63 BrowserThread::PostTask( | 65 BrowserThread::PostTask( |
| 64 BrowserThread::UI, FROM_HERE, | 66 BrowserThread::UI, FROM_HERE, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 BrowserThread::PostTask( | 107 BrowserThread::PostTask( |
| 106 BrowserThread::UI, FROM_HERE, | 108 BrowserThread::UI, FROM_HERE, |
| 107 base::Bind(&ImporterHost::NotifyImportEnded, host_)); | 109 base::Bind(&ImporterHost::NotifyImportEnded, host_)); |
| 108 } | 110 } |
| 109 | 111 |
| 110 string16 InProcessImporterBridge::GetLocalizedString(int message_id) { | 112 string16 InProcessImporterBridge::GetLocalizedString(int message_id) { |
| 111 return l10n_util::GetStringUTF16(message_id); | 113 return l10n_util::GetStringUTF16(message_id); |
| 112 } | 114 } |
| 113 | 115 |
| 114 InProcessImporterBridge::~InProcessImporterBridge() {} | 116 InProcessImporterBridge::~InProcessImporterBridge() {} |
| OLD | NEW |