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
,
43 // The tiling of the theme background image.
44 enum ThemeBackgroundImageTiling
{
45 THEME_BKGRND_IMAGE_NO_REPEAT
,
46 THEME_BKGRND_IMAGE_REPEAT_X
,
47 THEME_BKGRND_IMAGE_REPEAT_Y
,
48 THEME_BKGRND_IMAGE_REPEAT
,
51 // The RGBA color components for the text and links of the theme.
56 bool operator==(const RGBAColor
& rhs
) const;
58 // The color in RGBA format where the R, G, B and A values
59 // are between 0 and 255 inclusive and always valid.
66 // Theme background settings for the NTP.
67 struct ThemeBackgroundInfo
{
68 ThemeBackgroundInfo();
69 ~ThemeBackgroundInfo();
71 bool operator==(const ThemeBackgroundInfo
& rhs
) const;
73 // True if the default theme is selected.
74 bool using_default_theme
;
76 // The theme background color in RGBA format always valid.
77 RGBAColor background_color
;
79 // The theme text color in RGBA format.
82 // The theme link color in RGBA format.
85 // The theme text color light in RGBA format.
86 RGBAColor text_color_light
;
88 // The theme color for the header in RGBA format.
89 RGBAColor header_color
;
91 // The theme color for the section border in RGBA format.
92 RGBAColor section_border_color
;
94 // The theme id for the theme background image.
95 // Value is only valid if there's a custom theme background image.
98 // The theme background image horizontal alignment is only valid if |theme_id|
100 ThemeBackgroundImageAlignment image_horizontal_alignment
;
102 // The theme background image vertical alignment is only valid if |theme_id|
104 ThemeBackgroundImageAlignment image_vertical_alignment
;
106 // The theme background image tiling is only valid if |theme_id| is valid.
107 ThemeBackgroundImageTiling image_tiling
;
109 // The theme background image height.
110 // Value is only valid if |theme_id| is valid.
113 // True if theme has attribution logo.
114 // Value is only valid if |theme_id| is valid.
115 bool has_attribution
;
117 // True if theme has an alternate logo.
121 struct InstantMostVisitedItem
{
122 // The URL of the Most Visited item.
125 // The title of the Most Visited page. May be empty, in which case the |url|
126 // is used as the title.
127 base::string16 title
;
130 // An InstantMostVisitedItem along with its assigned restricted ID.
131 typedef std::pair
<InstantRestrictedID
, InstantMostVisitedItem
>
132 InstantMostVisitedItemIDPair
;
134 #endif // CHROME_COMMON_INSTANT_TYPES_H_