| 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" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 std::string guid; | 25 std::string guid; |
| 26 size_t variant; | 26 size_t variant; |
| 27 | 27 |
| 28 // For using as a key in a map. | 28 // For using as a key in a map. |
| 29 bool operator<(const SuggestionBackendID& other) const; | 29 bool operator<(const SuggestionBackendID& other) const; |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 struct Suggestion { | 32 struct Suggestion { |
| 33 public: | 33 public: |
| 34 enum MatchMode { |
| 35 PREFIX_MATCH, // for prefix matched suggestions; |
| 36 SUBSTRING_MATCH // for substring matched suggestions; |
| 37 }; |
| 38 |
| 34 Suggestion(); | 39 Suggestion(); |
| 35 | 40 |
| 36 // Copy constructor for STL containers. | 41 // Copy constructor for STL containers. |
| 37 Suggestion(const Suggestion& other); | 42 Suggestion(const Suggestion& other); |
| 38 | 43 |
| 39 explicit Suggestion(const base::string16& value); | 44 explicit Suggestion(const base::string16& value); |
| 40 | 45 |
| 41 // Constructor for unit tests. It will convert the strings from UTF-8 to | 46 // Constructor for unit tests. It will convert the strings from UTF-8 to |
| 42 // UTF-16. | 47 // UTF-16. |
| 43 Suggestion(const std::string& value, | 48 Suggestion(const std::string& value, |
| 44 const std::string& label, | 49 const std::string& label, |
| 45 const std::string& icon, | 50 const std::string& icon, |
| 46 int frontend_id); | 51 int frontend_id); |
| 47 | 52 |
| 48 ~Suggestion(); | 53 ~Suggestion(); |
| 49 | 54 |
| 50 // ID generated by the backend layer. This identifies the exact autofill | 55 // ID generated by the backend layer. This identifies the exact autofill |
| 51 // profile that generated this suggestion. | 56 // profile that generated this suggestion. |
| 52 SuggestionBackendID backend_id; | 57 SuggestionBackendID backend_id; |
| 53 | 58 |
| 54 // ID for the frontend to use in identifying the particular result. Positive | 59 // ID for the frontend to use in identifying the particular result. Positive |
| 55 // values are sent over IPC to identify the item selected. Negative values | 60 // values are sent over IPC to identify the item selected. Negative values |
| 56 // (see popup_item_ids.h) have special built-in meanings. Default initialized | 61 // (see popup_item_ids.h) have special built-in meanings. Default initialized |
| 57 // to 0. | 62 // to 0. |
| 58 int frontend_id; | 63 int frontend_id; |
| 59 | 64 |
| 60 base::string16 value; | 65 base::string16 value; |
| 61 base::string16 label; | 66 base::string16 label; |
| 62 base::string16 icon; | 67 base::string16 icon; |
| 68 MatchMode match; |
| 63 }; | 69 }; |
| 64 | 70 |
| 65 } // namespace autofill | 71 } // namespace autofill |
| 66 | 72 |
| 67 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_SUGGESTION_H_ | 73 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_SUGGESTION_H_ |
| OLD | NEW |