OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/wm/gestures/two_finger_drag_handler.h" | 5 #include "ash/wm/gestures/two_finger_drag_handler.h" |
6 | 6 |
7 #include "ash/shell.h" | |
8 #include "ash/wm/default_window_resizer.h" | 7 #include "ash/wm/default_window_resizer.h" |
9 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
10 #include "ash/wm/workspace/snap_sizer.h" | 9 #include "ash/wm/workspace/snap_sizer.h" |
11 #include "ui/aura/client/window_types.h" | 10 #include "ui/aura/client/window_types.h" |
12 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
13 #include "ui/base/events/event.h" | 12 #include "ui/base/events/event.h" |
14 #include "ui/base/events/event_constants.h" | 13 #include "ui/base/events/event_constants.h" |
15 #include "ui/base/hit_test.h" | 14 #include "ui/base/hit_test.h" |
16 #include "ui/compositor/layer.h" | 15 #include "ui/compositor/layer.h" |
17 #include "ui/compositor/scoped_layer_animation_settings.h" | 16 #include "ui/compositor/scoped_layer_animation_settings.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 Reset(); | 60 Reset(); |
62 | 61 |
63 if (event.details().swipe_up()) { | 62 if (event.details().swipe_up()) { |
64 wm::MaximizeWindow(target); | 63 wm::MaximizeWindow(target); |
65 } else if (event.details().swipe_down()) { | 64 } else if (event.details().swipe_down()) { |
66 wm::MinimizeWindow(target); | 65 wm::MinimizeWindow(target); |
67 } else { | 66 } else { |
68 internal::SnapSizer sizer(target, | 67 internal::SnapSizer sizer(target, |
69 gfx::Point(), | 68 gfx::Point(), |
70 event.details().swipe_left() ? internal::SnapSizer::LEFT_EDGE : | 69 event.details().swipe_left() ? internal::SnapSizer::LEFT_EDGE : |
71 internal::SnapSizer::RIGHT_EDGE, | 70 internal::SnapSizer::RIGHT_EDGE); |
72 Shell::GetInstance()->GetGridSize()); | |
73 | 71 |
74 ui::ScopedLayerAnimationSettings scoped_setter( | 72 ui::ScopedLayerAnimationSettings scoped_setter( |
75 target->layer()->GetAnimator()); | 73 target->layer()->GetAnimator()); |
76 scoped_setter.SetPreemptionStrategy( | 74 scoped_setter.SetPreemptionStrategy( |
77 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); | 75 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); |
78 target->SetBounds(sizer.target_bounds()); | 76 target->SetBounds(sizer.target_bounds()); |
79 } | 77 } |
80 return true; | 78 return true; |
81 } | 79 } |
82 | 80 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 bool visible) { | 113 bool visible) { |
116 Reset(); | 114 Reset(); |
117 } | 115 } |
118 | 116 |
119 void TwoFingerDragHandler::OnWindowDestroying(aura::Window* window) { | 117 void TwoFingerDragHandler::OnWindowDestroying(aura::Window* window) { |
120 Reset(); | 118 Reset(); |
121 } | 119 } |
122 | 120 |
123 } // namespace internal | 121 } // namespace internal |
124 } // namespace ash | 122 } // namespace ash |
OLD | NEW |