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

Side by Side Diff: components/autofill/browser/autofill_manager.cc

Issue 14564003: Make PersonalDataManager use GetCreditCards() (rather than using credit_cards_ directly) so Autofill (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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 "components/autofill/browser/autofill_manager.h" 5 #include "components/autofill/browser/autofill_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 333
334 submitted_form->UpdateFromCache(*cached_submitted_form); 334 submitted_form->UpdateFromCache(*cached_submitted_form);
335 // Don't prompt the user to save data entered by Autocheckout. 335 // Don't prompt the user to save data entered by Autocheckout.
336 if (submitted_form->IsAutofillable(true) && 336 if (submitted_form->IsAutofillable(true) &&
337 !submitted_form->filled_by_autocheckout()) 337 !submitted_form->filled_by_autocheckout())
338 ImportFormData(*submitted_form); 338 ImportFormData(*submitted_form);
339 339
340 // Only upload server statistics and UMA metrics if at least some local data 340 // Only upload server statistics and UMA metrics if at least some local data
341 // is available to use as a baseline. 341 // is available to use as a baseline.
342 const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles(); 342 const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles();
343 const std::vector<CreditCard*>& credit_cards = personal_data_->credit_cards(); 343 const std::vector<CreditCard*>& credit_cards =
344 personal_data_->GetCreditCards();
344 if (!profiles.empty() || !credit_cards.empty()) { 345 if (!profiles.empty() || !credit_cards.empty()) {
345 // Copy the profile and credit card data, so that it can be accessed on a 346 // Copy the profile and credit card data, so that it can be accessed on a
346 // separate thread. 347 // separate thread.
347 std::vector<AutofillProfile> copied_profiles; 348 std::vector<AutofillProfile> copied_profiles;
348 copied_profiles.reserve(profiles.size()); 349 copied_profiles.reserve(profiles.size());
349 for (std::vector<AutofillProfile*>::const_iterator it = profiles.begin(); 350 for (std::vector<AutofillProfile*>::const_iterator it = profiles.begin();
350 it != profiles.end(); ++it) { 351 it != profiles.end(); ++it) {
351 copied_profiles.push_back(**it); 352 copied_profiles.push_back(**it);
352 } 353 }
353 354
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 void AutofillManager::set_metric_logger(const AutofillMetrics* metric_logger) { 975 void AutofillManager::set_metric_logger(const AutofillMetrics* metric_logger) {
975 metric_logger_.reset(metric_logger); 976 metric_logger_.reset(metric_logger);
976 } 977 }
977 978
978 bool AutofillManager::GetHost(RenderViewHost** host) const { 979 bool AutofillManager::GetHost(RenderViewHost** host) const {
979 if (!IsAutofillEnabled()) 980 if (!IsAutofillEnabled())
980 return false; 981 return false;
981 982
982 // No autofill data to return if the profiles are empty. 983 // No autofill data to return if the profiles are empty.
983 if (personal_data_->GetProfiles().empty() && 984 if (personal_data_->GetProfiles().empty() &&
984 personal_data_->credit_cards().empty()) { 985 personal_data_->GetCreditCards().empty()) {
985 return false; 986 return false;
986 } 987 }
987 988
988 *host = web_contents()->GetRenderViewHost(); 989 *host = web_contents()->GetRenderViewHost();
989 if (!*host) 990 if (!*host)
990 return false; 991 return false;
991 992
992 return true; 993 return true;
993 } 994 }
994 995
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 1283
1283 void AutofillManager::UpdateInitialInteractionTimestamp( 1284 void AutofillManager::UpdateInitialInteractionTimestamp(
1284 const TimeTicks& interaction_timestamp) { 1285 const TimeTicks& interaction_timestamp) {
1285 if (initial_interaction_timestamp_.is_null() || 1286 if (initial_interaction_timestamp_.is_null() ||
1286 interaction_timestamp < initial_interaction_timestamp_) { 1287 interaction_timestamp < initial_interaction_timestamp_) {
1287 initial_interaction_timestamp_ = interaction_timestamp; 1288 initial_interaction_timestamp_ = interaction_timestamp;
1288 } 1289 }
1289 } 1290 }
1290 1291
1291 } // namespace autofill 1292 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/autofill_options_handler.cc ('k') | components/autofill/browser/personal_data_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698