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

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

Issue 10872099: ash: Add support for additional icons in apps search list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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_VIEW_H_ 5 #ifndef UI_APP_LIST_SEARCH_RESULT_VIEW_H_
6 #define UI_APP_LIST_SEARCH_RESULT_VIEW_H_ 6 #define UI_APP_LIST_SEARCH_RESULT_VIEW_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "ui/app_list/search_result_observer.h" 12 #include "ui/app_list/search_result_observer.h"
13 #include "ui/views/controls/button/custom_button.h" 13 #include "ui/views/controls/button/custom_button.h"
14 14
15 namespace gfx { 15 namespace gfx {
16 class RenderText; 16 class RenderText;
17 } 17 }
18 18
19 namespace views { 19 namespace views {
20 class ImageButton;
20 class ImageView; 21 class ImageView;
21 } 22 }
22 23
23 namespace app_list { 24 namespace app_list {
24 25
25 class SearchResult; 26 class SearchResult;
26 class SearchResultListView; 27 class SearchResultListView;
28 class SearchResultViewDelegate;
27 29
28 // SearchResultView displays a SearchResult. 30 // SearchResultView displays a SearchResult.
29 class SearchResultView : public views::CustomButton, 31 class SearchResultView : public views::CustomButton,
32 public views::ButtonListener,
30 public SearchResultObserver { 33 public SearchResultObserver {
31 public: 34 public:
32 // Internal class name. 35 // Internal class name.
33 static const char kViewClassName[]; 36 static const char kViewClassName[];
34 37
35 SearchResultView(SearchResultListView* list_view, 38 SearchResultView(SearchResultListView* list_view,
36 views::ButtonListener* listener); 39 SearchResultViewDelegate* delegate);
37 virtual ~SearchResultView(); 40 virtual ~SearchResultView();
38 41
39 // Sets/gets SearchResult displayed by this view. 42 // Sets/gets SearchResult displayed by this view.
40 void SetResult(SearchResult* result); 43 void SetResult(SearchResult* result);
41 const SearchResult* result() const { return result_; } 44 const SearchResult* result() const { return result_; }
42 45
43 // Clears reference to SearchResult but don't schedule repaint. 46 // Clears reference to SearchResult but don't schedule repaint.
44 void ClearResultNoRepaint(); 47 void ClearResultNoRepaint();
45 48
46 private: 49 private:
47 void UpdateTitleText(); 50 void UpdateTitleText();
48 void UpdateDetailsText(); 51 void UpdateDetailsText();
49 52
50 // views::View overrides: 53 // views::View overrides:
51 virtual std::string GetClassName() const OVERRIDE; 54 virtual std::string GetClassName() const OVERRIDE;
52 virtual gfx::Size GetPreferredSize() OVERRIDE; 55 virtual gfx::Size GetPreferredSize() OVERRIDE;
53 virtual void Layout() OVERRIDE; 56 virtual void Layout() OVERRIDE;
54 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 57 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
55 58
59 // views::ButtonListener overrides:
60 virtual void ButtonPressed(views::Button* sender,
61 const ui::Event& event) OVERRIDE;
62
56 // SearchResultObserver overrides: 63 // SearchResultObserver overrides:
57 virtual void OnIconChanged() OVERRIDE; 64 virtual void OnIconChanged() OVERRIDE;
65 virtual void OnActionIconsChanged() OVERRIDE;
58 66
59 SearchResult* result_; // Owned by AppListModel::SearchResults. 67 SearchResult* result_; // Owned by AppListModel::SearchResults.
60 68
61 // Parent list view. Owned by views hierarchy. 69 // Parent list view. Owned by views hierarchy.
62 SearchResultListView* list_view_; 70 SearchResultListView* list_view_;
63 71
72 // Not owned by us.
73 SearchResultViewDelegate* delegate_;
74
64 views::ImageView* icon_; // Owned by views hierarchy. 75 views::ImageView* icon_; // Owned by views hierarchy.
65 scoped_ptr<gfx::RenderText> title_text_; 76 scoped_ptr<gfx::RenderText> title_text_;
66 scoped_ptr<gfx::RenderText> details_text_; 77 scoped_ptr<gfx::RenderText> details_text_;
67 78
79 // Owned by the views hierarchy.
80 std::vector<views::ImageButton*> action_buttons_;
81
68 DISALLOW_COPY_AND_ASSIGN(SearchResultView); 82 DISALLOW_COPY_AND_ASSIGN(SearchResultView);
69 }; 83 };
70 84
71 } // namespace app_list 85 } // namespace app_list
72 86
73 #endif // UI_APP_LIST_SEARCH_RESULT_VIEW_H_ 87 #endif // UI_APP_LIST_SEARCH_RESULT_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698