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
3 // found in the LICENSE file.
5 #ifndef CHROME_COMMON_INSTANT_TYPES_H_
6 #define CHROME_COMMON_INSTANT_TYPES_H_
11 #include "base/basictypes.h"
12 #include "base/strings/string16.h"
15 // ID used by Instant code to refer to objects (e.g. Autocomplete results, Most
16 // Visited items) that the Instant page needs access to.
17 typedef int InstantRestrictedID
;
19 // A wrapper to hold Instant suggested text and its metadata. Used to tell the
20 // server what suggestion to prefetch.
21 struct InstantSuggestion
{
23 InstantSuggestion(const base::string16
& in_text
,
24 const std::string
& in_metadata
);
27 // Full suggested text.
30 // JSON metadata from the server response which produced this suggestion.
34 // The alignment of the theme background image.
35 enum ThemeBackgroundImageAlignment
{
36 THEME_BKGRND_IMAGE_ALIGN_CENTER
,
37 THEME_BKGRND_IMAGE_ALIGN_LEFT
,
38 THEME_BKGRND_IMAGE_ALIGN_TOP
,
39 THEME_BKGRND_IMAGE_ALIGN_RIGHT
,
40 THEME_BKGRND_IMAGE_ALIGN_BOTTOM
,
42 THEME_BKGRND_IMAGE_ALIGN_LAST
= THEME_BKGRND_IMAGE_ALIGN_BOTTOM
,
45 // The tiling of the theme background image.
46 enum ThemeBackgroundImageTiling
{
47 THEME_BKGRND_IMAGE_NO_REPEAT
,
48 THEME_BKGRND_IMAGE_REPEAT_X
,
49 THEME_BKGRND_IMAGE_REPEAT_Y
,
50 THEME_BKGRND_IMAGE_REPEAT
,
52 THEME_BKGRND_IMAGE_LAST
= THEME_BKGRND_IMAGE_REPEAT
,
55 // The RGBA color components for the text and links of the theme.
60 bool operator==(const RGBAColor
& rhs
) const;
62 // The color in RGBA format where the R, G, B and A values
63 // are between 0 and 255 inclusive and always valid.
70 // Theme background settings for the NTP.
71 struct ThemeBackgroundInfo
{
72 ThemeBackgroundInfo();
73 ~ThemeBackgroundInfo();
75 bool operator==(const ThemeBackgroundInfo
& rhs
) const;
77 // True if the default theme is selected.
78 bool using_default_theme
;
80 // The theme background color in RGBA format always valid.
81 RGBAColor background_color
;
83 // The theme text color in RGBA format.
86 // The theme link color in RGBA format.
89 // The theme text color light in RGBA format.
90 RGBAColor text_color_light
;
92 // The theme color for the header in RGBA format.
93 RGBAColor header_color
;
95 // The theme color for the section border in RGBA format.
96 RGBAColor section_border_color
;
98 // The theme id for the theme background image.
99 // Value is only valid if there's a custom theme background image.
100 std::string theme_id
;
102 // The theme background image horizontal alignment is only valid if |theme_id|
104 ThemeBackgroundImageAlignment image_horizontal_alignment
;
106 // The theme background image vertical alignment is only valid if |theme_id|
108 ThemeBackgroundImageAlignment image_vertical_alignment
;
110 // The theme background image tiling is only valid if |theme_id| is valid.
111 ThemeBackgroundImageTiling image_tiling
;
113 // The theme background image height.
114 // Value is only valid if |theme_id| is valid.
117 // True if theme has attribution logo.
118 // Value is only valid if |theme_id| is valid.
119 bool has_attribution
;
121 // True if theme has an alternate logo.
125 struct InstantMostVisitedItem
{
126 // The URL of the Most Visited item.
129 // The title of the Most Visited page. May be empty, in which case the |url|
130 // is used as the title.
131 base::string16 title
;
134 // An InstantMostVisitedItem along with its assigned restricted ID.
135 typedef std::pair
<InstantRestrictedID
, InstantMostVisitedItem
>
136 InstantMostVisitedItemIDPair
;
138 // Embedded search request logging stats params.
139 extern const char kSearchQueryKey
[];
140 extern const char kOriginalQueryKey
[];
141 extern const char kRLZParameterKey
[];
142 extern const char kInputEncodingKey
[];
143 extern const char kAssistedQueryStatsKey
[];
145 // A wrapper to hold embedded search request params. Used to tell the server
146 // about the search query logging stats at the query submission time.
147 struct EmbeddedSearchRequestParams
{
148 EmbeddedSearchRequestParams();
149 // Extracts the request params from the |url| and initializes the member
151 explicit EmbeddedSearchRequestParams(const GURL
& url
);
152 ~EmbeddedSearchRequestParams();
154 // Submitted search query.
155 base::string16 search_query
;
158 base::string16 original_query
;
161 base::string16 rlz_parameter_value
;
163 // Character input encoding type.
164 base::string16 input_encoding
;
166 // The optional assisted query stats, aka AQS, used for logging purposes.
167 // This string contains impressions of all autocomplete matches shown
168 // at the query submission time. For privacy reasons, we require the
169 // search provider to support HTTPS protocol in order to receive the AQS
171 // For more details, see http://goto.google.com/binary-clients-logging.
172 base::string16 assisted_query_stats
;
174 #endif // CHROME_COMMON_INSTANT_TYPES_H_