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.
5 #ifndef UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_
6 #define UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "ui/views/view.h"
25 class ApplicationDragAndDropHost;
26 class AppListFolderItem;
27 class AppListMainView;
29 class AppListViewDelegate;
30 class AppsContainerView;
31 class PaginationModel;
33 // A view to manage sub views under the search box (apps grid view + page
34 // switcher and search results). The two sets of sub views are mutually
35 // exclusive. ContentsView manages a show state to choose one set to show
36 // and animates the transition between show states.
37 class ContentsView : public views::View {
39 ContentsView(AppListMainView* app_list_main_view,
40 PaginationModel* pagination_model,
42 AppListViewDelegate* view_delegate);
43 virtual ~ContentsView();
45 // The app list gets closed and drag and drop operations need to be cancelled.
48 // If |drag_and_drop| is not NULL it will be called upon drag and drop
49 // operations outside the application list.
50 void SetDragAndDropHostOfCurrentAppList(
51 ApplicationDragAndDropHost* drag_and_drop_host);
53 void ShowSearchResults(bool show);
54 void ShowFolderContent(AppListFolderItem* folder);
58 AppsContainerView* apps_container_view() { return apps_container_view_; }
60 // Overridden from views::View:
61 virtual gfx::Size GetPreferredSize() OVERRIDE;
62 virtual void Layout() OVERRIDE;
63 virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
64 virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE;
73 void SetShowState(ShowState show_state);
75 // Invoked when show state is changed.
76 void ShowStateChanged();
78 void CalculateIdealBounds();
79 void AnimateToIdealBounds();
81 // Overridden from ui::EventHandler:
82 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
83 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
85 ShowState show_state_;
86 PaginationModel* pagination_model_; // Owned by AppListController.
88 AppsContainerView* apps_container_view_; // Owned by the views hierarchy.
90 scoped_ptr<views::ViewModel> view_model_;
91 scoped_ptr<views::BoundsAnimator> bounds_animator_;
93 DISALLOW_COPY_AND_ASSIGN(ContentsView);
96 } // namespace app_list
98 #endif // UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_