OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/autofill/core/browser/autofill_handler.h" |
| 6 |
| 7 #include "components/autofill/core/common/autofill_data_validation.h" |
| 8 #include "ui/gfx/geometry/rect_f.h" |
| 9 |
| 10 namespace autofill { |
| 11 |
| 12 using base::TimeTicks; |
| 13 |
| 14 AutofillHandler::AutofillHandler(AutofillDriver* driver) : driver_(driver) {} |
| 15 |
| 16 AutofillHandler::~AutofillHandler() {} |
| 17 |
| 18 bool AutofillHandler::OnWillSubmitForm(const FormData& form, |
| 19 const TimeTicks timestamp) { |
| 20 if (!IsValidFormData(form)) |
| 21 return false; |
| 22 |
| 23 return OnWillSubmitFormImpl(form, timestamp); |
| 24 } |
| 25 |
| 26 void AutofillHandler::OnTextFieldDidChange(const FormData& form, |
| 27 const FormFieldData& field, |
| 28 const TimeTicks timestamp) { |
| 29 if (!IsValidFormData(form) || !IsValidFormFieldData(field)) |
| 30 return; |
| 31 |
| 32 OnTextFieldDidChangeImpl(form, field, timestamp); |
| 33 } |
| 34 |
| 35 void AutofillHandler::OnQueryFormFieldAutofill(int query_id, |
| 36 const FormData& form, |
| 37 const FormFieldData& field, |
| 38 const gfx::RectF& bounding_box) { |
| 39 if (!IsValidFormData(form) || !IsValidFormFieldData(field)) |
| 40 return; |
| 41 |
| 42 gfx::RectF transformed_box = |
| 43 driver_->TransformBoundingBoxToViewportCoordinates(bounding_box); |
| 44 |
| 45 OnQueryFormFieldAutofillImpl(query_id, form, field, transformed_box); |
| 46 } |
| 47 |
| 48 void AutofillHandler::SendFormDataToRenderer( |
| 49 int query_id, |
| 50 AutofillDriver::RendererFormDataAction action, |
| 51 const FormData& data) { |
| 52 driver_->SendFormDataToRenderer(query_id, action, data); |
| 53 } |
| 54 |
| 55 } // namespace autofill |
OLD | NEW |