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

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

Issue 100903002: Ignore fullscreen windows which are behind other windows for fullscreen mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test that WorkspaceLayoutManager correctly notifies on fullscreen changes. Created 7 years 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
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/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/root_window_controller.h" 8 #include "ash/root_window_controller.h"
9 #include "ash/screen_ash.h" 9 #include "ash/screen_ash.h"
10 #include "ash/shelf/shelf_layout_manager.h" 10 #include "ash/shelf/shelf_layout_manager.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 } 66 }
67 67
68 } // namespace 68 } // namespace
69 69
70 WorkspaceLayoutManager::WorkspaceLayoutManager(aura::Window* window) 70 WorkspaceLayoutManager::WorkspaceLayoutManager(aura::Window* window)
71 : BaseLayoutManager(window->GetRootWindow()), 71 : BaseLayoutManager(window->GetRootWindow()),
72 shelf_(NULL), 72 shelf_(NULL),
73 window_(window), 73 window_(window),
74 work_area_in_parent_(ScreenAsh::GetDisplayWorkAreaBoundsInParent( 74 work_area_in_parent_(ScreenAsh::GetDisplayWorkAreaBoundsInParent(
75 window->parent())) { 75 window->parent())),
76 is_fullscreen_(static_cast<bool>(GetRootWindowController(
77 window->GetRootWindow())->GetTopmostFullscreenWindow())) {
76 } 78 }
77 79
78 WorkspaceLayoutManager::~WorkspaceLayoutManager() { 80 WorkspaceLayoutManager::~WorkspaceLayoutManager() {
79 } 81 }
80 82
81 void WorkspaceLayoutManager::SetShelf(internal::ShelfLayoutManager* shelf) { 83 void WorkspaceLayoutManager::SetShelf(internal::ShelfLayoutManager* shelf) {
82 shelf_ = shelf; 84 shelf_ = shelf;
83 } 85 }
84 86
85 void WorkspaceLayoutManager::OnWindowAddedToLayout(Window* child) { 87 void WorkspaceLayoutManager::OnWindowAddedToLayout(Window* child) {
(...skipping 13 matching lines...) Expand all
99 BaseLayoutManager::OnWindowRemovedFromLayout(child); 101 BaseLayoutManager::OnWindowRemovedFromLayout(child);
100 UpdateDesktopVisibility(); 102 UpdateDesktopVisibility();
101 } 103 }
102 104
103 void WorkspaceLayoutManager::OnChildWindowVisibilityChanged(Window* child, 105 void WorkspaceLayoutManager::OnChildWindowVisibilityChanged(Window* child,
104 bool visible) { 106 bool visible) {
105 BaseLayoutManager::OnChildWindowVisibilityChanged(child, visible); 107 BaseLayoutManager::OnChildWindowVisibilityChanged(child, visible);
106 if (child->TargetVisibility()) { 108 if (child->TargetVisibility()) {
107 WindowPositioner::RearrangeVisibleWindowOnShow(child); 109 WindowPositioner::RearrangeVisibleWindowOnShow(child);
108 } else { 110 } else {
109 if (wm::GetWindowState(child)->IsFullscreen()) { 111 if (wm::GetWindowState(child)->IsFullscreen())
110 ash::Shell::GetInstance()->NotifyFullscreenStateChange( 112 UpdateFullscreenState();
111 false, child->GetRootWindow());
112 }
113 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove(child); 113 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove(child);
114 } 114 }
115 UpdateDesktopVisibility(); 115 UpdateDesktopVisibility();
116 } 116 }
117 117
118 void WorkspaceLayoutManager::SetChildBounds( 118 void WorkspaceLayoutManager::SetChildBounds(
119 Window* child, 119 Window* child,
120 const gfx::Rect& requested_bounds) { 120 const gfx::Rect& requested_bounds) {
121 wm::WindowState* window_state = wm::GetWindowState(child); 121 wm::WindowState* window_state = wm::GetWindowState(child);
122 if (!window_state->tracked_by_workspace()) { 122 if (!window_state->tracked_by_workspace()) {
(...skipping 27 matching lines...) Expand all
150 void WorkspaceLayoutManager::OnWindowPropertyChanged(Window* window, 150 void WorkspaceLayoutManager::OnWindowPropertyChanged(Window* window,
151 const void* key, 151 const void* key,
152 intptr_t old) { 152 intptr_t old) {
153 if (key == aura::client::kAlwaysOnTopKey && 153 if (key == aura::client::kAlwaysOnTopKey &&
154 window->GetProperty(aura::client::kAlwaysOnTopKey)) { 154 window->GetProperty(aura::client::kAlwaysOnTopKey)) {
155 GetRootWindowController(window->GetRootWindow())-> 155 GetRootWindowController(window->GetRootWindow())->
156 always_on_top_controller()->GetContainer(window)->AddChild(window); 156 always_on_top_controller()->GetContainer(window)->AddChild(window);
157 } 157 }
158 } 158 }
159 159
160 void WorkspaceLayoutManager::OnWindowStackingChanged(aura::Window* window) {
161 BaseLayoutManager::OnWindowStackingChanged(window);
162 UpdateDesktopVisibility();
pkotwicz 2013/12/05 02:46:29 Can you please rename UpdateDesktopVisibility() to
flackr 2013/12/05 16:48:54 Done.
163 UpdateFullscreenState();
164 }
165
160 void WorkspaceLayoutManager::OnTrackedByWorkspaceChanged( 166 void WorkspaceLayoutManager::OnTrackedByWorkspaceChanged(
161 wm::WindowState* window_state, 167 wm::WindowState* window_state,
162 bool old){ 168 bool old){
163 if (window_state->tracked_by_workspace()) { 169 if (window_state->tracked_by_workspace()) {
164 if (!SetMaximizedOrFullscreenBounds(window_state)) { 170 if (!SetMaximizedOrFullscreenBounds(window_state)) {
165 gfx::Rect bounds = window_state->window()->bounds(); 171 gfx::Rect bounds = window_state->window()->bounds();
166 AdjustSnappedBounds(window_state, &bounds); 172 AdjustSnappedBounds(window_state, &bounds);
167 if (window_state->window()->bounds() != bounds) 173 if (window_state->window()->bounds() != bounds)
168 SetChildBoundsDirect(window_state->window(), bounds); 174 SetChildBoundsDirect(window_state->window(), bounds);
169 } 175 }
(...skipping 21 matching lines...) Expand all
191 new_state == ui::SHOW_STATE_DEFAULT) && 197 new_state == ui::SHOW_STATE_DEFAULT) &&
192 window_state->HasRestoreBounds() && 198 window_state->HasRestoreBounds() &&
193 !window_state->always_restores_to_restore_bounds()) { 199 !window_state->always_restores_to_restore_bounds()) {
194 restore = window_state->GetRestoreBoundsInScreen(); 200 restore = window_state->GetRestoreBoundsInScreen();
195 window_state->SaveCurrentBoundsForRestore(); 201 window_state->SaveCurrentBoundsForRestore();
196 } 202 }
197 // Notify observers that fullscreen state may be changing. 203 // Notify observers that fullscreen state may be changing.
198 if (old_state != new_state && 204 if (old_state != new_state &&
199 (new_state == ui::SHOW_STATE_FULLSCREEN || 205 (new_state == ui::SHOW_STATE_FULLSCREEN ||
200 old_state == ui::SHOW_STATE_FULLSCREEN)) { 206 old_state == ui::SHOW_STATE_FULLSCREEN)) {
201 ash::Shell::GetInstance()->NotifyFullscreenStateChange( 207 UpdateFullscreenState();
202 new_state == ui::SHOW_STATE_FULLSCREEN,
203 window_state->window()->GetRootWindow());
204 } 208 }
205 209
206 UpdateBoundsFromShowState(window_state, old_state); 210 UpdateBoundsFromShowState(window_state, old_state);
207 ShowStateChanged(window_state, old_state); 211 ShowStateChanged(window_state, old_state);
208 212
209 // Set the restore rectangle to the previously set restore rectangle. 213 // Set the restore rectangle to the previously set restore rectangle.
210 if (!restore.IsEmpty()) 214 if (!restore.IsEmpty())
211 window_state->SetRestoreBoundsInScreen(restore); 215 window_state->SetRestoreBoundsInScreen(restore);
212 } 216 }
213 217
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 AdjustSnappedBounds(window_state, &bounds); 298 AdjustSnappedBounds(window_state, &bounds);
295 if (window->bounds() != bounds) 299 if (window->bounds() != bounds)
296 window->SetBounds(bounds); 300 window->SetBounds(bounds);
297 } 301 }
298 302
299 void WorkspaceLayoutManager::UpdateDesktopVisibility() { 303 void WorkspaceLayoutManager::UpdateDesktopVisibility() {
300 if (shelf_) 304 if (shelf_)
301 shelf_->UpdateVisibilityState(); 305 shelf_->UpdateVisibilityState();
302 } 306 }
303 307
308 void WorkspaceLayoutManager::UpdateFullscreenState() {
309 bool is_fullscreen = static_cast<bool>(GetRootWindowController(
pkotwicz 2013/12/05 02:46:29 Can you explicity check for NULL instead of the st
flackr 2013/12/05 16:48:54 Done.
310 window_->GetRootWindow())->GetTopmostFullscreenWindow());
311 if (is_fullscreen != is_fullscreen_) {
312 ash::Shell::GetInstance()->NotifyFullscreenStateChange(
313 is_fullscreen, window_->GetRootWindow());
314 is_fullscreen_ = is_fullscreen;
315 }
316 }
317
304 void WorkspaceLayoutManager::UpdateBoundsFromShowState( 318 void WorkspaceLayoutManager::UpdateBoundsFromShowState(
305 wm::WindowState* window_state, 319 wm::WindowState* window_state,
306 ui::WindowShowState last_show_state) { 320 ui::WindowShowState last_show_state) {
307 aura::Window* window = window_state->window(); 321 aura::Window* window = window_state->window();
308 // See comment in SetMaximizedOrFullscreenBounds() as to why we use parent in 322 // See comment in SetMaximizedOrFullscreenBounds() as to why we use parent in
309 // these calculation. 323 // these calculation.
310 // TODO(varkha): Change the switch statement below to use wm::WindowShowType. 324 // TODO(varkha): Change the switch statement below to use wm::WindowShowType.
311 switch (window_state->GetShowState()) { 325 switch (window_state->GetShowState()) {
312 case ui::SHOW_STATE_DEFAULT: 326 case ui::SHOW_STATE_DEFAULT:
313 case ui::SHOW_STATE_NORMAL: { 327 case ui::SHOW_STATE_NORMAL: {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator()); 447 ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator());
434 slide_settings.SetPreemptionStrategy( 448 slide_settings.SetPreemptionStrategy(
435 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 449 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
436 slide_settings.SetTransitionDuration( 450 slide_settings.SetTransitionDuration(
437 base::TimeDelta::FromMilliseconds(kBoundsChangeSlideDurationMs)); 451 base::TimeDelta::FromMilliseconds(kBoundsChangeSlideDurationMs));
438 SetChildBoundsDirect(child, bounds); 452 SetChildBoundsDirect(child, bounds);
439 } 453 }
440 454
441 } // namespace internal 455 } // namespace internal
442 } // namespace ash 456 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698