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> |
| 9 #include <utility> |
9 | 10 |
10 #include "base/string16.h" | 11 #include "base/string16.h" |
11 #include "content/public/common/page_transition_types.h" | 12 #include "content/public/common/page_transition_types.h" |
12 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
13 | 14 |
| 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; |
| 18 |
| 19 // The size of the InstantMostVisitedItem cache. |
| 20 const size_t kMaxInstantMostVisitedItemCacheSize = 100; |
| 21 |
14 // Ways that the Instant suggested text is autocompleted into the omnibox. | 22 // Ways that the Instant suggested text is autocompleted into the omnibox. |
15 enum InstantCompleteBehavior { | 23 enum InstantCompleteBehavior { |
16 // Autocomplete the suggestion immediately. | 24 // Autocomplete the suggestion immediately. |
17 INSTANT_COMPLETE_NOW, | 25 INSTANT_COMPLETE_NOW, |
18 | 26 |
19 // Do not autocomplete the suggestion. The suggestion may still be displayed | 27 // 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., | 28 // 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). | 29 // by displaying the suggestion as non-highlighted, non-selected gray text). |
22 INSTANT_COMPLETE_NEVER, | 30 INSTANT_COMPLETE_NEVER, |
23 | 31 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 string16 destination_url; | 82 string16 destination_url; |
75 | 83 |
76 // The transition type to use when the user opens this match. Same as | 84 // The transition type to use when the user opens this match. Same as |
77 // AutocompleteMatch::transition. | 85 // AutocompleteMatch::transition. |
78 content::PageTransition transition; | 86 content::PageTransition transition; |
79 | 87 |
80 // The relevance score of this match, same as AutocompleteMatch::relevance. | 88 // The relevance score of this match, same as AutocompleteMatch::relevance. |
81 int relevance; | 89 int relevance; |
82 }; | 90 }; |
83 | 91 |
| 92 // An InstantAutocompleteResult along with its assigned restricted ID. |
| 93 typedef std::pair<InstantRestrictedID, InstantAutocompleteResult> |
| 94 InstantAutocompleteResultIDPair; |
| 95 |
84 // How to interpret the size (height or width) of the Instant overlay (preview). | 96 // How to interpret the size (height or width) of the Instant overlay (preview). |
85 enum InstantSizeUnits { | 97 enum InstantSizeUnits { |
86 // As an absolute number of pixels. | 98 // As an absolute number of pixels. |
87 INSTANT_SIZE_PIXELS, | 99 INSTANT_SIZE_PIXELS, |
88 | 100 |
89 // As a percentage of the height or width of the containing (parent) view. | 101 // As a percentage of the height or width of the containing (parent) view. |
90 INSTANT_SIZE_PERCENT, | 102 INSTANT_SIZE_PERCENT, |
91 }; | 103 }; |
92 | 104 |
93 // The alignment of the theme background image. | 105 // The alignment of the theme background image. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 144 |
133 // The theme background image tiling is only valid if |theme_id| is valid. | 145 // The theme background image tiling is only valid if |theme_id| is valid. |
134 ThemeBackgroundImageTiling image_tiling; | 146 ThemeBackgroundImageTiling image_tiling; |
135 | 147 |
136 // The theme background image height. | 148 // The theme background image height. |
137 // Value is only valid if |theme_id| is valid. | 149 // Value is only valid if |theme_id| is valid. |
138 uint16 image_height; | 150 uint16 image_height; |
139 }; | 151 }; |
140 | 152 |
141 struct InstantMostVisitedItem { | 153 struct InstantMostVisitedItem { |
142 InstantMostVisitedItem() : most_visited_item_id(0) {} | |
143 | |
144 // A private identifier used on the browser side when retrieving assets. | |
145 uint64 most_visited_item_id; | |
146 | |
147 // The URL of the Most Visited item. | 154 // The URL of the Most Visited item. |
148 GURL url; | 155 GURL url; |
149 | 156 |
150 // The title of the Most Visited page. May be empty, in which case the |url| | 157 // The title of the Most Visited page. May be empty, in which case the |url| |
151 // is used as the title. | 158 // is used as the title. |
152 string16 title; | 159 string16 title; |
153 }; | 160 }; |
154 | 161 |
| 162 // An InstantMostVisitedItem along with its assigned restricted ID. |
| 163 typedef std::pair<InstantRestrictedID, InstantMostVisitedItem> |
| 164 InstantMostVisitedItemIDPair; |
| 165 |
155 #endif // CHROME_COMMON_INSTANT_TYPES_H_ | 166 #endif // CHROME_COMMON_INSTANT_TYPES_H_ |
OLD | NEW |