| Index: ui/app_list/views/contents_view.h
|
| diff --git a/ui/app_list/views/contents_view.h b/ui/app_list/views/contents_view.h
|
| index 2a67248e95cea18cc7d167b4e96975f3b50b8129..9e048a19b982eb0fd2dd4c1d396c187c9e5253f3 100644
|
| --- a/ui/app_list/views/contents_view.h
|
| +++ b/ui/app_list/views/contents_view.h
|
| @@ -11,10 +11,11 @@
|
| #include "base/compiler_specific.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "ui/app_list/app_list_export.h"
|
| +#include "ui/app_list/pagination_model.h"
|
| +#include "ui/app_list/pagination_model_observer.h"
|
| #include "ui/views/view.h"
|
|
|
| namespace views {
|
| -class BoundsAnimator;
|
| class ViewModel;
|
| }
|
|
|
| @@ -36,7 +37,8 @@ class StartPageView;
|
| // one of which can be active at a given time. ContentsView provides the user
|
| // interface for switching between launcher pages, and animates the transition
|
| // between them.
|
| -class APP_LIST_EXPORT ContentsView : public views::View {
|
| +class APP_LIST_EXPORT ContentsView : public views::View,
|
| + public PaginationModelObserver {
|
| public:
|
| // Values of this enum denote special launcher pages that require hard-coding.
|
| // Launcher pages are not required to have a NamedPage enum value.
|
| @@ -67,7 +69,7 @@ class APP_LIST_EXPORT ContentsView : public views::View {
|
| void SetActivePage(int page_index);
|
|
|
| // The index of the currently active launcher page.
|
| - int active_page_index() const { return active_page_; }
|
| + int GetActivePageIndex() const;
|
|
|
| // True if |named_page| is the current active laucher page.
|
| bool IsNamedPageActive(NamedPage named_page) const;
|
| @@ -75,11 +77,17 @@ class APP_LIST_EXPORT ContentsView : public views::View {
|
| // Gets the index of a launcher page in |view_model_|, by NamedPage.
|
| int GetPageIndexForNamedPage(NamedPage named_page) const;
|
|
|
| + int NumLauncherPages() const;
|
| +
|
| void Prerender();
|
|
|
| AppsContainerView* apps_container_view() { return apps_container_view_; }
|
| StartPageView* start_page_view() { return start_page_view_; }
|
| SearchResultListView* search_results_view() { return search_results_view_; }
|
| + views::View* GetPageView(int index);
|
| +
|
| + // Adds a blank launcher page. For use in tests only.
|
| + void AddBlankPageForTesting();
|
|
|
| // Overridden from views::View:
|
| virtual gfx::Size GetPreferredSize() const OVERRIDE;
|
| @@ -87,6 +95,12 @@ class APP_LIST_EXPORT ContentsView : public views::View {
|
| virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
|
| virtual bool OnMouseWheel(const ui::MouseWheelEvent& event) OVERRIDE;
|
|
|
| + // Overridden from PaginationModelObserver:
|
| + virtual void TotalPagesChanged() OVERRIDE;
|
| + virtual void SelectedPageChanged(int old_selected, int new_selected) OVERRIDE;
|
| + virtual void TransitionStarted() OVERRIDE;
|
| + virtual void TransitionChanged() OVERRIDE;
|
| +
|
| private:
|
| // Sets the active launcher page, accounting for whether the change is for
|
| // search results.
|
| @@ -95,8 +109,9 @@ class APP_LIST_EXPORT ContentsView : public views::View {
|
| // Invoked when active view is changed.
|
| void ActivePageChanged(bool show_search_results);
|
|
|
| - void CalculateIdealBounds();
|
| - void AnimateToIdealBounds();
|
| + // Calculates and sets the bounds for the subviews. If there is currently an
|
| + // animation, this positions the views as appropriate for the current frame.
|
| + void UpdatePageBounds();
|
|
|
| // Adds |view| as a new page to the end of the list of launcher pages. The
|
| // view is inserted as a child of the ContentsView. There is no name
|
| @@ -109,15 +124,14 @@ class APP_LIST_EXPORT ContentsView : public views::View {
|
| int AddLauncherPage(views::View* view, NamedPage named_page);
|
|
|
| // Gets the PaginationModel owned by the AppsGridView.
|
| + // Note: This is different to |pagination_model_|, which manages top-level
|
| + // launcher-page pagination.
|
| PaginationModel* GetAppsPaginationModel();
|
|
|
| // Overridden from ui::EventHandler:
|
| virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE;
|
| virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE;
|
|
|
| - // Index into |view_model_| of the currently active page.
|
| - int active_page_;
|
| -
|
| // Special sub views of the ContentsView. All owned by the views hierarchy.
|
| AppsContainerView* apps_container_view_;
|
| SearchResultListView* search_results_view_;
|
| @@ -128,7 +142,9 @@ class APP_LIST_EXPORT ContentsView : public views::View {
|
| scoped_ptr<views::ViewModel> view_model_;
|
| // Maps NamedPage onto |view_model_| indices.
|
| std::map<NamedPage, int> named_page_to_view_;
|
| - scoped_ptr<views::BoundsAnimator> bounds_animator_;
|
| +
|
| + // Manages the pagination for the launcher pages.
|
| + PaginationModel pagination_model_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ContentsView);
|
| };
|
|
|