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

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

Issue 2216463002: [Autofill] Migrate ContentPasswordManagerDriver<-->Password{Autofill,Generation}Agent IPCs to mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nit from Vaclav Created 4 years, 4 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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 password_autofill_agent_->PreviewSuggestion(element_, username, password); 551 password_autofill_agent_->PreviewSuggestion(element_, username, password);
553 DCHECK(handled); 552 DCHECK(handled);
554 } 553 }
555 554
556 void AutofillAgent::ShowInitialPasswordAccountSuggestions( 555 void AutofillAgent::ShowInitialPasswordAccountSuggestions(
557 int32_t key, 556 int32_t key,
558 const PasswordFormFillData& form_data) { 557 const PasswordFormFillData& form_data) {
559 std::vector<blink::WebInputElement> elements; 558 std::vector<blink::WebInputElement> elements;
560 std::unique_ptr<RendererSavePasswordProgressLogger> logger; 559 std::unique_ptr<RendererSavePasswordProgressLogger> logger;
561 if (password_autofill_agent_->logging_state_active()) { 560 if (password_autofill_agent_->logging_state_active()) {
562 logger.reset(new RendererSavePasswordProgressLogger(this, routing_id())); 561 logger.reset(new RendererSavePasswordProgressLogger(
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
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 (!mojo_autofill_driver_) { 785 if (!autofill_driver_) {
786 render_frame()->GetRemoteInterfaces()->GetInterface( 786 render_frame()->GetRemoteInterfaces()->GetInterface(
787 mojo::GetProxy(&mojo_autofill_driver_)); 787 mojo::GetProxy(&autofill_driver_));
788 } 788 }
789 789
790 return mojo_autofill_driver_; 790 return autofill_driver_;
791 }
792
793 const mojom::PasswordManagerDriverPtr&
794 AutofillAgent::GetPasswordManagerDriver() {
795 DCHECK(password_autofill_agent_);
796 return password_autofill_agent_->GetPasswordManagerDriver();
791 } 797 }
792 798
793 // LegacyAutofillAgent --------------------------------------------------------- 799 // LegacyAutofillAgent ---------------------------------------------------------
794 800
795 AutofillAgent::LegacyAutofillAgent::LegacyAutofillAgent( 801 AutofillAgent::LegacyAutofillAgent::LegacyAutofillAgent(
796 content::RenderView* render_view, 802 content::RenderView* render_view,
797 AutofillAgent* agent) 803 AutofillAgent* agent)
798 : content::RenderViewObserver(render_view), agent_(agent) { 804 : content::RenderViewObserver(render_view), agent_(agent) {
799 } 805 }
800 806
801 AutofillAgent::LegacyAutofillAgent::~LegacyAutofillAgent() { 807 AutofillAgent::LegacyAutofillAgent::~LegacyAutofillAgent() {
802 } 808 }
803 809
804 void AutofillAgent::LegacyAutofillAgent::Shutdown() { 810 void AutofillAgent::LegacyAutofillAgent::Shutdown() {
805 agent_ = nullptr; 811 agent_ = nullptr;
806 } 812 }
807 813
808 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { 814 void AutofillAgent::LegacyAutofillAgent::OnDestruct() {
809 // No-op. Don't delete |this|. 815 // No-op. Don't delete |this|.
810 } 816 }
811 817
812 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { 818 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() {
813 if (agent_) 819 if (agent_)
814 agent_->FocusChangeComplete(); 820 agent_->FocusChangeComplete();
815 } 821 }
816 822
817 } // namespace autofill 823 } // 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