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

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

Issue 1159513002: Allow autofill in iframe inside page of same origin (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove PasswordAutofillAgentTest.IframeNoFillTest Created 5 years, 6 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 | « chrome/test/data/password/password_form_in_same_origin_iframe.html ('k') | no next file » | 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_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/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 // |suggestedValue| set, and |suggestedValue| will be registered for copying to 443 // |suggestedValue| set, and |suggestedValue| will be registered for copying to
444 // the real value through |registration_callback|. Returns true when the 444 // the real value through |registration_callback|. Returns true when the
445 // username gets selected from |other_possible_usernames|, else returns false. 445 // username gets selected from |other_possible_usernames|, else returns false.
446 bool FillFormOnPasswordReceived( 446 bool FillFormOnPasswordReceived(
447 const PasswordFormFillData& fill_data, 447 const PasswordFormFillData& fill_data,
448 blink::WebInputElement username_element, 448 blink::WebInputElement username_element,
449 blink::WebInputElement password_element, 449 blink::WebInputElement password_element,
450 std::map<const blink::WebInputElement, blink::WebString>& 450 std::map<const blink::WebInputElement, blink::WebString>&
451 nonscript_modified_values, 451 nonscript_modified_values,
452 base::Callback<void(blink::WebInputElement*)> registration_callback) { 452 base::Callback<void(blink::WebInputElement*)> registration_callback) {
453 // Do not fill if the password field is in an iframe. 453 // Do not fill if the password field is in a chain of iframes not having
454 DCHECK(password_element.document().frame()); 454 // identical origin.
455 if (password_element.document().frame()->parent()) 455 blink::WebFrame* cur_frame = password_element.document().frame();
456 return false; 456 blink::WebString bottom_frame_origin =
457 cur_frame->securityOrigin().toString();
458
459 DCHECK(cur_frame);
460
461 while (cur_frame->parent()) {
462 cur_frame = cur_frame->parent();
463 if (!bottom_frame_origin.equals(cur_frame->securityOrigin().toString()))
464 return false;
465 }
457 466
458 // If we can't modify the password, don't try to set the username 467 // If we can't modify the password, don't try to set the username
459 if (!IsElementAutocompletable(password_element)) 468 if (!IsElementAutocompletable(password_element))
460 return false; 469 return false;
461 470
462 bool form_contains_username_field = FillDataContainsUsername(fill_data); 471 bool form_contains_username_field = FillDataContainsUsername(fill_data);
463 // If the form contains an autocompletable username field, try to set the 472 // If the form contains an autocompletable username field, try to set the
464 // username to the preferred name, but only if: 473 // username to the preferred name, but only if:
465 // (a) The fill-on-account-select flag is not set, and 474 // (a) The fill-on-account-select flag is not set, and
466 // (b) The username element isn't prefilled 475 // (b) The username element isn't prefilled
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
1430 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::DidStopLoading() { 1439 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::DidStopLoading() {
1431 agent_->DidStopLoading(); 1440 agent_->DidStopLoading();
1432 } 1441 }
1433 1442
1434 void PasswordAutofillAgent::LegacyPasswordAutofillAgent:: 1443 void PasswordAutofillAgent::LegacyPasswordAutofillAgent::
1435 DidStartProvisionalLoad(blink::WebLocalFrame* navigated_frame) { 1444 DidStartProvisionalLoad(blink::WebLocalFrame* navigated_frame) {
1436 agent_->LegacyDidStartProvisionalLoad(navigated_frame); 1445 agent_->LegacyDidStartProvisionalLoad(navigated_frame);
1437 } 1446 }
1438 1447
1439 } // namespace autofill 1448 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/test/data/password/password_form_in_same_origin_iframe.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698