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

Side by Side Diff: components/autofill/content/renderer/password_form_conversion_utils.cc

Issue 1099033004: Add a text/password field count metric for empty username forms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated the description. Created 5 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('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/content/renderer/password_form_conversion_utils.h" 5 #include "components/autofill/content/renderer/password_form_conversion_utils.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/metrics/histogram_macros.h"
11 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
12 #include "components/autofill/content/renderer/form_autofill_util.h" 13 #include "components/autofill/content/renderer/form_autofill_util.h"
13 #include "components/autofill/core/common/form_data_predictions.h" 14 #include "components/autofill/core/common/form_data_predictions.h"
14 #include "components/autofill/core/common/password_form.h" 15 #include "components/autofill/core/common/password_form.h"
15 #include "third_party/WebKit/public/platform/WebString.h" 16 #include "third_party/WebKit/public/platform/WebString.h"
16 #include "third_party/WebKit/public/web/WebDocument.h" 17 #include "third_party/WebKit/public/web/WebDocument.h"
17 #include "third_party/WebKit/public/web/WebFormControlElement.h" 18 #include "third_party/WebKit/public/web/WebFormControlElement.h"
18 #include "third_party/WebKit/public/web/WebInputElement.h" 19 #include "third_party/WebKit/public/web/WebInputElement.h"
19 #include "third_party/icu/source/i18n/unicode/regex.h" 20 #include "third_party/icu/source/i18n/unicode/regex.h"
20 21
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 password_form->password_value = password_value; 398 password_form->password_value = password_value;
398 password_form->password_autocomplete_set = password.autoComplete(); 399 password_form->password_autocomplete_set = password.autoComplete();
399 } 400 }
400 if (!new_password.isNull()) { 401 if (!new_password.isNull()) {
401 password_form->new_password_element = new_password.nameForAutofill(); 402 password_form->new_password_element = new_password.nameForAutofill();
402 password_form->new_password_value = new_password.value(); 403 password_form->new_password_value = new_password.value();
403 if (HasAutocompleteAttributeValue(new_password, "new-password")) 404 if (HasAutocompleteAttributeValue(new_password, "new-password"))
404 password_form->new_password_marked_by_site = true; 405 password_form->new_password_marked_by_site = true;
405 } 406 }
406 407
408 if (username_element.isNull()) {
409 // To get a better idea on how password forms without a username field
410 // look like, report the total number of text and password fields.
411 UMA_HISTOGRAM_COUNTS_100(
412 "PasswordManager.EmptyUsernames.TextAndPasswordFieldCount",
413 layout_sequence.size());
414 }
415
407 password_form->scheme = PasswordForm::SCHEME_HTML; 416 password_form->scheme = PasswordForm::SCHEME_HTML;
408 password_form->ssl_valid = false; 417 password_form->ssl_valid = false;
409 password_form->preferred = false; 418 password_form->preferred = false;
410 password_form->blacklisted_by_user = false; 419 password_form->blacklisted_by_user = false;
411 password_form->type = PasswordForm::TYPE_MANUAL; 420 password_form->type = PasswordForm::TYPE_MANUAL;
412 } 421 }
413 422
414 GURL StripAuthAndParams(const GURL& gurl) { 423 GURL StripAuthAndParams(const GURL& gurl) {
415 // We want to keep the path but strip any authentication data, as well as 424 // We want to keep the path but strip any authentication data, as well as
416 // query and ref portions of URL, for the form action and form origin. 425 // query and ref portions of URL, for the form action and form origin.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 WebFormElementToFormData(web_form, 465 WebFormElementToFormData(web_form,
457 blink::WebFormControlElement(), 466 blink::WebFormControlElement(),
458 EXTRACT_NONE, 467 EXTRACT_NONE,
459 &password_form->form_data, 468 &password_form->form_data,
460 NULL /* FormFieldData */); 469 NULL /* FormFieldData */);
461 470
462 return password_form.Pass(); 471 return password_form.Pass();
463 } 472 }
464 473
465 } // namespace autofill 474 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698