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

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

Issue 607953004: Importer - Add defensive check for data from IPC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/importer/external_process_importer_host.h" 10 #include "chrome/browser/importer/external_process_importer_host.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 167 }
168 168
169 void ExternalProcessImporterClient::OnHistoryImportGroup( 169 void ExternalProcessImporterClient::OnHistoryImportGroup(
170 const std::vector<ImporterURLRow>& history_rows_group, 170 const std::vector<ImporterURLRow>& history_rows_group,
171 int visit_source) { 171 int visit_source) {
172 if (cancelled_) 172 if (cancelled_)
173 return; 173 return;
174 174
175 history_rows_.insert(history_rows_.end(), history_rows_group.begin(), 175 history_rows_.insert(history_rows_.end(), history_rows_group.begin(),
176 history_rows_group.end()); 176 history_rows_group.end());
177 if (history_rows_.size() == total_history_rows_count_) 177 if (history_rows_.size() >= total_history_rows_count_)
178 bridge_->SetHistoryItems(history_rows_, 178 bridge_->SetHistoryItems(history_rows_,
179 static_cast<importer::VisitSource>(visit_source)); 179 static_cast<importer::VisitSource>(visit_source));
180 } 180 }
181 181
182 void ExternalProcessImporterClient::OnHomePageImportReady( 182 void ExternalProcessImporterClient::OnHomePageImportReady(
183 const GURL& home_page) { 183 const GURL& home_page) {
184 if (cancelled_) 184 if (cancelled_)
185 return; 185 return;
186 186
187 bridge_->AddHomePage(home_page); 187 bridge_->AddHomePage(home_page);
(...skipping 12 matching lines...) Expand all
200 200
201 void ExternalProcessImporterClient::OnBookmarksImportGroup( 201 void ExternalProcessImporterClient::OnBookmarksImportGroup(
202 const std::vector<ImportedBookmarkEntry>& bookmarks_group) { 202 const std::vector<ImportedBookmarkEntry>& bookmarks_group) {
203 if (cancelled_) 203 if (cancelled_)
204 return; 204 return;
205 205
206 // Collect sets of bookmarks from importer process until we have reached 206 // Collect sets of bookmarks from importer process until we have reached
207 // total_bookmarks_count_: 207 // total_bookmarks_count_:
208 bookmarks_.insert(bookmarks_.end(), bookmarks_group.begin(), 208 bookmarks_.insert(bookmarks_.end(), bookmarks_group.begin(),
209 bookmarks_group.end()); 209 bookmarks_group.end());
210 if (bookmarks_.size() == total_bookmarks_count_) 210 if (bookmarks_.size() >= total_bookmarks_count_)
211 bridge_->AddBookmarks(bookmarks_, bookmarks_first_folder_name_); 211 bridge_->AddBookmarks(bookmarks_, bookmarks_first_folder_name_);
212 } 212 }
213 213
214 void ExternalProcessImporterClient::OnFaviconsImportStart( 214 void ExternalProcessImporterClient::OnFaviconsImportStart(
215 size_t total_favicons_count) { 215 size_t total_favicons_count) {
216 if (cancelled_) 216 if (cancelled_)
217 return; 217 return;
218 218
219 total_favicons_count_ = total_favicons_count; 219 total_favicons_count_ = total_favicons_count;
220 favicons_.reserve(total_favicons_count); 220 favicons_.reserve(total_favicons_count);
221 } 221 }
222 222
223 void ExternalProcessImporterClient::OnFaviconsImportGroup( 223 void ExternalProcessImporterClient::OnFaviconsImportGroup(
224 const std::vector<ImportedFaviconUsage>& favicons_group) { 224 const std::vector<ImportedFaviconUsage>& favicons_group) {
225 if (cancelled_) 225 if (cancelled_)
226 return; 226 return;
227 227
228 favicons_.insert(favicons_.end(), favicons_group.begin(), 228 favicons_.insert(favicons_.end(), favicons_group.begin(),
229 favicons_group.end()); 229 favicons_group.end());
230 if (favicons_.size() == total_favicons_count_) 230 if (favicons_.size() >= total_favicons_count_)
231 bridge_->SetFavicons(favicons_); 231 bridge_->SetFavicons(favicons_);
232 } 232 }
233 233
234 void ExternalProcessImporterClient::OnPasswordFormImportReady( 234 void ExternalProcessImporterClient::OnPasswordFormImportReady(
235 const autofill::PasswordForm& form) { 235 const autofill::PasswordForm& form) {
236 if (cancelled_) 236 if (cancelled_)
237 return; 237 return;
238 238
239 bridge_->SetPasswordForm(form); 239 bridge_->SetPasswordForm(form);
240 } 240 }
(...skipping 24 matching lines...) Expand all
265 265
266 void ExternalProcessImporterClient::OnAutofillFormDataImportGroup( 266 void ExternalProcessImporterClient::OnAutofillFormDataImportGroup(
267 const std::vector<ImporterAutofillFormDataEntry>& 267 const std::vector<ImporterAutofillFormDataEntry>&
268 autofill_form_data_entry_group) { 268 autofill_form_data_entry_group) {
269 if (cancelled_) 269 if (cancelled_)
270 return; 270 return;
271 271
272 autofill_form_data_.insert(autofill_form_data_.end(), 272 autofill_form_data_.insert(autofill_form_data_.end(),
273 autofill_form_data_entry_group.begin(), 273 autofill_form_data_entry_group.begin(),
274 autofill_form_data_entry_group.end()); 274 autofill_form_data_entry_group.end());
275 if (autofill_form_data_.size() == total_autofill_form_data_entry_count_) 275 if (autofill_form_data_.size() >= total_autofill_form_data_entry_count_)
276 bridge_->SetAutofillFormData(autofill_form_data_); 276 bridge_->SetAutofillFormData(autofill_form_data_);
277 } 277 }
278 278
279 #if defined(OS_WIN) 279 #if defined(OS_WIN)
280 void ExternalProcessImporterClient::OnIE7PasswordReceived( 280 void ExternalProcessImporterClient::OnIE7PasswordReceived(
281 const importer::ImporterIE7PasswordInfo& importer_password_info) { 281 const importer::ImporterIE7PasswordInfo& importer_password_info) {
282 if (cancelled_) 282 if (cancelled_)
283 return; 283 return;
284 bridge_->AddIE7PasswordInfo(importer_password_info); 284 bridge_->AddIE7PasswordInfo(importer_password_info);
285 } 285 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 localized_strings.SetString( 343 localized_strings.SetString(
344 base::IntToString(IDS_IMPORT_FROM_SAFARI), 344 base::IntToString(IDS_IMPORT_FROM_SAFARI),
345 l10n_util::GetStringUTF8(IDS_IMPORT_FROM_SAFARI)); 345 l10n_util::GetStringUTF8(IDS_IMPORT_FROM_SAFARI));
346 localized_strings.SetString( 346 localized_strings.SetString(
347 base::IntToString(IDS_BOOKMARK_BAR_FOLDER_NAME), 347 base::IntToString(IDS_BOOKMARK_BAR_FOLDER_NAME),
348 l10n_util::GetStringUTF8(IDS_BOOKMARK_BAR_FOLDER_NAME)); 348 l10n_util::GetStringUTF8(IDS_BOOKMARK_BAR_FOLDER_NAME));
349 349
350 utility_process_host_->Send(new ProfileImportProcessMsg_StartImport( 350 utility_process_host_->Send(new ProfileImportProcessMsg_StartImport(
351 source_profile_, items_, localized_strings)); 351 source_profile_, items_, localized_strings));
352 } 352 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698