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 <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 const PasswordFormFillData& fill_data, | 522 const PasswordFormFillData& fill_data, |
523 blink::WebInputElement username_element, | 523 blink::WebInputElement username_element, |
524 blink::WebInputElement password_element, | 524 blink::WebInputElement password_element, |
525 std::map<const blink::WebInputElement, blink::WebString>* | 525 std::map<const blink::WebInputElement, blink::WebString>* |
526 nonscript_modified_values, | 526 nonscript_modified_values, |
527 base::Callback<void(blink::WebInputElement*)> registration_callback) { | 527 base::Callback<void(blink::WebInputElement*)> registration_callback) { |
528 // Do not fill if the password field is in a chain of iframes not having | 528 // Do not fill if the password field is in a chain of iframes not having |
529 // identical origin. | 529 // identical origin. |
530 blink::WebFrame* cur_frame = password_element.document().frame(); | 530 blink::WebFrame* cur_frame = password_element.document().frame(); |
531 blink::WebString bottom_frame_origin = | 531 blink::WebString bottom_frame_origin = |
532 cur_frame->securityOrigin().toString(); | 532 cur_frame->getSecurityOrigin().toString(); |
533 | 533 |
534 DCHECK(cur_frame); | 534 DCHECK(cur_frame); |
535 | 535 |
536 while (cur_frame->parent()) { | 536 while (cur_frame->parent()) { |
537 cur_frame = cur_frame->parent(); | 537 cur_frame = cur_frame->parent(); |
538 if (!bottom_frame_origin.equals(cur_frame->securityOrigin().toString())) | 538 if (!bottom_frame_origin.equals(cur_frame->getSecurityOrigin().toString())) |
539 return false; | 539 return false; |
540 } | 540 } |
541 | 541 |
542 // If we can't modify the password, don't try to set the username | 542 // If we can't modify the password, don't try to set the username |
543 if (!IsElementAutocompletable(password_element)) | 543 if (!IsElementAutocompletable(password_element)) |
544 return false; | 544 return false; |
545 | 545 |
546 bool form_contains_fillable_username_field = | 546 bool form_contains_fillable_username_field = |
547 FillDataContainsFillableUsername(fill_data); | 547 FillDataContainsFillableUsername(fill_data); |
548 bool ambiguous_or_empty_names = | 548 bool ambiguous_or_empty_names = |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 void PasswordAutofillAgent::SendPasswordForms(bool only_visible) { | 970 void PasswordAutofillAgent::SendPasswordForms(bool only_visible) { |
971 scoped_ptr<RendererSavePasswordProgressLogger> logger; | 971 scoped_ptr<RendererSavePasswordProgressLogger> logger; |
972 if (logging_state_active_) { | 972 if (logging_state_active_) { |
973 logger.reset(new RendererSavePasswordProgressLogger(this, routing_id())); | 973 logger.reset(new RendererSavePasswordProgressLogger(this, routing_id())); |
974 logger->LogMessage(Logger::STRING_SEND_PASSWORD_FORMS_METHOD); | 974 logger->LogMessage(Logger::STRING_SEND_PASSWORD_FORMS_METHOD); |
975 logger->LogBoolean(Logger::STRING_ONLY_VISIBLE, only_visible); | 975 logger->LogBoolean(Logger::STRING_ONLY_VISIBLE, only_visible); |
976 } | 976 } |
977 | 977 |
978 blink::WebFrame* frame = render_frame()->GetWebFrame(); | 978 blink::WebFrame* frame = render_frame()->GetWebFrame(); |
979 // Make sure that this security origin is allowed to use password manager. | 979 // Make sure that this security origin is allowed to use password manager. |
980 blink::WebSecurityOrigin origin = frame->document().securityOrigin(); | 980 blink::WebSecurityOrigin origin = frame->document().getSecurityOrigin(); |
981 if (logger) { | 981 if (logger) { |
982 logger->LogURL(Logger::STRING_SECURITY_ORIGIN, | 982 logger->LogURL(Logger::STRING_SECURITY_ORIGIN, |
983 GURL(origin.toString().utf8())); | 983 GURL(origin.toString().utf8())); |
984 } | 984 } |
985 if (!OriginCanAccessPasswordManager(origin)) { | 985 if (!OriginCanAccessPasswordManager(origin)) { |
986 if (logger) { | 986 if (logger) { |
987 logger->LogMessage(Logger::STRING_SECURITY_ORIGIN_FAILURE); | 987 logger->LogMessage(Logger::STRING_SECURITY_ORIGIN_FAILURE); |
988 } | 988 } |
989 return; | 989 return; |
990 } | 990 } |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 } | 1507 } |
1508 | 1508 |
1509 bool PasswordAutofillAgent::ProvisionallySavedPasswordIsValid() { | 1509 bool PasswordAutofillAgent::ProvisionallySavedPasswordIsValid() { |
1510 return provisionally_saved_form_ && | 1510 return provisionally_saved_form_ && |
1511 !provisionally_saved_form_->username_value.empty() && | 1511 !provisionally_saved_form_->username_value.empty() && |
1512 !(provisionally_saved_form_->password_value.empty() && | 1512 !(provisionally_saved_form_->password_value.empty() && |
1513 provisionally_saved_form_->new_password_value.empty()); | 1513 provisionally_saved_form_->new_password_value.empty()); |
1514 } | 1514 } |
1515 | 1515 |
1516 } // namespace autofill | 1516 } // namespace autofill |
OLD | NEW |