Move Webstore URL concepts to //extensions and out
[chromium-blink-merge.git] / chrome / common / instant_types.h
blob3cf8223c5434e846f60a22d8ea2d39397d9c398f
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_
8 #include <string>
9 #include <utility>
11 #include "base/basictypes.h"
12 #include "base/strings/string16.h"
13 #include "content/public/common/page_transition_types.h"
14 #include "url/gurl.h"
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;
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();
28 // Full suggested text.
29 base::string16 text;
31 // JSON metadata from the server response which produced this suggestion.
32 std::string metadata;
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,
44 // The tiling of the theme background image.
45 enum ThemeBackgroundImageTiling {
46 THEME_BKGRND_IMAGE_NO_REPEAT,
47 THEME_BKGRND_IMAGE_REPEAT_X,
48 THEME_BKGRND_IMAGE_REPEAT_Y,
49 THEME_BKGRND_IMAGE_REPEAT,
52 // The RGBA color components for the text and links of the theme.
53 struct RGBAColor {
54 RGBAColor();
55 ~RGBAColor();
57 bool operator==(const RGBAColor& rhs) const;
59 // The color in RGBA format where the R, G, B and A values
60 // are between 0 and 255 inclusive and always valid.
61 uint8 r;
62 uint8 g;
63 uint8 b;
64 uint8 a;
67 // Theme background settings for the NTP.
68 struct ThemeBackgroundInfo {
69 ThemeBackgroundInfo();
70 ~ThemeBackgroundInfo();
72 bool operator==(const ThemeBackgroundInfo& rhs) const;
74 // True if the default theme is selected.
75 bool using_default_theme;
77 // The theme background color in RGBA format always valid.
78 RGBAColor background_color;
80 // The theme text color in RGBA format.
81 RGBAColor text_color;
83 // The theme link color in RGBA format.
84 RGBAColor link_color;
86 // The theme text color light in RGBA format.
87 RGBAColor text_color_light;
89 // The theme color for the header in RGBA format.
90 RGBAColor header_color;
92 // The theme color for the section border in RGBA format.
93 RGBAColor section_border_color;
95 // The theme id for the theme background image.
96 // Value is only valid if there's a custom theme background image.
97 std::string theme_id;
99 // The theme background image horizontal alignment is only valid if |theme_id|
100 // is valid.
101 ThemeBackgroundImageAlignment image_horizontal_alignment;
103 // The theme background image vertical alignment is only valid if |theme_id|
104 // is valid.
105 ThemeBackgroundImageAlignment image_vertical_alignment;
107 // The theme background image tiling is only valid if |theme_id| is valid.
108 ThemeBackgroundImageTiling image_tiling;
110 // The theme background image height.
111 // Value is only valid if |theme_id| is valid.
112 uint16 image_height;
114 // True if theme has attribution logo.
115 // Value is only valid if |theme_id| is valid.
116 bool has_attribution;
118 // True if theme has an alternate logo.
119 bool logo_alternate;
122 struct InstantMostVisitedItem {
123 // The URL of the Most Visited item.
124 GURL url;
126 // The title of the Most Visited page. May be empty, in which case the |url|
127 // is used as the title.
128 base::string16 title;
131 // An InstantMostVisitedItem along with its assigned restricted ID.
132 typedef std::pair<InstantRestrictedID, InstantMostVisitedItem>
133 InstantMostVisitedItemIDPair;
135 #endif // CHROME_COMMON_INSTANT_TYPES_H_