Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: ui/app_list/search_result.h

Issue 439703002: Allow app list tiles to show search results in the experimental app list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/observer_list.h" 11 #include "base/observer_list.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "ui/app_list/app_list_export.h" 13 #include "ui/app_list/app_list_export.h"
14 #include "ui/gfx/image/image_skia.h" 14 #include "ui/gfx/image/image_skia.h"
15 #include "ui/gfx/range/range.h" 15 #include "ui/gfx/range/range.h"
16 16
17 namespace ui { 17 namespace ui {
18 class MenuModel; 18 class MenuModel;
19 } 19 }
20 20
21 namespace app_list { 21 namespace app_list {
22 22
23 class SearchResultObserver; 23 class SearchResultObserver;
24 24
25 // SearchResult consists of an icon, title text and details text. Title and 25 // SearchResult consists of an icon, title text and details text. Title and
26 // details text can have tagged ranges that are displayed differently from 26 // details text can have tagged ranges that are displayed differently from
27 // default style. 27 // default style.
28 class APP_LIST_EXPORT SearchResult { 28 class APP_LIST_EXPORT SearchResult {
29 public: 29 public:
30 // How the result should be displayed.
31 enum DisplayType {
32 DISPLAY_LIST,
33 DISPLAY_TILE,
34 };
35
30 // A tagged range in search result text. 36 // A tagged range in search result text.
31 struct APP_LIST_EXPORT Tag { 37 struct APP_LIST_EXPORT Tag {
32 // Similar to ACMatchClassification::Style, the style values are not 38 // Similar to ACMatchClassification::Style, the style values are not
33 // mutually exclusive. 39 // mutually exclusive.
34 enum Style { 40 enum Style {
35 NONE = 0, 41 NONE = 0,
36 URL = 1 << 0, 42 URL = 1 << 0,
37 MATCH = 1 << 1, 43 MATCH = 1 << 1,
38 DIM = 1 << 2, 44 DIM = 1 << 2,
39 }; 45 };
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 void set_title_tags(const Tags& tags) { title_tags_ = tags; } 89 void set_title_tags(const Tags& tags) { title_tags_ = tags; }
84 90
85 const base::string16& details() const { return details_; } 91 const base::string16& details() const { return details_; }
86 void set_details(const base::string16& details) { details_ = details; } 92 void set_details(const base::string16& details) { details_ = details; }
87 93
88 const Tags& details_tags() const { return details_tags_; } 94 const Tags& details_tags() const { return details_tags_; }
89 void set_details_tags(const Tags& tags) { details_tags_ = tags; } 95 void set_details_tags(const Tags& tags) { details_tags_ = tags; }
90 96
91 const std::string& id() const { return id_; } 97 const std::string& id() const { return id_; }
92 double relevance() const { return relevance_; } 98 double relevance() const { return relevance_; }
99 const DisplayType display_type() const { return display_type_; }
93 100
94 const Actions& actions() const { 101 const Actions& actions() const {
95 return actions_; 102 return actions_;
96 } 103 }
97 void SetActions(const Actions& sets); 104 void SetActions(const Actions& sets);
98 105
99 bool is_installing() const { return is_installing_; } 106 bool is_installing() const { return is_installing_; }
100 void SetIsInstalling(bool is_installing); 107 void SetIsInstalling(bool is_installing);
101 108
102 int percent_downloaded() const { return percent_downloaded_; } 109 int percent_downloaded() const { return percent_downloaded_; }
(...skipping 12 matching lines...) Expand all
115 virtual void InvokeAction(int action_index, int event_flags); 122 virtual void InvokeAction(int action_index, int event_flags);
116 123
117 // Returns the context menu model for this item, or NULL if there is currently 124 // Returns the context menu model for this item, or NULL if there is currently
118 // no menu for the item (e.g. during install). 125 // no menu for the item (e.g. during install).
119 // Note the returned menu model is owned by this item. 126 // Note the returned menu model is owned by this item.
120 virtual ui::MenuModel* GetContextMenuModel(); 127 virtual ui::MenuModel* GetContextMenuModel();
121 128
122 protected: 129 protected:
123 void set_id(const std::string& id) { id_ = id; } 130 void set_id(const std::string& id) { id_ = id; }
124 void set_relevance(double relevance) { relevance_ = relevance; } 131 void set_relevance(double relevance) { relevance_ = relevance; }
132 void set_display_type(DisplayType display_type) {
133 display_type_ = display_type;
134 }
125 135
126 private: 136 private:
127 gfx::ImageSkia icon_; 137 gfx::ImageSkia icon_;
128 138
129 base::string16 title_; 139 base::string16 title_;
130 Tags title_tags_; 140 Tags title_tags_;
131 141
132 base::string16 details_; 142 base::string16 details_;
133 Tags details_tags_; 143 Tags details_tags_;
134 144
135 std::string id_; 145 std::string id_;
136 double relevance_; 146 double relevance_;
147 DisplayType display_type_;
137 148
138 Actions actions_; 149 Actions actions_;
139 150
140 bool is_installing_; 151 bool is_installing_;
141 int percent_downloaded_; 152 int percent_downloaded_;
142 153
143 ObserverList<SearchResultObserver> observers_; 154 ObserverList<SearchResultObserver> observers_;
144 155
145 DISALLOW_COPY_AND_ASSIGN(SearchResult); 156 DISALLOW_COPY_AND_ASSIGN(SearchResult);
146 }; 157 };
147 158
148 } // namespace app_list 159 } // namespace app_list
149 160
150 #endif // UI_APP_LIST_SEARCH_RESULT_H_ 161 #endif // UI_APP_LIST_SEARCH_RESULT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698