12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_COMMON_INSTANT_TYPES_H_ 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_COMMON_INSTANT_TYPES_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include <string> 92a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include <utility> 102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 117dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "base/basictypes.h" 12868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/strings/string16.h" 137dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "url/gurl.h" 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// ID used by Instant code to refer to objects (e.g. Autocomplete results, Most 162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Visited items) that the Instant page needs access to. 172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)typedef int InstantRestrictedID; 182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 19424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// A wrapper to hold Instant suggested text and its metadata. Used to tell the 20424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)// server what suggestion to prefetch. 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)struct InstantSuggestion { 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) InstantSuggestion(); 23a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) InstantSuggestion(const base::string16& in_text, 24424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) const std::string& in_metadata); 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ~InstantSuggestion(); 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Full suggested text. 28a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) base::string16 text; 292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 30424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // JSON metadata from the server response which produced this suggestion. 31424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) std::string metadata; 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// The alignment of the theme background image. 352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)enum ThemeBackgroundImageAlignment { 362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) THEME_BKGRND_IMAGE_ALIGN_CENTER, 372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) THEME_BKGRND_IMAGE_ALIGN_LEFT, 382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) THEME_BKGRND_IMAGE_ALIGN_TOP, 392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) THEME_BKGRND_IMAGE_ALIGN_RIGHT, 402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) THEME_BKGRND_IMAGE_ALIGN_BOTTOM, 412a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}; 422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// The tiling of the theme background image. 442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)enum ThemeBackgroundImageTiling { 452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) THEME_BKGRND_IMAGE_NO_REPEAT, 462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) THEME_BKGRND_IMAGE_REPEAT_X, 472a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) THEME_BKGRND_IMAGE_REPEAT_Y, 482a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) THEME_BKGRND_IMAGE_REPEAT, 492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}; 502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 517dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// The RGBA color components for the text and links of the theme. 527dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochstruct RGBAColor { 537dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch RGBAColor(); 547dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch ~RGBAColor(); 557dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 567dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch bool operator==(const RGBAColor& rhs) const; 577dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 587dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // The color in RGBA format where the R, G, B and A values 597dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // are between 0 and 255 inclusive and always valid. 607dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch uint8 r; 617dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch uint8 g; 627dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch uint8 b; 637dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch uint8 a; 647dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch}; 657dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 667dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// Theme background settings for the NTP. 672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)struct ThemeBackgroundInfo { 682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) ThemeBackgroundInfo(); 692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) ~ThemeBackgroundInfo(); 702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 71eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch bool operator==(const ThemeBackgroundInfo& rhs) const; 72eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch 737dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // True if the default theme is selected. 747dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch bool using_default_theme; 757dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 767dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // The theme background color in RGBA format always valid. 777dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch RGBAColor background_color; 787dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 797dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // The theme text color in RGBA format. 807dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch RGBAColor text_color; 817dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 827dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // The theme link color in RGBA format. 837dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch RGBAColor link_color; 847dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 857dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // The theme text color light in RGBA format. 867dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch RGBAColor text_color_light; 877dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 887dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // The theme color for the header in RGBA format. 897dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch RGBAColor header_color; 907dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 917dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // The theme color for the section border in RGBA format. 927dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch RGBAColor section_border_color; 932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // The theme id for the theme background image. 952a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Value is only valid if there's a custom theme background image. 962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) std::string theme_id; 972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // The theme background image horizontal alignment is only valid if |theme_id| 992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // is valid. 1002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) ThemeBackgroundImageAlignment image_horizontal_alignment; 1012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // The theme background image vertical alignment is only valid if |theme_id| 1032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // is valid. 1042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) ThemeBackgroundImageAlignment image_vertical_alignment; 1052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // The theme background image tiling is only valid if |theme_id| is valid. 1072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) ThemeBackgroundImageTiling image_tiling; 1082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // The theme background image height. 1102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Value is only valid if |theme_id| is valid. 1112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) uint16 image_height; 1122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // True if theme has attribution logo. 1142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Value is only valid if |theme_id| is valid. 1152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool has_attribution; 1167dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 1177dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // True if theme has an alternate logo. 1187dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch bool logo_alternate; 1192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}; 1202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)struct InstantMostVisitedItem { 1222a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // The URL of the Most Visited item. 1232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) GURL url; 1242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // The title of the Most Visited page. May be empty, in which case the |url| 1262a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // is used as the title. 127a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) base::string16 title; 1282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}; 1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// An InstantMostVisitedItem along with its assigned restricted ID. 1312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)typedef std::pair<InstantRestrictedID, InstantMostVisitedItem> 1322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) InstantMostVisitedItemIDPair; 1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // CHROME_COMMON_INSTANT_TYPES_H_ 135