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

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

Issue 880353002: [Autofill] Log the number of autofill profiles available at form submission (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moved log statement Created 5 years, 10 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 | components/autofill/core/browser/autofill_metrics.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/core/browser/autofill_manager.h" 5 #include "components/autofill/core/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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 if (!FindCachedForm(form, &cached_submitted_form)) 348 if (!FindCachedForm(form, &cached_submitted_form))
349 return false; 349 return false;
350 350
351 submitted_form->UpdateFromCache(*cached_submitted_form); 351 submitted_form->UpdateFromCache(*cached_submitted_form);
352 if (submitted_form->IsAutofillable()) 352 if (submitted_form->IsAutofillable())
353 ImportFormData(*submitted_form); 353 ImportFormData(*submitted_form);
354 354
355 // Only upload server statistics and UMA metrics if at least some local data 355 // Only upload server statistics and UMA metrics if at least some local data
356 // is available to use as a baseline. 356 // is available to use as a baseline.
357 const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles(); 357 const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles();
358 if (submitted_form->IsAutofillable()) {
359 AutofillMetrics::LogNumberOfProfilesAtAutofillableFormSubmission(
360 personal_data_->GetProfiles().size());
361 }
358 const std::vector<CreditCard*>& credit_cards = 362 const std::vector<CreditCard*>& credit_cards =
359 personal_data_->GetCreditCards(); 363 personal_data_->GetCreditCards();
360 if (!profiles.empty() || !credit_cards.empty()) { 364 if (!profiles.empty() || !credit_cards.empty()) {
361 // Copy the profile and credit card data, so that it can be accessed on a 365 // Copy the profile and credit card data, so that it can be accessed on a
362 // separate thread. 366 // separate thread.
363 std::vector<AutofillProfile> copied_profiles; 367 std::vector<AutofillProfile> copied_profiles;
364 copied_profiles.reserve(profiles.size()); 368 copied_profiles.reserve(profiles.size());
365 for (std::vector<AutofillProfile*>::const_iterator it = profiles.begin(); 369 for (std::vector<AutofillProfile*>::const_iterator it = profiles.begin();
366 it != profiles.end(); ++it) { 370 it != profiles.end(); ++it) {
367 copied_profiles.push_back(**it); 371 copied_profiles.push_back(**it);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 } 527 }
524 528
525 // When filling credit card suggestions, the values and labels are 529 // When filling credit card suggestions, the values and labels are
526 // typically obfuscated, which makes detecting duplicates hard. Since 530 // typically obfuscated, which makes detecting duplicates hard. Since
527 // duplicates only tend to be a problem when filling address forms 531 // duplicates only tend to be a problem when filling address forms
528 // anyway, only don't de-dup credit card suggestions. 532 // anyway, only don't de-dup credit card suggestions.
529 if (!is_filling_credit_card) 533 if (!is_filling_credit_card)
530 RemoveDuplicateSuggestions(&suggestions); 534 RemoveDuplicateSuggestions(&suggestions);
531 535
532 // The first time we show suggestions on this page, log the number of 536 // The first time we show suggestions on this page, log the number of
533 // suggestions shown. 537 // suggestions available.
538 // TODO(mathp): Differentiate between number of suggestions available
539 // (current metric) and number shown to the user.
534 if (!has_logged_address_suggestions_count_ && !section_is_autofilled) { 540 if (!has_logged_address_suggestions_count_ && !section_is_autofilled) {
535 AutofillMetrics::LogAddressSuggestionsCount(suggestions.size()); 541 AutofillMetrics::LogAddressSuggestionsCount(suggestions.size());
536 has_logged_address_suggestions_count_ = true; 542 has_logged_address_suggestions_count_ = true;
537 } 543 }
538 } 544 }
539 } 545 }
540 } 546 }
541 547
542 if (field.should_autocomplete) { 548 if (field.should_autocomplete) {
543 // Add the results from AutoComplete. They come back asynchronously, so we 549 // Add the results from AutoComplete. They come back asynchronously, so we
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 return false; 1395 return false;
1390 1396
1391 // Disregard forms that we wouldn't ever autofill in the first place. 1397 // Disregard forms that we wouldn't ever autofill in the first place.
1392 if (!form.ShouldBeParsed()) 1398 if (!form.ShouldBeParsed())
1393 return false; 1399 return false;
1394 1400
1395 return true; 1401 return true;
1396 } 1402 }
1397 1403
1398 } // namespace autofill 1404 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | components/autofill/core/browser/autofill_metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698