| 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" | 9 #include "ui/aura/desktop.h" |
| 10 #include "ui/aura/event.h" | 10 #include "ui/aura/event.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 aura::Window* window) { | 128 aura::Window* window) { |
| 129 return StackingController::GetActivatableWindow(window) == modal_window(); | 129 return StackingController::GetActivatableWindow(window) == modal_window(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 //////////////////////////////////////////////////////////////////////////////// | 132 //////////////////////////////////////////////////////////////////////////////// |
| 133 // ModalContainerLayoutManager, private: | 133 // ModalContainerLayoutManager, private: |
| 134 | 134 |
| 135 void ModalContainerLayoutManager::AddModalWindow(aura::Window* window) { | 135 void ModalContainerLayoutManager::AddModalWindow(aura::Window* window) { |
| 136 modal_windows_.push_back(window); | 136 modal_windows_.push_back(window); |
| 137 CreateModalScreen(); | 137 CreateModalScreen(); |
| 138 container_->MoveChildToFront(window); | 138 container_->StackChildAtTop(window); |
| 139 window->Activate(); | 139 window->Activate(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void ModalContainerLayoutManager::RemoveModalWindow(aura::Window* window) { | 142 void ModalContainerLayoutManager::RemoveModalWindow(aura::Window* window) { |
| 143 aura::Window::Windows::iterator it = | 143 aura::Window::Windows::iterator it = |
| 144 std::find(modal_windows_.begin(), modal_windows_.end(), window); | 144 std::find(modal_windows_.begin(), modal_windows_.end(), window); |
| 145 if (it != modal_windows_.end()) | 145 if (it != modal_windows_.end()) |
| 146 modal_windows_.erase(it); | 146 modal_windows_.erase(it); |
| 147 | 147 |
| 148 if (modal_windows_.empty()) | 148 if (modal_windows_.empty()) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 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()->AddDesktopEventFilter(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_->MoveChildToFront(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()->RemoveDesktopEventFilter(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 |