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

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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 void AutofillManager::set_metric_logger(const AutofillMetrics* metric_logger) { 964 void AutofillManager::set_metric_logger(const AutofillMetrics* metric_logger) {
964 metric_logger_.reset(metric_logger); 965 metric_logger_.reset(metric_logger);
965 } 966 }
966 967
967 bool AutofillManager::GetHost(RenderViewHost** host) const { 968 bool AutofillManager::GetHost(RenderViewHost** host) const {
968 if (!IsAutofillEnabled()) 969 if (!IsAutofillEnabled())
969 return false; 970 return false;
970 971
971 // No autofill data to return if the profiles are empty. 972 // No autofill data to return if the profiles are empty.
972 if (personal_data_->GetProfiles().empty() && 973 if (personal_data_->GetProfiles().empty() &&
973 personal_data_->credit_cards().empty()) { 974 personal_data_->GetCreditCards().empty()) {
974 return false; 975 return false;
975 } 976 }
976 977
977 *host = web_contents()->GetRenderViewHost(); 978 *host = web_contents()->GetRenderViewHost();
978 if (!*host) 979 if (!*host)
979 return false; 980 return false;
980 981
981 return true; 982 return true;
982 } 983 }
983 984
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 1272
1272 void AutofillManager::UpdateInitialInteractionTimestamp( 1273 void AutofillManager::UpdateInitialInteractionTimestamp(
1273 const TimeTicks& interaction_timestamp) { 1274 const TimeTicks& interaction_timestamp) {
1274 if (initial_interaction_timestamp_.is_null() || 1275 if (initial_interaction_timestamp_.is_null() ||
1275 interaction_timestamp < initial_interaction_timestamp_) { 1276 interaction_timestamp < initial_interaction_timestamp_) {
1276 initial_interaction_timestamp_ = interaction_timestamp; 1277 initial_interaction_timestamp_ = interaction_timestamp;
1277 } 1278 }
1278 } 1279 }
1279 1280
1280 } // namespace autofill 1281 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698