Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: chrome/browser/views/tabs/grid.h

Issue 126185: Improved tab overview animations with better animation and wiring to... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_VIEWS_TABS_GRID_H_ 5 #ifndef CHROME_BROWSER_VIEWS_TABS_GRID_H_
6 #define CHROME_BROWSER_VIEWS_TABS_GRID_H_ 6 #define CHROME_BROWSER_VIEWS_TABS_GRID_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "app/slide_animation.h" 10 #include "app/slide_animation.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 // Returns the width of a cell. 59 // Returns the width of a cell.
60 int cell_width() const { return cell_width_; } 60 int cell_width() const { return cell_width_; }
61 61
62 // Returns the height of a cell. 62 // Returns the height of a cell.
63 int cell_height() const { return cell_height_; } 63 int cell_height() const { return cell_height_; }
64 64
65 // Returns the bounds of the specified cell. 65 // Returns the bounds of the specified cell.
66 gfx::Rect CellBounds(int index); 66 gfx::Rect CellBounds(int index);
67 67
68 // Returns the value based on the current animation. |start| gives the
69 // starting coordinate and |target| the target coordinate. The resulting
70 // value is between |start| and |target| based on the current animation.
71 int AnimationPosition(int start, int target);
72
73 // Convenience for returning a rectangle between |start_bounds| and
74 // |target_bounds| based on the current animation.
75 gfx::Rect AnimationPosition(const gfx::Rect& start_bounds,
76 const gfx::Rect& target_bounds);
77
68 // View overrides. 78 // View overrides.
69 virtual void ViewHierarchyChanged(bool is_add, 79 virtual void ViewHierarchyChanged(bool is_add,
70 views::View* parent, 80 views::View* parent,
71 views::View* child); 81 views::View* child);
72 virtual gfx::Size GetPreferredSize(); 82 virtual gfx::Size GetPreferredSize();
73 virtual void Layout(); 83 virtual void Layout();
74 void PaintChildren(gfx::Canvas* canvas); 84 void PaintChildren(gfx::Canvas* canvas);
75 85
76 // AnimationDelegate overrides. 86 // AnimationDelegate overrides.
77 virtual void AnimationEnded(const Animation* animation); 87 virtual void AnimationEnded(const Animation* animation);
78 virtual void AnimationProgressed(const Animation* animation); 88 virtual void AnimationProgressed(const Animation* animation);
79 virtual void AnimationCanceled(const Animation* animation); 89 virtual void AnimationCanceled(const Animation* animation);
80 90
81 // Padding between cells. 91 // Padding between cells.
82 static const int kCellXPadding; 92 static const int kCellXPadding;
83 static const int kCellYPadding; 93 static const int kCellYPadding;
84 94
85 private: 95 private:
86 // Calculates the bounds of each of the cells, adding the result to |bounds|. 96 // Calculates the bounds of each of the cells, adding the result to |bounds|.
87 void CalculateCellBounds(std::vector<gfx::Rect>* bounds); 97 void CalculateCellBounds(std::vector<gfx::Rect>* bounds);
88 98
89 // Resets start_bounds_ to the bounds of the current cells, and invokes 99 // Resets start_bounds_ to the bounds of the current cells, and invokes
90 // CalculateCellBounds to determine the target bounds. Then starts the 100 // CalculateCellBounds to determine the target bounds. Then starts the
91 // animation if it isn't already running. 101 // animation if it isn't already running.
92 void CalculateTargetBoundsAndStartAnimation(); 102 void CalculateTargetBoundsAndStartAnimation();
93 103
94 // Resets the bounds of each cell to that of target_bounds_. 104 // Resets the bounds of each cell to that of target_bounds_.
95 void SetViewBoundsToTarget(); 105 void SetViewBoundsToTarget();
96 106
97 // Returns the value based on the current animation. |start| gives the
98 // starting coordinate and |target| the target coordinate. The resulting
99 // value is between |start| and |target| based on the current animation.
100 int AnimationPosition(int start, int target);
101
102 // The animation. 107 // The animation.
103 SlideAnimation animation_; 108 SlideAnimation animation_;
104 109
105 // If true, we're adding/removing a child and can ignore the change in 110 // If true, we're adding/removing a child and can ignore the change in
106 // ViewHierarchyChanged. 111 // ViewHierarchyChanged.
107 bool modifying_children_; 112 bool modifying_children_;
108 113
109 // Do we need a layout? This is set to true any time a child is added/removed. 114 // Do we need a layout? This is set to true any time a child is added/removed.
110 bool needs_layout_; 115 bool needs_layout_;
111 116
(...skipping 18 matching lines...) Expand all
130 // Used during animation, gives the initial bounds of the views. 135 // Used during animation, gives the initial bounds of the views.
131 std::vector<gfx::Rect> start_bounds_; 136 std::vector<gfx::Rect> start_bounds_;
132 137
133 // Used during animation, gives the target bounds of the views. 138 // Used during animation, gives the target bounds of the views.
134 std::vector<gfx::Rect> target_bounds_; 139 std::vector<gfx::Rect> target_bounds_;
135 140
136 DISALLOW_COPY_AND_ASSIGN(Grid); 141 DISALLOW_COPY_AND_ASSIGN(Grid);
137 }; 142 };
138 143
139 #endif // CHROME_BROWSER_VIEWS_TABS_GRID_H_ 144 #endif // CHROME_BROWSER_VIEWS_TABS_GRID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698