Files.app: Stop to use file system URLs having externalfile:// scheme origin internally.
[chromium-blink-merge.git] / chrome / common / instant_types.h
blobe482a52a8946aacc0082c6d39b706791e4c5569f
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 "url/gurl.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 {
22 InstantSuggestion();
23 InstantSuggestion(const base::string16& in_text,
24 const std::string& in_metadata);
25 ~InstantSuggestion();
27 // Full suggested text.
28 base::string16 text;
30 // JSON metadata from the server response which produced this suggestion.
31 std::string metadata;
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.
52 struct RGBAColor {
53 RGBAColor();
54 ~RGBAColor();
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.
60 uint8 r;
61 uint8 g;
62 uint8 b;
63 uint8 a;
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.
80 RGBAColor text_color;
82 // The theme link color in RGBA format.
83 RGBAColor link_color;
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.
96 std::string theme_id;
98 // The theme background image horizontal alignment is only valid if |theme_id|
99 // is valid.
100 ThemeBackgroundImageAlignment image_horizontal_alignment;
102 // The theme background image vertical alignment is only valid if |theme_id|
103 // is valid.
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.
111 uint16 image_height;
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.
118 bool logo_alternate;
121 struct InstantMostVisitedItem {
122 // The URL of the Most Visited item.
123 GURL url;
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_