| 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& in_text, |
| 42 InstantCompleteBehavior in_behavior, |
| 43 InstantSuggestionType in_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 { |
| 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. |
| 70 int relevance; |
| 71 }; |
| 72 |
| 73 // How to interpret the size (dimensions) 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 size of the containing (parent) view. |
| 79 INSTANT_SIZE_PERCENT, |
| 18 }; | 80 }; |
| 19 | 81 |
| 20 #endif // CHROME_COMMON_INSTANT_TYPES_H_ | 82 #endif // CHROME_COMMON_INSTANT_TYPES_H_ |
| OLD | NEW |