| 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/browser/content_autofill_driver_factory.h" | 11 #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
| 12 #include "components/autofill/content/browser/autofill_provider.h" |
| 12 #include "components/autofill/core/browser/autofill_client.h" | 13 #include "components/autofill/core/browser/autofill_client.h" |
| 13 #include "components/autofill/core/browser/autofill_external_delegate.h" | 14 #include "components/autofill/core/browser/autofill_external_delegate.h" |
| 14 #include "components/autofill/core/browser/autofill_manager.h" | 15 #include "components/autofill/core/browser/autofill_manager.h" |
| 15 #include "components/autofill/core/browser/form_structure.h" | 16 #include "components/autofill/core/browser/form_structure.h" |
| 16 #include "components/autofill/core/common/autofill_switches.h" | 17 #include "components/autofill/core/common/autofill_switches.h" |
| 17 #include "content/public/browser/browser_context.h" | 18 #include "content/public/browser/browser_context.h" |
| 18 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 19 #include "content/public/browser/navigation_controller.h" | 20 #include "content/public/browser/navigation_controller.h" |
| 20 #include "content/public/browser/navigation_handle.h" | 21 #include "content/public/browser/navigation_handle.h" |
| 21 #include "content/public/browser/render_frame_host.h" | 22 #include "content/public/browser/render_frame_host.h" |
| 22 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
| 23 #include "content/public/browser/render_widget_host_view.h" | 24 #include "content/public/browser/render_widget_host_view.h" |
| 24 #include "content/public/browser/site_instance.h" | 25 #include "content/public/browser/site_instance.h" |
| 25 #include "content/public/browser/storage_partition.h" | 26 #include "content/public/browser/storage_partition.h" |
| 26 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 27 #include "services/service_manager/public/cpp/interface_provider.h" | 28 #include "services/service_manager/public/cpp/interface_provider.h" |
| 28 #include "ui/gfx/geometry/size_f.h" | 29 #include "ui/gfx/geometry/size_f.h" |
| 29 | 30 |
| 30 namespace autofill { | 31 namespace autofill { |
| 31 | 32 |
| 32 ContentAutofillDriver::ContentAutofillDriver( | 33 ContentAutofillDriver::ContentAutofillDriver( |
| 33 content::RenderFrameHost* render_frame_host, | 34 content::RenderFrameHost* render_frame_host, |
| 34 AutofillClient* client, | 35 AutofillClient* client, |
| 35 const std::string& app_locale, | 36 const std::string& app_locale, |
| 36 AutofillManager::AutofillDownloadManagerState enable_download_manager) | 37 AutofillManager::AutofillDownloadManagerState enable_download_manager, |
| 38 AutofillProvider* provider) |
| 37 : render_frame_host_(render_frame_host), | 39 : render_frame_host_(render_frame_host), |
| 38 client_(client), | 40 client_(client), |
| 39 autofill_manager_(new AutofillManager(this, | 41 autofill_manager_(new AutofillManager(this, |
| 40 client, | 42 client, |
| 41 app_locale, | 43 app_locale, |
| 42 enable_download_manager)), | 44 enable_download_manager)), |
| 43 autofill_external_delegate_(autofill_manager_.get(), this), | 45 autofill_external_delegate_(autofill_manager_.get(), this), |
| 44 binding_(this) { | 46 binding_(this), |
| 47 provider_(provider) { |
| 48 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 45 autofill_manager_->SetExternalDelegate(&autofill_external_delegate_); | 49 autofill_manager_->SetExternalDelegate(&autofill_external_delegate_); |
| 46 } | 50 } |
| 47 | 51 |
| 48 ContentAutofillDriver::~ContentAutofillDriver() {} | 52 ContentAutofillDriver::~ContentAutofillDriver() { |
| 53 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 54 // Provider_ might already be distroyed, might use weak_ptr here. |
| 55 if (provider_) |
| 56 provider_->OnContentAutofillDriverDestroyed(this); |
| 57 } |
| 49 | 58 |
| 50 // static | 59 // static |
| 51 ContentAutofillDriver* ContentAutofillDriver::GetForRenderFrameHost( | 60 ContentAutofillDriver* ContentAutofillDriver::GetForRenderFrameHost( |
| 52 content::RenderFrameHost* render_frame_host) { | 61 content::RenderFrameHost* render_frame_host) { |
| 53 ContentAutofillDriverFactory* factory = | 62 ContentAutofillDriverFactory* factory = |
| 54 ContentAutofillDriverFactory::FromWebContents( | 63 ContentAutofillDriverFactory::FromWebContents( |
| 55 content::WebContents::FromRenderFrameHost(render_frame_host)); | 64 content::WebContents::FromRenderFrameHost(render_frame_host)); |
| 56 return factory ? factory->DriverForFrame(render_frame_host) : nullptr; | 65 return factory ? factory->DriverForFrame(render_frame_host) : nullptr; |
| 57 } | 66 } |
| 58 | 67 |
| 59 void ContentAutofillDriver::BindRequest(mojom::AutofillDriverRequest request) { | 68 void ContentAutofillDriver::BindRequest(mojom::AutofillDriverRequest request) { |
| 60 binding_.Bind(std::move(request)); | 69 binding_.Bind(std::move(request)); |
| 61 } | 70 } |
| 62 | 71 |
| 63 bool ContentAutofillDriver::IsOffTheRecord() const { | 72 bool ContentAutofillDriver::IsOffTheRecord() const { |
| 73 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 64 return render_frame_host_->GetSiteInstance() | 74 return render_frame_host_->GetSiteInstance() |
| 65 ->GetBrowserContext() | 75 ->GetBrowserContext() |
| 66 ->IsOffTheRecord(); | 76 ->IsOffTheRecord(); |
| 67 } | 77 } |
| 68 | 78 |
| 69 net::URLRequestContextGetter* ContentAutofillDriver::GetURLRequestContext() { | 79 net::URLRequestContextGetter* ContentAutofillDriver::GetURLRequestContext() { |
| 80 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 70 return content::BrowserContext::GetDefaultStoragePartition( | 81 return content::BrowserContext::GetDefaultStoragePartition( |
| 71 render_frame_host_->GetSiteInstance()->GetBrowserContext())-> | 82 render_frame_host_->GetSiteInstance()->GetBrowserContext())-> |
| 72 GetURLRequestContext(); | 83 GetURLRequestContext(); |
| 73 } | 84 } |
| 74 | 85 |
| 75 base::SequencedWorkerPool* ContentAutofillDriver::GetBlockingPool() { | 86 base::SequencedWorkerPool* ContentAutofillDriver::GetBlockingPool() { |
| 87 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 76 return content::BrowserThread::GetBlockingPool(); | 88 return content::BrowserThread::GetBlockingPool(); |
| 77 } | 89 } |
| 78 | 90 |
| 79 bool ContentAutofillDriver::RendererIsAvailable() { | 91 bool ContentAutofillDriver::RendererIsAvailable() { |
| 80 return render_frame_host_->GetRenderViewHost() != NULL; | 92 return render_frame_host_->GetRenderViewHost() != NULL; |
| 81 } | 93 } |
| 82 | 94 |
| 83 void ContentAutofillDriver::SendFormDataToRenderer( | 95 void ContentAutofillDriver::SendFormDataToRenderer( |
| 84 int query_id, | 96 int query_id, |
| 85 RendererFormDataAction action, | 97 RendererFormDataAction action, |
| 86 const FormData& data) { | 98 const FormData& data) { |
| 99 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__ << this << "id = " << query_id; |
| 100 LOG(ERROR) << "bt:" << data; |
| 87 if (!RendererIsAvailable()) | 101 if (!RendererIsAvailable()) |
| 88 return; | 102 return; |
| 89 | 103 |
| 90 switch (action) { | 104 switch (action) { |
| 91 case FORM_DATA_ACTION_FILL: | 105 case FORM_DATA_ACTION_FILL: |
| 92 GetAutofillAgent()->FillForm(query_id, data); | 106 GetAutofillAgent()->FillForm(query_id, data); |
| 93 break; | 107 break; |
| 94 case FORM_DATA_ACTION_PREVIEW: | 108 case FORM_DATA_ACTION_PREVIEW: |
| 95 GetAutofillAgent()->PreviewForm(query_id, data); | 109 GetAutofillAgent()->PreviewForm(query_id, data); |
| 96 break; | 110 break; |
| 97 } | 111 } |
| 98 } | 112 } |
| 99 | 113 |
| 100 void ContentAutofillDriver::PropagateAutofillPredictions( | 114 void ContentAutofillDriver::PropagateAutofillPredictions( |
| 101 const std::vector<FormStructure*>& forms) { | 115 const std::vector<FormStructure*>& forms) { |
| 116 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 102 autofill_manager_->client()->PropagateAutofillPredictions(render_frame_host_, | 117 autofill_manager_->client()->PropagateAutofillPredictions(render_frame_host_, |
| 103 forms); | 118 forms); |
| 104 } | 119 } |
| 105 | 120 |
| 106 void ContentAutofillDriver::SendAutofillTypePredictionsToRenderer( | 121 void ContentAutofillDriver::SendAutofillTypePredictionsToRenderer( |
| 107 const std::vector<FormStructure*>& forms) { | 122 const std::vector<FormStructure*>& forms) { |
| 123 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 108 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 124 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 109 switches::kShowAutofillTypePredictions)) | 125 switches::kShowAutofillTypePredictions)) |
| 110 return; | 126 return; |
| 111 | 127 |
| 112 if (!RendererIsAvailable()) | 128 if (!RendererIsAvailable()) |
| 113 return; | 129 return; |
| 114 | 130 |
| 115 std::vector<FormDataPredictions> type_predictions = | 131 std::vector<FormDataPredictions> type_predictions = |
| 116 FormStructure::GetFieldTypePredictions(forms); | 132 FormStructure::GetFieldTypePredictions(forms); |
| 117 GetAutofillAgent()->FieldTypePredictionsAvailable(type_predictions); | 133 GetAutofillAgent()->FieldTypePredictionsAvailable(type_predictions); |
| 118 } | 134 } |
| 119 | 135 |
| 120 void ContentAutofillDriver::RendererShouldAcceptDataListSuggestion( | 136 void ContentAutofillDriver::RendererShouldAcceptDataListSuggestion( |
| 121 const base::string16& value) { | 137 const base::string16& value) { |
| 138 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 122 if (!RendererIsAvailable()) | 139 if (!RendererIsAvailable()) |
| 123 return; | 140 return; |
| 124 GetAutofillAgent()->AcceptDataListSuggestion(value); | 141 GetAutofillAgent()->AcceptDataListSuggestion(value); |
| 125 } | 142 } |
| 126 | 143 |
| 127 void ContentAutofillDriver::RendererShouldClearFilledForm() { | 144 void ContentAutofillDriver::RendererShouldClearFilledForm() { |
| 145 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 128 if (!RendererIsAvailable()) | 146 if (!RendererIsAvailable()) |
| 129 return; | 147 return; |
| 130 GetAutofillAgent()->ClearForm(); | 148 GetAutofillAgent()->ClearForm(); |
| 131 } | 149 } |
| 132 | 150 |
| 133 void ContentAutofillDriver::RendererShouldClearPreviewedForm() { | 151 void ContentAutofillDriver::RendererShouldClearPreviewedForm() { |
| 152 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 134 if (!RendererIsAvailable()) | 153 if (!RendererIsAvailable()) |
| 135 return; | 154 return; |
| 136 GetAutofillAgent()->ClearPreviewedForm(); | 155 GetAutofillAgent()->ClearPreviewedForm(); |
| 137 } | 156 } |
| 138 | 157 |
| 139 void ContentAutofillDriver::RendererShouldFillFieldWithValue( | 158 void ContentAutofillDriver::RendererShouldFillFieldWithValue( |
| 140 const base::string16& value) { | 159 const base::string16& value) { |
| 160 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 141 if (!RendererIsAvailable()) | 161 if (!RendererIsAvailable()) |
| 142 return; | 162 return; |
| 143 GetAutofillAgent()->FillFieldWithValue(value); | 163 GetAutofillAgent()->FillFieldWithValue(value); |
| 144 } | 164 } |
| 145 | 165 |
| 146 void ContentAutofillDriver::RendererShouldPreviewFieldWithValue( | 166 void ContentAutofillDriver::RendererShouldPreviewFieldWithValue( |
| 147 const base::string16& value) { | 167 const base::string16& value) { |
| 168 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 148 if (!RendererIsAvailable()) | 169 if (!RendererIsAvailable()) |
| 149 return; | 170 return; |
| 150 GetAutofillAgent()->PreviewFieldWithValue(value); | 171 GetAutofillAgent()->PreviewFieldWithValue(value); |
| 151 } | 172 } |
| 152 | 173 |
| 153 void ContentAutofillDriver::PopupHidden() { | 174 void ContentAutofillDriver::PopupHidden() { |
| 175 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 154 // If the unmask prompt is showing, keep showing the preview. The preview | 176 // If the unmask prompt is showing, keep showing the preview. The preview |
| 155 // will be cleared when the prompt closes. | 177 // will be cleared when the prompt closes. |
| 156 if (!autofill_manager_->IsShowingUnmaskPrompt()) | 178 if (!autofill_manager_->IsShowingUnmaskPrompt()) |
| 157 RendererShouldClearPreviewedForm(); | 179 RendererShouldClearPreviewedForm(); |
| 158 } | 180 } |
| 159 | 181 |
| 160 gfx::RectF ContentAutofillDriver::TransformBoundingBoxToViewportCoordinates( | 182 gfx::RectF ContentAutofillDriver::TransformBoundingBoxToViewportCoordinates( |
| 161 const gfx::RectF& bounding_box) { | 183 const gfx::RectF& bounding_box) { |
| 184 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 162 content::RenderWidgetHostView* view = render_frame_host_->GetView(); | 185 content::RenderWidgetHostView* view = render_frame_host_->GetView(); |
| 163 if (!view) | 186 if (!view) |
| 164 return bounding_box; | 187 return bounding_box; |
| 165 | 188 |
| 166 gfx::Point orig_point(bounding_box.x(), bounding_box.y()); | 189 gfx::Point orig_point(bounding_box.x(), bounding_box.y()); |
| 167 gfx::Point transformed_point = | 190 gfx::Point transformed_point = |
| 168 view->TransformPointToRootCoordSpace(orig_point); | 191 view->TransformPointToRootCoordSpace(orig_point); |
| 169 return gfx::RectF(transformed_point.x(), transformed_point.y(), | 192 return gfx::RectF(transformed_point.x(), transformed_point.y(), |
| 170 bounding_box.width(), bounding_box.height()); | 193 bounding_box.width(), bounding_box.height()); |
| 171 } | 194 } |
| 172 | 195 |
| 173 void ContentAutofillDriver::DidInteractWithCreditCardForm() { | 196 void ContentAutofillDriver::DidInteractWithCreditCardForm() { |
| 197 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 174 // Notify the WebContents about credit card inputs on HTTP pages. | 198 // Notify the WebContents about credit card inputs on HTTP pages. |
| 175 content::WebContents* contents = | 199 content::WebContents* contents = |
| 176 content::WebContents::FromRenderFrameHost(render_frame_host_); | 200 content::WebContents::FromRenderFrameHost(render_frame_host_); |
| 177 if (contents->GetVisibleURL().SchemeIsCryptographic()) | 201 if (contents->GetVisibleURL().SchemeIsCryptographic()) |
| 178 return; | 202 return; |
| 179 contents->OnCreditCardInputShownOnHttp(); | 203 contents->OnCreditCardInputShownOnHttp(); |
| 180 } | 204 } |
| 181 | 205 |
| 182 // mojom::AutofillDriver: | 206 // mojom::AutofillDriver: |
| 183 void ContentAutofillDriver::FirstUserGestureObserved() { | 207 void ContentAutofillDriver::FirstUserGestureObserved() { |
| 208 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 184 client_->OnFirstUserGestureObserved(); | 209 client_->OnFirstUserGestureObserved(); |
| 185 } | 210 } |
| 186 | 211 |
| 187 void ContentAutofillDriver::FormsSeen(const std::vector<FormData>& forms, | 212 void ContentAutofillDriver::FormsSeen(const std::vector<FormData>& forms, |
| 188 base::TimeTicks timestamp) { | 213 base::TimeTicks timestamp) { |
| 214 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__ << forms.size(); |
| 215 for(auto form: forms) { |
| 216 LOG(ERROR) << "bt:" << form; |
| 217 } |
| 189 autofill_manager_->OnFormsSeen(forms, timestamp); | 218 autofill_manager_->OnFormsSeen(forms, timestamp); |
| 190 } | 219 } |
| 191 | 220 |
| 192 void ContentAutofillDriver::WillSubmitForm(const FormData& form, | 221 void ContentAutofillDriver::WillSubmitForm(const FormData& form, |
| 193 base::TimeTicks timestamp) { | 222 base::TimeTicks timestamp) { |
| 194 autofill_manager_->OnWillSubmitForm(form, timestamp); | 223 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 224 if (provider_) |
| 225 provider_->OnWillSubmitForm(this, form, timestamp); |
| 226 else |
| 227 autofill_manager_->OnWillSubmitForm(form, timestamp); |
| 195 } | 228 } |
| 196 | 229 |
| 197 void ContentAutofillDriver::FormSubmitted(const FormData& form) { | 230 void ContentAutofillDriver::FormSubmitted(const FormData& form) { |
| 231 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 198 autofill_manager_->OnFormSubmitted(form); | 232 autofill_manager_->OnFormSubmitted(form); |
| 199 } | 233 } |
| 200 | 234 |
| 201 void ContentAutofillDriver::TextFieldDidChange(const FormData& form, | 235 void ContentAutofillDriver::TextFieldDidChange(const FormData& form, |
| 202 const FormFieldData& field, | 236 const FormFieldData& field, |
| 203 base::TimeTicks timestamp) { | 237 base::TimeTicks timestamp) { |
| 204 autofill_manager_->OnTextFieldDidChange(form, field, timestamp); | 238 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 239 if (provider_) |
| 240 provider_->OnTextFieldDidChange(this, form, field, timestamp); |
| 241 else |
| 242 autofill_manager_->OnTextFieldDidChange(form, field, timestamp); |
| 205 } | 243 } |
| 206 | 244 |
| 207 void ContentAutofillDriver::QueryFormFieldAutofill( | 245 void ContentAutofillDriver::QueryFormFieldAutofill( |
| 208 int32_t id, | 246 int32_t id, |
| 209 const FormData& form, | 247 const FormData& form, |
| 210 const FormFieldData& field, | 248 const FormFieldData& field, |
| 211 const gfx::RectF& bounding_box) { | 249 const gfx::RectF& bounding_box) { |
| 212 autofill_manager_->OnQueryFormFieldAutofill(id, form, field, bounding_box); | 250 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__ << this << " id:" << id; |
| 251 LOG(ERROR) << "bt:" << form; |
| 252 LOG(ERROR) << "bt:" << field; |
| 253 if (provider_) |
| 254 provider_->OnQueryFormFieldAutofill(this, id, form, field, bounding_box); |
| 255 else |
| 256 autofill_manager_->OnQueryFormFieldAutofill(id, form, field, bounding_box); |
| 213 } | 257 } |
| 214 | 258 |
| 215 void ContentAutofillDriver::HidePopup() { | 259 void ContentAutofillDriver::HidePopup() { |
| 260 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 216 autofill_manager_->OnHidePopup(); | 261 autofill_manager_->OnHidePopup(); |
| 217 } | 262 } |
| 218 | 263 |
| 219 void ContentAutofillDriver::FocusNoLongerOnForm() { | 264 void ContentAutofillDriver::FocusNoLongerOnForm() { |
| 220 autofill_manager_->OnFocusNoLongerOnForm(); | 265 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 266 if (provider_) |
| 267 provider_->OnFocusNoLongerOnForm(this); |
| 268 else |
| 269 autofill_manager_->OnFocusNoLongerOnForm(); |
| 221 } | 270 } |
| 222 | 271 |
| 223 void ContentAutofillDriver::DidFillAutofillFormData(const FormData& form, | 272 void ContentAutofillDriver::DidFillAutofillFormData(const FormData& form, |
| 224 base::TimeTicks timestamp) { | 273 base::TimeTicks timestamp) { |
| 225 autofill_manager_->OnDidFillAutofillFormData(form, timestamp); | 274 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 275 if (provider_) |
| 276 provider_->OnDidFillAutofillFormData(this, form, timestamp); |
| 277 else |
| 278 autofill_manager_->OnDidFillAutofillFormData(form, timestamp); |
| 226 } | 279 } |
| 227 | 280 |
| 228 void ContentAutofillDriver::DidPreviewAutofillFormData() { | 281 void ContentAutofillDriver::DidPreviewAutofillFormData() { |
| 282 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 229 autofill_manager_->OnDidPreviewAutofillFormData(); | 283 autofill_manager_->OnDidPreviewAutofillFormData(); |
| 230 } | 284 } |
| 231 | 285 |
| 232 void ContentAutofillDriver::DidEndTextFieldEditing() { | 286 void ContentAutofillDriver::DidEndTextFieldEditing() { |
| 287 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 233 autofill_manager_->OnDidEndTextFieldEditing(); | 288 autofill_manager_->OnDidEndTextFieldEditing(); |
| 234 } | 289 } |
| 235 | 290 |
| 236 void ContentAutofillDriver::SetDataList( | 291 void ContentAutofillDriver::SetDataList( |
| 237 const std::vector<base::string16>& values, | 292 const std::vector<base::string16>& values, |
| 238 const std::vector<base::string16>& labels) { | 293 const std::vector<base::string16>& labels) { |
| 294 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 295 for(auto v : values) { |
| 296 LOG(ERROR) << "bt:" << v; |
| 297 } |
| 298 for(auto l : labels) { |
| 299 LOG(ERROR) << "bt:" << l; |
| 300 } |
| 301 |
| 239 autofill_manager_->OnSetDataList(values, labels); | 302 autofill_manager_->OnSetDataList(values, labels); |
| 240 } | 303 } |
| 241 | 304 |
| 242 void ContentAutofillDriver::DidNavigateFrame( | 305 void ContentAutofillDriver::DidNavigateFrame( |
| 243 content::NavigationHandle* navigation_handle) { | 306 content::NavigationHandle* navigation_handle) { |
| 307 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 244 if (navigation_handle->IsInMainFrame() && | 308 if (navigation_handle->IsInMainFrame() && |
| 245 !navigation_handle->IsSameDocument()) { | 309 !navigation_handle->IsSameDocument()) { |
| 246 autofill_manager_->Reset(); | 310 autofill_manager_->Reset(); |
| 247 } | 311 } |
| 248 } | 312 } |
| 249 | 313 |
| 250 void ContentAutofillDriver::SetAutofillManager( | 314 void ContentAutofillDriver::SetAutofillManager( |
| 251 std::unique_ptr<AutofillManager> manager) { | 315 std::unique_ptr<AutofillManager> manager) { |
| 316 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 252 autofill_manager_ = std::move(manager); | 317 autofill_manager_ = std::move(manager); |
| 253 autofill_manager_->SetExternalDelegate(&autofill_external_delegate_); | 318 autofill_manager_->SetExternalDelegate(&autofill_external_delegate_); |
| 254 } | 319 } |
| 255 | 320 |
| 256 void ContentAutofillDriver::NotifyFirstUserGestureObservedInTab() { | 321 void ContentAutofillDriver::NotifyFirstUserGestureObservedInTab() { |
| 322 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 257 GetAutofillAgent()->FirstUserGestureObservedInTab(); | 323 GetAutofillAgent()->FirstUserGestureObservedInTab(); |
| 258 } | 324 } |
| 259 | 325 |
| 260 const mojom::AutofillAgentPtr& ContentAutofillDriver::GetAutofillAgent() { | 326 const mojom::AutofillAgentPtr& ContentAutofillDriver::GetAutofillAgent() { |
| 327 LOG(ERROR) << "bt:" << __PRETTY_FUNCTION__; |
| 261 // Here is a lazy binding, and will not reconnect after connection error. | 328 // Here is a lazy binding, and will not reconnect after connection error. |
| 262 if (!autofill_agent_) { | 329 if (!autofill_agent_) { |
| 263 render_frame_host_->GetRemoteInterfaces()->GetInterface( | 330 render_frame_host_->GetRemoteInterfaces()->GetInterface( |
| 264 mojo::MakeRequest(&autofill_agent_)); | 331 mojo::MakeRequest(&autofill_agent_)); |
| 265 } | 332 } |
| 266 | 333 |
| 267 return autofill_agent_; | 334 return autofill_agent_; |
| 268 } | 335 } |
| 269 | 336 |
| 270 } // namespace autofill | 337 } // namespace autofill |
| OLD | NEW |