OLD | NEW |
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/transform.h" | 10 #include "ui/gfx/transform.h" |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 ui::Transform SideToTransform(sensors::ScreenOrientation::Side side, | 14 ui::Transform SideToTransform(sensors::ScreenOrientation::Side side, |
15 const ui::Transform& old_transform, | 15 const ui::Transform& old_transform, |
16 const gfx::Size& size) { | 16 const gfx::Size& size) { |
17 gfx::Point origin; | 17 gfx::Point origin; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 views::desktop::DesktopWindowView::desktop_window_view; | 94 views::desktop::DesktopWindowView::desktop_window_view; |
95 | 95 |
96 if (!to_rotate) { | 96 if (!to_rotate) { |
97 // Otherwise, rotate the widget's view. | 97 // Otherwise, rotate the widget's view. |
98 views::Widget* widget = GetWidget(); | 98 views::Widget* widget = GetWidget(); |
99 to_rotate = widget->GetRootView(); | 99 to_rotate = widget->GetRootView(); |
100 } | 100 } |
101 | 101 |
102 if (!initialized_screen_rotation_) { | 102 if (!initialized_screen_rotation_) { |
103 to_rotate->SetPaintToLayer(true); | 103 to_rotate->SetPaintToLayer(true); |
104 to_rotate->SetLayerPropertySetter( | 104 to_rotate->SetLayerAnimator( |
105 ScreenRotationSetterFactory::Create(to_rotate)); | 105 ScreenRotationAnimatorFactory::Create(to_rotate)); |
106 initialized_screen_rotation_ = true; | 106 initialized_screen_rotation_ = true; |
107 } | 107 } |
108 | 108 |
109 const ui::Transform& old_xform = to_rotate->GetTransform(); | 109 const ui::Transform& old_xform = to_rotate->GetTransform(); |
110 const ui::Transform& new_xform = SideToTransform(change.upward, | 110 const ui::Transform& new_xform = SideToTransform(change.upward, |
111 old_xform, | 111 old_xform, |
112 to_rotate->size()); | 112 to_rotate->size()); |
113 if (old_xform != new_xform) | 113 if (old_xform != new_xform) |
114 to_rotate->SetTransform(new_xform); | 114 to_rotate->SetTransform(new_xform); |
115 } | 115 } |
OLD | NEW |