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

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

Issue 14295008: Add ash SessionStateDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 7 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
« no previous file with comments | « ash/wm/stacking_controller.cc ('k') | ash/wm/system_modal_container_layout_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/system_modal_container_layout_manager.h" 5 #include "ash/wm/system_modal_container_layout_manager.h"
6 6
7 #include "ash/session_state_delegate.h"
7 #include "ash/shell.h" 8 #include "ash/shell.h"
8 #include "ash/shell_delegate.h"
9 #include "ash/shell_window_ids.h" 9 #include "ash/shell_window_ids.h"
10 #include "ash/wm/system_modal_container_event_filter.h" 10 #include "ash/wm/system_modal_container_event_filter.h"
11 #include "ash/wm/window_animations.h" 11 #include "ash/wm/window_animations.h"
12 #include "ash/wm/window_util.h" 12 #include "ash/wm/window_util.h"
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "ui/aura/client/aura_constants.h" 15 #include "ui/aura/client/aura_constants.h"
16 #include "ui/aura/client/capture_client.h" 16 #include "ui/aura/client/capture_client.h"
17 #include "ui/aura/root_window.h" 17 #include "ui/aura/root_window.h"
18 #include "ui/views/corewm/compound_event_filter.h" 18 #include "ui/views/corewm/compound_event_filter.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 60 }
61 } 61 }
62 62
63 void SystemModalContainerLayoutManager::OnWindowAddedToLayout( 63 void SystemModalContainerLayoutManager::OnWindowAddedToLayout(
64 aura::Window* child) { 64 aura::Window* child) {
65 DCHECK((modal_background_ && child == modal_background_->GetNativeView()) || 65 DCHECK((modal_background_ && child == modal_background_->GetNativeView()) ||
66 child->type() == aura::client::WINDOW_TYPE_NORMAL || 66 child->type() == aura::client::WINDOW_TYPE_NORMAL ||
67 child->type() == aura::client::WINDOW_TYPE_POPUP); 67 child->type() == aura::client::WINDOW_TYPE_POPUP);
68 DCHECK( 68 DCHECK(
69 container_->id() != internal::kShellWindowId_LockSystemModalContainer || 69 container_->id() != internal::kShellWindowId_LockSystemModalContainer ||
70 Shell::GetInstance()->delegate()->IsScreenLocked() || 70 Shell::GetInstance()->session_state_delegate()->IsScreenLocked() ||
71 !Shell::GetInstance()->delegate()->IsSessionStarted()); 71 !Shell::GetInstance()->session_state_delegate()->
72 IsActiveUserSessionStarted());
72 73
73 child->AddObserver(this); 74 child->AddObserver(this);
74 if (child->GetProperty(aura::client::kModalKey) != ui::MODAL_TYPE_NONE) 75 if (child->GetProperty(aura::client::kModalKey) != ui::MODAL_TYPE_NONE)
75 AddModalWindow(child); 76 AddModalWindow(child);
76 } 77 }
77 78
78 void SystemModalContainerLayoutManager::OnWillRemoveWindowFromLayout( 79 void SystemModalContainerLayoutManager::OnWillRemoveWindowFromLayout(
79 aura::Window* child) { 80 aura::Window* child) {
80 child->RemoveObserver(this); 81 child->RemoveObserver(this);
81 if (child->GetProperty(aura::client::kModalKey) != ui::MODAL_TYPE_NONE) 82 if (child->GetProperty(aura::client::kModalKey) != ui::MODAL_TYPE_NONE)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // We could get when we're at lock screen and there is modal window at 132 // We could get when we're at lock screen and there is modal window at
132 // system modal window layer which added event filter. 133 // system modal window layer which added event filter.
133 // Now this lock modal windows layer layout manager should not block events 134 // Now this lock modal windows layer layout manager should not block events
134 // for windows at lock layer. 135 // for windows at lock layer.
135 // See SystemModalContainerLayoutManagerTest.EventFocusContainers and 136 // See SystemModalContainerLayoutManagerTest.EventFocusContainers and
136 // http://crbug.com/157469 137 // http://crbug.com/157469
137 if (modal_windows_.empty()) 138 if (modal_windows_.empty())
138 return true; 139 return true;
139 // This container can not handle events if the screen is locked and it is not 140 // This container can not handle events if the screen is locked and it is not
140 // above the lock screen layer (crbug.com/110920). 141 // above the lock screen layer (crbug.com/110920).
141 if (ash::Shell::GetInstance()->IsScreenLocked() && 142 if (Shell::GetInstance()->session_state_delegate()->IsScreenLocked() &&
142 container_->id() < ash::internal::kShellWindowId_LockScreenContainer) 143 container_->id() < ash::internal::kShellWindowId_LockScreenContainer)
143 return true; 144 return true;
144 return wm::GetActivatableWindow(window) == modal_window(); 145 return wm::GetActivatableWindow(window) == modal_window();
145 } 146 }
146 147
147 bool SystemModalContainerLayoutManager::ActivateNextModalWindow() { 148 bool SystemModalContainerLayoutManager::ActivateNextModalWindow() {
148 if (modal_windows_.empty()) 149 if (modal_windows_.empty())
149 return false; 150 return false;
150 wm::ActivateWindow(modal_window()); 151 wm::ActivateWindow(modal_window());
151 return true; 152 return true;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 void SystemModalContainerLayoutManager::RemoveModalWindow( 222 void SystemModalContainerLayoutManager::RemoveModalWindow(
222 aura::Window* window) { 223 aura::Window* window) {
223 aura::Window::Windows::iterator it = 224 aura::Window::Windows::iterator it =
224 std::find(modal_windows_.begin(), modal_windows_.end(), window); 225 std::find(modal_windows_.begin(), modal_windows_.end(), window);
225 if (it != modal_windows_.end()) 226 if (it != modal_windows_.end())
226 modal_windows_.erase(it); 227 modal_windows_.erase(it);
227 } 228 }
228 229
229 } // namespace internal 230 } // namespace internal
230 } // namespace ash 231 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/stacking_controller.cc ('k') | ash/wm/system_modal_container_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698