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

Side by Side Diff: chrome/browser/ui/touch/frame/touch_browser_frame_view.cc

Issue 8362006: Reland r107720 - Enable the new layer animation framework. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with parent patch Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ui/touch/frame/touch_browser_frame_view.h" 5 #include "chrome/browser/ui/touch/frame/touch_browser_frame_view.h"
6 6
7 #include "chrome/browser/ui/touch/animation/screen_rotation_setter.h" 7 #include "chrome/browser/ui/touch/animation/screen_rotation_animator.h"
8 #include "views/controls/button/image_button.h" 8 #include "views/controls/button/image_button.h"
9 #include "views/desktop/desktop_window_view.h" 9 #include "views/desktop/desktop_window_view.h"
10 #include "ui/gfx/compositor/layer.h"
10 #include "ui/gfx/transform.h" 11 #include "ui/gfx/transform.h"
11 12
12 namespace { 13 namespace {
13 14
14 ui::Transform SideToTransform(sensors::ScreenOrientation::Side side, 15 ui::Transform SideToTransform(sensors::ScreenOrientation::Side side,
15 const ui::Transform& old_transform, 16 const ui::Transform& old_transform,
16 const gfx::Size& size) { 17 const gfx::Size& size) {
17 gfx::Point origin; 18 gfx::Point origin;
18 gfx::Point bottom_right(size.width(), size.height()); 19 gfx::Point bottom_right(size.width(), size.height());
19 old_transform.TransformPoint(origin); 20 old_transform.TransformPoint(origin);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 views::desktop::DesktopWindowView::desktop_window_view; 95 views::desktop::DesktopWindowView::desktop_window_view;
95 96
96 if (!to_rotate) { 97 if (!to_rotate) {
97 // Otherwise, rotate the widget's view. 98 // Otherwise, rotate the widget's view.
98 views::Widget* widget = GetWidget(); 99 views::Widget* widget = GetWidget();
99 to_rotate = widget->GetRootView(); 100 to_rotate = widget->GetRootView();
100 } 101 }
101 102
102 if (!initialized_screen_rotation_) { 103 if (!initialized_screen_rotation_) {
103 to_rotate->SetPaintToLayer(true); 104 to_rotate->SetPaintToLayer(true);
104 to_rotate->SetLayerPropertySetter( 105 if (to_rotate->layer()) {
105 ScreenRotationSetterFactory::Create(to_rotate)); 106 to_rotate->layer()->SetAnimator(
106 initialized_screen_rotation_ = true; 107 ScreenRotationAnimatorFactory::Create(to_rotate));
108 initialized_screen_rotation_ = true;
109 }
107 } 110 }
108 111
109 const ui::Transform& old_xform = to_rotate->GetTransform(); 112 const ui::Transform& old_xform = to_rotate->GetTransform();
110 const ui::Transform& new_xform = SideToTransform(change.upward, 113 const ui::Transform& new_xform = SideToTransform(change.upward,
111 old_xform, 114 old_xform,
112 to_rotate->size()); 115 to_rotate->size());
113 if (old_xform != new_xform) 116 if (old_xform != new_xform)
114 to_rotate->SetTransform(new_xform); 117 to_rotate->SetTransform(new_xform);
115 } 118 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698