Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: components/autofill/core/browser/autofill_external_delegate.h

Issue 772253003: Create an autofill Suggestion class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "components/autofill/core/browser/autofill_popup_delegate.h" 14 #include "components/autofill/core/browser/autofill_popup_delegate.h"
15 #include "components/autofill/core/browser/suggestion.h"
15 #include "components/autofill/core/common/form_data.h" 16 #include "components/autofill/core/common/form_data.h"
16 #include "components/autofill/core/common/form_field_data.h" 17 #include "components/autofill/core/common/form_field_data.h"
17 #include "ui/gfx/rect.h" 18 #include "ui/gfx/rect.h"
18 19
19 namespace autofill { 20 namespace autofill {
20 21
21 class AutofillDriver; 22 class AutofillDriver;
22 class AutofillManager; 23 class AutofillManager;
23 24
24 // TODO(csharp): A lot of the logic in this class is copied from autofillagent. 25 // TODO(csharp): A lot of the logic in this class is copied from autofillagent.
(...skipping 29 matching lines...) Expand all
54 virtual void OnQuery(int query_id, 55 virtual void OnQuery(int query_id,
55 const FormData& form, 56 const FormData& form,
56 const FormFieldData& field, 57 const FormFieldData& field,
57 const gfx::RectF& element_bounds, 58 const gfx::RectF& element_bounds,
58 bool display_warning_if_disabled); 59 bool display_warning_if_disabled);
59 60
60 // Records query results and correctly formats them before sending them off 61 // Records query results and correctly formats them before sending them off
61 // to be displayed. Called when an Autofill query result is available. 62 // to be displayed. Called when an Autofill query result is available.
62 virtual void OnSuggestionsReturned( 63 virtual void OnSuggestionsReturned(
63 int query_id, 64 int query_id,
64 const std::vector<base::string16>& values, 65 const std::vector<Suggestion>& suggestions);
65 const std::vector<base::string16>& labels,
66 const std::vector<base::string16>& icons,
67 const std::vector<int>& unique_ids);
68 66
69 // Set the data list value associated with the current field. 67 // Set the data list value associated with the current field.
70 void SetCurrentDataListValues( 68 void SetCurrentDataListValues(
71 const std::vector<base::string16>& data_list_values, 69 const std::vector<base::string16>& data_list_values,
72 const std::vector<base::string16>& data_list_labels); 70 const std::vector<base::string16>& data_list_labels);
73 71
74 // Inform the delegate that the text field editing has ended. This is 72 // Inform the delegate that the text field editing has ended. This is
75 // used to help record the metrics of when a new popup is shown. 73 // used to help record the metrics of when a new popup is shown.
76 void DidEndTextFieldEditing(); 74 void DidEndTextFieldEditing();
77 75
(...skipping 16 matching lines...) Expand all
94 int expiration_month, 92 int expiration_month,
95 int expiration_year); 93 int expiration_year);
96 94
97 // Fills the form with the Autofill data corresponding to |unique_id|. 95 // Fills the form with the Autofill data corresponding to |unique_id|.
98 // If |is_preview| is true then this is just a preview to show the user what 96 // If |is_preview| is true then this is just a preview to show the user what
99 // would be selected and if |is_preview| is false then the user has selected 97 // would be selected and if |is_preview| is false then the user has selected
100 // this data. 98 // this data.
101 void FillAutofillFormData(int unique_id, bool is_preview); 99 void FillAutofillFormData(int unique_id, bool is_preview);
102 100
103 // Handle applying any Autofill warnings to the Autofill popup. 101 // Handle applying any Autofill warnings to the Autofill popup.
104 void ApplyAutofillWarnings(std::vector<base::string16>* values, 102 void ApplyAutofillWarnings(std::vector<Suggestion>* suggestions);
105 std::vector<base::string16>* labels,
106 std::vector<base::string16>* icons,
107 std::vector<int>* unique_ids);
108 103
109 // Handle applying any Autofill option listings to the Autofill popup. 104 // Handle applying any Autofill option listings to the Autofill popup.
110 // This function should only get called when there is at least one 105 // This function should only get called when there is at least one
111 // multi-field suggestion in the list of suggestions. 106 // multi-field suggestion in the list of suggestions.
112 void ApplyAutofillOptions(std::vector<base::string16>* values, 107 void ApplyAutofillOptions(std::vector<Suggestion>* suggestions);
113 std::vector<base::string16>* labels,
114 std::vector<base::string16>* icons,
115 std::vector<int>* unique_ids);
116 108
117 // Insert the data list values at the start of the given list, including 109 // Insert the data list values at the start of the given list, including
118 // any required separators. 110 // any required separators.
119 void InsertDataListValues(std::vector<base::string16>* values, 111 void InsertDataListValues(std::vector<Suggestion>* suggestions);
120 std::vector<base::string16>* labels,
121 std::vector<base::string16>* icons,
122 std::vector<int>* unique_ids);
123 112
124 #if defined(OS_MACOSX) && !defined(OS_IOS) 113 #if defined(OS_MACOSX) && !defined(OS_IOS)
125 // Pings the renderer. 114 // Pings the renderer.
126 void PingRenderer(); 115 void PingRenderer();
127 #endif // defined(OS_MACOSX) && !defined(OS_IOS) 116 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
128 117
129 AutofillManager* manager_; // weak. 118 AutofillManager* manager_; // weak.
130 119
131 // Provides driver-level context to the shared code of the component. Must 120 // Provides driver-level context to the shared code of the component. Must
132 // outlive this object. 121 // outlive this object.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 std::vector<base::string16> data_list_labels_; 154 std::vector<base::string16> data_list_labels_;
166 155
167 base::WeakPtrFactory<AutofillExternalDelegate> weak_ptr_factory_; 156 base::WeakPtrFactory<AutofillExternalDelegate> weak_ptr_factory_;
168 157
169 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); 158 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate);
170 }; 159 };
171 160
172 } // namespace autofill 161 } // namespace autofill
173 162
174 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_ 163 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_EXTERNAL_DELEGATE_H_
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_client.h ('k') | components/autofill/core/browser/autofill_external_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698