OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/content_autofill_driver.h" | 5 #include "components/autofill/content/browser/content_autofill_driver.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
11 #include "components/autofill/content/common/autofill_messages.h" | 11 #include "components/autofill/content/common/autofill_messages.h" |
12 #include "components/autofill/core/browser/autofill_client.h" | 12 #include "components/autofill/core/browser/autofill_client.h" |
13 #include "components/autofill/core/browser/autofill_external_delegate.h" | 13 #include "components/autofill/core/browser/autofill_external_delegate.h" |
14 #include "components/autofill/core/browser/autofill_manager.h" | 14 #include "components/autofill/core/browser/autofill_manager.h" |
15 #include "components/autofill/core/browser/form_structure.h" | 15 #include "components/autofill/core/browser/form_structure.h" |
16 #include "components/autofill/core/common/autofill_switches.h" | 16 #include "components/autofill/core/common/autofill_switches.h" |
17 #include "content/public/browser/browser_context.h" | 17 #include "content/public/browser/browser_context.h" |
18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/browser/navigation_controller.h" | 19 #include "content/public/browser/navigation_controller.h" |
20 #include "content/public/browser/navigation_details.h" | 20 #include "content/public/browser/navigation_details.h" |
21 #include "content/public/browser/render_frame_host.h" | 21 #include "content/public/browser/render_frame_host.h" |
22 #include "content/public/browser/render_view_host.h" | 22 #include "content/public/browser/render_view_host.h" |
| 23 #include "content/public/browser/render_widget_host_view.h" |
23 #include "content/public/browser/site_instance.h" | 24 #include "content/public/browser/site_instance.h" |
24 #include "ipc/ipc_message_macros.h" | 25 #include "ipc/ipc_message_macros.h" |
| 26 #include "ui/gfx/geometry/size_f.h" |
25 | 27 |
26 namespace autofill { | 28 namespace autofill { |
27 | 29 |
28 ContentAutofillDriver::ContentAutofillDriver( | 30 ContentAutofillDriver::ContentAutofillDriver( |
29 content::RenderFrameHost* render_frame_host, | 31 content::RenderFrameHost* render_frame_host, |
30 AutofillClient* client, | 32 AutofillClient* client, |
31 const std::string& app_locale, | 33 const std::string& app_locale, |
32 AutofillManager::AutofillDownloadManagerState enable_download_manager) | 34 AutofillManager::AutofillDownloadManagerState enable_download_manager) |
33 : render_frame_host_(render_frame_host), | 35 : render_frame_host_(render_frame_host), |
34 client_(client), | 36 client_(client), |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 render_frame_host_->GetRoutingID(), value)); | 142 render_frame_host_->GetRoutingID(), value)); |
141 } | 143 } |
142 | 144 |
143 void ContentAutofillDriver::PopupHidden() { | 145 void ContentAutofillDriver::PopupHidden() { |
144 // If the unmask prompt is showing, keep showing the preview. The preview | 146 // If the unmask prompt is showing, keep showing the preview. The preview |
145 // will be cleared when the prompt closes. | 147 // will be cleared when the prompt closes. |
146 if (!autofill_manager_->IsShowingUnmaskPrompt()) | 148 if (!autofill_manager_->IsShowingUnmaskPrompt()) |
147 RendererShouldClearPreviewedForm(); | 149 RendererShouldClearPreviewedForm(); |
148 } | 150 } |
149 | 151 |
| 152 gfx::RectF ContentAutofillDriver::TransformBoundingBoxToViewportCoordinates( |
| 153 const gfx::RectF& bounding_box) { |
| 154 gfx::Point orig_point(bounding_box.x(), bounding_box.y()); |
| 155 gfx::Point transformed_point; |
| 156 transformed_point = |
| 157 render_frame_host_->GetView()->TransformPointToRootCoordSpace(orig_point); |
| 158 |
| 159 gfx::RectF new_box; |
| 160 new_box.SetRect(transformed_point.x(), transformed_point.y(), |
| 161 bounding_box.width(), bounding_box.height()); |
| 162 return new_box; |
| 163 } |
| 164 |
150 bool ContentAutofillDriver::HandleMessage(const IPC::Message& message) { | 165 bool ContentAutofillDriver::HandleMessage(const IPC::Message& message) { |
151 bool handled = true; | 166 bool handled = true; |
152 IPC_BEGIN_MESSAGE_MAP(ContentAutofillDriver, message) | 167 IPC_BEGIN_MESSAGE_MAP(ContentAutofillDriver, message) |
153 IPC_MESSAGE_FORWARD(AutofillHostMsg_FirstUserGestureObserved, client_, | 168 IPC_MESSAGE_FORWARD(AutofillHostMsg_FirstUserGestureObserved, client_, |
154 AutofillClient::OnFirstUserGestureObserved) | 169 AutofillClient::OnFirstUserGestureObserved) |
155 IPC_MESSAGE_FORWARD(AutofillHostMsg_FormsSeen, | 170 IPC_MESSAGE_FORWARD(AutofillHostMsg_FormsSeen, |
156 autofill_manager_.get(), | 171 autofill_manager_.get(), |
157 AutofillManager::OnFormsSeen) | 172 AutofillManager::OnFormsSeen) |
158 IPC_MESSAGE_FORWARD(AutofillHostMsg_WillSubmitForm, autofill_manager_.get(), | 173 IPC_MESSAGE_FORWARD(AutofillHostMsg_WillSubmitForm, autofill_manager_.get(), |
159 AutofillManager::OnWillSubmitForm) | 174 AutofillManager::OnWillSubmitForm) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 autofill_manager_->Reset(); | 217 autofill_manager_->Reset(); |
203 } | 218 } |
204 | 219 |
205 void ContentAutofillDriver::SetAutofillManager( | 220 void ContentAutofillDriver::SetAutofillManager( |
206 scoped_ptr<AutofillManager> manager) { | 221 scoped_ptr<AutofillManager> manager) { |
207 autofill_manager_ = std::move(manager); | 222 autofill_manager_ = std::move(manager); |
208 autofill_manager_->SetExternalDelegate(&autofill_external_delegate_); | 223 autofill_manager_->SetExternalDelegate(&autofill_external_delegate_); |
209 } | 224 } |
210 | 225 |
211 } // namespace autofill | 226 } // namespace autofill |
OLD | NEW |