| 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_VIEWS_SEARCH_RESULT_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_SEARCH_RESULT_VIEW_H_ |
| 6 #define UI_APP_LIST_VIEWS_SEARCH_RESULT_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_SEARCH_RESULT_VIEW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 class SearchResultView : public views::CustomButton, | 40 class SearchResultView : public views::CustomButton, |
| 41 public views::ButtonListener, | 41 public views::ButtonListener, |
| 42 public views::ContextMenuController, | 42 public views::ContextMenuController, |
| 43 public SearchResultObserver, | 43 public SearchResultObserver, |
| 44 public SearchResultActionsViewDelegate { | 44 public SearchResultActionsViewDelegate { |
| 45 public: | 45 public: |
| 46 // Internal class name. | 46 // Internal class name. |
| 47 static const char kViewClassName[]; | 47 static const char kViewClassName[]; |
| 48 | 48 |
| 49 explicit SearchResultView(SearchResultListView* list_view); | 49 explicit SearchResultView(SearchResultListView* list_view); |
| 50 virtual ~SearchResultView(); | 50 ~SearchResultView() override; |
| 51 | 51 |
| 52 // Sets/gets SearchResult displayed by this view. | 52 // Sets/gets SearchResult displayed by this view. |
| 53 void SetResult(SearchResult* result); | 53 void SetResult(SearchResult* result); |
| 54 SearchResult* result() { return result_; } | 54 SearchResult* result() { return result_; } |
| 55 | 55 |
| 56 // Clears reference to SearchResult but don't schedule repaint. | 56 // Clears reference to SearchResult but don't schedule repaint. |
| 57 void ClearResultNoRepaint(); | 57 void ClearResultNoRepaint(); |
| 58 | 58 |
| 59 // Clears the selected action. | 59 // Clears the selected action. |
| 60 void ClearSelectedAction(); | 60 void ClearSelectedAction(); |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 friend class app_list::test::SearchResultListViewTest; | 63 friend class app_list::test::SearchResultListViewTest; |
| 64 | 64 |
| 65 void UpdateTitleText(); | 65 void UpdateTitleText(); |
| 66 void UpdateDetailsText(); | 66 void UpdateDetailsText(); |
| 67 | 67 |
| 68 // views::View overrides: | 68 // views::View overrides: |
| 69 virtual const char* GetClassName() const override; | 69 const char* GetClassName() const override; |
| 70 virtual gfx::Size GetPreferredSize() const override; | 70 gfx::Size GetPreferredSize() const override; |
| 71 virtual void Layout() override; | 71 void Layout() override; |
| 72 virtual bool OnKeyPressed(const ui::KeyEvent& event) override; | 72 bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 73 virtual void ChildPreferredSizeChanged(views::View* child) override; | 73 void ChildPreferredSizeChanged(views::View* child) override; |
| 74 virtual void OnPaint(gfx::Canvas* canvas) override; | 74 void OnPaint(gfx::Canvas* canvas) override; |
| 75 | 75 |
| 76 // views::ButtonListener overrides: | 76 // views::ButtonListener overrides: |
| 77 virtual void ButtonPressed(views::Button* sender, | 77 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 78 const ui::Event& event) override; | |
| 79 | 78 |
| 80 // views::ContextMenuController overrides: | 79 // views::ContextMenuController overrides: |
| 81 virtual void ShowContextMenuForView(views::View* source, | 80 void ShowContextMenuForView(views::View* source, |
| 82 const gfx::Point& point, | 81 const gfx::Point& point, |
| 83 ui::MenuSourceType source_type) override; | 82 ui::MenuSourceType source_type) override; |
| 84 | 83 |
| 85 // SearchResultObserver overrides: | 84 // SearchResultObserver overrides: |
| 86 virtual void OnIconChanged() override; | 85 void OnIconChanged() override; |
| 87 virtual void OnActionsChanged() override; | 86 void OnActionsChanged() override; |
| 88 virtual void OnIsInstallingChanged() override; | 87 void OnIsInstallingChanged() override; |
| 89 virtual void OnPercentDownloadedChanged() override; | 88 void OnPercentDownloadedChanged() override; |
| 90 virtual void OnItemInstalled() override; | 89 void OnItemInstalled() override; |
| 91 virtual void OnItemUninstalled() override; | 90 void OnItemUninstalled() override; |
| 92 | 91 |
| 93 // SearchResultActionsViewDelegate overrides: | 92 // SearchResultActionsViewDelegate overrides: |
| 94 virtual void OnSearchResultActionActivated(size_t index, | 93 void OnSearchResultActionActivated(size_t index, int event_flags) override; |
| 95 int event_flags) override; | |
| 96 | 94 |
| 97 SearchResult* result_; // Owned by AppListModel::SearchResults. | 95 SearchResult* result_; // Owned by AppListModel::SearchResults. |
| 98 | 96 |
| 99 // Parent list view. Owned by views hierarchy. | 97 // Parent list view. Owned by views hierarchy. |
| 100 SearchResultListView* list_view_; | 98 SearchResultListView* list_view_; |
| 101 | 99 |
| 102 views::ImageView* icon_; // Owned by views hierarchy. | 100 views::ImageView* icon_; // Owned by views hierarchy. |
| 103 scoped_ptr<gfx::RenderText> title_text_; | 101 scoped_ptr<gfx::RenderText> title_text_; |
| 104 scoped_ptr<gfx::RenderText> details_text_; | 102 scoped_ptr<gfx::RenderText> details_text_; |
| 105 SearchResultActionsView* actions_view_; // Owned by the views hierarchy. | 103 SearchResultActionsView* actions_view_; // Owned by the views hierarchy. |
| 106 ProgressBarView* progress_bar_; // Owned by views hierarchy. | 104 ProgressBarView* progress_bar_; // Owned by views hierarchy. |
| 107 | 105 |
| 108 scoped_ptr<views::MenuRunner> context_menu_runner_; | 106 scoped_ptr<views::MenuRunner> context_menu_runner_; |
| 109 | 107 |
| 110 DISALLOW_COPY_AND_ASSIGN(SearchResultView); | 108 DISALLOW_COPY_AND_ASSIGN(SearchResultView); |
| 111 }; | 109 }; |
| 112 | 110 |
| 113 } // namespace app_list | 111 } // namespace app_list |
| 114 | 112 |
| 115 #endif // UI_APP_LIST_VIEWS_SEARCH_RESULT_VIEW_H_ | 113 #endif // UI_APP_LIST_VIEWS_SEARCH_RESULT_VIEW_H_ |
| OLD | NEW |