| 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_CONTENTS_VIEW_H_ | |
| 6 #define UI_APP_LIST_CONTENTS_VIEW_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "ui/views/view.h" | |
| 12 | |
| 13 namespace views { | |
| 14 class BoundsAnimator; | |
| 15 class ViewModel; | |
| 16 } | |
| 17 | |
| 18 namespace app_list { | |
| 19 | |
| 20 class AppListModel; | |
| 21 class AppListView; | |
| 22 class PaginationModel; | |
| 23 | |
| 24 // A view to manage sub views under the search box (apps grid view + page | |
| 25 // switcher and search results). The two sets of sub views are mutually | |
| 26 // exclusive. ContentsView manages a show state to choose one set to show | |
| 27 // and animates the transition between show states. | |
| 28 class ContentsView : public views::View { | |
| 29 public: | |
| 30 ContentsView(AppListView* app_list_view, | |
| 31 PaginationModel* pagination_model); | |
| 32 virtual ~ContentsView(); | |
| 33 | |
| 34 void SetModel(AppListModel* model); | |
| 35 | |
| 36 void ShowSearchResults(bool show); | |
| 37 | |
| 38 private: | |
| 39 enum ShowState { | |
| 40 SHOW_APPS, | |
| 41 SHOW_SEARCH_RESULTS, | |
| 42 }; | |
| 43 | |
| 44 // Sets show state. | |
| 45 void SetShowState(ShowState show_state); | |
| 46 | |
| 47 // Invoked when show state is changed. | |
| 48 void ShowStateChanged(); | |
| 49 | |
| 50 void CalculateIdealBounds(); | |
| 51 void AnimateToIdealBounds(); | |
| 52 | |
| 53 // Overridden from views::View: | |
| 54 virtual gfx::Size GetPreferredSize() OVERRIDE; | |
| 55 virtual void Layout() OVERRIDE; | |
| 56 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE; | |
| 57 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE; | |
| 58 | |
| 59 // Overridden from ui::EventHandler: | |
| 60 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | |
| 61 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; | |
| 62 | |
| 63 ShowState show_state_; | |
| 64 PaginationModel* pagination_model_; // Owned by AppListController. | |
| 65 | |
| 66 scoped_ptr<views::ViewModel> view_model_; | |
| 67 scoped_ptr<views::BoundsAnimator> bounds_animator_; | |
| 68 | |
| 69 DISALLOW_COPY_AND_ASSIGN(ContentsView); | |
| 70 }; | |
| 71 | |
| 72 } // namespace app_list | |
| 73 | |
| 74 #endif // UI_APP_LIST_CONTENTS_VIEW_H_ | |
| OLD | NEW |