| 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 ~ActionIconSet(); |
| 56 |
| 57 gfx::ImageSkia base_image; |
| 58 gfx::ImageSkia hover_image; |
| 59 gfx::ImageSkia pressed_image; |
| 60 |
| 61 string16 tooltip_text; |
| 62 }; |
| 63 typedef std::vector<ActionIconSet> ActionIconSets; |
| 64 |
| 48 SearchResult(); | 65 SearchResult(); |
| 49 virtual ~SearchResult(); | 66 virtual ~SearchResult(); |
| 50 | 67 |
| 51 void AddObserver(SearchResultObserver* observer); | |
| 52 void RemoveObserver(SearchResultObserver* observer); | |
| 53 | |
| 54 const gfx::ImageSkia& icon() const { return icon_; } | 68 const gfx::ImageSkia& icon() const { return icon_; } |
| 55 void SetIcon(const gfx::ImageSkia& icon); | 69 void SetIcon(const gfx::ImageSkia& icon); |
| 56 | 70 |
| 57 const string16& title() const { return title_; } | 71 const string16& title() const { return title_; } |
| 58 void set_title(const string16& title) { title_ = title;} | 72 void set_title(const string16& title) { title_ = title;} |
| 59 | 73 |
| 60 const Tags& title_tags() const { return title_tags_; } | 74 const Tags& title_tags() const { return title_tags_; } |
| 61 void set_title_tags(const Tags& tags) { title_tags_ = tags; } | 75 void set_title_tags(const Tags& tags) { title_tags_ = tags; } |
| 62 | 76 |
| 63 const string16& details() const { return details_; } | 77 const string16& details() const { return details_; } |
| 64 void set_details(const string16& details) { details_ = details; } | 78 void set_details(const string16& details) { details_ = details; } |
| 65 | 79 |
| 66 const Tags& details_tags() const { return details_tags_; } | 80 const Tags& details_tags() const { return details_tags_; } |
| 67 void set_details_tags(const Tags& tags) { details_tags_ = tags; } | 81 void set_details_tags(const Tags& tags) { details_tags_ = tags; } |
| 68 | 82 |
| 83 const ActionIconSets& action_icons() const { |
| 84 return action_icons_; |
| 85 } |
| 86 void SetActionIcons(const ActionIconSets& sets); |
| 87 |
| 88 void AddObserver(SearchResultObserver* observer); |
| 89 void RemoveObserver(SearchResultObserver* observer); |
| 90 |
| 69 private: | 91 private: |
| 70 gfx::ImageSkia icon_; | 92 gfx::ImageSkia icon_; |
| 71 | 93 |
| 72 string16 title_; | 94 string16 title_; |
| 73 Tags title_tags_; | 95 Tags title_tags_; |
| 74 | 96 |
| 75 string16 details_; | 97 string16 details_; |
| 76 Tags details_tags_; | 98 Tags details_tags_; |
| 77 | 99 |
| 100 // Optional list of icons representing additional actions that can be |
| 101 // performed on this result. |
| 102 ActionIconSets action_icons_; |
| 103 |
| 78 ObserverList<SearchResultObserver> observers_; | 104 ObserverList<SearchResultObserver> observers_; |
| 79 | 105 |
| 80 DISALLOW_COPY_AND_ASSIGN(SearchResult); | 106 DISALLOW_COPY_AND_ASSIGN(SearchResult); |
| 81 }; | 107 }; |
| 82 | 108 |
| 83 } // namespace app_list | 109 } // namespace app_list |
| 84 | 110 |
| 85 #endif // UI_APP_LIST_SEARCH_RESULT_H_ | 111 #endif // UI_APP_LIST_SEARCH_RESULT_H_ |
| OLD | NEW |