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

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

Issue 16093036: Do not create a workspace for a maximized window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test failure Created 7 years, 6 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.h ('k') | ash/wm/workspace/workspace_layout_manager.cc » ('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.h" 5 #include "ash/wm/workspace/workspace.h"
6 6
7 #include "ash/shell_window_ids.h" 7 #include "ash/shell_window_ids.h"
8 #include "ash/wm/property_util.h" 8 #include "ash/wm/property_util.h"
9 #include "ash/wm/window_animations.h" 9 #include "ash/wm/window_animations.h"
10 #include "ash/wm/window_properties.h" 10 #include "ash/wm/window_properties.h"
11 #include "ash/wm/window_util.h" 11 #include "ash/wm/window_util.h"
12 #include "ash/wm/workspace/workspace_event_handler.h" 12 #include "ash/wm/workspace/workspace_event_handler.h"
13 #include "ash/wm/workspace/workspace_layout_manager.h" 13 #include "ash/wm/workspace/workspace_layout_manager.h"
14 #include "ash/wm/workspace/workspace_manager.h" 14 #include "ash/wm/workspace/workspace_manager.h"
15 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
16 #include "ui/views/corewm/visibility_controller.h" 16 #include "ui/views/corewm/visibility_controller.h"
17 17
18 namespace ash { 18 namespace ash {
19 namespace internal { 19 namespace internal {
20 20
21 Workspace::Workspace(WorkspaceManager* manager, 21 Workspace::Workspace(WorkspaceManager* manager,
22 aura::Window* parent, 22 aura::Window* parent,
23 bool is_maximized) 23 bool is_fullscreen)
24 : is_maximized_(is_maximized), 24 : is_fullscreen_(is_fullscreen),
25 workspace_manager_(manager), 25 workspace_manager_(manager),
26 window_(new aura::Window(NULL)), 26 window_(new aura::Window(NULL)),
27 event_handler_(new WorkspaceEventHandler(window_)), 27 event_handler_(new WorkspaceEventHandler(window_)),
28 workspace_layout_manager_(NULL) { 28 workspace_layout_manager_(NULL) {
29 views::corewm::SetChildWindowVisibilityChangesAnimated(window_); 29 views::corewm::SetChildWindowVisibilityChangesAnimated(window_);
30 SetWindowVisibilityAnimationTransition(window_, views::corewm::ANIMATE_NONE); 30 SetWindowVisibilityAnimationTransition(window_, views::corewm::ANIMATE_NONE);
31 window_->set_id(kShellWindowId_WorkspaceContainer); 31 window_->set_id(kShellWindowId_WorkspaceContainer);
32 window_->SetName("WorkspaceContainer"); 32 window_->SetName("WorkspaceContainer");
33 window_->Init(ui::LAYER_NOT_DRAWN); 33 window_->Init(ui::LAYER_NOT_DRAWN);
34 // Do this so when animating out windows don't extend beyond the bounds. 34 // Do this so when animating out windows don't extend beyond the bounds.
(...skipping 30 matching lines...) Expand all
65 window_->SetLayoutManager(NULL); 65 window_->SetLayoutManager(NULL);
66 window_->SetEventFilter(NULL); 66 window_->SetEventFilter(NULL);
67 window_->RemovePreTargetHandler(event_handler_.get()); 67 window_->RemovePreTargetHandler(event_handler_.get());
68 window_->RemovePostTargetHandler(event_handler_.get()); 68 window_->RemovePostTargetHandler(event_handler_.get());
69 aura::Window* window = window_; 69 aura::Window* window = window_;
70 window_ = NULL; 70 window_ = NULL;
71 return window; 71 return window;
72 } 72 }
73 73
74 bool Workspace::ShouldMoveToPending() const { 74 bool Workspace::ShouldMoveToPending() const {
75 if (!is_maximized_) 75 if (!is_fullscreen_)
76 return false; 76 return false;
77 77
78 for (size_t i = 0; i < window_->children().size(); ++i) { 78 for (size_t i = 0; i < window_->children().size(); ++i) {
79 aura::Window* child(window_->children()[i]); 79 aura::Window* child(window_->children()[i]);
80 if (!child->TargetVisibility() || wm::IsWindowMinimized(child)) 80 if (!child->TargetVisibility() || wm::IsWindowMinimized(child))
81 continue; 81 continue;
82 82
83 // If we have a maximized window don't move to pending. 83 // If we have a fullscreen window don't move to pending.
84 if (WorkspaceManager::IsMaximized(child)) 84 if (wm::IsWindowFullscreen(child))
85 return false; 85 return false;
86 86
87 if (GetTrackedByWorkspace(child) && !GetPersistsAcrossAllWorkspaces(child)) 87 if (GetTrackedByWorkspace(child) && !GetPersistsAcrossAllWorkspaces(child))
88 return false; 88 return false;
89 } 89 }
90 return true; 90 return true;
91 } 91 }
92 92
93 int Workspace::GetNumMaximizedWindows() const { 93 int Workspace::GetNumFullscreenWindows() const {
94 int count = 0; 94 int count = 0;
95 for (size_t i = 0; i < window_->children().size(); ++i) { 95 for (size_t i = 0; i < window_->children().size(); ++i) {
96 aura::Window* child = window_->children()[i]; 96 aura::Window* child = window_->children()[i];
97 if (GetTrackedByWorkspace(child) && 97 if (GetTrackedByWorkspace(child) &&
98 (WorkspaceManager::IsMaximized(child) || 98 (wm::IsWindowFullscreen(child) ||
99 WorkspaceManager::WillRestoreMaximized(child))) { 99 WorkspaceManager::WillRestoreToWorkspace(child))) {
100 if (++count == 2) 100 if (++count == 2)
101 return count; 101 return count;
102 } 102 }
103 } 103 }
104 return count; 104 return count;
105 } 105 }
106 106
107 } // namespace internal 107 } // namespace internal
108 } // namespace ash 108 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace.h ('k') | ash/wm/workspace/workspace_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698