| 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/event.h" | 9 #include "ui/aura/event.h" |
| 10 #include "ui/aura/root_window.h" | 10 #include "ui/aura/root_window.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 void ModalContainerLayoutManager::OnWindowResized() { | 59 void ModalContainerLayoutManager::OnWindowResized() { |
| 60 if (modal_screen_) { | 60 if (modal_screen_) { |
| 61 modal_screen_->SetBounds(gfx::Rect(0, 0, container_->bounds().width(), | 61 modal_screen_->SetBounds(gfx::Rect(0, 0, container_->bounds().width(), |
| 62 container_->bounds().height())); | 62 container_->bounds().height())); |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 void ModalContainerLayoutManager::OnWindowAddedToLayout( | 66 void ModalContainerLayoutManager::OnWindowAddedToLayout( |
| 67 aura::Window* child) { | 67 aura::Window* child) { |
| 68 child->AddObserver(this); | 68 child->AddObserver(this); |
| 69 if (child->GetIntProperty(aura::kModalKey)) | 69 if (child->GetIntProperty(aura::client::kModalKey)) |
| 70 AddModalWindow(child); | 70 AddModalWindow(child); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void ModalContainerLayoutManager::OnWillRemoveWindowFromLayout( | 73 void ModalContainerLayoutManager::OnWillRemoveWindowFromLayout( |
| 74 aura::Window* child) { | 74 aura::Window* child) { |
| 75 child->RemoveObserver(this); | 75 child->RemoveObserver(this); |
| 76 if (child->GetIntProperty(aura::kModalKey)) | 76 if (child->GetIntProperty(aura::client::kModalKey)) |
| 77 RemoveModalWindow(child); | 77 RemoveModalWindow(child); |
| 78 } | 78 } |
| 79 | 79 |
| 80 void ModalContainerLayoutManager::OnChildWindowVisibilityChanged( | 80 void ModalContainerLayoutManager::OnChildWindowVisibilityChanged( |
| 81 aura::Window* child, | 81 aura::Window* child, |
| 82 bool visible) { | 82 bool visible) { |
| 83 } | 83 } |
| 84 | 84 |
| 85 void ModalContainerLayoutManager::SetChildBounds( | 85 void ModalContainerLayoutManager::SetChildBounds( |
| 86 aura::Window* child, | 86 aura::Window* child, |
| 87 const gfx::Rect& requested_bounds) { | 87 const gfx::Rect& requested_bounds) { |
| 88 SetChildBoundsDirect(child, requested_bounds); | 88 SetChildBoundsDirect(child, requested_bounds); |
| 89 } | 89 } |
| 90 | 90 |
| 91 //////////////////////////////////////////////////////////////////////////////// | 91 //////////////////////////////////////////////////////////////////////////////// |
| 92 // ModalContainerLayoutManager, aura::WindowObserver implementation: | 92 // ModalContainerLayoutManager, aura::WindowObserver implementation: |
| 93 | 93 |
| 94 void ModalContainerLayoutManager::OnWindowPropertyChanged(aura::Window* window, | 94 void ModalContainerLayoutManager::OnWindowPropertyChanged(aura::Window* window, |
| 95 const char* key, | 95 const char* key, |
| 96 void* old) { | 96 void* old) { |
| 97 if (key != aura::kModalKey) | 97 if (key != aura::client::kModalKey) |
| 98 return; | 98 return; |
| 99 | 99 |
| 100 if (window->GetIntProperty(aura::kModalKey)) { | 100 if (window->GetIntProperty(aura::client::kModalKey)) { |
| 101 AddModalWindow(window); | 101 AddModalWindow(window); |
| 102 } else if (static_cast<int>(reinterpret_cast<intptr_t>(old))) { | 102 } else if (static_cast<int>(reinterpret_cast<intptr_t>(old))) { |
| 103 RemoveModalWindow(window); | 103 RemoveModalWindow(window); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 //////////////////////////////////////////////////////////////////////////////// | 107 //////////////////////////////////////////////////////////////////////////////// |
| 108 // ModalContainerLayoutManager, ui::LayerAnimationObserver implementation: | 108 // ModalContainerLayoutManager, ui::LayerAnimationObserver implementation: |
| 109 | 109 |
| 110 void ModalContainerLayoutManager::OnLayerAnimationEnded( | 110 void ModalContainerLayoutManager::OnLayerAnimationEnded( |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 aura_shell |
| OLD | NEW |