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 |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "components/autofill/core/common/autofill_data_validation.h" | 31 #include "components/autofill/core/common/autofill_data_validation.h" |
32 #include "components/autofill/core/common/autofill_switches.h" | 32 #include "components/autofill/core/common/autofill_switches.h" |
33 #include "components/autofill/core/common/autofill_util.h" | 33 #include "components/autofill/core/common/autofill_util.h" |
34 #include "components/autofill/core/common/form_data.h" | 34 #include "components/autofill/core/common/form_data.h" |
35 #include "components/autofill/core/common/form_data_predictions.h" | 35 #include "components/autofill/core/common/form_data_predictions.h" |
36 #include "components/autofill/core/common/form_field_data.h" | 36 #include "components/autofill/core/common/form_field_data.h" |
37 #include "components/autofill/core/common/password_form.h" | 37 #include "components/autofill/core/common/password_form.h" |
38 #include "components/autofill/core/common/password_form_fill_data.h" | 38 #include "components/autofill/core/common/password_form_fill_data.h" |
39 #include "components/autofill/core/common/save_password_progress_logger.h" | 39 #include "components/autofill/core/common/save_password_progress_logger.h" |
40 #include "content/public/common/content_switches.h" | 40 #include "content/public/common/content_switches.h" |
41 #include "content/public/common/service_registry.h" | |
42 #include "content/public/common/ssl_status.h" | 41 #include "content/public/common/ssl_status.h" |
43 #include "content/public/common/url_constants.h" | 42 #include "content/public/common/url_constants.h" |
44 #include "content/public/renderer/render_frame.h" | 43 #include "content/public/renderer/render_frame.h" |
45 #include "content/public/renderer/render_view.h" | 44 #include "content/public/renderer/render_view.h" |
46 #include "net/cert/cert_status_flags.h" | 45 #include "net/cert/cert_status_flags.h" |
| 46 #include "services/shell/public/cpp/interface_provider.h" |
| 47 #include "services/shell/public/cpp/interface_registry.h" |
47 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 48 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
48 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 49 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
49 #include "third_party/WebKit/public/web/WebDataSource.h" | 50 #include "third_party/WebKit/public/web/WebDataSource.h" |
50 #include "third_party/WebKit/public/web/WebDocument.h" | 51 #include "third_party/WebKit/public/web/WebDocument.h" |
51 #include "third_party/WebKit/public/web/WebElementCollection.h" | 52 #include "third_party/WebKit/public/web/WebElementCollection.h" |
52 #include "third_party/WebKit/public/web/WebFormControlElement.h" | 53 #include "third_party/WebKit/public/web/WebFormControlElement.h" |
53 #include "third_party/WebKit/public/web/WebFormElement.h" | 54 #include "third_party/WebKit/public/web/WebFormElement.h" |
54 #include "third_party/WebKit/public/web/WebInputEvent.h" | 55 #include "third_party/WebKit/public/web/WebInputEvent.h" |
55 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 56 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
56 #include "third_party/WebKit/public/web/WebNode.h" | 57 #include "third_party/WebKit/public/web/WebNode.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 legacy_(render_frame->GetRenderView(), this), | 176 legacy_(render_frame->GetRenderView(), this), |
176 autofill_query_id_(0), | 177 autofill_query_id_(0), |
177 was_query_node_autofilled_(false), | 178 was_query_node_autofilled_(false), |
178 ignore_text_changes_(false), | 179 ignore_text_changes_(false), |
179 is_popup_possibly_visible_(false), | 180 is_popup_possibly_visible_(false), |
180 is_generation_popup_possibly_visible_(false), | 181 is_generation_popup_possibly_visible_(false), |
181 weak_ptr_factory_(this) { | 182 weak_ptr_factory_(this) { |
182 render_frame->GetWebFrame()->setAutofillClient(this); | 183 render_frame->GetWebFrame()->setAutofillClient(this); |
183 | 184 |
184 // AutofillAgent is guaranteed to outlive |render_frame|. | 185 // AutofillAgent is guaranteed to outlive |render_frame|. |
185 render_frame->GetServiceRegistry()->AddService( | 186 render_frame->GetInterfaceRegistry()->AddInterface( |
186 base::Bind(&AutofillAgent::BindRequest, base::Unretained(this))); | 187 base::Bind(&AutofillAgent::BindRequest, base::Unretained(this))); |
187 | 188 |
188 // This owns itself, and will delete itself when |render_frame| is destructed | 189 // This owns itself, and will delete itself when |render_frame| is destructed |
189 // (same as AutofillAgent). This object must be constructed after | 190 // (same as AutofillAgent). This object must be constructed after |
190 // AutofillAgent so that password generation UI is shown before password | 191 // AutofillAgent so that password generation UI is shown before password |
191 // manager UI (see https://crbug.com/498545). | 192 // manager UI (see https://crbug.com/498545). |
192 new PageClickTracker(render_frame, this); | 193 new PageClickTracker(render_frame, this); |
193 } | 194 } |
194 | 195 |
195 AutofillAgent::~AutofillAgent() {} | 196 AutofillAgent::~AutofillAgent() {} |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 void AutofillAgent::ajaxSucceeded() { | 797 void AutofillAgent::ajaxSucceeded() { |
797 OnSamePageNavigationCompleted(); | 798 OnSamePageNavigationCompleted(); |
798 password_autofill_agent_->AJAXSucceeded(); | 799 password_autofill_agent_->AJAXSucceeded(); |
799 } | 800 } |
800 | 801 |
801 void AutofillAgent::ConnectToMojoAutofillDriverIfNeeded() { | 802 void AutofillAgent::ConnectToMojoAutofillDriverIfNeeded() { |
802 if (mojo_autofill_driver_.is_bound() && | 803 if (mojo_autofill_driver_.is_bound() && |
803 !mojo_autofill_driver_.encountered_error()) | 804 !mojo_autofill_driver_.encountered_error()) |
804 return; | 805 return; |
805 | 806 |
806 render_frame()->GetServiceRegistry()->ConnectToRemoteService( | 807 render_frame()->GetRemoteInterfaces()->GetInterface(&mojo_autofill_driver_); |
807 mojo::GetProxy(&mojo_autofill_driver_)); | |
808 } | 808 } |
809 | 809 |
810 // LegacyAutofillAgent --------------------------------------------------------- | 810 // LegacyAutofillAgent --------------------------------------------------------- |
811 | 811 |
812 AutofillAgent::LegacyAutofillAgent::LegacyAutofillAgent( | 812 AutofillAgent::LegacyAutofillAgent::LegacyAutofillAgent( |
813 content::RenderView* render_view, | 813 content::RenderView* render_view, |
814 AutofillAgent* agent) | 814 AutofillAgent* agent) |
815 : content::RenderViewObserver(render_view), agent_(agent) { | 815 : content::RenderViewObserver(render_view), agent_(agent) { |
816 } | 816 } |
817 | 817 |
818 AutofillAgent::LegacyAutofillAgent::~LegacyAutofillAgent() { | 818 AutofillAgent::LegacyAutofillAgent::~LegacyAutofillAgent() { |
819 } | 819 } |
820 | 820 |
821 void AutofillAgent::LegacyAutofillAgent::Shutdown() { | 821 void AutofillAgent::LegacyAutofillAgent::Shutdown() { |
822 agent_ = nullptr; | 822 agent_ = nullptr; |
823 } | 823 } |
824 | 824 |
825 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { | 825 void AutofillAgent::LegacyAutofillAgent::OnDestruct() { |
826 // No-op. Don't delete |this|. | 826 // No-op. Don't delete |this|. |
827 } | 827 } |
828 | 828 |
829 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { | 829 void AutofillAgent::LegacyAutofillAgent::FocusChangeComplete() { |
830 if (agent_) | 830 if (agent_) |
831 agent_->FocusChangeComplete(); | 831 agent_->FocusChangeComplete(); |
832 } | 832 } |
833 | 833 |
834 } // namespace autofill | 834 } // namespace autofill |
OLD | NEW |