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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_SUGGESTION_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_SUGGESTION_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_SUGGESTION_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_SUGGESTION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 | 12 |
13 namespace autofill { | 13 namespace autofill { |
14 | 14 |
15 class AutofillProfile; | 15 class AutofillProfile; |
16 class CreditCard; | 16 class CreditCard; |
17 | 17 |
18 struct Suggestion { | 18 struct Suggestion { |
19 public: | 19 public: |
| 20 enum MatchMode { |
| 21 PREFIX_MATCH, // for prefix matched suggestions; |
| 22 SUBSTRING_MATCH // for substring matched suggestions; |
| 23 }; |
| 24 |
20 Suggestion(); | 25 Suggestion(); |
21 | 26 |
22 // Copy constructor for STL containers. | 27 // Copy constructor for STL containers. |
23 Suggestion(const Suggestion& other); | 28 Suggestion(const Suggestion& other); |
24 | 29 |
25 explicit Suggestion(const base::string16& value); | 30 explicit Suggestion(const base::string16& value); |
26 | 31 |
27 // Constructor for unit tests. It will convert the strings from UTF-8 to | 32 // Constructor for unit tests. It will convert the strings from UTF-8 to |
28 // UTF-16. | 33 // UTF-16. |
29 Suggestion(const std::string& value, | 34 Suggestion(const std::string& value, |
30 const std::string& label, | 35 const std::string& label, |
31 const std::string& icon, | 36 const std::string& icon, |
32 int frontend_id); | 37 int frontend_id); |
33 | 38 |
34 ~Suggestion(); | 39 ~Suggestion(); |
35 | 40 |
36 // GUID generated by the backend layer. This identifies the exact autofill | 41 // GUID generated by the backend layer. This identifies the exact autofill |
37 // profile that generated this suggestion. | 42 // profile that generated this suggestion. |
38 std::string backend_id; | 43 std::string backend_id; |
39 | 44 |
40 // ID for the frontend to use in identifying the particular result. Positive | 45 // ID for the frontend to use in identifying the particular result. Positive |
41 // values are sent over IPC to identify the item selected. Negative values | 46 // values are sent over IPC to identify the item selected. Negative values |
42 // (see popup_item_ids.h) have special built-in meanings. Default initialized | 47 // (see popup_item_ids.h) have special built-in meanings. Default initialized |
43 // to 0. | 48 // to 0. |
44 int frontend_id; | 49 int frontend_id; |
45 | 50 |
46 base::string16 value; | 51 base::string16 value; |
47 base::string16 label; | 52 base::string16 label; |
48 base::string16 icon; | 53 base::string16 icon; |
| 54 MatchMode match; |
49 }; | 55 }; |
50 | 56 |
51 } // namespace autofill | 57 } // namespace autofill |
52 | 58 |
53 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_SUGGESTION_H_ | 59 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_SUGGESTION_H_ |
OLD | NEW |