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

Side by Side Diff: chrome/browser/views/tabs/dragged_tab_view.cc

Issue 1961001: Refactors animation to allow for cleaner subclassing. I'm doing this (Closed)
Patch Set: Incorporated review feedback Created 10 years, 7 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
« no previous file with comments | « chrome/browser/views/status_bubble_views.cc ('k') | chrome/browser/views/tabs/side_tab.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "chrome/browser/views/tabs/dragged_tab_view.h" 5 #include "chrome/browser/views/tabs/dragged_tab_view.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "chrome/browser/tab_contents/tab_contents.h" 8 #include "chrome/browser/tab_contents/tab_contents.h"
9 #include "chrome/browser/tabs/tab_strip_model.h" 9 #include "chrome/browser/tabs/tab_strip_model.h"
10 #include "chrome/browser/views/tabs/native_view_photobooth.h" 10 #include "chrome/browser/views/tabs/native_view_photobooth.h"
11 #include "chrome/browser/views/tabs/tab_renderer.h" 11 #include "chrome/browser/views/tabs/tab_renderer.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 #else 64 #else
65 container_.reset(new views::WidgetGtk(views::WidgetGtk::TYPE_POPUP)); 65 container_.reset(new views::WidgetGtk(views::WidgetGtk::TYPE_POPUP));
66 container_->MakeTransparent(); 66 container_->MakeTransparent();
67 container_->set_delete_on_destroy(false); 67 container_->set_delete_on_destroy(false);
68 container_->Init(NULL, gfx::Rect(0, 0, 0, 0)); 68 container_->Init(NULL, gfx::Rect(0, 0, 0, 0));
69 container_->SetContentsView(this); 69 container_->SetContentsView(this);
70 #endif 70 #endif
71 } 71 }
72 72
73 DraggedTabView::~DraggedTabView() { 73 DraggedTabView::~DraggedTabView() {
74 if (close_animation_.IsAnimating()) 74 if (close_animation_.is_animating())
75 close_animation_.Stop(); 75 close_animation_.Stop();
76 GetParent()->RemoveChildView(this); 76 GetParent()->RemoveChildView(this);
77 container_->CloseNow(); 77 container_->CloseNow();
78 } 78 }
79 79
80 void DraggedTabView::MoveTo(const gfx::Point& screen_point) { 80 void DraggedTabView::MoveTo(const gfx::Point& screen_point) {
81 int x; 81 int x;
82 if (UILayoutIsRightToLeft() && !attached_) { 82 if (UILayoutIsRightToLeft() && !attached_) {
83 // On RTL locales, a dragged tab (when it is not attached to a tab strip) 83 // On RTL locales, a dragged tab (when it is not attached to a tab strip)
84 // is rendered using a right-to-left orientation so we should calculate the 84 // is rendered using a right-to-left orientation so we should calculate the
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 void DraggedTabView::AnimateToBounds(const gfx::Rect& bounds, 147 void DraggedTabView::AnimateToBounds(const gfx::Rect& bounds,
148 Callback0::Type* callback) { 148 Callback0::Type* callback) {
149 animation_callback_.reset(callback); 149 animation_callback_.reset(callback);
150 150
151 gfx::Rect initial_bounds; 151 gfx::Rect initial_bounds;
152 GetWidget()->GetBounds(&initial_bounds, true); 152 GetWidget()->GetBounds(&initial_bounds, true);
153 animation_start_bounds_ = initial_bounds; 153 animation_start_bounds_ = initial_bounds;
154 animation_end_bounds_ = bounds; 154 animation_end_bounds_ = bounds;
155 155
156 close_animation_.SetSlideDuration(kAnimateToBoundsDurationMs); 156 close_animation_.SetSlideDuration(kAnimateToBoundsDurationMs);
157 close_animation_.SetTweenType(SlideAnimation::EASE_OUT); 157 close_animation_.SetTweenType(Tween::EASE_OUT);
158 if (!close_animation_.IsShowing()) { 158 if (!close_animation_.IsShowing()) {
159 close_animation_.Reset(); 159 close_animation_.Reset();
160 close_animation_.Show(); 160 close_animation_.Show();
161 } 161 }
162 } 162 }
163 163
164 /////////////////////////////////////////////////////////////////////////////// 164 ///////////////////////////////////////////////////////////////////////////////
165 // DraggedTabView, AnimationDelegate implementation: 165 // DraggedTabView, AnimationDelegate implementation:
166 166
167 void DraggedTabView::AnimationProgressed(const Animation* animation) { 167 void DraggedTabView::AnimationProgressed(const Animation* animation) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 #else 299 #else
300 gfx::Rect bounds; 300 gfx::Rect bounds;
301 container_->GetBounds(&bounds, true); 301 container_->GetBounds(&bounds, true);
302 container_->SetBounds(gfx::Rect(bounds.x(), bounds.y(), w, h)); 302 container_->SetBounds(gfx::Rect(bounds.x(), bounds.y(), w, h));
303 #endif 303 #endif
304 } 304 }
305 305
306 int DraggedTabView::ScaleValue(int value) { 306 int DraggedTabView::ScaleValue(int value) {
307 return attached_ ? value : static_cast<int>(value * kScalingFactor); 307 return attached_ ? value : static_cast<int>(value * kScalingFactor);
308 } 308 }
OLDNEW
« no previous file with comments | « chrome/browser/views/status_bubble_views.cc ('k') | chrome/browser/views/tabs/side_tab.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698