| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // True if theme has attribution logo. | 152 // True if theme has attribution logo. |
| 141 // Value is only valid if |theme_id| is valid. | 153 // Value is only valid if |theme_id| is valid. |
| 142 bool has_attribution; | 154 bool has_attribution; |
| 143 }; | 155 }; |
| 144 | 156 |
| 145 struct InstantMostVisitedItem { | 157 struct InstantMostVisitedItem { |
| 146 InstantMostVisitedItem() : most_visited_item_id(0) {} | |
| 147 | |
| 148 // A private identifier used on the browser side when retrieving assets. | |
| 149 uint64 most_visited_item_id; | |
| 150 | |
| 151 // The URL of the Most Visited item. | 158 // The URL of the Most Visited item. |
| 152 GURL url; | 159 GURL url; |
| 153 | 160 |
| 154 // The title of the Most Visited page. May be empty, in which case the |url| | 161 // The title of the Most Visited page. May be empty, in which case the |url| |
| 155 // is used as the title. | 162 // is used as the title. |
| 156 string16 title; | 163 string16 title; |
| 157 }; | 164 }; |
| 158 | 165 |
| 166 // An InstantMostVisitedItem along with its assigned restricted ID. |
| 167 typedef std::pair<InstantRestrictedID, InstantMostVisitedItem> |
| 168 InstantMostVisitedItemIDPair; |
| 169 |
| 159 #endif // CHROME_COMMON_INSTANT_TYPES_H_ | 170 #endif // CHROME_COMMON_INSTANT_TYPES_H_ |
| OLD | NEW |