| 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" | |
| 14 #include "content/public/common/page_transition_types.h" | 13 #include "content/public/common/page_transition_types.h" |
| 15 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 16 | 15 |
| 17 // ID used by Instant code to refer to objects (e.g. Autocomplete results, Most | 16 // ID used by Instant code to refer to objects (e.g. Autocomplete results, Most |
| 18 // Visited items) that the Instant page needs access to. | 17 // Visited items) that the Instant page needs access to. |
| 19 typedef int InstantRestrictedID; | 18 typedef int InstantRestrictedID; |
| 20 | 19 |
| 21 // A wrapper to hold Instant suggested text and its metadata. Used to tell the | 20 // A wrapper to hold Instant suggested text and its metadata. Used to tell the |
| 22 // server what suggestion to prefetch. | 21 // server what suggestion to prefetch. |
| 23 struct InstantSuggestion { | 22 struct InstantSuggestion { |
| 24 InstantSuggestion(); | 23 InstantSuggestion(); |
| 25 InstantSuggestion(const base::string16& in_text, | 24 InstantSuggestion(const base::string16& in_text, |
| 26 const std::string& in_metadata); | 25 const std::string& in_metadata); |
| 27 ~InstantSuggestion(); | 26 ~InstantSuggestion(); |
| 28 | 27 |
| 29 // Full suggested text. | 28 // Full suggested text. |
| 30 base::string16 text; | 29 base::string16 text; |
| 31 | 30 |
| 32 // JSON metadata from the server response which produced this suggestion. | 31 // JSON metadata from the server response which produced this suggestion. |
| 33 std::string metadata; | 32 std::string metadata; |
| 34 }; | 33 }; |
| 35 | 34 |
| 36 // Omnibox dropdown matches provided by the native autocomplete providers. | |
| 37 struct InstantAutocompleteResult { | |
| 38 InstantAutocompleteResult(); | |
| 39 ~InstantAutocompleteResult(); | |
| 40 | |
| 41 // The provider name, as returned by AutocompleteProvider::GetName(). | |
| 42 base::string16 provider; | |
| 43 | |
| 44 // The type of the result. | |
| 45 AutocompleteMatchType::Type type; | |
| 46 | |
| 47 // The description (title), same as AutocompleteMatch::description. | |
| 48 base::string16 description; | |
| 49 | |
| 50 // The URL of the match, same as AutocompleteMatch::destination_url. | |
| 51 base::string16 destination_url; | |
| 52 | |
| 53 // The search query for this match. Only set for matches coming from | |
| 54 // SearchProvider. Populated using AutocompleteMatch::contents. | |
| 55 base::string16 search_query; | |
| 56 | |
| 57 // The transition type to use when the user opens this match. Same as | |
| 58 // AutocompleteMatch::transition. | |
| 59 content::PageTransition transition; | |
| 60 | |
| 61 // The relevance score of this match, same as AutocompleteMatch::relevance. | |
| 62 int relevance; | |
| 63 | |
| 64 // The index of the match in AutocompleteResult. Used to get the instant | |
| 65 // suggestion metadata details. Set to kNoMatchIndex if the | |
| 66 // suggestion is displayed on the Instant NTP and set to a positive value if | |
| 67 // the suggestion is displayed on the Local NTP. | |
| 68 size_t autocomplete_match_index; | |
| 69 }; | |
| 70 | |
| 71 // An InstantAutocompleteResult along with its assigned restricted ID. | |
| 72 typedef std::pair<InstantRestrictedID, InstantAutocompleteResult> | |
| 73 InstantAutocompleteResultIDPair; | |
| 74 | |
| 75 // The alignment of the theme background image. | 35 // The alignment of the theme background image. |
| 76 enum ThemeBackgroundImageAlignment { | 36 enum ThemeBackgroundImageAlignment { |
| 77 THEME_BKGRND_IMAGE_ALIGN_CENTER, | 37 THEME_BKGRND_IMAGE_ALIGN_CENTER, |
| 78 THEME_BKGRND_IMAGE_ALIGN_LEFT, | 38 THEME_BKGRND_IMAGE_ALIGN_LEFT, |
| 79 THEME_BKGRND_IMAGE_ALIGN_TOP, | 39 THEME_BKGRND_IMAGE_ALIGN_TOP, |
| 80 THEME_BKGRND_IMAGE_ALIGN_RIGHT, | 40 THEME_BKGRND_IMAGE_ALIGN_RIGHT, |
| 81 THEME_BKGRND_IMAGE_ALIGN_BOTTOM, | 41 THEME_BKGRND_IMAGE_ALIGN_BOTTOM, |
| 82 }; | 42 }; |
| 83 | 43 |
| 84 // The tiling of the theme background image. | 44 // The tiling of the theme background image. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // The title of the Most Visited page. May be empty, in which case the |url| | 126 // The title of the Most Visited page. May be empty, in which case the |url| |
| 167 // is used as the title. | 127 // is used as the title. |
| 168 base::string16 title; | 128 base::string16 title; |
| 169 }; | 129 }; |
| 170 | 130 |
| 171 // An InstantMostVisitedItem along with its assigned restricted ID. | 131 // An InstantMostVisitedItem along with its assigned restricted ID. |
| 172 typedef std::pair<InstantRestrictedID, InstantMostVisitedItem> | 132 typedef std::pair<InstantRestrictedID, InstantMostVisitedItem> |
| 173 InstantMostVisitedItemIDPair; | 133 InstantMostVisitedItemIDPair; |
| 174 | 134 |
| 175 #endif // CHROME_COMMON_INSTANT_TYPES_H_ | 135 #endif // CHROME_COMMON_INSTANT_TYPES_H_ |
| OLD | NEW |