| 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/autofill_agent.h" | 5 #include "components/autofill/content/renderer/autofill_agent.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <tuple> | 9 #include <tuple> |
| 10 | 10 |
| 11 #include "base/auto_reset.h" | 11 #include "base/auto_reset.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/i18n/case_conversion.h" | 14 #include "base/i18n/case_conversion.h" |
| 15 #include "base/location.h" | 15 #include "base/location.h" |
| 16 #include "base/metrics/field_trial.h" | 16 #include "base/metrics/field_trial.h" |
| 17 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 18 #include "base/strings/string_split.h" | 18 #include "base/strings/string_split.h" |
| 19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
| 21 #include "base/threading/thread_task_runner_handle.h" | 21 #include "base/threading/thread_task_runner_handle.h" |
| 22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
| 23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
| 24 #include "components/autofill/content/common/autofill_messages.h" |
| 24 #include "components/autofill/content/renderer/form_autofill_util.h" | 25 #include "components/autofill/content/renderer/form_autofill_util.h" |
| 25 #include "components/autofill/content/renderer/page_click_tracker.h" | 26 #include "components/autofill/content/renderer/page_click_tracker.h" |
| 26 #include "components/autofill/content/renderer/password_autofill_agent.h" | 27 #include "components/autofill/content/renderer/password_autofill_agent.h" |
| 27 #include "components/autofill/content/renderer/password_generation_agent.h" | 28 #include "components/autofill/content/renderer/password_generation_agent.h" |
| 28 #include "components/autofill/content/renderer/renderer_save_password_progress_l
ogger.h" | 29 #include "components/autofill/content/renderer/renderer_save_password_progress_l
ogger.h" |
| 29 #include "components/autofill/core/common/autofill_constants.h" | 30 #include "components/autofill/core/common/autofill_constants.h" |
| 30 #include "components/autofill/core/common/autofill_data_validation.h" | 31 #include "components/autofill/core/common/autofill_data_validation.h" |
| 31 #include "components/autofill/core/common/autofill_switches.h" | 32 #include "components/autofill/core/common/autofill_switches.h" |
| 32 #include "components/autofill/core/common/autofill_util.h" | 33 #include "components/autofill/core/common/autofill_util.h" |
| 33 #include "components/autofill/core/common/form_data.h" | 34 #include "components/autofill/core/common/form_data.h" |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 password_autofill_agent_->PreviewSuggestion(element_, username, password); | 552 password_autofill_agent_->PreviewSuggestion(element_, username, password); |
| 552 DCHECK(handled); | 553 DCHECK(handled); |
| 553 } | 554 } |
| 554 | 555 |
| 555 void AutofillAgent::ShowInitialPasswordAccountSuggestions( | 556 void AutofillAgent::ShowInitialPasswordAccountSuggestions( |
| 556 int32_t key, | 557 int32_t key, |
| 557 const PasswordFormFillData& form_data) { | 558 const PasswordFormFillData& form_data) { |
| 558 std::vector<blink::WebInputElement> elements; | 559 std::vector<blink::WebInputElement> elements; |
| 559 std::unique_ptr<RendererSavePasswordProgressLogger> logger; | 560 std::unique_ptr<RendererSavePasswordProgressLogger> logger; |
| 560 if (password_autofill_agent_->logging_state_active()) { | 561 if (password_autofill_agent_->logging_state_active()) { |
| 561 logger.reset(new RendererSavePasswordProgressLogger( | 562 logger.reset(new RendererSavePasswordProgressLogger(this, routing_id())); |
| 562 GetPasswordManagerDriver().get())); | |
| 563 logger->LogMessage(SavePasswordProgressLogger:: | 563 logger->LogMessage(SavePasswordProgressLogger:: |
| 564 STRING_ON_SHOW_INITIAL_PASSWORD_ACCOUNT_SUGGESTIONS); | 564 STRING_ON_SHOW_INITIAL_PASSWORD_ACCOUNT_SUGGESTIONS); |
| 565 } | 565 } |
| 566 password_autofill_agent_->GetFillableElementFromFormData( | 566 password_autofill_agent_->GetFillableElementFromFormData( |
| 567 key, form_data, logger.get(), &elements); | 567 key, form_data, logger.get(), &elements); |
| 568 | 568 |
| 569 // If wait_for_username is true, we don't want to initially show form options | 569 // If wait_for_username is true, we don't want to initially show form options |
| 570 // until the user types in a valid username. | 570 // until the user types in a valid username. |
| 571 if (form_data.wait_for_username) | 571 if (form_data.wait_for_username) |
| 572 return; | 572 return; |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 password_generation_agent_->OnDynamicFormsSeen(); | 775 password_generation_agent_->OnDynamicFormsSeen(); |
| 776 } | 776 } |
| 777 } | 777 } |
| 778 | 778 |
| 779 void AutofillAgent::ajaxSucceeded() { | 779 void AutofillAgent::ajaxSucceeded() { |
| 780 OnSamePageNavigationCompleted(); | 780 OnSamePageNavigationCompleted(); |
| 781 password_autofill_agent_->AJAXSucceeded(); | 781 password_autofill_agent_->AJAXSucceeded(); |
| 782 } | 782 } |
| 783 | 783 |
| 784 const mojom::AutofillDriverPtr& AutofillAgent::GetAutofillDriver() { | 784 const mojom::AutofillDriverPtr& AutofillAgent::GetAutofillDriver() { |
| 785 if (!autofill_driver_) { | 785 if (!mojo_autofill_driver_) { |
| 786 render_frame()->GetRemoteInterfaces()->GetInterface( | 786 render_frame()->GetRemoteInterfaces()->GetInterface( |
| 787 mojo::GetProxy(&autofill_driver_)); | 787 mojo::GetProxy(&mojo_autofill_driver_)); |
| 788 } | 788 } |
| 789 | 789 |
| 790 return autofill_driver_; | 790 return mojo_autofill_driver_; |
| 791 } | |
| 792 | |
| 793 const mojom::PasswordManagerDriverPtr& | |
| 794 AutofillAgent::GetPasswordManagerDriver() { | |
| 795 DCHECK(password_autofill_agent_); | |
| 796 return password_autofill_agent_->GetPasswordManagerDriver(); | |
| 797 } | 791 } |
| 798 | 792 |
| 799 // LegacyAutofillAgent --------------------------------------------------------- | 793 // LegacyAutofillAgent --------------------------------------------------------- |
| 800 | 794 |
| 801 AutofillAgent::LegacyAutofillAgent::LegacyAutofillAgent( | 795 AutofillAgent::LegacyAutofillAgent::LegacyAutofillAgent( |
| 802 content::RenderView* render_view, | 796 content::RenderView* render_view, |
| 803 AutofillAgent* agent) | 797 AutofillAgent* agent) |
| 804 : content::RenderViewObserver(render_view), agent_(agent) { | 798 : content::RenderViewObserver(render_view), agent_(agent) { |
| 805 } | 799 } |
| 806 | 800 |
| 807 AutofillAgent::LegacyAutofillAgent::~LegacyAutofillAgent() { | 801 AutofillAgent::LegacyAutofillAgent::~LegacyAutofillAgent() { |
| 808 } | 802 } |
| 809 | 803 |
| 810 void AutofillAgent::LegacyAutofillAgent::Shutdown() { | 804 void AutofillAgent::LegacyAutofillAgent::Shutdown() { |
| 811 agent_ = nullptr; | 805 agent_ = nullptr; |
| 812 } | 806 } |
| 813 | 807 |
| 814 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { | 808 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { |
| 815 // No-op. Don't delete |this|. | 809 // No-op. Don't delete |this|. |
| 816 } | 810 } |
| 817 | 811 |
| 818 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { | 812 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { |
| 819 if (agent_) | 813 if (agent_) |
| 820 agent_->FocusChangeComplete(); | 814 agent_->FocusChangeComplete(); |
| 821 } | 815 } |
| 822 | 816 |
| 823 } // namespace autofill | 817 } // namespace autofill |
| OLD | NEW |