 Chromium Code Reviews
 Chromium Code Reviews Issue 701773002:
  App list: Added contents view custom animation framework.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 701773002:
  App list: Added contents view custom animation framework.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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 ade7fdbf388fe4283e79e5a78e7a565b49903b8e..5d8a5d754c0ae0fe45b3ad49ba2a0d339a4b975f 100644 | 
| --- a/ui/app_list/views/contents_view.h | 
| +++ b/ui/app_list/views/contents_view.h | 
| @@ -6,9 +6,11 @@ | 
| #define UI_APP_LIST_VIEWS_CONTENTS_VIEW_H_ | 
| #include <map> | 
| +#include <utility> | 
| #include "base/basictypes.h" | 
| #include "base/compiler_specific.h" | 
| +#include "base/memory/linked_ptr.h" | 
| #include "base/memory/scoped_ptr.h" | 
| #include "ui/app_list/app_list_export.h" | 
| #include "ui/app_list/app_list_model.h" | 
| @@ -30,6 +32,7 @@ class AppListMainView; | 
| class AppListModel; | 
| class AppListViewDelegate; | 
| class AppsContainerView; | 
| +class ContentsAnimator; | 
| class ContentsSwitcherView; | 
| class PaginationModel; | 
| class SearchResultListView; | 
| @@ -105,6 +108,13 @@ class APP_LIST_EXPORT ContentsView : public views::View, | 
| // specify their own custom layout. | 
| gfx::Rect GetDefaultContentsBounds() const; | 
| + // Exposes GetAnimatorForTransition for tests. | 
| + ContentsAnimator* GetAnimatorForTransitionForTests(int from_page, | 
| + int to_page, | 
| + bool* reverse) const { | 
| + return GetAnimatorForTransition(from_page, to_page, reverse); | 
| + } | 
| + | 
| // Overridden from views::View: | 
| gfx::Size GetPreferredSize() const override; | 
| void Layout() override; | 
| @@ -127,10 +137,6 @@ class APP_LIST_EXPORT ContentsView : public views::View, | 
| // Returns the size of the default content area. | 
| gfx::Size GetDefaultContentsSize() const; | 
| - // Gets the origin (the off-screen resting place) for a given launcher page | 
| - // with index |page_index|. | 
| - gfx::Rect GetOffscreenPageBounds(int page_index) const; | 
| - | 
| // 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(); | 
| @@ -154,6 +160,18 @@ class APP_LIST_EXPORT ContentsView : public views::View, | 
| // launcher-page pagination. | 
| PaginationModel* GetAppsPaginationModel(); | 
| + // Adds a ContentsAnimator for a transition from |from_page| to |to_page|. | 
| + // Takes ownership of |animator|. | 
| + void AddAnimator(int from_page, int to_page, ContentsAnimator* animator); | 
| 
calamity
2014/11/05 06:29:07
If this takes ownership, shouldn't it take a scope
 
Matt Giuca
2014/11/06 00:32:59
s/scoped_ptr/linked_ptr/ yeah... probably should.
 
calamity
2014/11/06 05:34:47
I think it would still be scoped_ptr and then made
 
Matt Giuca
2014/11/10 04:08:26
Sort of depends on https://codereview.chromium.org
 | 
| + | 
| + // Gets a ContentsAnimator for a transition from |from_page| to |to_page|. If | 
| + // the animator is should be run in reverse (because it is a |to_page| to | 
| 
calamity
2014/11/05 06:29:07
s/is//
 
Matt Giuca
2014/11/06 00:32:59
Done.
 | 
| + // |from_page| animator), |reverse| is set to true; otherwise it is set to | 
| + // false. | 
| + ContentsAnimator* GetAnimatorForTransition(int from_page, | 
| + int to_page, | 
| + bool* reverse) const; | 
| + | 
| // Special sub views of the ContentsView. All owned by the views hierarchy. | 
| AppsContainerView* apps_container_view_; | 
| SearchResultListView* search_results_view_; | 
| @@ -177,6 +195,14 @@ class APP_LIST_EXPORT ContentsView : public views::View, | 
| // Manages the pagination for the launcher pages. | 
| PaginationModel pagination_model_; | 
| + // Maps from {A, B} pair to ContentsAnimator, where A and B are page | 
| + // |view_model_| indices for an animation from A to B. | 
| + std::map<std::pair<int, int>, linked_ptr<ContentsAnimator>> | 
| + contents_animators_; | 
| + | 
| + // The animator for a transition not found in |contents_animators_|. | 
| 
calamity
2014/11/05 06:29:07
s/for a transition/for transitions/
 
Matt Giuca
2014/11/06 00:32:59
Done.
 | 
| + scoped_ptr<ContentsAnimator> default_animator_; | 
| + | 
| DISALLOW_COPY_AND_ASSIGN(ContentsView); | 
| }; |