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

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

Issue 2700523004: Remove docked windows entirely in M59. (Closed)
Patch Set: Rebase and fix 1 test Created 3 years, 10 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/wm/dock/docked_window_layout_manager.h"
11 #include "ash/common/wm/fullscreen_window_finder.h" 10 #include "ash/common/wm/fullscreen_window_finder.h"
12 #include "ash/common/wm/window_state.h" 11 #include "ash/common/wm/window_state.h"
13 #include "ash/common/wm/wm_window_animations.h" 12 #include "ash/common/wm/wm_window_animations.h"
14 #include "ash/common/wm/workspace/workspace_event_handler.h" 13 #include "ash/common/wm/workspace/workspace_event_handler.h"
15 #include "ash/common/wm/workspace/workspace_layout_manager.h" 14 #include "ash/common/wm/workspace/workspace_layout_manager.h"
16 #include "ash/common/wm/workspace/workspace_layout_manager_backdrop_delegate.h" 15 #include "ash/common/wm/workspace/workspace_layout_manager_backdrop_delegate.h"
17 #include "ash/common/wm_shell.h" 16 #include "ash/common/wm_shell.h"
18 #include "ash/common/wm_window.h" 17 #include "ash/common/wm_window.h"
19 #include "ash/public/cpp/shell_window_ids.h" 18 #include "ash/public/cpp/shell_window_ids.h"
20 #include "ash/root_window_controller.h" 19 #include "ash/root_window_controller.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 if (!viewport_ || !viewport_->GetRootWindowController()->HasShelf()) 54 if (!viewport_ || !viewport_->GetRootWindowController()->HasShelf())
56 return wm::WORKSPACE_WINDOW_STATE_DEFAULT; 55 return wm::WORKSPACE_WINDOW_STATE_DEFAULT;
57 56
58 const WmWindow* fullscreen = wm::GetWindowForFullscreenMode(viewport_); 57 const WmWindow* fullscreen = wm::GetWindowForFullscreenMode(viewport_);
59 if (fullscreen && !fullscreen->GetWindowState()->ignored_by_shelf()) 58 if (fullscreen && !fullscreen->GetWindowState()->ignored_by_shelf())
60 return wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN; 59 return wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN;
61 60
62 // These are the container ids of containers which may contain windows that 61 // These are the container ids of containers which may contain windows that
63 // may overlap the launcher shelf and affect its transparency. 62 // may overlap the launcher shelf and affect its transparency.
64 const int kWindowContainerIds[] = { 63 const int kWindowContainerIds[] = {
65 kShellWindowId_DefaultContainer, kShellWindowId_DockedContainer, 64 kShellWindowId_DefaultContainer,
66 }; 65 };
oshima 2017/02/22 06:49:07 can you remove the loop below?
afakhry 2017/02/22 22:04:43 Done.
67 const gfx::Rect shelf_bounds(WmShelf::ForWindow(viewport_)->GetIdealBounds()); 66 const gfx::Rect shelf_bounds(WmShelf::ForWindow(viewport_)->GetIdealBounds());
68 bool window_overlaps_launcher = false; 67 bool window_overlaps_launcher = false;
69 for (size_t i = 0; i < arraysize(kWindowContainerIds); i++) { 68 for (size_t i = 0; i < arraysize(kWindowContainerIds); i++) {
70 WmWindow* container = viewport_->GetRootWindow()->GetChildByShellWindowId( 69 WmWindow* container = viewport_->GetRootWindow()->GetChildByShellWindowId(
71 kWindowContainerIds[i]); 70 kWindowContainerIds[i]);
72 for (WmWindow* window : container->GetChildren()) { 71 for (WmWindow* window : container->GetChildren()) {
73 wm::WindowState* window_state = window->GetWindowState(); 72 wm::WindowState* window_state = window->GetWindowState();
74 if (window_state->ignored_by_shelf() || 73 if (window_state->ignored_by_shelf() ||
75 (window->GetLayer() && !window->GetLayer()->GetTargetVisibility())) { 74 (window->GetLayer() && !window->GetLayer()->GetTargetVisibility())) {
76 continue; 75 continue;
77 } 76 }
78 if (window_state->IsMaximized()) 77 if (window_state->IsMaximized())
79 return wm::WORKSPACE_WINDOW_STATE_MAXIMIZED; 78 return wm::WORKSPACE_WINDOW_STATE_MAXIMIZED;
80 window_overlaps_launcher |= window->GetBounds().Intersects(shelf_bounds); 79 window_overlaps_launcher |= window->GetBounds().Intersects(shelf_bounds);
81 } 80 }
82 } 81 }
83 82
84 // Check if there are visible docked windows in the same display. 83 return window_overlaps_launcher
85 DockedWindowLayoutManager* dock = DockedWindowLayoutManager::Get(viewport_);
86 const bool docked_area_visible = dock && !dock->docked_bounds().IsEmpty();
87 return (window_overlaps_launcher || docked_area_visible)
88 ? wm::WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF 84 ? wm::WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF
89 : wm::WORKSPACE_WINDOW_STATE_DEFAULT; 85 : wm::WORKSPACE_WINDOW_STATE_DEFAULT;
90 } 86 }
91 87
92 void WorkspaceController::DoInitialAnimation() { 88 void WorkspaceController::DoInitialAnimation() {
93 viewport_->Show(); 89 viewport_->Show();
94 90
95 ui::Layer* layer = viewport_->GetLayer(); 91 ui::Layer* layer = viewport_->GetLayer();
96 layer->SetOpacity(0.0f); 92 layer->SetOpacity(0.0f);
97 SetTransformForScaleAnimation(layer, LAYER_SCALE_ANIMATION_ABOVE); 93 SetTransformForScaleAnimation(layer, LAYER_SCALE_ANIMATION_ABOVE);
(...skipping 27 matching lines...) Expand all
125 void WorkspaceController::OnWindowDestroying(aura::Window* window) { 121 void WorkspaceController::OnWindowDestroying(aura::Window* window) {
126 DCHECK_EQ(WmWindow::Get(window), viewport_); 122 DCHECK_EQ(WmWindow::Get(window), viewport_);
127 viewport_->aura_window()->RemoveObserver(this); 123 viewport_->aura_window()->RemoveObserver(this);
128 viewport_ = nullptr; 124 viewport_ = nullptr;
129 // Destroy |event_handler_| too as it depends upon |window|. 125 // Destroy |event_handler_| too as it depends upon |window|.
130 event_handler_.reset(); 126 event_handler_.reset();
131 layout_manager_ = nullptr; 127 layout_manager_ = nullptr;
132 } 128 }
133 129
134 } // namespace ash 130 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698