Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Side by Side Diff: chrome/common/instant_types.h

Issue 2122903002: Move search-related files from chrome/common to chrome/common/search (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move search-related files Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/common/OWNERS ('k') | chrome/common/instant_types.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_COMMON_INSTANT_TYPES_H_
6 #define CHROME_COMMON_INSTANT_TYPES_H_
7
8 #include <stdint.h>
9
10 #include <string>
11 #include <utility>
12
13 #include "base/strings/string16.h"
14 #include "url/gurl.h"
15
16 // ID used by Instant code to refer to objects (e.g. Autocomplete results, Most
17 // Visited items) that the Instant page needs access to.
18 typedef int InstantRestrictedID;
19
20 // A wrapper to hold Instant suggested text and its metadata. Used to tell the
21 // server what suggestion to prefetch.
22 struct InstantSuggestion {
23 InstantSuggestion();
24 InstantSuggestion(const base::string16& in_text,
25 const std::string& in_metadata);
26 ~InstantSuggestion();
27
28 // Full suggested text.
29 base::string16 text;
30
31 // JSON metadata from the server response which produced this suggestion.
32 std::string metadata;
33 };
34
35 // The alignment of the theme background image.
36 enum ThemeBackgroundImageAlignment {
37 THEME_BKGRND_IMAGE_ALIGN_CENTER,
38 THEME_BKGRND_IMAGE_ALIGN_LEFT,
39 THEME_BKGRND_IMAGE_ALIGN_TOP,
40 THEME_BKGRND_IMAGE_ALIGN_RIGHT,
41 THEME_BKGRND_IMAGE_ALIGN_BOTTOM,
42
43 THEME_BKGRND_IMAGE_ALIGN_LAST = THEME_BKGRND_IMAGE_ALIGN_BOTTOM,
44 };
45
46 // The tiling of the theme background image.
47 enum ThemeBackgroundImageTiling {
48 THEME_BKGRND_IMAGE_NO_REPEAT,
49 THEME_BKGRND_IMAGE_REPEAT_X,
50 THEME_BKGRND_IMAGE_REPEAT_Y,
51 THEME_BKGRND_IMAGE_REPEAT,
52
53 THEME_BKGRND_IMAGE_LAST = THEME_BKGRND_IMAGE_REPEAT,
54 };
55
56 // The RGBA color components for the text and links of the theme.
57 struct RGBAColor {
58 RGBAColor();
59 ~RGBAColor();
60
61 bool operator==(const RGBAColor& rhs) const;
62
63 // The color in RGBA format where the R, G, B and A values
64 // are between 0 and 255 inclusive and always valid.
65 uint8_t r;
66 uint8_t g;
67 uint8_t b;
68 uint8_t a;
69 };
70
71 // Theme background settings for the NTP.
72 struct ThemeBackgroundInfo {
73 ThemeBackgroundInfo();
74 ~ThemeBackgroundInfo();
75
76 bool operator==(const ThemeBackgroundInfo& rhs) const;
77
78 // True if the default theme is selected.
79 bool using_default_theme;
80
81 // The theme background color in RGBA format always valid.
82 RGBAColor background_color;
83
84 // The theme text color in RGBA format.
85 RGBAColor text_color;
86
87 // The theme link color in RGBA format.
88 RGBAColor link_color;
89
90 // The theme text color light in RGBA format.
91 RGBAColor text_color_light;
92
93 // The theme color for the header in RGBA format.
94 RGBAColor header_color;
95
96 // The theme color for the section border in RGBA format.
97 RGBAColor section_border_color;
98
99 // The theme id for the theme background image.
100 // Value is only valid if there's a custom theme background image.
101 std::string theme_id;
102
103 // The theme background image horizontal alignment is only valid if |theme_id|
104 // is valid.
105 ThemeBackgroundImageAlignment image_horizontal_alignment;
106
107 // The theme background image vertical alignment is only valid if |theme_id|
108 // is valid.
109 ThemeBackgroundImageAlignment image_vertical_alignment;
110
111 // The theme background image tiling is only valid if |theme_id| is valid.
112 ThemeBackgroundImageTiling image_tiling;
113
114 // The theme background image height.
115 // Value is only valid if |theme_id| is valid.
116 uint16_t image_height;
117
118 // True if theme has attribution logo.
119 // Value is only valid if |theme_id| is valid.
120 bool has_attribution;
121
122 // True if theme has an alternate logo.
123 bool logo_alternate;
124 };
125
126 struct InstantMostVisitedItem {
127 InstantMostVisitedItem();
128 InstantMostVisitedItem(const InstantMostVisitedItem& other);
129 ~InstantMostVisitedItem();
130
131 // The URL of the Most Visited item.
132 GURL url;
133
134 // The title of the Most Visited page. May be empty, in which case the |url|
135 // is used as the title.
136 base::string16 title;
137
138 // The external URL of the thumbnail associated with this page.
139 GURL thumbnail;
140
141 // The external URL of the favicon associated with this page.
142 GURL favicon;
143
144 // The external URL that should be pinged when this item is suggested/clicked.
145 GURL impression_url;
146 GURL click_url;
147
148 // True if it's a server side suggestion.
149 // Otherwise, it's a client side suggestion.
150 bool is_server_side_suggestion;
151 };
152
153 // An InstantMostVisitedItem along with its assigned restricted ID.
154 typedef std::pair<InstantRestrictedID, InstantMostVisitedItem>
155 InstantMostVisitedItemIDPair;
156
157 // Embedded search request logging stats params.
158 extern const char kSearchQueryKey[];
159 extern const char kOriginalQueryKey[];
160 extern const char kRLZParameterKey[];
161 extern const char kInputEncodingKey[];
162 extern const char kAssistedQueryStatsKey[];
163
164 // A wrapper to hold embedded search request params. Used to tell the server
165 // about the search query logging stats at the query submission time.
166 struct EmbeddedSearchRequestParams {
167 EmbeddedSearchRequestParams();
168 // Extracts the request params from the |url| and initializes the member
169 // variables.
170 explicit EmbeddedSearchRequestParams(const GURL& url);
171 ~EmbeddedSearchRequestParams();
172
173 // Submitted search query.
174 base::string16 search_query;
175
176 // User typed query.
177 base::string16 original_query;
178
179 // RLZ parameter.
180 base::string16 rlz_parameter_value;
181
182 // Character input encoding type.
183 base::string16 input_encoding;
184
185 // The optional assisted query stats, aka AQS, used for logging purposes.
186 // This string contains impressions of all autocomplete matches shown
187 // at the query submission time. For privacy reasons, we require the
188 // search provider to support HTTPS protocol in order to receive the AQS
189 // param.
190 // For more details, see http://goto.google.com/binary-clients-logging.
191 base::string16 assisted_query_stats;
192 };
193 #endif // CHROME_COMMON_INSTANT_TYPES_H_
OLDNEW
« no previous file with comments | « chrome/common/OWNERS ('k') | chrome/common/instant_types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698