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

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: cleaned up 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
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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 // Don't save data that was submitted through JavaScript. 332 // Don't save data that was submitted through JavaScript.
333 if (!form.user_submitted) 333 if (!form.user_submitted)
334 return false; 334 return false;
335 335
336 // Ignore forms not present in our cache. These are typically forms with 336 // Ignore forms not present in our cache. These are typically forms with
337 // wonky JavaScript that also makes them not auto-fillable. 337 // wonky JavaScript that also makes them not auto-fillable.
338 FormStructure* cached_submitted_form; 338 FormStructure* cached_submitted_form;
339 if (!FindCachedForm(form, &cached_submitted_form)) 339 if (!FindCachedForm(form, &cached_submitted_form))
340 return false; 340 return false;
341 341
342 const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles();
343 const std::vector<CreditCard*>& credit_cards =
344 personal_data_->GetCreditCards();
345
342 submitted_form->UpdateFromCache(*cached_submitted_form); 346 submitted_form->UpdateFromCache(*cached_submitted_form);
343 if (submitted_form->IsAutofillable()) 347 if (submitted_form->IsAutofillable()) {
344 ImportFormData(*submitted_form); 348 ImportFormData(*submitted_form);
345 349
350 AutofillMetrics::LogNumberOfProfilesAtAutofillableFormSubmission(
351 profiles.size());
352 }
353
346 // Only upload server statistics and UMA metrics if at least some local data 354 // Only upload server statistics and UMA metrics if at least some local data
347 // is available to use as a baseline. 355 // is available to use as a baseline.
348 const std::vector<AutofillProfile*>& profiles = personal_data_->GetProfiles();
349 const std::vector<CreditCard*>& credit_cards =
350 personal_data_->GetCreditCards();
351 if (!profiles.empty() || !credit_cards.empty()) { 356 if (!profiles.empty() || !credit_cards.empty()) {
352 // Copy the profile and credit card data, so that it can be accessed on a 357 // Copy the profile and credit card data, so that it can be accessed on a
353 // separate thread. 358 // separate thread.
354 std::vector<AutofillProfile> copied_profiles; 359 std::vector<AutofillProfile> copied_profiles;
355 copied_profiles.reserve(profiles.size()); 360 copied_profiles.reserve(profiles.size());
356 for (std::vector<AutofillProfile*>::const_iterator it = profiles.begin(); 361 for (std::vector<AutofillProfile*>::const_iterator it = profiles.begin();
357 it != profiles.end(); ++it) { 362 it != profiles.end(); ++it) {
358 copied_profiles.push_back(**it); 363 copied_profiles.push_back(**it);
359 } 364 }
360 365
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 } 505 }
501 506
502 // When filling credit card suggestions, the values and labels are 507 // When filling credit card suggestions, the values and labels are
503 // typically obfuscated, which makes detecting duplicates hard. Since 508 // typically obfuscated, which makes detecting duplicates hard. Since
504 // duplicates only tend to be a problem when filling address forms 509 // duplicates only tend to be a problem when filling address forms
505 // anyway, only don't de-dup credit card suggestions. 510 // anyway, only don't de-dup credit card suggestions.
506 if (!is_filling_credit_card) 511 if (!is_filling_credit_card)
507 RemoveDuplicateSuggestions(&suggestions); 512 RemoveDuplicateSuggestions(&suggestions);
508 513
509 // The first time we show suggestions on this page, log the number of 514 // The first time we show suggestions on this page, log the number of
510 // suggestions shown. 515 // suggestions available.
516 // TODO(mathp): Differentiate between number of suggestions available
517 // (current metric) and number shown to the user.
511 if (!has_logged_address_suggestions_count_ && !section_is_autofilled) { 518 if (!has_logged_address_suggestions_count_ && !section_is_autofilled) {
512 AutofillMetrics::LogAddressSuggestionsCount(suggestions.size()); 519 AutofillMetrics::LogAddressSuggestionsCount(suggestions.size());
513 has_logged_address_suggestions_count_ = true; 520 has_logged_address_suggestions_count_ = true;
514 } 521 }
515 } 522 }
516 } 523 }
517 } 524 }
518 525
519 if (field.should_autocomplete) { 526 if (field.should_autocomplete) {
520 // Add the results from AutoComplete. They come back asynchronously, so we 527 // Add the results from AutoComplete. They come back asynchronously, so we
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
1350 return false; 1357 return false;
1351 1358
1352 // Disregard forms that we wouldn't ever autofill in the first place. 1359 // Disregard forms that we wouldn't ever autofill in the first place.
1353 if (!form.ShouldBeParsed()) 1360 if (!form.ShouldBeParsed())
1354 return false; 1361 return false;
1355 1362
1356 return true; 1363 return true;
1357 } 1364 }
1358 1365
1359 } // namespace autofill 1366 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698