OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/aura_shell/modal_container_layout_manager.h" | 5 #include "ui/aura_shell/modal_container_layout_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "ui/aura/client/aura_constants.h" | 8 #include "ui/aura/client/aura_constants.h" |
9 #include "ui/aura/desktop.h" | |
10 #include "ui/aura/event.h" | 9 #include "ui/aura/event.h" |
| 10 #include "ui/aura/root_window.h" |
11 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
12 #include "ui/aura_shell/modality_event_filter.h" | 12 #include "ui/aura_shell/modality_event_filter.h" |
13 #include "ui/aura_shell/shell.h" | 13 #include "ui/aura_shell/shell.h" |
14 #include "ui/aura_shell/stacking_controller.h" | 14 #include "ui/aura_shell/stacking_controller.h" |
15 #include "ui/gfx/canvas.h" | 15 #include "ui/gfx/canvas.h" |
16 #include "ui/gfx/compositor/layer.h" | 16 #include "ui/gfx/compositor/layer.h" |
17 #include "ui/gfx/compositor/layer_animator.h" | 17 #include "ui/gfx/compositor/layer_animator.h" |
18 #include "ui/views/view.h" | 18 #include "ui/views/view.h" |
19 #include "ui/views/widget/widget.h" | 19 #include "ui/views/widget/widget.h" |
20 | 20 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 params.parent = container_; | 159 params.parent = container_; |
160 params.bounds = gfx::Rect(0, 0, container_->bounds().width(), | 160 params.bounds = gfx::Rect(0, 0, container_->bounds().width(), |
161 container_->bounds().height()); | 161 container_->bounds().height()); |
162 modal_screen_->Init(params); | 162 modal_screen_->Init(params); |
163 modal_screen_->GetNativeView()->SetName( | 163 modal_screen_->GetNativeView()->SetName( |
164 "ModalContainerLayoutManager.ModalScreen"); | 164 "ModalContainerLayoutManager.ModalScreen"); |
165 modal_screen_->SetContentsView(new ScreenView); | 165 modal_screen_->SetContentsView(new ScreenView); |
166 modal_screen_->GetNativeView()->layer()->SetOpacity(0.0f); | 166 modal_screen_->GetNativeView()->layer()->SetOpacity(0.0f); |
167 modal_screen_->GetNativeView()->layer()->GetAnimator()->AddObserver(this); | 167 modal_screen_->GetNativeView()->layer()->GetAnimator()->AddObserver(this); |
168 | 168 |
169 Shell::GetInstance()->AddDesktopEventFilter(modality_filter_.get()); | 169 Shell::GetInstance()->AddRootWindowEventFilter(modality_filter_.get()); |
170 | 170 |
171 ui::LayerAnimator::ScopedSettings settings( | 171 ui::LayerAnimator::ScopedSettings settings( |
172 modal_screen_->GetNativeView()->layer()->GetAnimator()); | 172 modal_screen_->GetNativeView()->layer()->GetAnimator()); |
173 modal_screen_->Show(); | 173 modal_screen_->Show(); |
174 modal_screen_->GetNativeView()->layer()->SetOpacity(0.5f); | 174 modal_screen_->GetNativeView()->layer()->SetOpacity(0.5f); |
175 container_->StackChildAtTop(modal_screen_->GetNativeView()); | 175 container_->StackChildAtTop(modal_screen_->GetNativeView()); |
176 } | 176 } |
177 | 177 |
178 void ModalContainerLayoutManager::DestroyModalScreen() { | 178 void ModalContainerLayoutManager::DestroyModalScreen() { |
179 modal_screen_->GetNativeView()->layer()->GetAnimator()->RemoveObserver(this); | 179 modal_screen_->GetNativeView()->layer()->GetAnimator()->RemoveObserver(this); |
180 modal_screen_->Close(); | 180 modal_screen_->Close(); |
181 modal_screen_ = NULL; | 181 modal_screen_ = NULL; |
182 } | 182 } |
183 | 183 |
184 void ModalContainerLayoutManager::HideModalScreen() { | 184 void ModalContainerLayoutManager::HideModalScreen() { |
185 Shell::GetInstance()->RemoveDesktopEventFilter(modality_filter_.get()); | 185 Shell::GetInstance()->RemoveRootWindowEventFilter(modality_filter_.get()); |
186 ui::LayerAnimator::ScopedSettings settings( | 186 ui::LayerAnimator::ScopedSettings settings( |
187 modal_screen_->GetNativeView()->layer()->GetAnimator()); | 187 modal_screen_->GetNativeView()->layer()->GetAnimator()); |
188 modal_screen_->GetNativeView()->layer()->SetOpacity(0.0f); | 188 modal_screen_->GetNativeView()->layer()->SetOpacity(0.0f); |
189 } | 189 } |
190 | 190 |
191 } // namespace internal | 191 } // namespace internal |
192 } // namespace aura_shell | 192 } // namespace aura_shell |
OLD | NEW |