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 "ash/wm/modal_container_layout_manager.h" | 5 #include "ash/wm/modal_container_layout_manager.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/wm/modality_event_filter.h" | 8 #include "ash/wm/modality_event_filter.h" |
9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "ui/aura/client/aura_constants.h" | 11 #include "ui/aura/client/aura_constants.h" |
12 #include "ui/aura/event.h" | 12 #include "ui/aura/event.h" |
13 #include "ui/aura/root_window.h" | 13 #include "ui/aura/root_window.h" |
14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.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 |
21 namespace aura_shell { | 21 namespace ash { |
22 namespace internal { | 22 namespace internal { |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 class ScreenView : public views::View { | 26 class ScreenView : public views::View { |
27 public: | 27 public: |
28 ScreenView() {} | 28 ScreenView() {} |
29 virtual ~ScreenView() {} | 29 virtual ~ScreenView() {} |
30 | 30 |
31 // Overridden from views::View: | 31 // Overridden from views::View: |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 void ModalContainerLayoutManager::RemoveModalWindow(aura::Window* window) { | 140 void ModalContainerLayoutManager::RemoveModalWindow(aura::Window* window) { |
141 aura::Window::Windows::iterator it = | 141 aura::Window::Windows::iterator it = |
142 std::find(modal_windows_.begin(), modal_windows_.end(), window); | 142 std::find(modal_windows_.begin(), modal_windows_.end(), window); |
143 if (it != modal_windows_.end()) | 143 if (it != modal_windows_.end()) |
144 modal_windows_.erase(it); | 144 modal_windows_.erase(it); |
145 | 145 |
146 if (modal_windows_.empty()) | 146 if (modal_windows_.empty()) |
147 HideModalScreen(); | 147 HideModalScreen(); |
148 else | 148 else |
149 aura_shell::ActivateWindow(modal_window()); | 149 ash::ActivateWindow(modal_window()); |
150 } | 150 } |
151 | 151 |
152 void ModalContainerLayoutManager::CreateModalScreen() { | 152 void ModalContainerLayoutManager::CreateModalScreen() { |
153 if (modal_screen_) | 153 if (modal_screen_) |
154 return; | 154 return; |
155 modal_screen_ = new views::Widget; | 155 modal_screen_ = new views::Widget; |
156 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); | 156 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); |
157 params.parent = container_; | 157 params.parent = container_; |
158 params.bounds = gfx::Rect(0, 0, container_->bounds().width(), | 158 params.bounds = gfx::Rect(0, 0, container_->bounds().width(), |
159 container_->bounds().height()); | 159 container_->bounds().height()); |
(...skipping 20 matching lines...) Expand all Loading... |
180 } | 180 } |
181 | 181 |
182 void ModalContainerLayoutManager::HideModalScreen() { | 182 void ModalContainerLayoutManager::HideModalScreen() { |
183 Shell::GetInstance()->RemoveRootWindowEventFilter(modality_filter_.get()); | 183 Shell::GetInstance()->RemoveRootWindowEventFilter(modality_filter_.get()); |
184 ui::LayerAnimator::ScopedSettings settings( | 184 ui::LayerAnimator::ScopedSettings settings( |
185 modal_screen_->GetNativeView()->layer()->GetAnimator()); | 185 modal_screen_->GetNativeView()->layer()->GetAnimator()); |
186 modal_screen_->GetNativeView()->layer()->SetOpacity(0.0f); | 186 modal_screen_->GetNativeView()->layer()->SetOpacity(0.0f); |
187 } | 187 } |
188 | 188 |
189 } // namespace internal | 189 } // namespace internal |
190 } // namespace aura_shell | 190 } // namespace ash |
OLD | NEW |