Chromium Code Reviews| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 Tag(int styles, size_t start, size_t end) | 38 Tag(int styles, size_t start, size_t end) |
| 39 : styles(styles), | 39 : styles(styles), |
| 40 range(start, end) { | 40 range(start, end) { |
| 41 } | 41 } |
| 42 | 42 |
| 43 int styles; | 43 int styles; |
| 44 ui::Range range; | 44 ui::Range range; |
| 45 }; | 45 }; |
| 46 typedef std::vector<Tag> Tags; | 46 typedef std::vector<Tag> Tags; |
| 47 | 47 |
| 48 // A collection of images representing an action that can be performed on this | |
| 49 // search result. | |
| 50 struct ActionIconSet { | |
| 51 ActionIconSet(const gfx::ImageSkia& base_image, | |
| 52 const gfx::ImageSkia& hover_image, | |
| 53 const gfx::ImageSkia& pressed_image, | |
| 54 const string16& tooltip_text) | |
| 55 : base_image(base_image), | |
| 56 hover_image(hover_image), | |
| 57 pressed_image(pressed_image), | |
| 58 tooltip_text(tooltip_text) { | |
| 59 } | |
| 60 | |
| 61 gfx::ImageSkia base_image; | |
| 62 gfx::ImageSkia hover_image; | |
| 63 gfx::ImageSkia pressed_image; | |
| 64 | |
| 65 string16 tooltip_text; | |
| 66 }; | |
| 67 typedef std::vector<ActionIconSet> ActionIconSets; | |
| 68 | |
| 48 SearchResult(); | 69 SearchResult(); |
| 49 virtual ~SearchResult(); | 70 virtual ~SearchResult(); |
| 50 | 71 |
| 51 void AddObserver(SearchResultObserver* observer); | |
| 52 void RemoveObserver(SearchResultObserver* observer); | |
| 53 | |
| 54 const gfx::ImageSkia& icon() const { return icon_; } | 72 const gfx::ImageSkia& icon() const { return icon_; } |
| 55 void SetIcon(const gfx::ImageSkia& icon); | 73 void SetIcon(const gfx::ImageSkia& icon); |
| 56 | 74 |
| 57 const string16& title() const { return title_; } | 75 const string16& title() const { return title_; } |
| 58 void set_title(const string16& title) { title_ = title;} | 76 void set_title(const string16& title) { title_ = title;} |
| 59 | 77 |
| 60 const Tags& title_tags() const { return title_tags_; } | 78 const Tags& title_tags() const { return title_tags_; } |
| 61 void set_title_tags(const Tags& tags) { title_tags_ = tags; } | 79 void set_title_tags(const Tags& tags) { title_tags_ = tags; } |
| 62 | 80 |
| 63 const string16& details() const { return details_; } | 81 const string16& details() const { return details_; } |
| 64 void set_details(const string16& details) { details_ = details; } | 82 void set_details(const string16& details) { details_ = details; } |
| 65 | 83 |
| 66 const Tags& details_tags() const { return details_tags_; } | 84 const Tags& details_tags() const { return details_tags_; } |
| 67 void set_details_tags(const Tags& tags) { details_tags_ = tags; } | 85 void set_details_tags(const Tags& tags) { details_tags_ = tags; } |
| 68 | 86 |
| 87 const ActionIconSets& action_icons() const { | |
| 88 return action_icons_; | |
| 89 } | |
| 90 void SetActionIcons(const std::vector<ActionIconSet>& sets); | |
|
xiyuan
2012/08/28 01:01:49
nit: Use ActionIconSets typedef'd above?
Daniel Erat
2012/08/28 16:45:37
Whoops, done.
| |
| 91 | |
| 92 void AddObserver(SearchResultObserver* observer); | |
| 93 void RemoveObserver(SearchResultObserver* observer); | |
| 94 | |
| 69 private: | 95 private: |
| 70 gfx::ImageSkia icon_; | 96 gfx::ImageSkia icon_; |
| 71 | 97 |
| 72 string16 title_; | 98 string16 title_; |
| 73 Tags title_tags_; | 99 Tags title_tags_; |
| 74 | 100 |
| 75 string16 details_; | 101 string16 details_; |
| 76 Tags details_tags_; | 102 Tags details_tags_; |
| 77 | 103 |
| 104 // Optional list of icons representing additional actions that can be | |
| 105 // performed on this result. | |
| 106 ActionIconSets action_icons_; | |
| 107 | |
| 78 ObserverList<SearchResultObserver> observers_; | 108 ObserverList<SearchResultObserver> observers_; |
| 79 | 109 |
| 80 DISALLOW_COPY_AND_ASSIGN(SearchResult); | 110 DISALLOW_COPY_AND_ASSIGN(SearchResult); |
| 81 }; | 111 }; |
| 82 | 112 |
| 83 } // namespace app_list | 113 } // namespace app_list |
| 84 | 114 |
| 85 #endif // UI_APP_LIST_SEARCH_RESULT_H_ | 115 #endif // UI_APP_LIST_SEARCH_RESULT_H_ |
| OLD | NEW |