| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <tuple> | 5 #include <tuple> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 bool called_field_change() const { return called_field_change_; } | 58 bool called_field_change() const { return called_field_change_; } |
| 59 | 59 |
| 60 const std::vector<FormData>* forms() const { return forms_.get(); } | 60 const std::vector<FormData>* forms() const { return forms_.get(); } |
| 61 | 61 |
| 62 void reset_forms() { return forms_.reset(); } | 62 void reset_forms() { return forms_.reset(); } |
| 63 | 63 |
| 64 private: | 64 private: |
| 65 // mojom::AutofillDriver: | 65 // mojom::AutofillDriver: |
| 66 void FirstUserGestureObserved() override {} | 66 void FirstUserGestureObserved() override {} |
| 67 | 67 |
| 68 void FormsSeen(mojo::Array<FormData> forms, | 68 void FormsSeen(const std::vector<FormData>& forms, |
| 69 base::TimeTicks timestamp) override { | 69 base::TimeTicks timestamp) override { |
| 70 // FormsSeen() could be called multiple times and sometimes even with empty | 70 // FormsSeen() could be called multiple times and sometimes even with empty |
| 71 // forms array for main frame, but we're interested in only the first time | 71 // forms array for main frame, but we're interested in only the first time |
| 72 // call. | 72 // call. |
| 73 if (!forms_) | 73 if (!forms_) |
| 74 forms_.reset(new std::vector<FormData>(forms.PassStorage())); | 74 forms_.reset(new std::vector<FormData>(forms)); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void WillSubmitForm(const FormData& form, | 77 void WillSubmitForm(const FormData& form, |
| 78 base::TimeTicks timestamp) override {} | 78 base::TimeTicks timestamp) override {} |
| 79 | 79 |
| 80 void FormSubmitted(const FormData& form) override {} | 80 void FormSubmitted(const FormData& form) override {} |
| 81 | 81 |
| 82 void TextFieldDidChange(const FormData& form, | 82 void TextFieldDidChange(const FormData& form, |
| 83 const FormFieldData& field, | 83 const FormFieldData& field, |
| 84 base::TimeTicks timestamp) override { | 84 base::TimeTicks timestamp) override { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 96 | 96 |
| 97 void FocusNoLongerOnForm() override {} | 97 void FocusNoLongerOnForm() override {} |
| 98 | 98 |
| 99 void DidFillAutofillFormData(const FormData& form, | 99 void DidFillAutofillFormData(const FormData& form, |
| 100 base::TimeTicks timestamp) override {} | 100 base::TimeTicks timestamp) override {} |
| 101 | 101 |
| 102 void DidPreviewAutofillFormData() override {} | 102 void DidPreviewAutofillFormData() override {} |
| 103 | 103 |
| 104 void DidEndTextFieldEditing() override {} | 104 void DidEndTextFieldEditing() override {} |
| 105 | 105 |
| 106 void SetDataList(mojo::Array<mojo::String> values, | 106 void SetDataList(const std::vector<base::string16>& values, |
| 107 mojo::Array<mojo::String> labels) override {} | 107 const std::vector<base::string16>& labels) override {} |
| 108 | 108 |
| 109 // Records whether TextFieldDidChange() get called. | 109 // Records whether TextFieldDidChange() get called. |
| 110 bool called_field_change_; | 110 bool called_field_change_; |
| 111 // Records data received via FormSeen() call. | 111 // Records data received via FormSeen() call. |
| 112 std::unique_ptr<std::vector<FormData>> forms_; | 112 std::unique_ptr<std::vector<FormData>> forms_; |
| 113 | 113 |
| 114 mojo::BindingSet<mojom::AutofillDriver> bindings_; | 114 mojo::BindingSet<mojom::AutofillDriver> bindings_; |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 } // namespace | 117 } // namespace |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 base::RunLoop().RunUntilIdle(); | 337 base::RunLoop().RunUntilIdle(); |
| 338 ASSERT_FALSE(fake_driver_.called_field_change()); | 338 ASSERT_FALSE(fake_driver_.called_field_change()); |
| 339 | 339 |
| 340 // A user gesture will send a message to the browser. | 340 // A user gesture will send a message to the browser. |
| 341 EnableUserGestureSimulationForAutofill(); | 341 EnableUserGestureSimulationForAutofill(); |
| 342 SimulateUserInputChangeForElement(&full_name, "Alice"); | 342 SimulateUserInputChangeForElement(&full_name, "Alice"); |
| 343 ASSERT_TRUE(fake_driver_.called_field_change()); | 343 ASSERT_TRUE(fake_driver_.called_field_change()); |
| 344 } | 344 } |
| 345 | 345 |
| 346 } // namespace autofill | 346 } // namespace autofill |
| OLD | NEW |