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

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

Issue 2270333002: Reland: [Autofill] Migrate ContentPasswordManagerDriver<-->Password{Autofill,Generation}Agent IPCs … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 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
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/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"
25 #include "components/autofill/content/renderer/form_autofill_util.h" 24 #include "components/autofill/content/renderer/form_autofill_util.h"
26 #include "components/autofill/content/renderer/page_click_tracker.h" 25 #include "components/autofill/content/renderer/page_click_tracker.h"
27 #include "components/autofill/content/renderer/password_autofill_agent.h" 26 #include "components/autofill/content/renderer/password_autofill_agent.h"
28 #include "components/autofill/content/renderer/password_generation_agent.h" 27 #include "components/autofill/content/renderer/password_generation_agent.h"
29 #include "components/autofill/content/renderer/renderer_save_password_progress_l ogger.h" 28 #include "components/autofill/content/renderer/renderer_save_password_progress_l ogger.h"
30 #include "components/autofill/core/common/autofill_constants.h" 29 #include "components/autofill/core/common/autofill_constants.h"
31 #include "components/autofill/core/common/autofill_data_validation.h" 30 #include "components/autofill/core/common/autofill_data_validation.h"
32 #include "components/autofill/core/common/autofill_switches.h" 31 #include "components/autofill/core/common/autofill_switches.h"
33 #include "components/autofill/core/common/autofill_util.h" 32 #include "components/autofill/core/common/autofill_util.h"
34 #include "components/autofill/core/common/form_data.h" 33 #include "components/autofill/core/common/form_data.h"
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 password_autofill_agent_->PreviewSuggestion(element_, username, password); 550 password_autofill_agent_->PreviewSuggestion(element_, username, password);
552 DCHECK(handled); 551 DCHECK(handled);
553 } 552 }
554 553
555 void AutofillAgent::ShowInitialPasswordAccountSuggestions( 554 void AutofillAgent::ShowInitialPasswordAccountSuggestions(
556 int32_t key, 555 int32_t key,
557 const PasswordFormFillData& form_data) { 556 const PasswordFormFillData& form_data) {
558 std::vector<blink::WebInputElement> elements; 557 std::vector<blink::WebInputElement> elements;
559 std::unique_ptr<RendererSavePasswordProgressLogger> logger; 558 std::unique_ptr<RendererSavePasswordProgressLogger> logger;
560 if (password_autofill_agent_->logging_state_active()) { 559 if (password_autofill_agent_->logging_state_active()) {
561 logger.reset(new RendererSavePasswordProgressLogger(this, routing_id())); 560 logger.reset(new RendererSavePasswordProgressLogger(
561 GetPasswordManagerDriver().get()));
562 logger->LogMessage(SavePasswordProgressLogger:: 562 logger->LogMessage(SavePasswordProgressLogger::
563 STRING_ON_SHOW_INITIAL_PASSWORD_ACCOUNT_SUGGESTIONS); 563 STRING_ON_SHOW_INITIAL_PASSWORD_ACCOUNT_SUGGESTIONS);
564 } 564 }
565 password_autofill_agent_->GetFillableElementFromFormData( 565 password_autofill_agent_->GetFillableElementFromFormData(
566 key, form_data, logger.get(), &elements); 566 key, form_data, logger.get(), &elements);
567 567
568 // If wait_for_username is true, we don't want to initially show form options 568 // If wait_for_username is true, we don't want to initially show form options
569 // until the user types in a valid username. 569 // until the user types in a valid username.
570 if (form_data.wait_for_username) 570 if (form_data.wait_for_username)
571 return; 571 return;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 password_generation_agent_->OnDynamicFormsSeen(); 774 password_generation_agent_->OnDynamicFormsSeen();
775 } 775 }
776 } 776 }
777 777
778 void AutofillAgent::ajaxSucceeded() { 778 void AutofillAgent::ajaxSucceeded() {
779 OnSamePageNavigationCompleted(); 779 OnSamePageNavigationCompleted();
780 password_autofill_agent_->AJAXSucceeded(); 780 password_autofill_agent_->AJAXSucceeded();
781 } 781 }
782 782
783 const mojom::AutofillDriverPtr& AutofillAgent::GetAutofillDriver() { 783 const mojom::AutofillDriverPtr& AutofillAgent::GetAutofillDriver() {
784 if (!mojo_autofill_driver_) { 784 if (!autofill_driver_) {
785 render_frame()->GetRemoteInterfaces()->GetInterface( 785 render_frame()->GetRemoteInterfaces()->GetInterface(
786 mojo::GetProxy(&mojo_autofill_driver_)); 786 mojo::GetProxy(&autofill_driver_));
787 } 787 }
788 788
789 return mojo_autofill_driver_; 789 return autofill_driver_;
790 }
791
792 const mojom::PasswordManagerDriverPtr&
793 AutofillAgent::GetPasswordManagerDriver() {
794 DCHECK(password_autofill_agent_);
795 return password_autofill_agent_->GetPasswordManagerDriver();
790 } 796 }
791 797
792 // LegacyAutofillAgent --------------------------------------------------------- 798 // LegacyAutofillAgent ---------------------------------------------------------
793 799
794 AutofillAgent::LegacyAutofillAgent::LegacyAutofillAgent( 800 AutofillAgent::LegacyAutofillAgent::LegacyAutofillAgent(
795 content::RenderView* render_view, 801 content::RenderView* render_view,
796 AutofillAgent* agent) 802 AutofillAgent* agent)
797 : content::RenderViewObserver(render_view), agent_(agent) { 803 : content::RenderViewObserver(render_view), agent_(agent) {
798 } 804 }
799 805
800 AutofillAgent::LegacyAutofillAgent::~LegacyAutofillAgent() { 806 AutofillAgent::LegacyAutofillAgent::~LegacyAutofillAgent() {
801 } 807 }
802 808
803 void AutofillAgent::LegacyAutofillAgent::Shutdown() { 809 void AutofillAgent::LegacyAutofillAgent::Shutdown() {
804 agent_ = nullptr; 810 agent_ = nullptr;
805 } 811 }
806 812
807 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { 813 void AutofillAgent::LegacyAutofillAgent::OnDestruct() {
808 // No-op. Don't delete |this|. 814 // No-op. Don't delete |this|.
809 } 815 }
810 816
811 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { 817 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() {
812 if (agent_) 818 if (agent_)
813 agent_->FocusChangeComplete(); 819 agent_->FocusChangeComplete();
814 } 820 }
815 821
816 } // namespace autofill 822 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/content/renderer/autofill_agent.h ('k') | components/autofill/content/renderer/password_autofill_agent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698