| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_APP_LIST_SEARCH_RESULT_H_ |
| 6 #define UI_APP_LIST_SEARCH_RESULT_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <vector> |
| 10 |
| 11 #include "base/basictypes.h" |
| 12 #include "base/string16.h" |
| 13 #include "ui/app_list/app_list_export.h" |
| 14 #include "ui/base/models/list_model.h" |
| 15 #include "ui/base/range/range.h" |
| 16 #include "ui/gfx/image/image_skia.h" |
| 17 |
| 18 namespace app_list { |
| 19 |
| 20 // SearchResult consists of an icon, title text and details text. Title and |
| 21 // details text can have tagged ranges that are displayed differently from |
| 22 // default style. |
| 23 class APP_LIST_EXPORT SearchResult { |
| 24 public: |
| 25 // A tagged range in search result text. |
| 26 struct Tag { |
| 27 // Similar to ACMatchClassification::Style, the style values are not |
| 28 // mutually exclusive. |
| 29 enum Style { |
| 30 NONE = 0, |
| 31 URL = 1 << 0, |
| 32 MATCH = 1 << 1, |
| 33 DIM = 1 << 2, |
| 34 }; |
| 35 |
| 36 Tag(int styles, size_t start, size_t end) |
| 37 : styles(styles), |
| 38 range(start, end) { |
| 39 } |
| 40 |
| 41 int styles; |
| 42 ui::Range range; |
| 43 }; |
| 44 typedef std::vector<Tag> Tags; |
| 45 |
| 46 SearchResult(); |
| 47 virtual ~SearchResult(); |
| 48 |
| 49 const gfx::ImageSkia& icon() const { return icon_; } |
| 50 void set_icon(const gfx::ImageSkia& icon) { icon_ = icon; } |
| 51 |
| 52 const string16& title() const { return title_; } |
| 53 void set_title(const string16& title) { title_ = title;} |
| 54 |
| 55 const Tags& title_tags() const { return title_tags_; } |
| 56 void set_title_tags(const Tags& tags) { title_tags_ = tags; } |
| 57 |
| 58 const string16& details() const { return details_; } |
| 59 void set_details(const string16& details) { details_ = details; } |
| 60 |
| 61 const Tags& details_tags() const { return details_tags_; } |
| 62 void set_details_tags(const Tags& tags) { details_tags_ = tags; } |
| 63 |
| 64 private: |
| 65 gfx::ImageSkia icon_; |
| 66 |
| 67 string16 title_; |
| 68 Tags title_tags_; |
| 69 |
| 70 string16 details_; |
| 71 Tags details_tags_; |
| 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(SearchResult); |
| 74 }; |
| 75 |
| 76 } // namespace app_list |
| 77 |
| 78 #endif // UI_APP_LIST_SEARCH_RESULT_H_ |
| OLD | NEW |