Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: chrome/browser/importer/external_process_importer_client.cc

Issue 14575004: Extract BookmarksFileImporter from Firefox2Importer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test cleanup Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/external_process_importer_client.h" 5 #include "chrome/browser/importer/external_process_importer_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "chrome/browser/bookmarks/imported_bookmark_entry.h"
9 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/importer/external_process_importer_host.h" 11 #include "chrome/browser/importer/external_process_importer_host.h"
11 #include "chrome/browser/importer/firefox_importer_utils.h" 12 #include "chrome/browser/importer/firefox_importer_utils.h"
12 #include "chrome/browser/importer/importer_host.h" 13 #include "chrome/browser/importer/importer_host.h"
13 #include "chrome/browser/importer/in_process_importer_bridge.h" 14 #include "chrome/browser/importer/in_process_importer_bridge.h"
14 #include "chrome/browser/importer/profile_import_process_messages.h" 15 #include "chrome/browser/importer/profile_import_process_messages.h"
15 #include "chrome/browser/search_engines/template_url.h" 16 #include "chrome/browser/search_engines/template_url.h"
16 #include "chrome/browser/search_engines/template_url_service.h" 17 #include "chrome/browser/search_engines/template_url_service.h"
17 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/utility_process_host.h" 19 #include "content/public/browser/utility_process_host.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 size_t total_bookmarks_count) { 180 size_t total_bookmarks_count) {
180 if (cancelled_) 181 if (cancelled_)
181 return; 182 return;
182 183
183 bookmarks_first_folder_name_ = first_folder_name; 184 bookmarks_first_folder_name_ = first_folder_name;
184 total_bookmarks_count_ = total_bookmarks_count; 185 total_bookmarks_count_ = total_bookmarks_count;
185 bookmarks_.reserve(total_bookmarks_count); 186 bookmarks_.reserve(total_bookmarks_count);
186 } 187 }
187 188
188 void ExternalProcessImporterClient::OnBookmarksImportGroup( 189 void ExternalProcessImporterClient::OnBookmarksImportGroup(
189 const std::vector<ProfileWriter::BookmarkEntry>& bookmarks_group) { 190 const std::vector<ImportedBookmarkEntry>& bookmarks_group) {
190 if (cancelled_) 191 if (cancelled_)
191 return; 192 return;
192 193
193 // Collect sets of bookmarks from importer process until we have reached 194 // Collect sets of bookmarks from importer process until we have reached
194 // total_bookmarks_count_: 195 // total_bookmarks_count_:
195 bookmarks_.insert(bookmarks_.end(), bookmarks_group.begin(), 196 bookmarks_.insert(bookmarks_.end(), bookmarks_group.begin(),
196 bookmarks_group.end()); 197 bookmarks_group.end());
197 if (bookmarks_.size() == total_bookmarks_count_) 198 if (bookmarks_.size() == total_bookmarks_count_)
198 bridge_->AddBookmarks(bookmarks_, bookmarks_first_folder_name_); 199 bridge_->AddBookmarks(bookmarks_, bookmarks_first_folder_name_);
199 } 200 }
200 201
201 void ExternalProcessImporterClient::OnFaviconsImportStart( 202 void ExternalProcessImporterClient::OnFaviconsImportStart(
202 size_t total_favicons_count) { 203 size_t total_favicons_count) {
203 if (cancelled_) 204 if (cancelled_)
204 return; 205 return;
205 206
206 total_favicons_count_ = total_favicons_count; 207 total_favicons_count_ = total_favicons_count;
207 favicons_.reserve(total_favicons_count); 208 favicons_.reserve(total_favicons_count);
208 } 209 }
209 210
210 void ExternalProcessImporterClient::OnFaviconsImportGroup( 211 void ExternalProcessImporterClient::OnFaviconsImportGroup(
211 const std::vector<history::ImportedFaviconUsage>& favicons_group) { 212 const std::vector<ImportedFaviconUsage>& favicons_group) {
212 if (cancelled_) 213 if (cancelled_)
213 return; 214 return;
214 215
215 favicons_.insert(favicons_.end(), favicons_group.begin(), 216 favicons_.insert(favicons_.end(), favicons_group.begin(),
216 favicons_group.end()); 217 favicons_group.end());
217 if (favicons_.size() == total_favicons_count_) 218 if (favicons_.size() == total_favicons_count_)
218 bridge_->SetFavicons(favicons_); 219 bridge_->SetFavicons(favicons_);
219 } 220 }
220 221
221 void ExternalProcessImporterClient::OnPasswordFormImportReady( 222 void ExternalProcessImporterClient::OnPasswordFormImportReady(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 localized_strings.SetString( 293 localized_strings.SetString(
293 base::IntToString(IDS_IMPORT_FROM_SAFARI), 294 base::IntToString(IDS_IMPORT_FROM_SAFARI),
294 l10n_util::GetStringUTF8(IDS_IMPORT_FROM_SAFARI)); 295 l10n_util::GetStringUTF8(IDS_IMPORT_FROM_SAFARI));
295 localized_strings.SetString( 296 localized_strings.SetString(
296 base::IntToString(IDS_BOOKMARK_BAR_FOLDER_NAME), 297 base::IntToString(IDS_BOOKMARK_BAR_FOLDER_NAME),
297 l10n_util::GetStringUTF8(IDS_BOOKMARK_BAR_FOLDER_NAME)); 298 l10n_util::GetStringUTF8(IDS_BOOKMARK_BAR_FOLDER_NAME));
298 299
299 utility_process_host_->Send(new ProfileImportProcessMsg_StartImport( 300 utility_process_host_->Send(new ProfileImportProcessMsg_StartImport(
300 source_profile_, items_, localized_strings)); 301 source_profile_, items_, localized_strings));
301 } 302 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698