| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 // Copyright 2014 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_VIEWS_CONTENTS_ANIMATOR_H_ | 
|  | 6 #define UI_APP_LIST_VIEWS_CONTENTS_ANIMATOR_H_ | 
|  | 7 | 
|  | 8 #include <string> | 
|  | 9 | 
|  | 10 #include "base/macros.h" | 
|  | 11 | 
|  | 12 namespace gfx { | 
|  | 13 class Rect; | 
|  | 14 } | 
|  | 15 | 
|  | 16 namespace app_list { | 
|  | 17 | 
|  | 18 class ContentsView; | 
|  | 19 | 
|  | 20 // Manages an animation between two specific pages of the ContentsView. | 
|  | 21 // Different subclasses implement different animations, so we can have a custom | 
|  | 22 // animation for each pair of pages. Animations are reversible (if A -> B is | 
|  | 23 // implemented, B -> A will implicitly be the inverse animation). | 
|  | 24 class ContentsAnimator { | 
|  | 25  public: | 
|  | 26   ContentsAnimator(ContentsView* contents_view); | 
|  | 27 | 
|  | 28   virtual ~ContentsAnimator(); | 
|  | 29 | 
|  | 30   // Gets the name of the animator, for testing. | 
|  | 31   virtual std::string NameForTests() const = 0; | 
|  | 32 | 
|  | 33   // Updates the state of the ContentsView. |progress| is the amount of progress | 
|  | 34   // made on the animation, where 0.0 is the beginning and 1.0 is the end. The | 
|  | 35   // animation should be linear (not eased in or out) so that it can be played | 
|  | 36   // forwards or reversed. Easing will be applied by the PaginationModel. | 
|  | 37   virtual void Update(double progress, int from_page, int to_page) = 0; | 
|  | 38 | 
|  | 39  protected: | 
|  | 40   ContentsView* contents_view() { return contents_view_; } | 
|  | 41 | 
|  | 42   // Gets the origin (the off-screen resting place) for a given launcher page | 
|  | 43   // with index |page_index|. | 
|  | 44   gfx::Rect GetOffscreenPageBounds(int page_index) const; | 
|  | 45 | 
|  | 46  private: | 
|  | 47   ContentsView* contents_view_; | 
|  | 48 | 
|  | 49   DISALLOW_COPY_AND_ASSIGN(ContentsAnimator); | 
|  | 50 }; | 
|  | 51 | 
|  | 52 // Simple animator that slides pages in and out vertically. Appropriate for any | 
|  | 53 // page pair. | 
|  | 54 class DefaultAnimator : public ContentsAnimator { | 
|  | 55  public: | 
|  | 56   DefaultAnimator(ContentsView* contents_view); | 
|  | 57 | 
|  | 58   ~DefaultAnimator() override {} | 
|  | 59 | 
|  | 60   // ContentsAnimator overrides: | 
|  | 61   std::string NameForTests() const override; | 
|  | 62   void Update(double progress, int from_page, int to_page) override; | 
|  | 63 | 
|  | 64   DISALLOW_COPY_AND_ASSIGN(DefaultAnimator); | 
|  | 65 }; | 
|  | 66 | 
|  | 67 // Animator between the start page and apps grid page. | 
|  | 68 class StartToAppsAnimator : public ContentsAnimator { | 
|  | 69  public: | 
|  | 70   StartToAppsAnimator(ContentsView* contents_view); | 
|  | 71 | 
|  | 72   ~StartToAppsAnimator() override {} | 
|  | 73 | 
|  | 74   // ContentsAnimator overrides: | 
|  | 75   std::string NameForTests() const override; | 
|  | 76   void Update(double progress, int start_page, int apps_page) override; | 
|  | 77 | 
|  | 78   DISALLOW_COPY_AND_ASSIGN(StartToAppsAnimator); | 
|  | 79 }; | 
|  | 80 | 
|  | 81 }  // app_list | 
|  | 82 | 
|  | 83 #endif  // UI_APP_LIST_VIEWS_CONTENTS_ANIMATOR_H_ | 
| OLD | NEW | 
|---|