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

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

Issue 1901773002: Removes most of aura dependencies from DefaultState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wm_window_positioner
Patch Set: nit and merge Created 4 years, 8 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/wm/workspace_controller.h" 5 #include "ash/wm/workspace_controller.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/shelf/shelf_layout_manager.h" 10 #include "ash/shelf/shelf_layout_manager.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 viewport_->SetLayoutManager(layout_manager_); 56 viewport_->SetLayoutManager(layout_manager_);
57 viewport_->AddPreTargetHandler(event_handler_.get()); 57 viewport_->AddPreTargetHandler(event_handler_.get());
58 } 58 }
59 59
60 WorkspaceController::~WorkspaceController() { 60 WorkspaceController::~WorkspaceController() {
61 viewport_->SetLayoutManager(NULL); 61 viewport_->SetLayoutManager(NULL);
62 viewport_->RemovePreTargetHandler(event_handler_.get()); 62 viewport_->RemovePreTargetHandler(event_handler_.get());
63 } 63 }
64 64
65 WorkspaceWindowState WorkspaceController::GetWindowState() const { 65 wm::WorkspaceWindowState WorkspaceController::GetWindowState() const {
66 if (!shelf_) 66 if (!shelf_)
67 return WORKSPACE_WINDOW_STATE_DEFAULT; 67 return wm::WORKSPACE_WINDOW_STATE_DEFAULT;
68 const aura::Window* topmost_fullscreen_window = GetRootWindowController( 68 const aura::Window* topmost_fullscreen_window = GetRootWindowController(
69 viewport_->GetRootWindow())->GetWindowForFullscreenMode(); 69 viewport_->GetRootWindow())->GetWindowForFullscreenMode();
70 if (topmost_fullscreen_window && 70 if (topmost_fullscreen_window &&
71 !wm::GetWindowState(topmost_fullscreen_window)->ignored_by_shelf()) { 71 !wm::GetWindowState(topmost_fullscreen_window)->ignored_by_shelf()) {
72 return WORKSPACE_WINDOW_STATE_FULL_SCREEN; 72 return wm::WORKSPACE_WINDOW_STATE_FULL_SCREEN;
73 } 73 }
74 74
75 // These are the container ids of containers which may contain windows that 75 // These are the container ids of containers which may contain windows that
76 // may overlap the launcher shelf and affect its transparency. 76 // may overlap the launcher shelf and affect its transparency.
77 const int kWindowContainerIds[] = {kShellWindowId_DefaultContainer, 77 const int kWindowContainerIds[] = {kShellWindowId_DefaultContainer,
78 kShellWindowId_DockedContainer, }; 78 kShellWindowId_DockedContainer, };
79 const gfx::Rect shelf_bounds(shelf_->GetIdealBounds()); 79 const gfx::Rect shelf_bounds(shelf_->GetIdealBounds());
80 bool window_overlaps_launcher = false; 80 bool window_overlaps_launcher = false;
81 for (size_t idx = 0; idx < arraysize(kWindowContainerIds); idx++) { 81 for (size_t idx = 0; idx < arraysize(kWindowContainerIds); idx++) {
82 const aura::Window* container = Shell::GetContainer( 82 const aura::Window* container = Shell::GetContainer(
83 viewport_->GetRootWindow(), kWindowContainerIds[idx]); 83 viewport_->GetRootWindow(), kWindowContainerIds[idx]);
84 const aura::Window::Windows& windows(container->children()); 84 const aura::Window::Windows& windows(container->children());
85 for (aura::Window::Windows::const_iterator i = windows.begin(); 85 for (aura::Window::Windows::const_iterator i = windows.begin();
86 i != windows.end(); ++i) { 86 i != windows.end(); ++i) {
87 wm::WindowState* window_state = wm::GetWindowState(*i); 87 wm::WindowState* window_state = wm::GetWindowState(*i);
88 if (window_state->ignored_by_shelf()) 88 if (window_state->ignored_by_shelf())
89 continue; 89 continue;
90 ui::Layer* layer = (*i)->layer(); 90 ui::Layer* layer = (*i)->layer();
91 if (!layer->GetTargetVisibility()) 91 if (!layer->GetTargetVisibility())
92 continue; 92 continue;
93 if (window_state->IsMaximized()) 93 if (window_state->IsMaximized())
94 return WORKSPACE_WINDOW_STATE_MAXIMIZED; 94 return wm::WORKSPACE_WINDOW_STATE_MAXIMIZED;
95 if (!window_overlaps_launcher && 95 if (!window_overlaps_launcher &&
96 ((*i)->bounds().Intersects(shelf_bounds))) { 96 ((*i)->bounds().Intersects(shelf_bounds))) {
97 window_overlaps_launcher = true; 97 window_overlaps_launcher = true;
98 } 98 }
99 } 99 }
100 } 100 }
101 101
102 return (window_overlaps_launcher || IsDockedAreaVisible(shelf_)) ? 102 return (window_overlaps_launcher || IsDockedAreaVisible(shelf_))
103 WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF : 103 ? wm::WORKSPACE_WINDOW_STATE_WINDOW_OVERLAPS_SHELF
104 WORKSPACE_WINDOW_STATE_DEFAULT; 104 : wm::WORKSPACE_WINDOW_STATE_DEFAULT;
105 } 105 }
106 106
107 void WorkspaceController::SetShelf(ShelfLayoutManager* shelf) { 107 void WorkspaceController::SetShelf(ShelfLayoutManager* shelf) {
108 shelf_ = shelf; 108 shelf_ = shelf;
109 } 109 }
110 110
111 void WorkspaceController::DoInitialAnimation() { 111 void WorkspaceController::DoInitialAnimation() {
112 viewport_->Show(); 112 viewport_->Show();
113 113
114 viewport_->layer()->SetOpacity(0.0f); 114 viewport_->layer()->SetOpacity(0.0f);
(...skipping 21 matching lines...) Expand all
136 viewport_->layer()->SetOpacity(1.0f); 136 viewport_->layer()->SetOpacity(1.0f);
137 } 137 }
138 } 138 }
139 139
140 void WorkspaceController::SetMaximizeBackdropDelegate( 140 void WorkspaceController::SetMaximizeBackdropDelegate(
141 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> delegate) { 141 std::unique_ptr<WorkspaceLayoutManagerBackdropDelegate> delegate) {
142 layout_manager_->SetMaximizeBackdropDelegate(std::move(delegate)); 142 layout_manager_->SetMaximizeBackdropDelegate(std::move(delegate));
143 } 143 }
144 144
145 } // namespace ash 145 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace_controller.h ('k') | chrome/browser/chromeos/background/ash_user_wallpaper_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698