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

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

Issue 169643005: Adding a gray semi transparent backdrop behind the topmost window within the default container (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Created 6 years, 9 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
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_util.h" 9 #include "ash/screen_util.h"
10 #include "ash/session_state_delegate.h" 10 #include "ash/session_state_delegate.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 for (WindowSet::const_iterator i = windows_.begin(); i != windows_.end(); ++i) 53 for (WindowSet::const_iterator i = windows_.begin(); i != windows_.end(); ++i)
54 (*i)->RemoveObserver(this); 54 (*i)->RemoveObserver(this);
55 Shell::GetInstance()->RemoveShellObserver(this); 55 Shell::GetInstance()->RemoveShellObserver(this);
56 Shell::GetInstance()->activation_client()->RemoveObserver(this); 56 Shell::GetInstance()->activation_client()->RemoveObserver(this);
57 } 57 }
58 58
59 void WorkspaceLayoutManager::SetShelf(internal::ShelfLayoutManager* shelf) { 59 void WorkspaceLayoutManager::SetShelf(internal::ShelfLayoutManager* shelf) {
60 shelf_ = shelf; 60 shelf_ = shelf;
61 } 61 }
62 62
63 void WorkspaceLayoutManager::SetMaximizeBackdropDelegate(
64 MaximizeBackdropDelegate* delegate) {
65 backdrop_delegate_.reset(delegate);
66 }
67
63 ////////////////////////////////////////////////////////////////////////////// 68 //////////////////////////////////////////////////////////////////////////////
64 // WorkspaceLayoutManager, aura::LayoutManager implementation: 69 // WorkspaceLayoutManager, aura::LayoutManager implementation:
65 70
66 void WorkspaceLayoutManager::OnWindowAddedToLayout(Window* child) { 71 void WorkspaceLayoutManager::OnWindowAddedToLayout(Window* child) {
67 wm::WindowState* window_state = wm::GetWindowState(child); 72 wm::WindowState* window_state = wm::GetWindowState(child);
68 wm::WMEvent event(wm::WM_EVENT_ADDED_TO_WORKSPACE); 73 wm::WMEvent event(wm::WM_EVENT_ADDED_TO_WORKSPACE);
69 window_state->OnWMEvent(&event); 74 window_state->OnWMEvent(&event);
70 windows_.insert(child); 75 windows_.insert(child);
71 child->AddObserver(this); 76 child->AddObserver(this);
72 window_state->AddObserver(this); 77 window_state->AddObserver(this);
73 UpdateShelfVisibility(); 78 UpdateShelfVisibility();
74 UpdateFullscreenState(); 79 UpdateFullscreenState();
80 if (backdrop_delegate_)
81 backdrop_delegate_->RestackBackdrop();
75 WindowPositioner::RearrangeVisibleWindowOnShow(child); 82 WindowPositioner::RearrangeVisibleWindowOnShow(child);
76 } 83 }
77 84
78 void WorkspaceLayoutManager::OnWillRemoveWindowFromLayout(Window* child) { 85 void WorkspaceLayoutManager::OnWillRemoveWindowFromLayout(Window* child) {
79 windows_.erase(child); 86 windows_.erase(child);
80 child->RemoveObserver(this); 87 child->RemoveObserver(this);
81 wm::GetWindowState(child)->RemoveObserver(this); 88 wm::GetWindowState(child)->RemoveObserver(this);
82 89
83 if (child->TargetVisibility()) 90 if (child->TargetVisibility())
84 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove(child); 91 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove(child);
85 } 92 }
86 93
87 void WorkspaceLayoutManager::OnWindowRemovedFromLayout(Window* child) { 94 void WorkspaceLayoutManager::OnWindowRemovedFromLayout(Window* child) {
88 UpdateShelfVisibility(); 95 UpdateShelfVisibility();
89 UpdateFullscreenState(); 96 UpdateFullscreenState();
97 if (backdrop_delegate_)
98 backdrop_delegate_->RestackBackdrop();
90 } 99 }
91 100
92 void WorkspaceLayoutManager::OnChildWindowVisibilityChanged(Window* child, 101 void WorkspaceLayoutManager::OnChildWindowVisibilityChanged(Window* child,
93 bool visible) { 102 bool visible) {
94 wm::WindowState* window_state = wm::GetWindowState(child); 103 wm::WindowState* window_state = wm::GetWindowState(child);
95 // Attempting to show a minimized window. Unminimize it. 104 // Attempting to show a minimized window. Unminimize it.
96 if (visible && window_state->IsMinimized()) 105 if (visible && window_state->IsMinimized())
97 window_state->Unminimize(); 106 window_state->Unminimize();
98 107
99 if (child->TargetVisibility()) 108 if (child->TargetVisibility())
100 WindowPositioner::RearrangeVisibleWindowOnShow(child); 109 WindowPositioner::RearrangeVisibleWindowOnShow(child);
101 else 110 else
102 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove(child); 111 WindowPositioner::RearrangeVisibleWindowOnHideOrRemove(child);
103 UpdateFullscreenState(); 112 UpdateFullscreenState();
104 UpdateShelfVisibility(); 113 UpdateShelfVisibility();
114 if (backdrop_delegate_)
115 backdrop_delegate_->RestackBackdrop();
105 } 116 }
106 117
107 void WorkspaceLayoutManager::SetChildBounds( 118 void WorkspaceLayoutManager::SetChildBounds(
108 Window* child, 119 Window* child,
109 const gfx::Rect& requested_bounds) { 120 const gfx::Rect& requested_bounds) {
110 wm::WindowState* window_state = wm::GetWindowState(child); 121 wm::WindowState* window_state = wm::GetWindowState(child);
111 wm::SetBoundsEvent event(wm::WM_EVENT_SET_BOUNDS, requested_bounds); 122 wm::SetBoundsEvent event(wm::WM_EVENT_SET_BOUNDS, requested_bounds);
112 window_state->OnWMEvent(&event); 123 window_state->OnWMEvent(&event);
113 UpdateShelfVisibility(); 124 UpdateShelfVisibility();
114 } 125 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 if (key == aura::client::kAlwaysOnTopKey && 166 if (key == aura::client::kAlwaysOnTopKey &&
156 window->GetProperty(aura::client::kAlwaysOnTopKey)) { 167 window->GetProperty(aura::client::kAlwaysOnTopKey)) {
157 GetRootWindowController(window->GetRootWindow())-> 168 GetRootWindowController(window->GetRootWindow())->
158 always_on_top_controller()->GetContainer(window)->AddChild(window); 169 always_on_top_controller()->GetContainer(window)->AddChild(window);
159 } 170 }
160 } 171 }
161 172
162 void WorkspaceLayoutManager::OnWindowStackingChanged(aura::Window* window) { 173 void WorkspaceLayoutManager::OnWindowStackingChanged(aura::Window* window) {
163 UpdateShelfVisibility(); 174 UpdateShelfVisibility();
164 UpdateFullscreenState(); 175 UpdateFullscreenState();
176 if (backdrop_delegate_)
177 backdrop_delegate_->RestackBackdrop();
165 } 178 }
166 179
167 void WorkspaceLayoutManager::OnWindowDestroying(aura::Window* window) { 180 void WorkspaceLayoutManager::OnWindowDestroying(aura::Window* window) {
168 if (root_window_ == window) { 181 if (root_window_ == window) {
169 root_window_->RemoveObserver(this); 182 root_window_->RemoveObserver(this);
170 root_window_ = NULL; 183 root_window_ = NULL;
171 } 184 }
172 } 185 }
173 186
174 void WorkspaceLayoutManager::OnWindowBoundsChanged(aura::Window* window, 187 void WorkspaceLayoutManager::OnWindowBoundsChanged(aura::Window* window,
(...skipping 28 matching lines...) Expand all
203 wm::WindowState* window_state, 216 wm::WindowState* window_state,
204 wm::WindowStateType old_type) { 217 wm::WindowStateType old_type) {
205 218
206 // Notify observers that fullscreen state may be changing. 219 // Notify observers that fullscreen state may be changing.
207 if (window_state->IsFullscreen() || 220 if (window_state->IsFullscreen() ||
208 old_type == wm::WINDOW_STATE_TYPE_FULLSCREEN) { 221 old_type == wm::WINDOW_STATE_TYPE_FULLSCREEN) {
209 UpdateFullscreenState(); 222 UpdateFullscreenState();
210 } 223 }
211 224
212 UpdateShelfVisibility(); 225 UpdateShelfVisibility();
226 if (backdrop_delegate_)
227 backdrop_delegate_->RestackBackdrop();
213 } 228 }
214 229
215 ////////////////////////////////////////////////////////////////////////////// 230 //////////////////////////////////////////////////////////////////////////////
216 // WorkspaceLayoutManager, private: 231 // WorkspaceLayoutManager, private:
217 232
218 void WorkspaceLayoutManager::AdjustAllWindowsBoundsForWorkAreaChange( 233 void WorkspaceLayoutManager::AdjustAllWindowsBoundsForWorkAreaChange(
219 const wm::WMEvent* event) { 234 const wm::WMEvent* event) {
220 DCHECK(event->type() == wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED || 235 DCHECK(event->type() == wm::WM_EVENT_DISPLAY_BOUNDS_CHANGED ||
221 event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED); 236 event->type() == wm::WM_EVENT_WORKAREA_BOUNDS_CHANGED);
222 237
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL; 275 window_->GetRootWindow())->GetWindowForFullscreenMode() != NULL;
261 if (is_fullscreen != is_fullscreen_) { 276 if (is_fullscreen != is_fullscreen_) {
262 ash::Shell::GetInstance()->NotifyFullscreenStateChange( 277 ash::Shell::GetInstance()->NotifyFullscreenStateChange(
263 is_fullscreen, window_->GetRootWindow()); 278 is_fullscreen, window_->GetRootWindow());
264 is_fullscreen_ = is_fullscreen; 279 is_fullscreen_ = is_fullscreen;
265 } 280 }
266 } 281 }
267 282
268 } // namespace internal 283 } // namespace internal
269 } // namespace ash 284 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698