OLD | NEW |
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_autofill_agent.h" | 5 #include "components/autofill/content/renderer/password_autofill_agent.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 SendPasswordForms(frame, false /* only_visible */); | 460 SendPasswordForms(frame, false /* only_visible */); |
461 } | 461 } |
462 | 462 |
463 void PasswordAutofillAgent::FirstUserGestureObserved() { | 463 void PasswordAutofillAgent::FirstUserGestureObserved() { |
464 gatekeeper_.OnUserGesture(); | 464 gatekeeper_.OnUserGesture(); |
465 } | 465 } |
466 | 466 |
467 void PasswordAutofillAgent::SendPasswordForms(blink::WebFrame* frame, | 467 void PasswordAutofillAgent::SendPasswordForms(blink::WebFrame* frame, |
468 bool only_visible) { | 468 bool only_visible) { |
469 scoped_ptr<RendererSavePasswordProgressLogger> logger; | 469 scoped_ptr<RendererSavePasswordProgressLogger> logger; |
470 // From the perspective of saving passwords, only calls with |only_visible| | 470 if (logging_state_active_) { |
471 // being true are important -- the decision whether to save the password is | |
472 // only made after visible forms are known, for failed login detection. Calls | |
473 // with |only_visible| false are important for password form autofill, which | |
474 // is currently not part of the logging. | |
475 if (only_visible && logging_state_active_) { | |
476 logger.reset(new RendererSavePasswordProgressLogger(this, routing_id())); | 471 logger.reset(new RendererSavePasswordProgressLogger(this, routing_id())); |
477 logger->LogMessage(Logger::STRING_SEND_PASSWORD_FORMS_METHOD); | 472 logger->LogMessage(Logger::STRING_SEND_PASSWORD_FORMS_METHOD); |
| 473 logger->LogBoolean(Logger::STRING_ONLY_VISIBLE, only_visible); |
478 } | 474 } |
479 | 475 |
480 // Make sure that this security origin is allowed to use password manager. | 476 // Make sure that this security origin is allowed to use password manager. |
481 blink::WebSecurityOrigin origin = frame->document().securityOrigin(); | 477 blink::WebSecurityOrigin origin = frame->document().securityOrigin(); |
482 if (logger) { | 478 if (logger) { |
483 logger->LogURL(Logger::STRING_SECURITY_ORIGIN, | 479 logger->LogURL(Logger::STRING_SECURITY_ORIGIN, |
484 GURL(origin.toString().utf8())); | 480 GURL(origin.toString().utf8())); |
485 } | 481 } |
486 if (!OriginCanAccessPasswordManager(origin)) { | 482 if (!OriginCanAccessPasswordManager(origin)) { |
487 if (logger) { | 483 if (logger) { |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 username->setSelectionRange(username_selection_start_, | 1066 username->setSelectionRange(username_selection_start_, |
1071 username->value().length()); | 1067 username->value().length()); |
1072 } | 1068 } |
1073 if (!password->suggestedValue().isEmpty()) { | 1069 if (!password->suggestedValue().isEmpty()) { |
1074 password->setSuggestedValue(blink::WebString()); | 1070 password->setSuggestedValue(blink::WebString()); |
1075 password->setAutofilled(was_password_autofilled_); | 1071 password->setAutofilled(was_password_autofilled_); |
1076 } | 1072 } |
1077 } | 1073 } |
1078 | 1074 |
1079 } // namespace autofill | 1075 } // namespace autofill |
OLD | NEW |