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> | |
9 | |
10 #include "base/string16.h" | 8 #include "base/string16.h" |
11 #include "content/public/common/page_transition_types.h" | 9 #include "content/public/common/page_transition_types.h" |
12 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
13 | 11 |
14 // Ways that the Instant suggested text is autocompleted into the omnibox. | 12 // Ways that the Instant suggested text is autocompleted into the omnibox. |
15 enum InstantCompleteBehavior { | 13 enum InstantCompleteBehavior { |
16 // Autocomplete the suggestion immediately. | 14 // Autocomplete the suggestion immediately. |
17 INSTANT_COMPLETE_NOW, | 15 INSTANT_COMPLETE_NOW, |
18 | 16 |
19 // Do not autocomplete the suggestion. The suggestion may still be displayed | 17 // Do not autocomplete the suggestion. The suggestion may still be displayed |
(...skipping 10 matching lines...) Expand all Loading... |
30 // "yahoo.com", should that be considered a search string or a URL? | 28 // "yahoo.com", should that be considered a search string or a URL? |
31 enum InstantSuggestionType { | 29 enum InstantSuggestionType { |
32 INSTANT_SUGGESTION_SEARCH, | 30 INSTANT_SUGGESTION_SEARCH, |
33 INSTANT_SUGGESTION_URL, | 31 INSTANT_SUGGESTION_URL, |
34 }; | 32 }; |
35 | 33 |
36 // A wrapper to hold Instant suggested text and its metadata such as the type | 34 // A wrapper to hold Instant suggested text and its metadata such as the type |
37 // of the suggestion and what completion behavior should be applied to it. | 35 // of the suggestion and what completion behavior should be applied to it. |
38 struct InstantSuggestion { | 36 struct InstantSuggestion { |
39 InstantSuggestion(); | 37 InstantSuggestion(); |
40 InstantSuggestion(const string16& text, | 38 InstantSuggestion(const string16& in_text, |
41 InstantCompleteBehavior behavior, | 39 InstantCompleteBehavior in_behavior, |
42 InstantSuggestionType type); | 40 InstantSuggestionType in_type); |
43 ~InstantSuggestion(); | 41 ~InstantSuggestion(); |
44 | 42 |
45 string16 text; | 43 string16 text; |
46 InstantCompleteBehavior behavior; | 44 InstantCompleteBehavior behavior; |
47 InstantSuggestionType type; | 45 InstantSuggestionType type; |
48 }; | 46 }; |
49 | 47 |
50 // Omnibox dropdown matches provided by the native autocomplete providers. | 48 // Omnibox dropdown matches provided by the native autocomplete providers. |
51 struct InstantAutocompleteResult { | 49 struct InstantAutocompleteResult { |
52 InstantAutocompleteResult(); | 50 InstantAutocompleteResult(); |
53 ~InstantAutocompleteResult(); | 51 ~InstantAutocompleteResult(); |
54 | 52 |
55 // The provider name, as returned by AutocompleteProvider::GetName(). | 53 // The provider name, as returned by AutocompleteProvider::GetName(). |
56 string16 provider; | 54 string16 provider; |
57 | 55 |
58 // The type of the result, as returned by AutocompleteMatch::TypeToString(). | 56 // The type of the result, as returned by AutocompleteMatch::TypeToString(). |
59 string16 type; | 57 string16 type; |
60 | 58 |
61 // The description (title), same as AutocompleteMatch::description. | 59 // The description (title), same as AutocompleteMatch::description. |
62 string16 description; | 60 string16 description; |
63 | 61 |
64 // The URL of the match, same as AutocompleteMatch::destination_url. | 62 // The URL of the match, same as AutocompleteMatch::destination_url. |
65 string16 destination_url; | 63 GURL destination_url; |
66 | 64 |
67 // The transition type to use when the user opens this match. Same as | 65 // The transition type to use when the user opens this match. Same as |
68 // AutocompleteMatch::transition. | 66 // AutocompleteMatch::transition. |
69 content::PageTransition transition; | 67 content::PageTransition transition; |
70 | 68 |
71 // The relevance score of this match, same as AutocompleteMatch::relevance. | 69 // The relevance score of this match, same as AutocompleteMatch::relevance. |
72 int relevance; | 70 int relevance; |
73 }; | 71 }; |
74 | 72 |
75 // How to interpret the size (height or width) of the Instant overlay (preview). | 73 // How to interpret the size (height or width) of the Instant overlay (preview). |
76 enum InstantSizeUnits { | 74 enum InstantSizeUnits { |
77 // As an absolute number of pixels. | 75 // As an absolute number of pixels. |
78 INSTANT_SIZE_PIXELS, | 76 INSTANT_SIZE_PIXELS, |
79 | 77 |
80 // As a percentage of the height or width of the containing (parent) view. | 78 // As a percentage of the height or width of the containing (parent) view. |
81 INSTANT_SIZE_PERCENT, | 79 INSTANT_SIZE_PERCENT, |
82 }; | 80 }; |
83 | 81 |
84 // What the Instant page contains when it requests to be shown. | |
85 // TODO(jered): Delete this. | |
86 enum InstantShownReason { | |
87 // Contents are not specified; the page wants to be shown unconditionally. | |
88 // This is a stopgap to display in unexpected situations, and should not | |
89 // normally be used. | |
90 INSTANT_SHOWN_NOT_SPECIFIED, | |
91 | |
92 // Custom content on the NTP, e.g. a custom logo. | |
93 INSTANT_SHOWN_CUSTOM_NTP_CONTENT, | |
94 | |
95 // Query suggestions and search results relevant when the user is typing in | |
96 // the omnibox. | |
97 INSTANT_SHOWN_QUERY_SUGGESTIONS, | |
98 | |
99 // ZeroSuggest suggestions relevant when the user has focused in the omnibox, | |
100 // but not yet typed anything. | |
101 INSTANT_SHOWN_ZERO_SUGGESTIONS, | |
102 | |
103 // Search results in response to the user clicking a query suggestion. | |
104 INSTANT_SHOWN_CLICKED_QUERY_SUGGESTION, | |
105 }; | |
106 | |
107 // The alignment of the theme background image. | 82 // The alignment of the theme background image. |
108 enum ThemeBackgroundImageAlignment { | 83 enum ThemeBackgroundImageAlignment { |
109 THEME_BKGRND_IMAGE_ALIGN_CENTER, | 84 THEME_BKGRND_IMAGE_ALIGN_CENTER, |
110 THEME_BKGRND_IMAGE_ALIGN_LEFT, | 85 THEME_BKGRND_IMAGE_ALIGN_LEFT, |
111 THEME_BKGRND_IMAGE_ALIGN_TOP, | 86 THEME_BKGRND_IMAGE_ALIGN_TOP, |
112 THEME_BKGRND_IMAGE_ALIGN_RIGHT, | 87 THEME_BKGRND_IMAGE_ALIGN_RIGHT, |
113 THEME_BKGRND_IMAGE_ALIGN_BOTTOM, | 88 THEME_BKGRND_IMAGE_ALIGN_BOTTOM, |
114 }; | 89 }; |
115 | 90 |
116 // The tiling of the theme background image. | 91 // The tiling of the theme background image. |
117 enum ThemeBackgroundImageTiling { | 92 enum ThemeBackgroundImageTiling { |
118 THEME_BKGRND_IMAGE_NO_REPEAT, | 93 THEME_BKGRND_IMAGE_NO_REPEAT, |
119 THEME_BKGRND_IMAGE_REPEAT_X, | 94 THEME_BKGRND_IMAGE_REPEAT_X, |
120 THEME_BKGRND_IMAGE_REPEAT_Y, | 95 THEME_BKGRND_IMAGE_REPEAT_Y, |
121 THEME_BKGRND_IMAGE_REPEAT, | 96 THEME_BKGRND_IMAGE_REPEAT, |
122 }; | 97 }; |
123 | 98 |
124 struct ThemeBackgroundInfo { | 99 struct ThemeBackgroundInfo { |
125 ThemeBackgroundInfo(); | 100 ThemeBackgroundInfo(); |
126 ~ThemeBackgroundInfo(); | 101 ~ThemeBackgroundInfo(); |
127 | 102 |
128 // The theme background color in RGBA format where the R, G, B and A values | 103 // The theme background color in RGBA format where the R, G, B and A values |
129 // are between 0 and 255 inclusive and always valid. | 104 // are between 0 and 255 inclusive and always valid. |
130 int color_r; | 105 int color_r; |
131 int color_g; | 106 int color_g; |
132 int color_b; | 107 int color_b; |
133 int color_a; | 108 int color_a; |
134 | 109 |
135 // The theme id for the theme background image. | 110 // The theme ID for the theme background image is only valid if there's a |
136 // Value is only valid if there's a custom theme background image. | 111 // custom theme background image. |
137 std::string theme_id; | 112 string16 theme_id; |
138 | 113 |
139 // The theme background image horizontal alignment is only valid if |theme_id| | 114 // The theme background image horizontal alignment is only valid if |theme_id| |
140 // is valid. | 115 // is valid. |
141 ThemeBackgroundImageAlignment image_horizontal_alignment; | 116 ThemeBackgroundImageAlignment image_horizontal_alignment; |
142 | 117 |
143 // The theme background image vertical alignment is only valid if |theme_id| | 118 // The theme background image vertical alignment is only valid if |theme_id| |
144 // is valid. | 119 // is valid. |
145 ThemeBackgroundImageAlignment image_vertical_alignment; | 120 ThemeBackgroundImageAlignment image_vertical_alignment; |
146 | 121 |
147 // The theme background image tiling is only valid if |theme_id| is valid. | 122 // The theme background image tiling is only valid if |theme_id| is valid. |
148 ThemeBackgroundImageTiling image_tiling; | 123 ThemeBackgroundImageTiling image_tiling; |
149 | 124 |
150 // The theme background image height. | 125 // The theme background image height is only valid if |theme_id| is valid. |
151 // Value is only valid if |theme_id| is valid. | |
152 uint16 image_height; | 126 uint16 image_height; |
153 }; | 127 }; |
154 | 128 |
155 // A most visited item. | 129 // A most visited item. |
156 struct MostVisitedItem { | 130 struct MostVisitedItem { |
| 131 MostVisitedItem(); |
| 132 MostVisitedItem(const GURL& in_url, const string16& in_title); |
| 133 ~MostVisitedItem(); |
| 134 |
157 // URL of the most visited page. | 135 // URL of the most visited page. |
158 GURL url; | 136 GURL url; |
159 | 137 |
160 // Title of the most visited page. | 138 // Title of the most visited page. |
161 string16 title; | 139 string16 title; |
162 }; | 140 }; |
163 | 141 |
164 #endif // CHROME_COMMON_INSTANT_TYPES_H_ | 142 #endif // CHROME_COMMON_INSTANT_TYPES_H_ |
OLD | NEW |