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

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

Issue 9222018: reland -- Disable animations during aura tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 10 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/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/shell.h" 8 #include "ash/shell.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"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 return; 115 return;
116 116
117 if (window->GetIntProperty(aura::client::kModalKey)) { 117 if (window->GetIntProperty(aura::client::kModalKey)) {
118 AddModalWindow(window); 118 AddModalWindow(window);
119 } else if (static_cast<int>(reinterpret_cast<intptr_t>(old))) { 119 } else if (static_cast<int>(reinterpret_cast<intptr_t>(old))) {
120 RemoveModalWindow(window); 120 RemoveModalWindow(window);
121 } 121 }
122 } 122 }
123 123
124 //////////////////////////////////////////////////////////////////////////////// 124 ////////////////////////////////////////////////////////////////////////////////
125 // SystemModalContainerLayoutManager, ui::LayerAnimationObserver implementation: 125 // SystemModalContainerLayoutManager,
126 // ui::ImplicitAnimationObserver implementation:
126 127
127 void SystemModalContainerLayoutManager::OnLayerAnimationEnded( 128 void SystemModalContainerLayoutManager::OnImplicitAnimationsCompleted() {
128 const ui::LayerAnimationSequence* sequence) {
129 if (modal_screen_ && !modal_screen_->GetNativeView()->layer()->ShouldDraw()) 129 if (modal_screen_ && !modal_screen_->GetNativeView()->layer()->ShouldDraw())
130 DestroyModalScreen(); 130 DestroyModalScreen();
131 } 131 }
132 132
133 void SystemModalContainerLayoutManager::OnLayerAnimationAborted(
134 const ui::LayerAnimationSequence* sequence) {
135 }
136
137 void SystemModalContainerLayoutManager::OnLayerAnimationScheduled(
138 const ui::LayerAnimationSequence* sequence) {
139 }
140
141 //////////////////////////////////////////////////////////////////////////////// 133 ////////////////////////////////////////////////////////////////////////////////
142 // SystemModalContainerLayoutManager, 134 // SystemModalContainerLayoutManager,
143 // SystemModalContainerEventFilter::Delegate implementation: 135 // SystemModalContainerEventFilter::Delegate implementation:
144 136
145 bool SystemModalContainerLayoutManager::CanWindowReceiveEvents( 137 bool SystemModalContainerLayoutManager::CanWindowReceiveEvents(
146 aura::Window* window) { 138 aura::Window* window) {
147 // 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
148 // above the lock screen layer (crbug.com/110920). 140 // above the lock screen layer (crbug.com/110920).
149 if (ash::Shell::GetInstance()->IsScreenLocked() && 141 if (ash::Shell::GetInstance()->IsScreenLocked() &&
150 container_->id() < ash::internal::kShellWindowId_LockScreenContainer) 142 container_->id() < ash::internal::kShellWindowId_LockScreenContainer)
(...skipping 28 matching lines...) Expand all
179 modal_screen_ = new views::Widget; 171 modal_screen_ = new views::Widget;
180 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); 172 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
181 params.parent = container_; 173 params.parent = container_;
182 params.bounds = gfx::Rect(0, 0, container_->bounds().width(), 174 params.bounds = gfx::Rect(0, 0, container_->bounds().width(),
183 container_->bounds().height()); 175 container_->bounds().height());
184 modal_screen_->Init(params); 176 modal_screen_->Init(params);
185 modal_screen_->GetNativeView()->SetName( 177 modal_screen_->GetNativeView()->SetName(
186 "SystemModalContainerLayoutManager.ModalScreen"); 178 "SystemModalContainerLayoutManager.ModalScreen");
187 modal_screen_->SetContentsView(new ScreenView); 179 modal_screen_->SetContentsView(new ScreenView);
188 modal_screen_->GetNativeView()->layer()->SetOpacity(0.0f); 180 modal_screen_->GetNativeView()->layer()->SetOpacity(0.0f);
189 modal_screen_->GetNativeView()->layer()->GetAnimator()->AddObserver(this);
190 181
191 Shell::GetInstance()->AddRootWindowEventFilter(modality_filter_.get()); 182 Shell::GetInstance()->AddRootWindowEventFilter(modality_filter_.get());
192 183
184 StopObservingImplicitAnimations();
185
193 ui::ScopedLayerAnimationSettings settings( 186 ui::ScopedLayerAnimationSettings settings(
194 modal_screen_->GetNativeView()->layer()->GetAnimator()); 187 modal_screen_->GetNativeView()->layer()->GetAnimator());
188 settings.AddObserver(this);
195 modal_screen_->Show(); 189 modal_screen_->Show();
196 modal_screen_->GetNativeView()->layer()->SetOpacity(0.5f); 190 modal_screen_->GetNativeView()->layer()->SetOpacity(0.5f);
197 container_->StackChildAtTop(modal_screen_->GetNativeView()); 191 container_->StackChildAtTop(modal_screen_->GetNativeView());
198 } 192 }
199 193
200 void SystemModalContainerLayoutManager::DestroyModalScreen() { 194 void SystemModalContainerLayoutManager::DestroyModalScreen() {
201 modal_screen_->GetNativeView()->layer()->GetAnimator()->RemoveObserver(this); 195 // Stop observing the modal screen's animations.
196 StopObservingImplicitAnimations();
202 modal_screen_->Close(); 197 modal_screen_->Close();
203 modal_screen_ = NULL; 198 modal_screen_ = NULL;
204 } 199 }
205 200
206 void SystemModalContainerLayoutManager::HideModalScreen() { 201 void SystemModalContainerLayoutManager::HideModalScreen() {
202 StopObservingImplicitAnimations();
203
207 Shell::GetInstance()->RemoveRootWindowEventFilter(modality_filter_.get()); 204 Shell::GetInstance()->RemoveRootWindowEventFilter(modality_filter_.get());
208 ui::ScopedLayerAnimationSettings settings( 205 ui::ScopedLayerAnimationSettings settings(
209 modal_screen_->GetNativeView()->layer()->GetAnimator()); 206 modal_screen_->GetNativeView()->layer()->GetAnimator());
207 settings.AddObserver(this);
210 modal_screen_->GetNativeView()->layer()->SetOpacity(0.0f); 208 modal_screen_->GetNativeView()->layer()->SetOpacity(0.0f);
211 } 209 }
212 210
213 } // namespace internal 211 } // namespace internal
214 } // namespace ash 212 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/system_modal_container_layout_manager.h ('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