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 | 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 // visisted items) that the Instant page needs access to. | |
dhollowa
2013/03/14 00:02:43
nit: "Autocomplete results", "Most Visited items"
Shishir
2013/03/14 19:53:03
Done.
| |
16 typedef int InstantRestrictedID; | |
palmer
2013/03/13 23:50:37
This should be an unsigned int (it never goes < 0,
dhollowa
2013/03/14 00:02:43
unsigned int
Shishir
2013/03/14 19:53:03
From "base/basictypes.h"
// NOTE: unsigned types
Shishir
2013/03/14 19:53:03
Ditto.
dhollowa
2013/03/14 23:40:00
I'm fine with int.
palmer
2013/03/15 01:47:53
That comment is wrong. The problem is when you com
Shishir
2013/03/15 17:31:15
With the current code there is no strict requireme
| |
17 | |
14 // Ways that the Instant suggested text is autocompleted into the omnibox. | 18 // Ways that the Instant suggested text is autocompleted into the omnibox. |
15 enum InstantCompleteBehavior { | 19 enum InstantCompleteBehavior { |
16 // Autocomplete the suggestion immediately. | 20 // Autocomplete the suggestion immediately. |
17 INSTANT_COMPLETE_NOW, | 21 INSTANT_COMPLETE_NOW, |
18 | 22 |
19 // Do not autocomplete the suggestion. The suggestion may still be displayed | 23 // 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., | 24 // 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). | 25 // by displaying the suggestion as non-highlighted, non-selected gray text). |
22 INSTANT_COMPLETE_NEVER, | 26 INSTANT_COMPLETE_NEVER, |
23 | 27 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 string16 destination_url; | 69 string16 destination_url; |
66 | 70 |
67 // The transition type to use when the user opens this match. Same as | 71 // The transition type to use when the user opens this match. Same as |
68 // AutocompleteMatch::transition. | 72 // AutocompleteMatch::transition. |
69 content::PageTransition transition; | 73 content::PageTransition transition; |
70 | 74 |
71 // The relevance score of this match, same as AutocompleteMatch::relevance. | 75 // The relevance score of this match, same as AutocompleteMatch::relevance. |
72 int relevance; | 76 int relevance; |
73 }; | 77 }; |
74 | 78 |
79 // An InstantAutocompleteResult along with its assigned restricted ID. | |
80 typedef std::pair<InstantRestrictedID, InstantAutocompleteResult> | |
81 InstantAutocompleteResultIDPair; | |
82 | |
75 // How to interpret the size (height or width) of the Instant overlay (preview). | 83 // How to interpret the size (height or width) of the Instant overlay (preview). |
76 enum InstantSizeUnits { | 84 enum InstantSizeUnits { |
77 // As an absolute number of pixels. | 85 // As an absolute number of pixels. |
78 INSTANT_SIZE_PIXELS, | 86 INSTANT_SIZE_PIXELS, |
79 | 87 |
80 // As a percentage of the height or width of the containing (parent) view. | 88 // As a percentage of the height or width of the containing (parent) view. |
81 INSTANT_SIZE_PERCENT, | 89 INSTANT_SIZE_PERCENT, |
82 }; | 90 }; |
83 | 91 |
84 // What the Instant page contains when it requests to be shown. | 92 // 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 | 154 |
147 // The theme background image tiling is only valid if |theme_id| is valid. | 155 // The theme background image tiling is only valid if |theme_id| is valid. |
148 ThemeBackgroundImageTiling image_tiling; | 156 ThemeBackgroundImageTiling image_tiling; |
149 | 157 |
150 // The theme background image height. | 158 // The theme background image height. |
151 // Value is only valid if |theme_id| is valid. | 159 // Value is only valid if |theme_id| is valid. |
152 uint16 image_height; | 160 uint16 image_height; |
153 }; | 161 }; |
154 | 162 |
155 struct InstantMostVisitedItem { | 163 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. | 164 // The URL of the Most Visited item. |
162 GURL url; | 165 GURL url; |
163 | 166 |
164 // The title of the Most Visited page. May be empty, in which case the |url| | 167 // The title of the Most Visited page. May be empty, in which case the |url| |
165 // is used as the title. | 168 // is used as the title. |
166 string16 title; | 169 string16 title; |
167 }; | 170 }; |
168 | 171 |
172 // An InstantMostVisitedItem along with its assigned restricted ID. | |
173 typedef std::pair<InstantRestrictedID, InstantMostVisitedItem> | |
174 InstantMostVisitedItemIDPair; | |
175 | |
169 #endif // CHROME_COMMON_INSTANT_TYPES_H_ | 176 #endif // CHROME_COMMON_INSTANT_TYPES_H_ |
OLD | NEW |