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/system_pinch_handler.h" | 5 #include "ash/wm/gestures/system_pinch_handler.h" |
6 | 6 |
7 #include "ash/screen_ash.h" | 7 #include "ash/screen_util.h" |
8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" |
9 #include "ash/shelf/shelf_widget.h" | 9 #include "ash/shelf/shelf_widget.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
11 #include "ash/wm/window_animations.h" | 11 #include "ash/wm/window_animations.h" |
12 #include "ash/wm/window_state.h" | 12 #include "ash/wm/window_state.h" |
13 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
14 #include "ash/wm/workspace/snap_sizer.h" | 14 #include "ash/wm/workspace/snap_sizer.h" |
15 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
16 #include "ui/compositor/scoped_layer_animation_settings.h" | 16 #include "ui/compositor/scoped_layer_animation_settings.h" |
17 #include "ui/events/event_constants.h" | 17 #include "ui/events/event_constants.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 | 108 |
109 return SYSTEM_GESTURE_PROCESSED; | 109 return SYSTEM_GESTURE_PROCESSED; |
110 } | 110 } |
111 | 111 |
112 gfx::Rect SystemPinchHandler::GetPhantomWindowScreenBounds( | 112 gfx::Rect SystemPinchHandler::GetPhantomWindowScreenBounds( |
113 aura::Window* window, | 113 aura::Window* window, |
114 const gfx::Point& point) { | 114 const gfx::Point& point) { |
115 if (pinch_factor_ > kPinchThresholdForMaximize) { | 115 if (pinch_factor_ > kPinchThresholdForMaximize) { |
116 phantom_state_ = PHANTOM_WINDOW_MAXIMIZED; | 116 phantom_state_ = PHANTOM_WINDOW_MAXIMIZED; |
117 return ScreenAsh::ConvertRectToScreen( | 117 return ScreenUtil::ConvertRectToScreen( |
118 target_->parent(), | 118 target_->parent(), |
119 ScreenAsh::GetMaximizedWindowBoundsInParent(target_)); | 119 ScreenUtil::GetMaximizedWindowBoundsInParent(target_)); |
120 } | 120 } |
121 | 121 |
122 if (pinch_factor_ < kPinchThresholdForMinimize) { | 122 if (pinch_factor_ < kPinchThresholdForMinimize) { |
123 wm::WindowState* window_state = wm::GetWindowState(window); | 123 wm::WindowState* window_state = wm::GetWindowState(window); |
124 if (window_state->IsMaximizedOrFullscreen()) { | 124 if (window_state->IsMaximizedOrFullscreen()) { |
125 if (window_state->HasRestoreBounds()) { | 125 if (window_state->HasRestoreBounds()) { |
126 phantom_state_ = PHANTOM_WINDOW_MINIMIZED; | 126 phantom_state_ = PHANTOM_WINDOW_MINIMIZED; |
127 return window_state->GetRestoreBoundsInScreen(); | 127 return window_state->GetRestoreBoundsInScreen(); |
128 } | 128 } |
129 return window->bounds(); | 129 return window->bounds(); |
130 } | 130 } |
131 | 131 |
132 gfx::Rect rect = GetMinimizeAnimationTargetBoundsInScreen(target_); | 132 gfx::Rect rect = GetMinimizeAnimationTargetBoundsInScreen(target_); |
133 if (!rect.IsEmpty()) | 133 if (!rect.IsEmpty()) |
134 rect.Inset(-8, -8); | 134 rect.Inset(-8, -8); |
135 phantom_state_ = PHANTOM_WINDOW_MINIMIZED; | 135 phantom_state_ = PHANTOM_WINDOW_MINIMIZED; |
136 return rect; | 136 return rect; |
137 } | 137 } |
138 | 138 |
139 phantom_state_ = PHANTOM_WINDOW_NORMAL; | 139 phantom_state_ = PHANTOM_WINDOW_NORMAL; |
140 return window->bounds(); | 140 return window->bounds(); |
141 } | 141 } |
142 | 142 |
143 } // namespace internal | 143 } // namespace internal |
144 } // namespace ash | 144 } // namespace ash |
OLD | NEW |