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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "ui/app_list/app_list_export.h" | 14 #include "ui/app_list/app_list_export.h" |
15 #include "ui/gfx/image/image_skia.h" | 15 #include "ui/gfx/image/image_skia.h" |
16 #include "ui/gfx/range/range.h" | 16 #include "ui/gfx/range/range.h" |
17 | 17 |
18 namespace ui { | 18 namespace ui { |
19 class MenuModel; | 19 class MenuModel; |
20 } | 20 } |
21 | 21 |
22 namespace app_list { | 22 namespace app_list { |
23 | 23 |
24 class SearchResultObserver; | 24 class SearchResultObserver; |
25 class TokenizedString; | |
26 class TokenizedStringMatch; | |
25 | 27 |
26 // SearchResult consists of an icon, title text and details text. Title and | 28 // SearchResult consists of an icon, title text and details text. Title and |
27 // details text can have tagged ranges that are displayed differently from | 29 // details text can have tagged ranges that are displayed differently from |
28 // default style. | 30 // default style. |
29 class APP_LIST_EXPORT SearchResult { | 31 class APP_LIST_EXPORT SearchResult { |
30 public: | 32 public: |
31 // How the result should be displayed. Do not change the order of these as | 33 // How the result should be displayed. Do not change the order of these as |
32 // they are used for metrics. | 34 // they are used for metrics. |
33 enum DisplayType { | 35 enum DisplayType { |
34 DISPLAY_NONE = 0, | 36 DISPLAY_NONE = 0, |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 void SetPercentDownloaded(int percent_downloaded); | 130 void SetPercentDownloaded(int percent_downloaded); |
129 | 131 |
130 // Returns the dimension at which this result's icon should be displayed. | 132 // Returns the dimension at which this result's icon should be displayed. |
131 int GetPreferredIconDimension() const; | 133 int GetPreferredIconDimension() const; |
132 | 134 |
133 void NotifyItemInstalled(); | 135 void NotifyItemInstalled(); |
134 | 136 |
135 void AddObserver(SearchResultObserver* observer); | 137 void AddObserver(SearchResultObserver* observer); |
136 void RemoveObserver(SearchResultObserver* observer); | 138 void RemoveObserver(SearchResultObserver* observer); |
137 | 139 |
140 // Updates the results relevance score, and sets its title and title tags, | |
calamity
2015/04/30 06:36:06
nit: result's?
Matt Giuca
2015/05/11 04:53:21
Done.
| |
141 // based on a string match result. | |
142 void UpdateFromMatch(const TokenizedString& title, | |
143 const TokenizedStringMatch& match); | |
144 | |
138 // TODO(mukai): Remove this method and really simplify the ownership of | 145 // TODO(mukai): Remove this method and really simplify the ownership of |
139 // SearchResult. Ideally, SearchResult will be copyable. | 146 // SearchResult. Ideally, SearchResult will be copyable. |
140 virtual scoped_ptr<SearchResult> Duplicate() const = 0; | 147 virtual scoped_ptr<SearchResult> Duplicate() const = 0; |
141 | 148 |
142 // Opens the result. | 149 // Opens the result. |
143 virtual void Open(int event_flags); | 150 virtual void Open(int event_flags); |
144 | 151 |
145 // Invokes a custom action on the result. It does nothing by default. | 152 // Invokes a custom action on the result. It does nothing by default. |
146 virtual void InvokeAction(int action_index, int event_flags); | 153 virtual void InvokeAction(int action_index, int event_flags); |
147 | 154 |
(...skipping 26 matching lines...) Expand all Loading... | |
174 int percent_downloaded_; | 181 int percent_downloaded_; |
175 | 182 |
176 ObserverList<SearchResultObserver> observers_; | 183 ObserverList<SearchResultObserver> observers_; |
177 | 184 |
178 DISALLOW_COPY_AND_ASSIGN(SearchResult); | 185 DISALLOW_COPY_AND_ASSIGN(SearchResult); |
179 }; | 186 }; |
180 | 187 |
181 } // namespace app_list | 188 } // namespace app_list |
182 | 189 |
183 #endif // UI_APP_LIST_SEARCH_RESULT_H_ | 190 #endif // UI_APP_LIST_SEARCH_RESULT_H_ |
OLD | NEW |