OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "base/string16.h" |
| 9 #include "googleurl/src/gurl.h" |
| 10 |
8 // Ways that the Instant suggested text is autocompleted into the omnibox. | 11 // Ways that the Instant suggested text is autocompleted into the omnibox. |
9 enum InstantCompleteBehavior { | 12 enum InstantCompleteBehavior { |
10 // Autocomplete the suggestion immediately. | 13 // Autocomplete the suggestion immediately. |
11 INSTANT_COMPLETE_NOW, | 14 INSTANT_COMPLETE_NOW, |
12 | 15 |
13 // Autocomplete the suggestion after a delay. | 16 // Autocomplete the suggestion after a delay. |
14 INSTANT_COMPLETE_DELAYED, | 17 INSTANT_COMPLETE_DELAYED, |
15 | 18 |
16 // Do not autocomplete the suggestion. The suggestion may still be displayed | 19 // Do not autocomplete the suggestion. The suggestion may still be displayed |
17 // in the omnibox, but not made a part of the omnibox text by default (e.g., | 20 // in the omnibox, but not made a part of the omnibox text by default (e.g., |
18 // by displaying the suggestion as non-highlighted, non-selected gray text). | 21 // by displaying the suggestion as non-highlighted, non-selected gray text). |
19 INSTANT_COMPLETE_NEVER, | 22 INSTANT_COMPLETE_NEVER, |
| 23 |
| 24 // Treat the suggested text as the entire omnibox text, effectively replacing |
| 25 // whatever the user has typed. |
| 26 INSTANT_COMPLETE_REPLACE, |
| 27 }; |
| 28 |
| 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 |
| 37 // of the suggestion and what completion behavior should be applied to it. |
| 38 struct InstantSuggestion { |
| 39 InstantSuggestion(); |
| 40 InstantSuggestion(const string16& text, |
| 41 InstantCompleteBehavior behavior, |
| 42 InstantSuggestionType type); |
| 43 ~InstantSuggestion(); |
| 44 |
| 45 string16 text; |
| 46 InstantCompleteBehavior behavior; |
| 47 InstantSuggestionType type; |
| 48 }; |
| 49 |
| 50 // Omnibox dropdown matches provided by the native autocomplete providers. |
| 51 struct InstantAutocompleteResult { |
| 52 InstantAutocompleteResult(); |
| 53 ~InstantAutocompleteResult(); |
| 54 |
| 55 // The provider name. May be empty. |
| 56 string16 provider; |
| 57 |
| 58 // True iff this is a search suggestion. |
| 59 bool is_search; |
| 60 |
| 61 // The title of the match. |
| 62 string16 contents; |
| 63 |
| 64 // The URL of the match. |
| 65 // TODO(dhollowa): Remove this once the privacy story is sorted out. |
| 66 GURL destination_url; |
| 67 |
| 68 // The relevance score of this match. Same as the relevance score stored in |
| 69 // AutocompleteMatch. |
| 70 int relevance; |
| 71 }; |
| 72 |
| 73 // How to interpret the size (height or width) of the Instant overlay (preview). |
| 74 enum InstantSizeUnits { |
| 75 // As an absolute number of pixels. |
| 76 INSTANT_SIZE_PIXELS, |
| 77 |
| 78 // As a percentage of the height or width of the containing (parent) view. |
| 79 INSTANT_SIZE_PERCENT, |
20 }; | 80 }; |
21 | 81 |
22 #endif // CHROME_COMMON_INSTANT_TYPES_H_ | 82 #endif // CHROME_COMMON_INSTANT_TYPES_H_ |
OLD | NEW |