OLD | NEW |
---|---|
1 // Copyright (c) 2011 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 // Enum describing the ways instant suggest text can be completed. | 8 #include <string> |
9 | |
10 #include "googleurl/src/gurl.h" | |
11 | |
12 // Ways that the Instant suggested text is autocompleted into the omnibox. | |
9 enum InstantCompleteBehavior { | 13 enum InstantCompleteBehavior { |
10 // Complete the suggestion now. | 14 // Autocomplete the suggestion immediately. |
11 INSTANT_COMPLETE_NOW, | 15 INSTANT_COMPLETE_NOW, |
12 | 16 |
13 // Complete the suggestion after a delay. | 17 // Autocomplete the suggestion after a delay. |
14 INSTANT_COMPLETE_DELAYED, | 18 INSTANT_COMPLETE_DELAYED, |
15 | 19 |
16 // Never complete the suggestion. | 20 // Do not autocomplete the suggestion. The suggestion may still be displayed |
17 INSTANT_COMPLETE_NEVER | 21 // in the omnibox, but not made a part of the omnibox text by default (e.g., |
22 // by displaying the suggestion as non-highlighted, non-selected gray text). | |
23 INSTANT_COMPLETE_NEVER, | |
24 | |
25 // Treat the suggested text as the entire omnibox text, effectively replacing | |
26 // whatever the user has typed. | |
27 INSTANT_COMPLETE_REPLACE, | |
28 }; | |
29 | |
30 // The type of suggestion provided by Instant. For example, if Instant suggests | |
31 // "yahoo.com", should that be considered a search string or a URL? | |
32 enum InstantSuggestionType { | |
33 INSTANT_SUGGESTION_SEARCH, | |
34 INSTANT_SUGGESTION_URL, | |
35 }; | |
36 | |
37 // A wrapper to hold Instant suggested text and its metadata such as the type | |
38 // of the suggestion and what completion behavior should be applied to it. | |
39 struct InstantSuggestion { | |
40 InstantSuggestion(); | |
41 InstantSuggestion(const std::string& text, | |
42 InstantCompleteBehavior behavior, | |
43 InstantSuggestionType type); | |
44 ~InstantSuggestion(); | |
45 | |
46 std::string text; | |
47 InstantCompleteBehavior behavior; | |
48 InstantSuggestionType type; | |
49 }; | |
50 | |
51 // Omnibox dropdown matches provided by the native autocomplete providers. | |
52 struct InstantNativeSuggestionsParts { | |
sky
2012/07/24 23:00:23
'native' is a bit confusing here. I think this sho
Shishir
2012/07/24 23:28:07
The naming is to be consistent with the JS API: On
sreeram
2012/07/25 17:48:23
I agree that "native" is confusing. When I first j
| |
53 InstantNativeSuggestionsParts(); | |
54 ~InstantNativeSuggestionsParts(); | |
55 | |
56 // The provider name. May be empty. | |
57 std::string provider; | |
58 | |
59 // True iff this is a search suggestion. | |
60 bool is_search; | |
61 | |
62 // The title of the match. | |
63 std::string 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, | |
18 }; | 81 }; |
19 | 82 |
20 #endif // CHROME_COMMON_INSTANT_TYPES_H_ | 83 #endif // CHROME_COMMON_INSTANT_TYPES_H_ |
OLD | NEW |