Chromium Code Reviews| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "components/autofill/content/common/autofill_messages.h" | 10 #include "components/autofill/content/common/autofill_messages.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 : form(password_form), | 113 : form(password_form), |
| 114 password_elements(passwords) {} | 114 password_elements(passwords) {} |
| 115 | 115 |
| 116 PasswordGenerationAgent::AccountCreationFormData::~AccountCreationFormData() {} | 116 PasswordGenerationAgent::AccountCreationFormData::~AccountCreationFormData() {} |
| 117 | 117 |
| 118 PasswordGenerationAgent::PasswordGenerationAgent( | 118 PasswordGenerationAgent::PasswordGenerationAgent( |
| 119 content::RenderFrame* render_frame, | 119 content::RenderFrame* render_frame, |
| 120 PasswordAutofillAgent* password_agent) | 120 PasswordAutofillAgent* password_agent) |
| 121 : content::RenderFrameObserver(render_frame), | 121 : content::RenderFrameObserver(render_frame), |
| 122 password_is_generated_(false), | 122 password_is_generated_(false), |
| 123 is_manually_triggered(false), | |
| 123 password_edited_(false), | 124 password_edited_(false), |
| 124 generation_popup_shown_(false), | 125 generation_popup_shown_(false), |
| 125 editing_popup_shown_(false), | 126 editing_popup_shown_(false), |
| 126 enabled_(password_generation::IsPasswordGenerationEnabled()), | 127 enabled_(password_generation::IsPasswordGenerationEnabled()), |
| 127 password_agent_(password_agent) { | 128 password_agent_(password_agent) { |
| 128 VLOG(2) << "Password Generation is " << (enabled_ ? "Enabled" : "Disabled"); | 129 VLOG(2) << "Password Generation is " << (enabled_ ? "Enabled" : "Disabled"); |
| 129 } | 130 } |
| 130 PasswordGenerationAgent::~PasswordGenerationAgent() {} | 131 PasswordGenerationAgent::~PasswordGenerationAgent() {} |
| 131 | 132 |
| 132 void PasswordGenerationAgent::DidFinishDocumentLoad() { | 133 void PasswordGenerationAgent::DidFinishDocumentLoad() { |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 // characters typed, so keep offering the password. Note this function | 432 // characters typed, so keep offering the password. Note this function |
| 432 // will just keep the previous popup if one is already showing. | 433 // will just keep the previous popup if one is already showing. |
| 433 ShowGenerationPopup(); | 434 ShowGenerationPopup(); |
| 434 } | 435 } |
| 435 | 436 |
| 436 return true; | 437 return true; |
| 437 } | 438 } |
| 438 | 439 |
| 439 void PasswordGenerationAgent::ShowGenerationPopup() { | 440 void PasswordGenerationAgent::ShowGenerationPopup() { |
| 440 Send(new AutofillHostMsg_ShowPasswordGenerationPopup( | 441 Send(new AutofillHostMsg_ShowPasswordGenerationPopup( |
| 441 routing_id(), | 442 routing_id(), |
| 442 render_frame()->GetRenderView()->ElementBoundsInWindow( | 443 render_frame()->GetRenderView()->ElementBoundsInWindow( |
| 443 generation_element_), | 444 generation_element_), |
| 444 generation_element_.maxLength(), | 445 generation_element_.maxLength(), |
| 445 *generation_form_data_->form)); | 446 generation_element_.nameForAutofill(), |
| 447 is_manually_triggered, | |
| 448 *generation_form_data_->form)); | |
| 446 generation_popup_shown_ = true; | 449 generation_popup_shown_ = true; |
| 447 } | 450 } |
| 448 | 451 |
| 449 void PasswordGenerationAgent::ShowEditingPopup() { | 452 void PasswordGenerationAgent::ShowEditingPopup() { |
| 450 Send(new AutofillHostMsg_ShowPasswordEditingPopup( | 453 Send(new AutofillHostMsg_ShowPasswordEditingPopup( |
| 451 routing_id(), | 454 routing_id(), |
| 452 render_frame()->GetRenderView()->ElementBoundsInWindow( | 455 render_frame()->GetRenderView()->ElementBoundsInWindow( |
| 453 generation_element_), | 456 generation_element_), |
| 454 *generation_form_data_->form)); | 457 *generation_form_data_->form)); |
| 455 editing_popup_shown_ = true; | 458 editing_popup_shown_ = true; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 478 if (!password_form) | 481 if (!password_form) |
| 479 return; | 482 return; |
| 480 | 483 |
| 481 generation_element_ = *element; | 484 generation_element_ = *element; |
| 482 std::vector<blink::WebInputElement> password_elements; | 485 std::vector<blink::WebInputElement> password_elements; |
| 483 GetAccountCreationPasswordFields(form, &password_elements); | 486 GetAccountCreationPasswordFields(form, &password_elements); |
| 484 password_elements = FindPasswordElementsForGeneration( | 487 password_elements = FindPasswordElementsForGeneration( |
| 485 password_elements, element->nameForAutofill()); | 488 password_elements, element->nameForAutofill()); |
| 486 generation_form_data_.reset(new AccountCreationFormData( | 489 generation_form_data_.reset(new AccountCreationFormData( |
| 487 make_linked_ptr(password_form.release()), password_elements)); | 490 make_linked_ptr(password_form.release()), password_elements)); |
| 491 is_manually_triggered = true; | |
|
vabr (Chromium)
2016/02/17 13:43:22
nit: Currently this method is only called when the
dvadym
2016/02/19 16:25:05
Thanks, it makes perfect sense, I've renamed to Us
| |
| 488 ShowGenerationPopup(); | 492 ShowGenerationPopup(); |
| 489 } | 493 } |
| 490 | 494 |
| 491 } // namespace autofill | 495 } // namespace autofill |
| OLD | NEW |