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 void Clear(); | |
sky
2012/08/14 17:10:10
newline between 43/44 and add a description. That
Shishir
2012/08/14 17:30:19
Removed the clear method.
| |
45 | |
46 string16 text; | |
47 InstantCompleteBehavior behavior; | |
48 InstantSuggestionType type; | |
49 }; | |
50 | |
51 // Omnibox dropdown matches provided by the native autocomplete providers. | |
52 struct InstantAutocompleteResult { | |
53 InstantAutocompleteResult(); | |
54 ~InstantAutocompleteResult(); | |
55 | |
56 // The provider name. May be empty. | |
57 string16 provider; | |
58 | |
59 // True iff this is a search suggestion. | |
60 bool is_search; | |
61 | |
62 // The title of the match. | |
63 string16 contents; | |
64 | |
65 // The URL of the match. | |
66 // TODO(dhollowa): Remove this once the privacy story is sorted out. | |
67 GURL destination_url; | |
68 | |
69 // The relevance score of this match. Same as the relevance score stored in | |
70 // AutocompleteMatch. | |
71 int relevance; | |
72 }; | |
73 | |
74 // How to interpret the size (height or width) of the Instant overlay (preview). | |
75 enum InstantSizeUnits { | |
76 // As an absolute number of pixels. | |
77 INSTANT_SIZE_PIXELS, | |
78 | |
79 // As a percentage of the height or width of the containing (parent) view. | |
80 INSTANT_SIZE_PERCENT, | |
20 }; | 81 }; |
21 | 82 |
22 #endif // CHROME_COMMON_INSTANT_TYPES_H_ | 83 #endif // CHROME_COMMON_INSTANT_TYPES_H_ |
OLD | NEW |