OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/dock/docked_window_resizer.h" | 5 #include "ash/wm/dock/docked_window_resizer.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
10 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
11 #include "ash/shelf/shelf_types.h" | 11 #include "ash/shelf/shelf_types.h" |
12 #include "ash/shelf/shelf_widget.h" | 12 #include "ash/shelf/shelf_widget.h" |
13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
14 #include "ash/shell_window_ids.h" | 14 #include "ash/shell_window_ids.h" |
| 15 #include "ash/wm/coordinate_conversion.h" |
15 #include "ash/wm/dock/docked_window_layout_manager.h" | 16 #include "ash/wm/dock/docked_window_layout_manager.h" |
16 #include "ash/wm/window_state.h" | 17 #include "ash/wm/window_state.h" |
17 #include "ash/wm/window_util.h" | 18 #include "ash/wm/window_util.h" |
18 #include "ash/wm/workspace/magnetism_matcher.h" | 19 #include "ash/wm/workspace/magnetism_matcher.h" |
19 #include "ash/wm/workspace/workspace_window_resizer.h" | 20 #include "ash/wm/workspace/workspace_window_resizer.h" |
20 #include "base/command_line.h" | 21 #include "base/command_line.h" |
21 #include "base/memory/weak_ptr.h" | 22 #include "base/memory/weak_ptr.h" |
22 #include "ui/aura/client/aura_constants.h" | 23 #include "ui/aura/client/aura_constants.h" |
23 #include "ui/aura/client/window_tree_client.h" | 24 #include "ui/aura/client/window_tree_client.h" |
24 #include "ui/aura/env.h" | 25 #include "ui/aura/env.h" |
25 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
26 #include "ui/aura/window_delegate.h" | 27 #include "ui/aura/window_delegate.h" |
27 #include "ui/aura/window_event_dispatcher.h" | 28 #include "ui/aura/window_event_dispatcher.h" |
28 #include "ui/base/hit_test.h" | 29 #include "ui/base/hit_test.h" |
29 #include "ui/base/ui_base_types.h" | 30 #include "ui/base/ui_base_types.h" |
30 #include "ui/gfx/screen.h" | 31 #include "ui/gfx/screen.h" |
31 #include "ui/views/widget/widget.h" | 32 #include "ui/views/widget/widget.h" |
32 #include "ui/wm/core/coordinate_conversion.h" | |
33 | 33 |
34 namespace ash { | 34 namespace ash { |
35 namespace { | 35 namespace { |
36 | 36 |
37 DockedWindowLayoutManager* GetDockedLayoutManagerAtPoint( | 37 DockedWindowLayoutManager* GetDockedLayoutManagerAtPoint( |
38 const gfx::Point& point) { | 38 const gfx::Point& point) { |
39 gfx::Display display = ScreenUtil::FindDisplayContainingPoint(point); | 39 gfx::Display display = ScreenUtil::FindDisplayContainingPoint(point); |
40 if (!display.is_valid()) | 40 if (!display.is_valid()) |
41 return NULL; | 41 return NULL; |
42 aura::Window* root = Shell::GetInstance()->display_controller()-> | 42 aura::Window* root = Shell::GetInstance()->display_controller()-> |
(...skipping 11 matching lines...) Expand all Loading... |
54 | 54 |
55 // static | 55 // static |
56 DockedWindowResizer* | 56 DockedWindowResizer* |
57 DockedWindowResizer::Create(WindowResizer* next_window_resizer, | 57 DockedWindowResizer::Create(WindowResizer* next_window_resizer, |
58 wm::WindowState* window_state) { | 58 wm::WindowState* window_state) { |
59 return new DockedWindowResizer(next_window_resizer, window_state); | 59 return new DockedWindowResizer(next_window_resizer, window_state); |
60 } | 60 } |
61 | 61 |
62 void DockedWindowResizer::Drag(const gfx::Point& location, int event_flags) { | 62 void DockedWindowResizer::Drag(const gfx::Point& location, int event_flags) { |
63 last_location_ = location; | 63 last_location_ = location; |
64 ::wm::ConvertPointToScreen(GetTarget()->parent(), &last_location_); | 64 wm::ConvertPointToScreen(GetTarget()->parent(), &last_location_); |
65 if (!did_move_or_resize_) { | 65 if (!did_move_or_resize_) { |
66 did_move_or_resize_ = true; | 66 did_move_or_resize_ = true; |
67 StartedDragging(); | 67 StartedDragging(); |
68 } | 68 } |
69 gfx::Point offset; | 69 gfx::Point offset; |
70 gfx::Rect bounds(CalculateBoundsForDrag(location)); | 70 gfx::Rect bounds(CalculateBoundsForDrag(location)); |
71 MaybeSnapToEdge(bounds, &offset); | 71 MaybeSnapToEdge(bounds, &offset); |
72 gfx::Point modified_location(location); | 72 gfx::Point modified_location(location); |
73 modified_location.Offset(offset.x(), offset.y()); | 73 modified_location.Offset(offset.x(), offset.y()); |
74 | 74 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 // docked it is auto-sized unless it has been resized while being docked | 312 // docked it is auto-sized unless it has been resized while being docked |
313 // before. | 313 // before. |
314 if (is_docked_) { | 314 if (is_docked_) { |
315 wm::GetWindowState(window)->set_bounds_changed_by_user( | 315 wm::GetWindowState(window)->set_bounds_changed_by_user( |
316 was_docked_ && (is_resized || was_bounds_changed_by_user_)); | 316 was_docked_ && (is_resized || was_bounds_changed_by_user_)); |
317 } | 317 } |
318 return action; | 318 return action; |
319 } | 319 } |
320 | 320 |
321 } // namespace ash | 321 } // namespace ash |
OLD | NEW |