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

Side by Side Diff: ash/common/wm/workspace_controller.cc

Issue 2297893002: Merges RootWindowControllerCommon into WmRootWindowController (Closed)
Patch Set: feedback Created 4 years, 3 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
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/common/wm/workspace_controller.h" 5 #include "ash/common/wm/workspace_controller.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/common/shelf/wm_shelf.h" 9 #include "ash/common/shelf/wm_shelf.h"
10 #include "ash/common/shell_window_ids.h" 10 #include "ash/common/shell_window_ids.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 WorkspaceController::~WorkspaceController() { 46 WorkspaceController::~WorkspaceController() {
47 if (!viewport_) 47 if (!viewport_)
48 return; 48 return;
49 49
50 viewport_->RemoveObserver(this); 50 viewport_->RemoveObserver(this);
51 viewport_->SetLayoutManager(nullptr); 51 viewport_->SetLayoutManager(nullptr);
52 } 52 }
53 53
54 wm::WorkspaceWindowState WorkspaceController::GetWindowState() const { 54 wm::WorkspaceWindowState WorkspaceController::GetWindowState() const {
55 if (!viewport_->GetRootWindowController()->HasShelf()) 55 if (!viewport_ || !viewport_->GetRootWindowController()->HasShelf())
56 return wm::WORKSPACE_WINDOW_STATE_DEFAULT; 56 return wm::WORKSPACE_WINDOW_STATE_DEFAULT;
57 57
58 const WmWindow* fullscreen = wm::GetWindowForFullscreenMode(viewport_); 58 const WmWindow* fullscreen = wm::GetWindowForFullscreenMode(viewport_);
59 if (fullscreen && !fullscreen->GetWindowState()->ignored_by_shelf()) 59 if (fullscreen && !fullscreen->GetWindowState()->ignored_by_shelf())
60 return wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN; 60 return wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN;
61 61
62 // These are the container ids of containers which may contain windows that 62 // These are the container ids of containers which may contain windows that
63 // may overlap the launcher shelf and affect its transparency. 63 // may overlap the launcher shelf and affect its transparency.
64 const int kWindowContainerIds[] = { 64 const int kWindowContainerIds[] = {
65 kShellWindowId_DefaultContainer, kShellWindowId_DockedContainer, 65 kShellWindowId_DefaultContainer, kShellWindowId_DockedContainer,
66 }; 66 };
67 const gfx::Rect shelf_bounds( 67 const gfx::Rect shelf_bounds(
68 viewport_->GetRootWindowController()->GetShelf()->GetIdealBounds()); 68 viewport_->GetRootWindowController()->GetShelf()->GetIdealBounds());
69 bool window_overlaps_launcher = false; 69 bool window_overlaps_launcher = false;
70 for (size_t i = 0; i < arraysize(kWindowContainerIds); i++) { 70 for (size_t i = 0; i < arraysize(kWindowContainerIds); i++) {
71 WmWindow* container = viewport_->GetRootWindow()->GetChildByShellWindowId( 71 WmWindow* container = viewport_->GetRootWindow()->GetChildByShellWindowId(
72 kWindowContainerIds[i]); 72 kWindowContainerIds[i]);
73 for (WmWindow* window : container->GetChildren()) { 73 for (WmWindow* window : container->GetChildren()) {
74 wm::WindowState* window_state = window->GetWindowState(); 74 wm::WindowState* window_state = window->GetWindowState();
75 if (window_state->ignored_by_shelf() || 75 if (window_state->ignored_by_shelf() ||
76 !window->GetLayer()->GetTargetVisibility()) { 76 (window->GetLayer() && !window->GetLayer()->GetTargetVisibility())) {
77 continue; 77 continue;
78 } 78 }
79 if (window_state->IsMaximized()) 79 if (window_state->IsMaximized())
80 return wm::WORKSPACE_WINDOW_STATE_MAXIMIZED; 80 return wm::WORKSPACE_WINDOW_STATE_MAXIMIZED;
81 window_overlaps_launcher |= window->GetBounds().Intersects(shelf_bounds); 81 window_overlaps_launcher |= window->GetBounds().Intersects(shelf_bounds);
82 } 82 }
83 } 83 }
84 84
85 // Check if there are visible docked windows in the same display. 85 // Check if there are visible docked windows in the same display.
86 DockedWindowLayoutManager* dock = DockedWindowLayoutManager::Get(viewport_); 86 DockedWindowLayoutManager* dock = DockedWindowLayoutManager::Get(viewport_);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 void WorkspaceController::OnWindowDestroying(WmWindow* window) { 126 void WorkspaceController::OnWindowDestroying(WmWindow* window) {
127 DCHECK_EQ(window, viewport_); 127 DCHECK_EQ(window, viewport_);
128 viewport_->RemoveObserver(this); 128 viewport_->RemoveObserver(this);
129 viewport_ = nullptr; 129 viewport_ = nullptr;
130 // Destroy |event_handler_| too as it depends upon |window|. 130 // Destroy |event_handler_| too as it depends upon |window|.
131 event_handler_.reset(); 131 event_handler_.reset();
132 } 132 }
133 133
134 } // namespace ash 134 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/maximize_mode/maximize_mode_window_manager.cc ('k') | ash/common/wm_root_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698