| 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_APP_LIST_VIEW_H_ | 5 #ifndef UI_APP_LIST_APP_LIST_VIEW_H_ |
| 6 #define UI_APP_LIST_APP_LIST_VIEW_H_ | 6 #define UI_APP_LIST_APP_LIST_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/app_list/app_list_export.h" | 10 #include "ui/app_list/app_list_export.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 class APP_LIST_EXPORT AppListView : public views::BubbleDelegateView, | 33 class APP_LIST_EXPORT AppListView : public views::BubbleDelegateView, |
| 34 public views::ButtonListener, | 34 public views::ButtonListener, |
| 35 public SearchBoxViewDelegate, | 35 public SearchBoxViewDelegate, |
| 36 public SearchResultListViewDelegate { | 36 public SearchResultListViewDelegate { |
| 37 public: | 37 public: |
| 38 // Takes ownership of |delegate|. | 38 // Takes ownership of |delegate|. |
| 39 explicit AppListView(AppListViewDelegate* delegate); | 39 explicit AppListView(AppListViewDelegate* delegate); |
| 40 virtual ~AppListView(); | 40 virtual ~AppListView(); |
| 41 | 41 |
| 42 // Initializes the widget. | 42 // Initializes the widget. |
| 43 void InitAsFullscreenWidget(gfx::NativeView parent, | |
| 44 const gfx::Rect& screen_bounds, | |
| 45 const gfx::Rect& work_area); | |
| 46 void InitAsBubble(gfx::NativeView parent, | 43 void InitAsBubble(gfx::NativeView parent, |
| 47 views::View* anchor, | 44 views::View* anchor, |
| 48 views::BubbleBorder::ArrowLocation arrow_location); | 45 views::BubbleBorder::ArrowLocation arrow_location); |
| 49 | 46 |
| 50 void SetBubbleArrowLocation( | 47 void SetBubbleArrowLocation( |
| 51 views::BubbleBorder::ArrowLocation arrow_location); | 48 views::BubbleBorder::ArrowLocation arrow_location); |
| 52 | 49 |
| 53 void AnimateShow(int duration_ms); | |
| 54 void AnimateHide(int duration_ms); | |
| 55 | |
| 56 void Close(); | 50 void Close(); |
| 57 | 51 |
| 58 void UpdateBounds(const gfx::Rect& screen_bounds, | 52 void UpdateBounds(); |
| 59 const gfx::Rect& work_area); | |
| 60 | |
| 61 bool bubble_style() const { return bubble_style_; } | |
| 62 SearchBoxView* search_box() const { return search_box_view_; } | |
| 63 | 53 |
| 64 private: | 54 private: |
| 65 // Creates models to use. | 55 // Creates models to use. |
| 66 void CreateModel(); | 56 void CreateModel(); |
| 67 | 57 |
| 68 // Overridden from views::WidgetDelegateView: | 58 // Overridden from views::WidgetDelegateView: |
| 69 virtual views::View* GetInitiallyFocusedView() OVERRIDE; | 59 virtual views::View* GetInitiallyFocusedView() OVERRIDE; |
| 70 | 60 |
| 71 // Overridden from views::View: | 61 // Overridden from views::View: |
| 72 virtual gfx::Size GetPreferredSize() OVERRIDE; | 62 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 73 virtual void Layout() OVERRIDE; | 63 virtual void Layout() OVERRIDE; |
| 74 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; | 64 virtual bool OnKeyPressed(const views::KeyEvent& event) OVERRIDE; |
| 75 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | |
| 76 | 65 |
| 77 // Overridden from views::ButtonListener: | 66 // Overridden from views::ButtonListener: |
| 78 virtual void ButtonPressed(views::Button* sender, | 67 virtual void ButtonPressed(views::Button* sender, |
| 79 const views::Event& event) OVERRIDE; | 68 const views::Event& event) OVERRIDE; |
| 80 | 69 |
| 81 // Overridden from views::BubbleDelegate: | 70 // Overridden from views::BubbleDelegate: |
| 82 virtual gfx::Rect GetBubbleBounds() OVERRIDE; | 71 virtual gfx::Rect GetBubbleBounds() OVERRIDE; |
| 83 | 72 |
| 84 // Overridden from SearchBoxViewDelegate: | 73 // Overridden from SearchBoxViewDelegate: |
| 85 virtual void QueryChanged(SearchBoxView* sender) OVERRIDE; | 74 virtual void QueryChanged(SearchBoxView* sender) OVERRIDE; |
| 86 | 75 |
| 87 // Overridden from SearchResultListViewDelegate: | 76 // Overridden from SearchResultListViewDelegate: |
| 88 virtual void OpenResult(const SearchResult& result, | 77 virtual void OpenResult(const SearchResult& result, |
| 89 int event_flags) OVERRIDE; | 78 int event_flags) OVERRIDE; |
| 90 | 79 |
| 91 scoped_ptr<AppListModel> model_; | 80 scoped_ptr<AppListModel> model_; |
| 92 scoped_ptr<AppListViewDelegate> delegate_; | 81 scoped_ptr<AppListViewDelegate> delegate_; |
| 93 | 82 |
| 94 // PaginationModel for model view and page switcher. | 83 // PaginationModel for model view and page switcher. |
| 95 scoped_ptr<PaginationModel> pagination_model_; | 84 scoped_ptr<PaginationModel> pagination_model_; |
| 96 | 85 |
| 97 bool bubble_style_; | |
| 98 AppListBubbleBorder* bubble_border_; // Owned by views hierarchy. | 86 AppListBubbleBorder* bubble_border_; // Owned by views hierarchy. |
| 99 | 87 |
| 100 AppsGridView* apps_view_; // Owned by views hierarchy. | 88 AppsGridView* apps_grid_view_; // Owned by views hierarchy. |
| 101 PageSwitcher* page_switcher_view_; // Owned by views hierarchy. | 89 PageSwitcher* page_switcher_view_; // Owned by views hierarchy. |
| 102 SearchBoxView* search_box_view_; // Owned by views hierarchy. | 90 SearchBoxView* search_box_view_; // Owned by views hierarchy. |
| 103 SearchResultListView* search_results_view_; // Owned by views hierarchy. | 91 SearchResultListView* search_results_view_; // Owned by views hierarchy. |
| 104 | 92 |
| 105 // Work area in screen coordinates to layout app list. This is used for | |
| 106 // full screen mode. | |
| 107 gfx::Rect work_area_; | |
| 108 | |
| 109 DISALLOW_COPY_AND_ASSIGN(AppListView); | 93 DISALLOW_COPY_AND_ASSIGN(AppListView); |
| 110 }; | 94 }; |
| 111 | 95 |
| 112 } // namespace app_list | 96 } // namespace app_list |
| 113 | 97 |
| 114 #endif // UI_APP_LIST_APP_LIST_VIEW_H_ | 98 #endif // UI_APP_LIST_APP_LIST_VIEW_H_ |
| OLD | NEW |