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

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

Issue 14200034: Revert 194578 "Add ash SessionStateDelegate" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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 | 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/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"
8 #include "ash/shell.h" 7 #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()->session_state_delegate()->IsScreenLocked() || 70 Shell::GetInstance()->delegate()->IsScreenLocked() ||
71 !Shell::GetInstance()->session_state_delegate()-> 71 !Shell::GetInstance()->delegate()->IsSessionStarted());
72 IsActiveUserSessionStarted());
73 72
74 child->AddObserver(this); 73 child->AddObserver(this);
75 if (child->GetProperty(aura::client::kModalKey) != ui::MODAL_TYPE_NONE) 74 if (child->GetProperty(aura::client::kModalKey) != ui::MODAL_TYPE_NONE)
76 AddModalWindow(child); 75 AddModalWindow(child);
77 } 76 }
78 77
79 void SystemModalContainerLayoutManager::OnWillRemoveWindowFromLayout( 78 void SystemModalContainerLayoutManager::OnWillRemoveWindowFromLayout(
80 aura::Window* child) { 79 aura::Window* child) {
81 child->RemoveObserver(this); 80 child->RemoveObserver(this);
82 if (child->GetProperty(aura::client::kModalKey) != ui::MODAL_TYPE_NONE) 81 if (child->GetProperty(aura::client::kModalKey) != ui::MODAL_TYPE_NONE)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 // We could get when we're at lock screen and there is modal window at 131 // We could get when we're at lock screen and there is modal window at
133 // system modal window layer which added event filter. 132 // system modal window layer which added event filter.
134 // Now this lock modal windows layer layout manager should not block events 133 // Now this lock modal windows layer layout manager should not block events
135 // for windows at lock layer. 134 // for windows at lock layer.
136 // See SystemModalContainerLayoutManagerTest.EventFocusContainers and 135 // See SystemModalContainerLayoutManagerTest.EventFocusContainers and
137 // http://crbug.com/157469 136 // http://crbug.com/157469
138 if (modal_windows_.empty()) 137 if (modal_windows_.empty())
139 return true; 138 return true;
140 // This container can not handle events if the screen is locked and it is not 139 // This container can not handle events if the screen is locked and it is not
141 // above the lock screen layer (crbug.com/110920). 140 // above the lock screen layer (crbug.com/110920).
142 if (Shell::GetInstance()->session_state_delegate()->IsScreenLocked() && 141 if (ash::Shell::GetInstance()->IsScreenLocked() &&
143 container_->id() < ash::internal::kShellWindowId_LockScreenContainer) 142 container_->id() < ash::internal::kShellWindowId_LockScreenContainer)
144 return true; 143 return true;
145 return wm::GetActivatableWindow(window) == modal_window(); 144 return wm::GetActivatableWindow(window) == modal_window();
146 } 145 }
147 146
148 bool SystemModalContainerLayoutManager::ActivateNextModalWindow() { 147 bool SystemModalContainerLayoutManager::ActivateNextModalWindow() {
149 if (modal_windows_.empty()) 148 if (modal_windows_.empty())
150 return false; 149 return false;
151 wm::ActivateWindow(modal_window()); 150 wm::ActivateWindow(modal_window());
152 return true; 151 return true;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 void SystemModalContainerLayoutManager::RemoveModalWindow( 221 void SystemModalContainerLayoutManager::RemoveModalWindow(
223 aura::Window* window) { 222 aura::Window* window) {
224 aura::Window::Windows::iterator it = 223 aura::Window::Windows::iterator it =
225 std::find(modal_windows_.begin(), modal_windows_.end(), window); 224 std::find(modal_windows_.begin(), modal_windows_.end(), window);
226 if (it != modal_windows_.end()) 225 if (it != modal_windows_.end())
227 modal_windows_.erase(it); 226 modal_windows_.erase(it);
228 } 227 }
229 228
230 } // namespace internal 229 } // namespace internal
231 } // namespace ash 230 } // namespace ash
OLDNEW
« no previous file with comments | « trunk/src/ash/wm/stacking_controller.cc ('k') | trunk/src/ash/wm/system_modal_container_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698