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

Unified Diff: ui/aura/window.cc

Issue 7972023: Implicit animations through Layer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More tweaks Created 9 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/window.h ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/window.cc
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index 7e8070eee943a7c6bb3c00339f7c25011568e811..86e1dda7e273bcd9c56f68610f561e83adb26669 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -13,6 +13,7 @@
#include "ui/aura/focus_manager.h"
#include "ui/aura/layout_manager.h"
#include "ui/aura/window_delegate.h"
+#include "ui/base/animation/multi_animation.h"
#include "ui/gfx/canvas_skia.h"
#include "ui/gfx/compositor/compositor.h"
#include "ui/gfx/compositor/layer.h"
@@ -84,23 +85,26 @@ void Window::SetLayoutManager(LayoutManager* layout_manager) {
layout_manager_.reset(layout_manager);
}
-void Window::SetBounds(const gfx::Rect& bounds, int anim_ms) {
- // TODO: support anim_ms
+void Window::SetBounds(const gfx::Rect& new_bounds) {
// TODO: funnel this through the Desktop.
- bool was_move = bounds_.size() == bounds.size();
- gfx::Rect old_bounds = bounds_;
- bounds_ = bounds;
- layer_->SetBounds(bounds);
+ gfx::Rect old_bounds = bounds();
+ bool was_move = old_bounds.size() == new_bounds.size();
+ layer_->SetBounds(new_bounds);
+
if (layout_manager_.get())
layout_manager_->OnWindowResized();
if (delegate_)
- delegate_->OnBoundsChanged(old_bounds, bounds_);
+ delegate_->OnBoundsChanged(old_bounds, new_bounds);
if (was_move)
SchedulePaintInRect(gfx::Rect());
else
SchedulePaint();
}
+const gfx::Rect& Window::bounds() const {
+ return layer_->bounds();
+}
+
void Window::SchedulePaintInRect(const gfx::Rect& rect) {
layer_->SchedulePaint(rect);
}
@@ -231,12 +235,21 @@ bool Window::HasCapture() {
return root && root->capture_window() == this;
}
+// static
+ui::Animation* Window::CreateDefaultAnimation() {
+ std::vector<ui::MultiAnimation::Part> parts;
+ parts.push_back(ui::MultiAnimation::Part(200, ui::Tween::LINEAR));
+ ui::MultiAnimation* multi_animation = new ui::MultiAnimation(parts);
+ multi_animation->set_continuous(false);
+ return multi_animation;
+}
+
internal::RootWindow* Window::GetRoot() {
return parent_ ? parent_->GetRoot() : NULL;
}
void Window::SchedulePaint() {
- SchedulePaintInRect(gfx::Rect(0, 0, bounds_.width(), bounds_.height()));
+ SchedulePaintInRect(gfx::Rect(0, 0, bounds().width(), bounds().height()));
}
void Window::OnPaintLayer(gfx::Canvas* canvas) {
« no previous file with comments | « ui/aura/window.h ('k') | ui/aura/window_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698