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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "components/autofill/core/browser/autofill_popup_delegate.h" | 15 #include "components/autofill/core/browser/autofill_popup_delegate.h" |
16 #include "components/autofill/core/browser/suggestion.h" | 16 #include "components/autofill/core/browser/suggestion.h" |
17 #include "components/autofill/core/common/form_data.h" | 17 #include "components/autofill/core/common/form_data.h" |
18 #include "components/autofill/core/common/form_field_data.h" | 18 #include "components/autofill/core/common/form_field_data.h" |
19 #include "ui/gfx/geometry/rect_f.h" | 19 #include "ui/gfx/geometry/rect_f.h" |
20 | 20 |
21 namespace autofill { | 21 namespace autofill { |
22 | 22 |
23 class AutofillDriver; | 23 class AutofillDriver; |
24 class AutofillManager; | 24 class AutofillManager; |
| 25 class CreditCard; |
25 | 26 |
26 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. | 27 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. |
27 // Once Autofill is moved out of WebKit this class should be the only home for | 28 // Once Autofill is moved out of WebKit this class should be the only home for |
28 // this logic. See http://crbug.com/51644 | 29 // this logic. See http://crbug.com/51644 |
29 | 30 |
30 // Delegate for in-browser Autocomplete and Autofill display and selection. | 31 // Delegate for in-browser Autocomplete and Autofill display and selection. |
31 class AutofillExternalDelegate : public AutofillPopupDelegate { | 32 class AutofillExternalDelegate : public AutofillPopupDelegate { |
32 public: | 33 public: |
33 // Creates an AutofillExternalDelegate for the specified AutofillManager and | 34 // Creates an AutofillExternalDelegate for the specified AutofillManager and |
34 // AutofillDriver. | 35 // AutofillDriver. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 void OnPingAck(); | 85 void OnPingAck(); |
85 | 86 |
86 protected: | 87 protected: |
87 base::WeakPtr<AutofillExternalDelegate> GetWeakPtr(); | 88 base::WeakPtr<AutofillExternalDelegate> GetWeakPtr(); |
88 | 89 |
89 private: | 90 private: |
90 FRIEND_TEST_ALL_PREFIXES(AutofillExternalDelegateUnitTest, | 91 FRIEND_TEST_ALL_PREFIXES(AutofillExternalDelegateUnitTest, |
91 FillCreditCardForm); | 92 FillCreditCardForm); |
92 | 93 |
93 // Called when a credit card is scanned using device camera. | 94 // Called when a credit card is scanned using device camera. |
94 void OnCreditCardScanned(const base::string16& card_number, | 95 void OnCreditCardScanned(const CreditCard& card); |
95 int expiration_month, | |
96 int expiration_year); | |
97 | 96 |
98 // Fills the form with the Autofill data corresponding to |unique_id|. | 97 // Fills the form with the Autofill data corresponding to |unique_id|. |
99 // If |is_preview| is true then this is just a preview to show the user what | 98 // If |is_preview| is true then this is just a preview to show the user what |
100 // would be selected and if |is_preview| is false then the user has selected | 99 // would be selected and if |is_preview| is false then the user has selected |
101 // this data. | 100 // this data. |
102 void FillAutofillFormData(int unique_id, bool is_preview); | 101 void FillAutofillFormData(int unique_id, bool is_preview); |
103 | 102 |
104 // Handle applying any Autofill warnings to the Autofill popup. | 103 // Handle applying any Autofill warnings to the Autofill popup. |
105 void ApplyAutofillWarnings(std::vector<Suggestion>* suggestions); | 104 void ApplyAutofillWarnings(std::vector<Suggestion>* suggestions); |
106 | 105 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 std::vector<base::string16> data_list_labels_; | 153 std::vector<base::string16> data_list_labels_; |
155 | 154 |
156 base::WeakPtrFactory<AutofillExternalDelegate> weak_ptr_factory_; | 155 base::WeakPtrFactory<AutofillExternalDelegate> weak_ptr_factory_; |
157 | 156 |
158 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); | 157 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); |
159 }; | 158 }; |
160 | 159 |
161 } // namespace autofill | 160 } // namespace autofill |
162 | 161 |
163 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ | 162 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ |
OLD | NEW |