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

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

Issue 12386019: Instant: Use only one hidden WebContents per profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_COMMON_INSTANT_TYPES_H_ 5 #ifndef CHROME_COMMON_INSTANT_TYPES_H_
6 #define CHROME_COMMON_INSTANT_TYPES_H_ 6 #define CHROME_COMMON_INSTANT_TYPES_H_
7 7
8 #include <string>
9
10 #include "base/string16.h" 8 #include "base/string16.h"
11 #include "content/public/common/page_transition_types.h" 9 #include "content/public/common/page_transition_types.h"
12 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
13 11
14 // Ways that the Instant suggested text is autocompleted into the omnibox. 12 // Ways that the Instant suggested text is autocompleted into the omnibox.
15 enum InstantCompleteBehavior { 13 enum InstantCompleteBehavior {
16 // Autocomplete the suggestion immediately. 14 // Autocomplete the suggestion immediately.
17 INSTANT_COMPLETE_NOW, 15 INSTANT_COMPLETE_NOW,
18 16
19 // Do not autocomplete the suggestion. The suggestion may still be displayed 17 // Do not autocomplete the suggestion. The suggestion may still be displayed
20 // in the omnibox, but not made a part of the omnibox text by default (e.g., 18 // in the omnibox, but not made a part of the omnibox text by default (e.g.,
21 // by displaying the suggestion as non-highlighted, non-selected gray text). 19 // by displaying the suggestion as non-highlighted, non-selected gray text).
22 INSTANT_COMPLETE_NEVER, 20 INSTANT_COMPLETE_NEVER,
23 21
24 // Treat the suggested text as the entire omnibox text, effectively replacing 22 // Treat the suggested text as the entire omnibox text, effectively replacing
25 // whatever the user has typed. 23 // whatever the user has typed.
26 INSTANT_COMPLETE_REPLACE, 24 INSTANT_COMPLETE_REPLACE,
27 }; 25 };
28 26
29 // The type of suggestion provided by Instant. For example, if Instant suggests
30 // "yahoo.com", should that be considered a search string or a URL?
31 enum InstantSuggestionType {
32 INSTANT_SUGGESTION_SEARCH,
33 INSTANT_SUGGESTION_URL,
34 };
35
36 // A wrapper to hold Instant suggested text and its metadata such as the type 27 // A wrapper to hold Instant suggested text and its metadata such as the type
37 // of the suggestion and what completion behavior should be applied to it. 28 // of the suggestion and what completion behavior should be applied to it.
38 struct InstantSuggestion { 29 struct InstantSuggestion {
39 InstantSuggestion(); 30 InstantSuggestion();
40 InstantSuggestion(const string16& text, 31 InstantSuggestion(const string16& in_text,
41 InstantCompleteBehavior behavior, 32 InstantCompleteBehavior in_behavior,
42 InstantSuggestionType type); 33 bool in_is_url);
43 ~InstantSuggestion(); 34 ~InstantSuggestion();
44 35
45 string16 text; 36 string16 text;
46 InstantCompleteBehavior behavior; 37 InstantCompleteBehavior behavior;
47 InstantSuggestionType type; 38 bool is_url; // Whether |text| is a search query or a URL.
48 }; 39 };
49 40
50 // Omnibox dropdown matches provided by the native autocomplete providers. 41 // Omnibox dropdown matches provided by the native autocomplete providers.
51 struct InstantAutocompleteResult { 42 struct InstantAutocompleteResult {
52 InstantAutocompleteResult(); 43 InstantAutocompleteResult();
53 ~InstantAutocompleteResult(); 44 ~InstantAutocompleteResult();
54 45
55 // The provider name, as returned by AutocompleteProvider::GetName(). 46 // The provider name, as returned by AutocompleteProvider::GetName().
56 string16 provider; 47 string16 provider;
57 48
58 // The type of the result, as returned by AutocompleteMatch::TypeToString(). 49 // The type of the result, as returned by AutocompleteMatch::TypeToString().
59 string16 type; 50 string16 type;
60 51
61 // The description (title), same as AutocompleteMatch::description. 52 // The description (title), same as AutocompleteMatch::description.
62 string16 description; 53 string16 description;
63 54
64 // The URL of the match, same as AutocompleteMatch::destination_url. 55 // The URL of the match, same as AutocompleteMatch::destination_url.
65 string16 destination_url; 56 GURL destination_url;
66 57
67 // The transition type to use when the user opens this match. Same as 58 // The transition type to use when the user opens this match. Same as
68 // AutocompleteMatch::transition. 59 // AutocompleteMatch::transition.
69 content::PageTransition transition; 60 content::PageTransition transition;
70 61
71 // The relevance score of this match, same as AutocompleteMatch::relevance. 62 // The relevance score of this match, same as AutocompleteMatch::relevance.
72 int relevance; 63 int relevance;
73 }; 64 };
74 65
75 // How to interpret the size (height or width) of the Instant overlay (preview).
76 enum InstantSizeUnits {
77 // As an absolute number of pixels.
78 INSTANT_SIZE_PIXELS,
79
80 // As a percentage of the height or width of the containing (parent) view.
81 INSTANT_SIZE_PERCENT,
82 };
83
84 // What the Instant page contains when it requests to be shown.
85 // TODO(jered): Delete this.
86 enum InstantShownReason {
87 // Contents are not specified; the page wants to be shown unconditionally.
88 // This is a stopgap to display in unexpected situations, and should not
89 // normally be used.
90 INSTANT_SHOWN_NOT_SPECIFIED,
91
92 // Custom content on the NTP, e.g. a custom logo.
93 INSTANT_SHOWN_CUSTOM_NTP_CONTENT,
94
95 // Query suggestions and search results relevant when the user is typing in
96 // the omnibox.
97 INSTANT_SHOWN_QUERY_SUGGESTIONS,
98
99 // ZeroSuggest suggestions relevant when the user has focused in the omnibox,
100 // but not yet typed anything.
101 INSTANT_SHOWN_ZERO_SUGGESTIONS,
102
103 // Search results in response to the user clicking a query suggestion.
104 INSTANT_SHOWN_CLICKED_QUERY_SUGGESTION,
105 };
106
107 // The alignment of the theme background image. 66 // The alignment of the theme background image.
108 enum ThemeBackgroundImageAlignment { 67 enum ThemeBackgroundImageAlignment {
109 THEME_BKGRND_IMAGE_ALIGN_CENTER, 68 THEME_BKGRND_IMAGE_ALIGN_CENTER,
110 THEME_BKGRND_IMAGE_ALIGN_LEFT, 69 THEME_BKGRND_IMAGE_ALIGN_LEFT,
111 THEME_BKGRND_IMAGE_ALIGN_TOP, 70 THEME_BKGRND_IMAGE_ALIGN_TOP,
112 THEME_BKGRND_IMAGE_ALIGN_RIGHT, 71 THEME_BKGRND_IMAGE_ALIGN_RIGHT,
113 THEME_BKGRND_IMAGE_ALIGN_BOTTOM, 72 THEME_BKGRND_IMAGE_ALIGN_BOTTOM,
114 }; 73 };
115 74
116 // The tiling of the theme background image. 75 // The tiling of the theme background image.
117 enum ThemeBackgroundImageTiling { 76 enum ThemeBackgroundImageTiling {
118 THEME_BKGRND_IMAGE_NO_REPEAT, 77 THEME_BKGRND_IMAGE_NO_REPEAT,
119 THEME_BKGRND_IMAGE_REPEAT_X, 78 THEME_BKGRND_IMAGE_REPEAT_X,
120 THEME_BKGRND_IMAGE_REPEAT_Y, 79 THEME_BKGRND_IMAGE_REPEAT_Y,
121 THEME_BKGRND_IMAGE_REPEAT, 80 THEME_BKGRND_IMAGE_REPEAT,
122 }; 81 };
123 82
124 struct ThemeBackgroundInfo { 83 struct ThemeBackgroundInfo {
125 ThemeBackgroundInfo(); 84 ThemeBackgroundInfo();
126 ~ThemeBackgroundInfo(); 85 ~ThemeBackgroundInfo();
127 86
128 // The theme background color in RGBA format where the R, G, B and A values 87 // The theme background color in RGBA format where the R, G, B and A values
129 // are between 0 and 255 inclusive and always valid. 88 // are between 0 and 255 inclusive and always valid.
130 int color_r; 89 int color_r;
131 int color_g; 90 int color_g;
132 int color_b; 91 int color_b;
133 int color_a; 92 int color_a;
134 93
135 // The theme id for the theme background image. 94 // The theme ID for the theme background image is only valid if there's a
136 // Value is only valid if there's a custom theme background image. 95 // custom theme background image.
137 std::string theme_id; 96 string16 theme_id;
138 97
139 // The theme background image horizontal alignment is only valid if |theme_id| 98 // The theme background image horizontal alignment is only valid if |theme_id|
140 // is valid. 99 // is valid.
141 ThemeBackgroundImageAlignment image_horizontal_alignment; 100 ThemeBackgroundImageAlignment image_horizontal_alignment;
142 101
143 // The theme background image vertical alignment is only valid if |theme_id| 102 // The theme background image vertical alignment is only valid if |theme_id|
144 // is valid. 103 // is valid.
145 ThemeBackgroundImageAlignment image_vertical_alignment; 104 ThemeBackgroundImageAlignment image_vertical_alignment;
146 105
147 // The theme background image top offset is only valid if 106 // The theme background image top offset is only valid if
148 // |image_vertical_alignment| is |THEME_BKGRND_IMAGE_ALIGN_TOP|. 107 // |image_vertical_alignment| is |THEME_BKGRND_IMAGE_ALIGN_TOP|.
149 int image_top_offset; 108 int image_top_offset;
150 109
151 // The theme background image tiling is only valid if |theme_id| is valid. 110 // The theme background image tiling is only valid if |theme_id| is valid.
152 ThemeBackgroundImageTiling image_tiling; 111 ThemeBackgroundImageTiling image_tiling;
153 112
154 // The theme background image height. 113 // The theme background image height is only valid if |theme_id| is valid.
155 // Value is only valid if |theme_id| is valid.
156 uint16 image_height; 114 uint16 image_height;
157 }; 115 };
158 116
159 // A most visited item. 117 // A most visited item.
160 struct MostVisitedItem { 118 struct MostVisitedItem {
119 MostVisitedItem();
120 MostVisitedItem(const GURL& in_url, const string16& in_title);
121 ~MostVisitedItem();
122
161 // URL of the most visited page. 123 // URL of the most visited page.
162 GURL url; 124 GURL url;
163 125
164 // Title of the most visited page. 126 // Title of the most visited page.
165 string16 title; 127 string16 title;
166 }; 128 };
167 129
168 #endif // CHROME_COMMON_INSTANT_TYPES_H_ 130 #endif // CHROME_COMMON_INSTANT_TYPES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698