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/workspace/workspace_layout_manager.h" | 5 #include "ash/wm/workspace/workspace_layout_manager.h" |
6 | 6 |
7 #include "ash/wm/property_util.h" | 7 #include "ash/wm/property_util.h" |
8 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
9 #include "ash/wm/workspace/workspace.h" | 9 #include "ash/wm/workspace/workspace.h" |
10 #include "ash/wm/workspace/workspace_manager.h" | 10 #include "ash/wm/workspace/workspace_manager.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 //////////////////////////////////////////////////////////////////////////////// | 24 //////////////////////////////////////////////////////////////////////////////// |
25 // WorkspaceLayoutManager, public: | 25 // WorkspaceLayoutManager, public: |
26 | 26 |
27 WorkspaceLayoutManager::WorkspaceLayoutManager( | 27 WorkspaceLayoutManager::WorkspaceLayoutManager( |
28 WorkspaceManager* workspace_manager) | 28 WorkspaceManager* workspace_manager) |
29 : workspace_manager_(workspace_manager) { | 29 : workspace_manager_(workspace_manager) { |
30 } | 30 } |
31 | 31 |
32 WorkspaceLayoutManager::~WorkspaceLayoutManager() {} | 32 WorkspaceLayoutManager::~WorkspaceLayoutManager() {} |
33 | 33 |
34 void WorkspaceLayoutManager::PrepareForMoveOrResize( | |
35 aura::Window* drag, | |
36 aura::MouseEvent* event) { | |
37 } | |
38 | |
39 void WorkspaceLayoutManager::CancelMoveOrResize( | |
40 aura::Window* drag, | |
41 aura::MouseEvent* event) { | |
42 } | |
43 | |
44 void WorkspaceLayoutManager::ProcessMove( | |
45 aura::Window* drag, | |
46 aura::MouseEvent* event) { | |
47 // TODO: needs implementation for TYPE_SPLIT. For TYPE_SPLIT I want to | |
48 // disallow eventfilter from moving and instead deal with it here. | |
49 } | |
50 | |
51 void WorkspaceLayoutManager::EndMove( | |
52 aura::Window* drag, | |
53 aura::MouseEvent* evnet) { | |
54 // TODO: see comment in ProcessMove. | |
55 } | |
56 | |
57 void WorkspaceLayoutManager::EndResize( | |
58 aura::Window* drag, | |
59 aura::MouseEvent* evnet) { | |
60 // TODO: see comment in ProcessMove. | |
61 } | |
62 | |
63 //////////////////////////////////////////////////////////////////////////////// | |
64 // WorkspaceLayoutManager, aura::LayoutManager implementation: | |
65 | |
66 void WorkspaceLayoutManager::OnWindowResized() { | 34 void WorkspaceLayoutManager::OnWindowResized() { |
67 // Workspace is updated via RootWindowObserver::OnRootWindowResized. | 35 // Workspace is updated via RootWindowObserver::OnRootWindowResized. |
68 } | 36 } |
69 | 37 |
70 void WorkspaceLayoutManager::OnWindowAddedToLayout(aura::Window* child) { | 38 void WorkspaceLayoutManager::OnWindowAddedToLayout(aura::Window* child) { |
71 if (!workspace_manager_->IsManagedWindow(child)) | 39 if (!workspace_manager_->IsManagedWindow(child)) |
72 return; | 40 return; |
73 | 41 |
74 if (child->IsVisible()) { | 42 if (child->IsVisible()) { |
75 workspace_manager_->AddWindow(child); | 43 workspace_manager_->AddWindow(child); |
(...skipping 29 matching lines...) Expand all Loading... |
105 if (visible) | 73 if (visible) |
106 workspace_manager_->AddWindow(child); | 74 workspace_manager_->AddWindow(child); |
107 else | 75 else |
108 workspace_manager_->RemoveWindow(child); | 76 workspace_manager_->RemoveWindow(child); |
109 } | 77 } |
110 | 78 |
111 void WorkspaceLayoutManager::SetChildBounds( | 79 void WorkspaceLayoutManager::SetChildBounds( |
112 aura::Window* child, | 80 aura::Window* child, |
113 const gfx::Rect& requested_bounds) { | 81 const gfx::Rect& requested_bounds) { |
114 gfx::Rect child_bounds(requested_bounds); | 82 gfx::Rect child_bounds(requested_bounds); |
115 if (window_util::IsWindowMaximized(child)) | 83 if (window_util::IsWindowMaximized(child)) { |
116 child_bounds = gfx::Screen::GetMonitorWorkAreaNearestWindow(child); | 84 child_bounds = gfx::Screen::GetMonitorWorkAreaNearestWindow(child); |
117 else if (window_util::IsWindowFullscreen(child)) | 85 } else if (window_util::IsWindowFullscreen(child)) { |
118 child_bounds = gfx::Screen::GetMonitorAreaNearestWindow(child); | 86 child_bounds = gfx::Screen::GetMonitorAreaNearestWindow(child); |
| 87 } else { |
| 88 child_bounds = gfx::Screen::GetMonitorWorkAreaNearestWindow(child). |
| 89 AdjustToFit(requested_bounds); |
| 90 } |
119 SetChildBoundsDirect(child, child_bounds); | 91 SetChildBoundsDirect(child, child_bounds); |
120 } | 92 } |
121 | 93 |
122 } // namespace internal | 94 } // namespace internal |
123 } // namespace ash | 95 } // namespace ash |
OLD | NEW |