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