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

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

Issue 2750323003: [Password Manager] Replace WebInputElement.setValue with WebInputElement.setAutofillValue (Closed)
Patch Set: Fixed a comment Created 3 years, 9 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 | « components/autofill/content/renderer/password_autofill_agent.cc ('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_generation_agent.h" 5 #include "components/autofill/content/renderer/password_generation_agent.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 passwords.push_back(*confirmation_field_iter); 102 passwords.push_back(*confirmation_field_iter);
103 } 103 }
104 return passwords; 104 return passwords;
105 } 105 }
106 106
107 void CopyElementValueToOtherInputElements( 107 void CopyElementValueToOtherInputElements(
108 const blink::WebInputElement* element, 108 const blink::WebInputElement* element,
109 std::vector<blink::WebInputElement>* elements) { 109 std::vector<blink::WebInputElement>* elements) {
110 for (blink::WebInputElement& it : *elements) { 110 for (blink::WebInputElement& it : *elements) {
111 if (*element != it) { 111 if (*element != it) {
112 it.setValue(element->value(), true /* sendEvents */); 112 it.setAutofillValue(element->value());
113 } 113 }
114 } 114 }
115 } 115 }
116 116
117 bool AutocompleteAttributesSetForGeneration(const PasswordForm& form) { 117 bool AutocompleteAttributesSetForGeneration(const PasswordForm& form) {
118 return form.username_marked_by_site && form.new_password_marked_by_site; 118 return form.username_marked_by_site && form.new_password_marked_by_site;
119 } 119 }
120 120
121 } // namespace 121 } // namespace
122 122
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 DetermineGenerationElement(); 311 DetermineGenerationElement();
312 } 312 }
313 313
314 void PasswordGenerationAgent::GeneratedPasswordAccepted( 314 void PasswordGenerationAgent::GeneratedPasswordAccepted(
315 const base::string16& password) { 315 const base::string16& password) {
316 password_is_generated_ = true; 316 password_is_generated_ = true;
317 password_generation::LogPasswordGenerationEvent( 317 password_generation::LogPasswordGenerationEvent(
318 password_generation::PASSWORD_ACCEPTED); 318 password_generation::PASSWORD_ACCEPTED);
319 LogMessage(Logger::STRING_GENERATION_RENDERER_GENERATED_PASSWORD_ACCEPTED); 319 LogMessage(Logger::STRING_GENERATION_RENDERER_GENERATED_PASSWORD_ACCEPTED);
320 for (auto& password_element : generation_form_data_->password_elements) { 320 for (auto& password_element : generation_form_data_->password_elements) {
321 password_element.setValue(blink::WebString::fromUTF16(password), 321 password_element.setAutofillValue(blink::WebString::fromUTF16(password));
322 true /* sendEvents */); 322 // setAutofillValue() above may have resulted in JavaScript closing the
323 // setValue() above may have resulted in JavaScript closing the frame. 323 // frame.
324 if (!render_frame()) 324 if (!render_frame())
325 return; 325 return;
326 password_element.setAutofilled(true); 326 password_element.setAutofilled(true);
327 // Needed to notify password_autofill_agent that the content of the field 327 // Needed to notify password_autofill_agent that the content of the field
328 // has changed. Without this we will overwrite the generated 328 // has changed. Without this we will overwrite the generated
329 // password with an Autofilled password when saving. 329 // password with an Autofilled password when saving.
330 // https://crbug.com/493455 330 // https://crbug.com/493455
331 password_agent_->UpdateStateForTextChange(password_element); 331 password_agent_->UpdateStateForTextChange(password_element);
332 // Advance focus to the next input field. We assume password fields in 332 // Advance focus to the next input field. We assume password fields in
333 // an account creation form are always adjacent. 333 // an account creation form are always adjacent.
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 617
618 void PasswordGenerationAgent::LogNumber(Logger::StringID message_id, 618 void PasswordGenerationAgent::LogNumber(Logger::StringID message_id,
619 int number) { 619 int number) {
620 if (!password_agent_->logging_state_active()) 620 if (!password_agent_->logging_state_active())
621 return; 621 return;
622 RendererSavePasswordProgressLogger logger(GetPasswordManagerDriver().get()); 622 RendererSavePasswordProgressLogger logger(GetPasswordManagerDriver().get());
623 logger.LogNumber(message_id, number); 623 logger.LogNumber(message_id, number);
624 } 624 }
625 625
626 } // namespace autofill 626 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/content/renderer/password_autofill_agent.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698