Chromium Code Reviews| 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 "third_party/skia/include/core/SkBitmap.h" | |
| 14 #include "ui/app_list/app_list_export.h" | |
| 15 #include "ui/base/models/list_model.h" | |
| 16 #include "ui/base/range/range.h" | |
| 17 | |
| 18 namespace app_list { | |
| 19 | |
| 20 // SearchResult consists of an icon, a title text and a details text. Title and | |
|
sky
2012/05/22 22:16:06
'SearchResult consists of an icon, a title text an
xiyuan
2012/05/23 21:25:22
Done.
| |
| 21 // details text could have tagged ranges that are displayed differently from | |
|
sky
2012/05/22 22:16:06
could -> can
xiyuan
2012/05/23 21:25:22
Done.
| |
| 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(); | |
|
sky
2012/05/22 22:16:06
Why did you make it so that folks subclass this? S
xiyuan
2012/05/23 21:25:22
Subclass is allowed here because SeachResult is re
| |
| 48 | |
| 49 const SkBitmap& icon() const { return icon_; } | |
| 50 void set_icon(const SkBitmap& 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 SkBitmap icon_; | |
|
sky
2012/05/22 22:16:06
ImageSkia
xiyuan
2012/05/23 21:25:22
Done.
| |
| 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 |