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_generation_agent.h" | 5 #include "components/autofill/content/renderer/password_generation_agent.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 } | 327 } |
328 | 328 |
329 void PasswordGenerationAgent::FormNotBlacklisted(const PasswordForm& form) { | 329 void PasswordGenerationAgent::FormNotBlacklisted(const PasswordForm& form) { |
330 not_blacklisted_password_form_origins_.push_back(form.origin); | 330 not_blacklisted_password_form_origins_.push_back(form.origin); |
331 DetermineGenerationElement(); | 331 DetermineGenerationElement(); |
332 } | 332 } |
333 | 333 |
334 void PasswordGenerationAgent::GeneratedPasswordAccepted( | 334 void PasswordGenerationAgent::GeneratedPasswordAccepted( |
335 const base::string16& password) { | 335 const base::string16& password) { |
336 password_is_generated_ = true; | 336 password_is_generated_ = true; |
| 337 password_edited_ = false; |
337 password_generation::LogPasswordGenerationEvent( | 338 password_generation::LogPasswordGenerationEvent( |
338 password_generation::PASSWORD_ACCEPTED); | 339 password_generation::PASSWORD_ACCEPTED); |
339 LogMessage(Logger::STRING_GENERATION_RENDERER_GENERATED_PASSWORD_ACCEPTED); | 340 LogMessage(Logger::STRING_GENERATION_RENDERER_GENERATED_PASSWORD_ACCEPTED); |
340 for (auto& password_element : generation_form_data_->password_elements) { | 341 for (auto& password_element : generation_form_data_->password_elements) { |
341 password_element.SetAutofillValue(blink::WebString::FromUTF16(password)); | 342 password_element.SetAutofillValue(blink::WebString::FromUTF16(password)); |
342 // setAutofillValue() above may have resulted in JavaScript closing the | 343 // setAutofillValue() above may have resulted in JavaScript closing the |
343 // frame. | 344 // frame. |
344 if (!render_frame()) | 345 if (!render_frame()) |
345 return; | 346 return; |
346 password_element.SetAutofilled(true); | 347 password_element.SetAutofilled(true); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 editing_popup_shown_ = true; | 559 editing_popup_shown_ = true; |
559 } | 560 } |
560 | 561 |
561 void PasswordGenerationAgent::HidePopup() { | 562 void PasswordGenerationAgent::HidePopup() { |
562 GetPasswordManagerClient()->HidePasswordGenerationPopup(); | 563 GetPasswordManagerClient()->HidePasswordGenerationPopup(); |
563 } | 564 } |
564 | 565 |
565 void PasswordGenerationAgent::PasswordNoLongerGenerated() { | 566 void PasswordGenerationAgent::PasswordNoLongerGenerated() { |
566 // Do not treat the password as generated, either here or in the browser. | 567 // Do not treat the password as generated, either here or in the browser. |
567 password_is_generated_ = false; | 568 password_is_generated_ = false; |
| 569 password_edited_ = false; |
568 generation_element_.SetShouldRevealPassword(false); | 570 generation_element_.SetShouldRevealPassword(false); |
569 for (blink::WebInputElement& password : | 571 for (blink::WebInputElement& password : |
570 generation_form_data_->password_elements) | 572 generation_form_data_->password_elements) |
571 password.SetAutofilled(false); | 573 password.SetAutofilled(false); |
572 password_generation::LogPasswordGenerationEvent( | 574 password_generation::LogPasswordGenerationEvent( |
573 password_generation::PASSWORD_DELETED); | 575 password_generation::PASSWORD_DELETED); |
574 CopyElementValueToOtherInputElements( | 576 CopyElementValueToOtherInputElements( |
575 &generation_element_, &generation_form_data_->password_elements); | 577 &generation_element_, &generation_form_data_->password_elements); |
576 std::unique_ptr<PasswordForm> presaved_form(CreatePasswordFormToPresave()); | 578 std::unique_ptr<PasswordForm> presaved_form(CreatePasswordFormToPresave()); |
577 if (presaved_form) | 579 if (presaved_form) |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 | 653 |
652 void PasswordGenerationAgent::LogNumber(Logger::StringID message_id, | 654 void PasswordGenerationAgent::LogNumber(Logger::StringID message_id, |
653 int number) { | 655 int number) { |
654 if (!password_agent_->logging_state_active()) | 656 if (!password_agent_->logging_state_active()) |
655 return; | 657 return; |
656 RendererSavePasswordProgressLogger logger(GetPasswordManagerDriver().get()); | 658 RendererSavePasswordProgressLogger logger(GetPasswordManagerDriver().get()); |
657 logger.LogNumber(message_id, number); | 659 logger.LogNumber(message_id, number); |
658 } | 660 } |
659 | 661 |
660 } // namespace autofill | 662 } // namespace autofill |
OLD | NEW |