| 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 UI_APP_LIST_SEARCH_RESULT_H_ | 5 #ifndef UI_APP_LIST_SEARCH_RESULT_H_ |
| 6 #define UI_APP_LIST_SEARCH_RESULT_H_ | 6 #define UI_APP_LIST_SEARCH_RESULT_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 DISPLAY_NONE = 0, | 42 DISPLAY_NONE = 0, |
| 43 DISPLAY_LIST, | 43 DISPLAY_LIST, |
| 44 DISPLAY_TILE, | 44 DISPLAY_TILE, |
| 45 DISPLAY_RECOMMENDATION, | 45 DISPLAY_RECOMMENDATION, |
| 46 DISPLAY_CARD, | 46 DISPLAY_CARD, |
| 47 // Add new values here. | 47 // Add new values here. |
| 48 | 48 |
| 49 DISPLAY_TYPE_LAST, | 49 DISPLAY_TYPE_LAST, |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 // Type of the search result. This should be set in corresponding subclass's |
| 53 // constructor. |
| 54 enum ResultType { |
| 55 RESULT_UNKNOWN, // Unknown type. |
| 56 RESULT_INSTALLED_APP, // Installed apps. |
| 57 RESULT_PLAYSTORE_APP, // Uninstalled apps from playstore. |
| 58 RESULT_INSTANT_APP, // Instant apps. |
| 59 // Add new values here. |
| 60 }; |
| 61 |
| 52 // A tagged range in search result text. | 62 // A tagged range in search result text. |
| 53 struct APP_LIST_EXPORT Tag { | 63 struct APP_LIST_EXPORT Tag { |
| 54 // Similar to ACMatchClassification::Style, the style values are not | 64 // Similar to ACMatchClassification::Style, the style values are not |
| 55 // mutually exclusive. | 65 // mutually exclusive. |
| 56 enum Style { | 66 enum Style { |
| 57 NONE = 0, | 67 NONE = 0, |
| 58 URL = 1 << 0, | 68 URL = 1 << 0, |
| 59 MATCH = 1 << 1, | 69 MATCH = 1 << 1, |
| 60 DIM = 1 << 2, | 70 DIM = 1 << 2, |
| 61 }; | 71 }; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 const std::string& id() const { return id_; } | 138 const std::string& id() const { return id_; } |
| 129 | 139 |
| 130 double relevance() const { return relevance_; } | 140 double relevance() const { return relevance_; } |
| 131 void set_relevance(double relevance) { relevance_ = relevance; } | 141 void set_relevance(double relevance) { relevance_ = relevance; } |
| 132 | 142 |
| 133 DisplayType display_type() const { return display_type_; } | 143 DisplayType display_type() const { return display_type_; } |
| 134 void set_display_type(DisplayType display_type) { | 144 void set_display_type(DisplayType display_type) { |
| 135 display_type_ = display_type; | 145 display_type_ = display_type; |
| 136 } | 146 } |
| 137 | 147 |
| 148 ResultType result_type() const { return result_type_; } |
| 149 void set_result_type(ResultType result_type) { result_type_ = result_type; } |
| 150 |
| 138 int distance_from_origin() { return distance_from_origin_; } | 151 int distance_from_origin() { return distance_from_origin_; } |
| 139 void set_distance_from_origin(int distance) { | 152 void set_distance_from_origin(int distance) { |
| 140 distance_from_origin_ = distance; | 153 distance_from_origin_ = distance; |
| 141 } | 154 } |
| 142 | 155 |
| 143 const Actions& actions() const { | 156 const Actions& actions() const { |
| 144 return actions_; | 157 return actions_; |
| 145 } | 158 } |
| 146 void SetActions(const Actions& sets); | 159 void SetActions(const Actions& sets); |
| 147 | 160 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // SearchProvider to set this property and own this view. | 229 // SearchProvider to set this property and own this view. |
| 217 views::View* view_ = nullptr; | 230 views::View* view_ = nullptr; |
| 218 | 231 |
| 219 // If view_ isn't null, indicates whether the mouse cursor is inside view_. | 232 // If view_ isn't null, indicates whether the mouse cursor is inside view_. |
| 220 bool mouse_is_in_view_ = false; | 233 bool mouse_is_in_view_ = false; |
| 221 | 234 |
| 222 std::string id_; | 235 std::string id_; |
| 223 double relevance_ = 0; | 236 double relevance_ = 0; |
| 224 DisplayType display_type_ = DISPLAY_LIST; | 237 DisplayType display_type_ = DISPLAY_LIST; |
| 225 | 238 |
| 239 ResultType result_type_ = RESULT_UNKNOWN; |
| 240 |
| 226 // The Manhattan distance from the origin of all search results to this | 241 // The Manhattan distance from the origin of all search results to this |
| 227 // result. This is logged for UMA. | 242 // result. This is logged for UMA. |
| 228 int distance_from_origin_ = -1; | 243 int distance_from_origin_ = -1; |
| 229 | 244 |
| 230 Actions actions_; | 245 Actions actions_; |
| 231 bool voice_result_ = false; | 246 bool voice_result_ = false; |
| 232 | 247 |
| 233 bool is_installing_ = false; | 248 bool is_installing_ = false; |
| 234 int percent_downloaded_ = 0; | 249 int percent_downloaded_ = 0; |
| 235 | 250 |
| 236 base::ObserverList<SearchResultObserver> observers_; | 251 base::ObserverList<SearchResultObserver> observers_; |
| 237 | 252 |
| 238 DISALLOW_COPY_AND_ASSIGN(SearchResult); | 253 DISALLOW_COPY_AND_ASSIGN(SearchResult); |
| 239 }; | 254 }; |
| 240 | 255 |
| 241 } // namespace app_list | 256 } // namespace app_list |
| 242 | 257 |
| 243 #endif // UI_APP_LIST_SEARCH_RESULT_H_ | 258 #endif // UI_APP_LIST_SEARCH_RESULT_H_ |
| OLD | NEW |