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/drag_window_resizer.h" | 5 #include "ash/wm/drag_window_resizer.h" |
6 | 6 |
7 #include "ash/display/mouse_cursor_event_filter.h" | 7 #include "ash/display/mouse_cursor_event_filter.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
11 #include "ash/system/tray/system_tray.h" | 11 #include "ash/system/tray/system_tray.h" |
12 #include "ash/system/user/tray_user.h" | 12 #include "ash/system/user/tray_user.h" |
13 #include "ash/wm/coordinate_conversion.h" | 13 #include "ash/wm/coordinate_conversion.h" |
14 #include "ash/wm/drag_window_controller.h" | 14 #include "ash/wm/drag_window_controller.h" |
15 #include "ash/wm/window_state.h" | 15 #include "ash/wm/window_state.h" |
16 #include "ash/wm/window_util.h" | |
17 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
18 #include "ui/aura/client/aura_constants.h" | 17 #include "ui/aura/client/aura_constants.h" |
19 #include "ui/aura/env.h" | 18 #include "ui/aura/env.h" |
20 #include "ui/aura/root_window.h" | 19 #include "ui/aura/root_window.h" |
21 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
22 #include "ui/aura/window_delegate.h" | 21 #include "ui/aura/window_delegate.h" |
23 #include "ui/base/hit_test.h" | 22 #include "ui/base/hit_test.h" |
24 #include "ui/base/ui_base_types.h" | 23 #include "ui/base/ui_base_types.h" |
25 #include "ui/gfx/screen.h" | 24 #include "ui/gfx/screen.h" |
26 #include "ui/views/corewm/window_util.h" | 25 #include "ui/views/corewm/window_util.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 ScreenAsh::ConvertRectToScreen(GetTarget()->parent(), bounds); | 142 ScreenAsh::ConvertRectToScreen(GetTarget()->parent(), bounds); |
144 | 143 |
145 // Adjust the position so that the cursor is on the window. | 144 // Adjust the position so that the cursor is on the window. |
146 if (!dst_bounds.Contains(last_mouse_location_in_screen)) { | 145 if (!dst_bounds.Contains(last_mouse_location_in_screen)) { |
147 if (last_mouse_location_in_screen.x() < dst_bounds.x()) | 146 if (last_mouse_location_in_screen.x() < dst_bounds.x()) |
148 dst_bounds.set_x(last_mouse_location_in_screen.x()); | 147 dst_bounds.set_x(last_mouse_location_in_screen.x()); |
149 else if (last_mouse_location_in_screen.x() > dst_bounds.right()) | 148 else if (last_mouse_location_in_screen.x() > dst_bounds.right()) |
150 dst_bounds.set_x( | 149 dst_bounds.set_x( |
151 last_mouse_location_in_screen.x() - dst_bounds.width()); | 150 last_mouse_location_in_screen.x() - dst_bounds.width()); |
152 } | 151 } |
153 ash::wm::AdjustBoundsToEnsureMinimumWindowVisibility( | |
154 dst_display.bounds(), &dst_bounds); | |
155 | |
156 GetTarget()->SetBoundsInScreen(dst_bounds, dst_display); | 152 GetTarget()->SetBoundsInScreen(dst_bounds, dst_display); |
157 } | 153 } |
158 } | 154 } |
159 | 155 |
160 void DragWindowResizer::RevertDrag() { | 156 void DragWindowResizer::RevertDrag() { |
161 next_window_resizer_->RevertDrag(); | 157 next_window_resizer_->RevertDrag(); |
162 | 158 |
163 drag_window_controller_.reset(); | 159 drag_window_controller_.reset(); |
164 GetTarget()->layer()->SetOpacity(details_.initial_opacity); | 160 GetTarget()->layer()->SetOpacity(details_.initial_opacity); |
165 } | 161 } |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 if (!tray_user->TransferWindowToUser(details_.window)) { | 289 if (!tray_user->TransferWindowToUser(details_.window)) { |
294 GetTarget()->layer()->SetOpacity(old_opacity); | 290 GetTarget()->layer()->SetOpacity(old_opacity); |
295 return false; | 291 return false; |
296 } | 292 } |
297 RevertDrag(); | 293 RevertDrag(); |
298 return true; | 294 return true; |
299 } | 295 } |
300 | 296 |
301 } // namespace internal | 297 } // namespace internal |
302 } // namespace ash | 298 } // namespace ash |
OLD | NEW |