Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(579)

Side by Side Diff: ash/wm/workspace/workspace_layout_manager.cc

Issue 9565004: Revert 124385 - Allows tab dragging when maximized on aura. To fix it I made it so (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager.h ('k') | ash/wm/workspace/workspace_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "ash/wm/workspace/workspace_window_resizer.h"
12 #include "ui/aura/client/aura_constants.h" 11 #include "ui/aura/client/aura_constants.h"
13 #include "ui/aura/event.h" 12 #include "ui/aura/event.h"
14 #include "ui/aura/root_window.h" 13 #include "ui/aura/root_window.h"
15 #include "ui/aura/screen_aura.h" 14 #include "ui/aura/screen_aura.h"
16 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
17 #include "ui/aura/window_observer.h" 16 #include "ui/aura/window_observer.h"
18 #include "ui/base/ui_base_types.h" 17 #include "ui/base/ui_base_types.h"
19 #include "ui/gfx/rect.h" 18 #include "ui/gfx/rect.h"
20 #include "ui/views/widget/native_widget_aura.h" 19 #include "ui/views/widget/native_widget_aura.h"
21 20
22 namespace ash { 21 namespace ash {
23 namespace internal { 22 namespace internal {
24 23
25 //////////////////////////////////////////////////////////////////////////////// 24 ////////////////////////////////////////////////////////////////////////////////
26 // WorkspaceLayoutManager, public: 25 // WorkspaceLayoutManager, public:
27 26
28 WorkspaceLayoutManager::WorkspaceLayoutManager( 27 WorkspaceLayoutManager::WorkspaceLayoutManager(
29 WorkspaceManager* workspace_manager) 28 WorkspaceManager* workspace_manager)
30 : workspace_manager_(workspace_manager) { 29 : workspace_manager_(workspace_manager) {
31 } 30 }
32 31
33 WorkspaceLayoutManager::~WorkspaceLayoutManager() { 32 WorkspaceLayoutManager::~WorkspaceLayoutManager() {}
34 const aura::Window::Windows& windows(
35 workspace_manager_->contents_view()->children());
36 for (size_t i = 0; i < windows.size(); ++i)
37 windows[i]->RemoveObserver(this);
38 }
39 33
40 void WorkspaceLayoutManager::OnWindowResized() { 34 void WorkspaceLayoutManager::OnWindowResized() {
41 // Workspace is updated via RootWindowObserver::OnRootWindowResized. 35 // Workspace is updated via RootWindowObserver::OnRootWindowResized.
42 } 36 }
43 37
44 void WorkspaceLayoutManager::OnWindowAddedToLayout(aura::Window* child) { 38 void WorkspaceLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
45 child->AddObserver(this);
46 if (!workspace_manager_->IsManagedWindow(child)) 39 if (!workspace_manager_->IsManagedWindow(child))
47 return; 40 return;
48 41
49 if (child->IsVisible()) { 42 if (child->IsVisible()) {
50 workspace_manager_->AddWindow(child); 43 workspace_manager_->AddWindow(child);
51 } else if (wm::IsWindowMaximized(child)) { 44 } else if (wm::IsWindowMaximized(child)) {
52 SetChildBoundsDirect(child, 45 SetChildBoundsDirect(child,
53 gfx::Screen::GetMonitorWorkAreaNearestWindow(child)); 46 gfx::Screen::GetMonitorWorkAreaNearestWindow(child));
54 } else if (wm::IsWindowFullscreen(child)) { 47 } else if (wm::IsWindowFullscreen(child)) {
55 SetChildBoundsDirect(child, 48 SetChildBoundsDirect(child,
56 gfx::Screen::GetMonitorAreaNearestWindow(child)); 49 gfx::Screen::GetMonitorAreaNearestWindow(child));
57 } else { 50 } else {
58 // Align non-maximized/fullscreen windows to a grid. 51 // Align non-maximized/fullscreen windows to a grid.
59 SetChildBoundsDirect( 52 SetChildBoundsDirect(
60 child, workspace_manager_->AlignBoundsToGrid(child->GetTargetBounds())); 53 child, workspace_manager_->AlignBoundsToGrid(child->GetTargetBounds()));
61 } 54 }
62 } 55 }
63 56
64 void WorkspaceLayoutManager::OnWillRemoveWindowFromLayout( 57 void WorkspaceLayoutManager::OnWillRemoveWindowFromLayout(
65 aura::Window* child) { 58 aura::Window* child) {
66 child->RemoveObserver(this);
67 ClearRestoreBounds(child); 59 ClearRestoreBounds(child);
68 workspace_manager_->RemoveWindow(child); 60 workspace_manager_->RemoveWindow(child);
69 } 61 }
70 62
71 void WorkspaceLayoutManager::OnChildWindowVisibilityChanged( 63 void WorkspaceLayoutManager::OnChildWindowVisibilityChanged(
72 aura::Window* child, 64 aura::Window* child,
73 bool visible) { 65 bool visible) {
74 if (!workspace_manager_->IsManagedWindow(child)) 66 if (!workspace_manager_->IsManagedWindow(child))
75 return; 67 return;
76 if (visible) 68 if (visible)
77 workspace_manager_->AddWindow(child); 69 workspace_manager_->AddWindow(child);
78 else 70 else
79 workspace_manager_->RemoveWindow(child); 71 workspace_manager_->RemoveWindow(child);
80 } 72 }
81 73
82 void WorkspaceLayoutManager::SetChildBounds( 74 void WorkspaceLayoutManager::SetChildBounds(
83 aura::Window* child, 75 aura::Window* child,
84 const gfx::Rect& requested_bounds) { 76 const gfx::Rect& requested_bounds) {
85 gfx::Rect child_bounds(requested_bounds); 77 gfx::Rect child_bounds(requested_bounds);
86 if (GetTrackedByWorkspace(child)) { 78 if (wm::IsWindowMaximized(child)) {
87 if (wm::IsWindowMaximized(child)) { 79 child_bounds = gfx::Screen::GetMonitorWorkAreaNearestWindow(child);
88 child_bounds = gfx::Screen::GetMonitorWorkAreaNearestWindow(child); 80 } else if (wm::IsWindowFullscreen(child)) {
89 } else if (wm::IsWindowFullscreen(child)) { 81 child_bounds = gfx::Screen::GetMonitorAreaNearestWindow(child);
90 child_bounds = gfx::Screen::GetMonitorAreaNearestWindow(child); 82 } else {
91 } else { 83 child_bounds = gfx::Screen::GetMonitorWorkAreaNearestWindow(child).
92 child_bounds = gfx::Screen::GetMonitorWorkAreaNearestWindow(child). 84 AdjustToFit(requested_bounds);
93 AdjustToFit(requested_bounds);
94 }
95 } 85 }
96 SetChildBoundsDirect(child, child_bounds); 86 SetChildBoundsDirect(child, child_bounds);
97 } 87 }
98 88
99 void WorkspaceLayoutManager::OnWindowPropertyChanged(aura::Window* window,
100 const void* key,
101 intptr_t old) {
102 if (key == ash::kWindowTrackedByWorkspaceSplitPropKey &&
103 ash::GetTrackedByWorkspace(window)) {
104 // We currently don't need to support transitioning from true to false, so
105 // we ignore it.
106 workspace_manager_->AddWindow(window);
107 }
108 }
109
110 } // namespace internal 89 } // namespace internal
111 } // namespace ash 90 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager.h ('k') | ash/wm/workspace/workspace_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698