OLD | NEW |
---|---|
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> | 8 #include <string> |
sreeram
2013/03/14 23:05:36
#include <utility>
Shishir
2013/03/15 17:31:15
Done.
| |
9 | 9 |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
11 #include "content/public/common/page_transition_types.h" | 11 #include "content/public/common/page_transition_types.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 | 13 |
14 // ID used by Instant code to refer to objects (e.g. Autocomplete results, Most | |
15 // Visited items) that the Instant page needs access to. | |
16 typedef int InstantRestrictedID; | |
17 | |
18 // The size of the InstantMostVisitedItem cache. | |
19 const size_t kMaxInstantMostVisitedItemCacheSize = 100; | |
20 | |
14 // Ways that the Instant suggested text is autocompleted into the omnibox. | 21 // Ways that the Instant suggested text is autocompleted into the omnibox. |
15 enum InstantCompleteBehavior { | 22 enum InstantCompleteBehavior { |
16 // Autocomplete the suggestion immediately. | 23 // Autocomplete the suggestion immediately. |
17 INSTANT_COMPLETE_NOW, | 24 INSTANT_COMPLETE_NOW, |
18 | 25 |
19 // Do not autocomplete the suggestion. The suggestion may still be displayed | 26 // 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., | 27 // 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). | 28 // by displaying the suggestion as non-highlighted, non-selected gray text). |
22 INSTANT_COMPLETE_NEVER, | 29 INSTANT_COMPLETE_NEVER, |
23 | 30 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 string16 destination_url; | 72 string16 destination_url; |
66 | 73 |
67 // The transition type to use when the user opens this match. Same as | 74 // The transition type to use when the user opens this match. Same as |
68 // AutocompleteMatch::transition. | 75 // AutocompleteMatch::transition. |
69 content::PageTransition transition; | 76 content::PageTransition transition; |
70 | 77 |
71 // The relevance score of this match, same as AutocompleteMatch::relevance. | 78 // The relevance score of this match, same as AutocompleteMatch::relevance. |
72 int relevance; | 79 int relevance; |
73 }; | 80 }; |
74 | 81 |
82 // An InstantAutocompleteResult along with its assigned restricted ID. | |
83 typedef std::pair<InstantRestrictedID, InstantAutocompleteResult> | |
84 InstantAutocompleteResultIDPair; | |
85 | |
75 // How to interpret the size (height or width) of the Instant overlay (preview). | 86 // How to interpret the size (height or width) of the Instant overlay (preview). |
76 enum InstantSizeUnits { | 87 enum InstantSizeUnits { |
77 // As an absolute number of pixels. | 88 // As an absolute number of pixels. |
78 INSTANT_SIZE_PIXELS, | 89 INSTANT_SIZE_PIXELS, |
79 | 90 |
80 // As a percentage of the height or width of the containing (parent) view. | 91 // As a percentage of the height or width of the containing (parent) view. |
81 INSTANT_SIZE_PERCENT, | 92 INSTANT_SIZE_PERCENT, |
82 }; | 93 }; |
83 | 94 |
84 // What the Instant page contains when it requests to be shown. | 95 // What the Instant page contains when it requests to be shown. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 | 157 |
147 // The theme background image tiling is only valid if |theme_id| is valid. | 158 // The theme background image tiling is only valid if |theme_id| is valid. |
148 ThemeBackgroundImageTiling image_tiling; | 159 ThemeBackgroundImageTiling image_tiling; |
149 | 160 |
150 // The theme background image height. | 161 // The theme background image height. |
151 // Value is only valid if |theme_id| is valid. | 162 // Value is only valid if |theme_id| is valid. |
152 uint16 image_height; | 163 uint16 image_height; |
153 }; | 164 }; |
154 | 165 |
155 struct InstantMostVisitedItem { | 166 struct InstantMostVisitedItem { |
156 InstantMostVisitedItem() : most_visited_item_id(0) {} | |
157 | |
158 // A private identifier used on the browser side when retrieving assets. | |
159 uint64 most_visited_item_id; | |
160 | |
161 // The URL of the Most Visited item. | 167 // The URL of the Most Visited item. |
162 GURL url; | 168 GURL url; |
163 | 169 |
164 // The title of the Most Visited page. May be empty, in which case the |url| | 170 // The title of the Most Visited page. May be empty, in which case the |url| |
165 // is used as the title. | 171 // is used as the title. |
166 string16 title; | 172 string16 title; |
167 }; | 173 }; |
168 | 174 |
175 // An InstantMostVisitedItem along with its assigned restricted ID. | |
176 typedef std::pair<InstantRestrictedID, InstantMostVisitedItem> | |
177 InstantMostVisitedItemIDPair; | |
178 | |
169 #endif // CHROME_COMMON_INSTANT_TYPES_H_ | 179 #endif // CHROME_COMMON_INSTANT_TYPES_H_ |
OLD | NEW |