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 InstantMostVisitedItem();
127 ~InstantMostVisitedItem();
129 // The URL of the Most Visited item.
132 // The title of the Most Visited page. May be empty, in which case the |url|
133 // is used as the title.
134 base::string16 title
;
136 // The external URL of the thumbnail associated with this page.
139 // The external URL of the favicon associated with this page.
142 // The external URL that should be pinged when this item is suggested/clicked.
147 // An InstantMostVisitedItem along with its assigned restricted ID.
148 typedef std::pair
<InstantRestrictedID
, InstantMostVisitedItem
>
149 InstantMostVisitedItemIDPair
;
151 // Embedded search request logging stats params.
152 extern const char kSearchQueryKey
[];
153 extern const char kOriginalQueryKey
[];
154 extern const char kRLZParameterKey
[];
155 extern const char kInputEncodingKey
[];
156 extern const char kAssistedQueryStatsKey
[];
158 // A wrapper to hold embedded search request params. Used to tell the server
159 // about the search query logging stats at the query submission time.
160 struct EmbeddedSearchRequestParams
{
161 EmbeddedSearchRequestParams();
162 // Extracts the request params from the |url| and initializes the member
164 explicit EmbeddedSearchRequestParams(const GURL
& url
);
165 ~EmbeddedSearchRequestParams();
167 // Submitted search query.
168 base::string16 search_query
;
171 base::string16 original_query
;
174 base::string16 rlz_parameter_value
;
176 // Character input encoding type.
177 base::string16 input_encoding
;
179 // The optional assisted query stats, aka AQS, used for logging purposes.
180 // This string contains impressions of all autocomplete matches shown
181 // at the query submission time. For privacy reasons, we require the
182 // search provider to support HTTPS protocol in order to receive the AQS
184 // For more details, see http://goto.google.com/binary-clients-logging.
185 base::string16 assisted_query_stats
;
187 #endif // CHROME_COMMON_INSTANT_TYPES_H_