OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef CHROME_COMMON_INSTANT_TYPES_H_ | 5 #ifndef CHROME_COMMON_INSTANT_TYPES_H_ |
6 #define CHROME_COMMON_INSTANT_TYPES_H_ | 6 #define CHROME_COMMON_INSTANT_TYPES_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "chrome/common/autocomplete_match_type.h" | 13 #include "chrome/common/autocomplete_match_type.h" |
14 #include "content/public/common/page_transition_types.h" | 14 #include "content/public/common/page_transition_types.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 | 16 |
17 // ID used by Instant code to refer to objects (e.g. Autocomplete results, Most | 17 // ID used by Instant code to refer to objects (e.g. Autocomplete results, Most |
18 // Visited items) that the Instant page needs access to. | 18 // Visited items) that the Instant page needs access to. |
19 typedef int InstantRestrictedID; | 19 typedef int InstantRestrictedID; |
20 | 20 |
21 // A wrapper to hold Instant suggested text and its metadata. Used to tell the | 21 // A wrapper to hold Instant suggested text and its metadata. Used to tell the |
22 // server what suggestion to prefetch. | 22 // server what suggestion to prefetch. |
23 struct InstantSuggestion { | 23 struct InstantSuggestion { |
24 InstantSuggestion(); | 24 InstantSuggestion(); |
25 InstantSuggestion(const string16& in_text, | 25 InstantSuggestion(const base::string16& in_text, |
26 const std::string& in_metadata); | 26 const std::string& in_metadata); |
27 ~InstantSuggestion(); | 27 ~InstantSuggestion(); |
28 | 28 |
29 // Full suggested text. | 29 // Full suggested text. |
30 string16 text; | 30 base::string16 text; |
31 | 31 |
32 // JSON metadata from the server response which produced this suggestion. | 32 // JSON metadata from the server response which produced this suggestion. |
33 std::string metadata; | 33 std::string metadata; |
34 }; | 34 }; |
35 | 35 |
36 // Omnibox dropdown matches provided by the native autocomplete providers. | 36 // Omnibox dropdown matches provided by the native autocomplete providers. |
37 struct InstantAutocompleteResult { | 37 struct InstantAutocompleteResult { |
38 InstantAutocompleteResult(); | 38 InstantAutocompleteResult(); |
39 ~InstantAutocompleteResult(); | 39 ~InstantAutocompleteResult(); |
40 | 40 |
41 // The provider name, as returned by AutocompleteProvider::GetName(). | 41 // The provider name, as returned by AutocompleteProvider::GetName(). |
42 string16 provider; | 42 base::string16 provider; |
43 | 43 |
44 // The type of the result. | 44 // The type of the result. |
45 AutocompleteMatchType::Type type; | 45 AutocompleteMatchType::Type type; |
46 | 46 |
47 // The description (title), same as AutocompleteMatch::description. | 47 // The description (title), same as AutocompleteMatch::description. |
48 string16 description; | 48 base::string16 description; |
49 | 49 |
50 // The URL of the match, same as AutocompleteMatch::destination_url. | 50 // The URL of the match, same as AutocompleteMatch::destination_url. |
51 string16 destination_url; | 51 base::string16 destination_url; |
52 | 52 |
53 // The search query for this match. Only set for matches coming from | 53 // The search query for this match. Only set for matches coming from |
54 // SearchProvider. Populated using AutocompleteMatch::contents. | 54 // SearchProvider. Populated using AutocompleteMatch::contents. |
55 string16 search_query; | 55 base::string16 search_query; |
56 | 56 |
57 // The transition type to use when the user opens this match. Same as | 57 // The transition type to use when the user opens this match. Same as |
58 // AutocompleteMatch::transition. | 58 // AutocompleteMatch::transition. |
59 content::PageTransition transition; | 59 content::PageTransition transition; |
60 | 60 |
61 // The relevance score of this match, same as AutocompleteMatch::relevance. | 61 // The relevance score of this match, same as AutocompleteMatch::relevance. |
62 int relevance; | 62 int relevance; |
63 | 63 |
64 // The index of the match in AutocompleteResult. Used to get the instant | 64 // The index of the match in AutocompleteResult. Used to get the instant |
65 // suggestion metadata details. Set to kNoMatchIndex if the | 65 // suggestion metadata details. Set to kNoMatchIndex if the |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // True if theme has an alternate logo. | 158 // True if theme has an alternate logo. |
159 bool logo_alternate; | 159 bool logo_alternate; |
160 }; | 160 }; |
161 | 161 |
162 struct InstantMostVisitedItem { | 162 struct InstantMostVisitedItem { |
163 // The URL of the Most Visited item. | 163 // The URL of the Most Visited item. |
164 GURL url; | 164 GURL url; |
165 | 165 |
166 // The title of the Most Visited page. May be empty, in which case the |url| | 166 // The title of the Most Visited page. May be empty, in which case the |url| |
167 // is used as the title. | 167 // is used as the title. |
168 string16 title; | 168 base::string16 title; |
169 }; | 169 }; |
170 | 170 |
171 // An InstantMostVisitedItem along with its assigned restricted ID. | 171 // An InstantMostVisitedItem along with its assigned restricted ID. |
172 typedef std::pair<InstantRestrictedID, InstantMostVisitedItem> | 172 typedef std::pair<InstantRestrictedID, InstantMostVisitedItem> |
173 InstantMostVisitedItemIDPair; | 173 InstantMostVisitedItemIDPair; |
174 | 174 |
175 #endif // CHROME_COMMON_INSTANT_TYPES_H_ | 175 #endif // CHROME_COMMON_INSTANT_TYPES_H_ |
OLD | NEW |