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

Side by Side Diff: ui/aura_shell/modal_container_layout_manager.cc

Issue 8926004: Revert 114095 - Move the concept of Activation to the Shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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
Property Changes:
Added: svn:mergeinfo
OLDNEW
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"
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/window_util.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
21 namespace aura_shell { 21 namespace aura_shell {
22 namespace internal { 22 namespace internal {
23 23
24 namespace { 24 namespace {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 void ModalContainerLayoutManager::OnLayerAnimationScheduled( 120 void ModalContainerLayoutManager::OnLayerAnimationScheduled(
121 const ui::LayerAnimationSequence* sequence) { 121 const ui::LayerAnimationSequence* sequence) {
122 } 122 }
123 123
124 //////////////////////////////////////////////////////////////////////////////// 124 ////////////////////////////////////////////////////////////////////////////////
125 // ModalContainerLayoutManager, ModalityEventFilter::Delegate implementation: 125 // ModalContainerLayoutManager, ModalityEventFilter::Delegate implementation:
126 126
127 bool ModalContainerLayoutManager::CanWindowReceiveEvents( 127 bool ModalContainerLayoutManager::CanWindowReceiveEvents(
128 aura::Window* window) { 128 aura::Window* window) {
129 return 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_->StackChildAtTop(window);
139 window->Activate();
138 } 140 }
139 141
140 void ModalContainerLayoutManager::RemoveModalWindow(aura::Window* window) { 142 void ModalContainerLayoutManager::RemoveModalWindow(aura::Window* window) {
141 aura::Window::Windows::iterator it = 143 aura::Window::Windows::iterator it =
142 std::find(modal_windows_.begin(), modal_windows_.end(), window); 144 std::find(modal_windows_.begin(), modal_windows_.end(), window);
143 if (it != modal_windows_.end()) 145 if (it != modal_windows_.end())
144 modal_windows_.erase(it); 146 modal_windows_.erase(it);
145 147
146 if (modal_windows_.empty()) 148 if (modal_windows_.empty())
147 HideModalScreen(); 149 HideModalScreen();
148 else 150 else
149 aura_shell::ActivateWindow(modal_window()); 151 modal_window()->Activate();
150 } 152 }
151 153
152 void ModalContainerLayoutManager::CreateModalScreen() { 154 void ModalContainerLayoutManager::CreateModalScreen() {
153 if (modal_screen_) 155 if (modal_screen_)
154 return; 156 return;
155 modal_screen_ = new views::Widget; 157 modal_screen_ = new views::Widget;
156 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); 158 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
157 params.parent = container_; 159 params.parent = container_;
158 params.bounds = gfx::Rect(0, 0, container_->bounds().width(), 160 params.bounds = gfx::Rect(0, 0, container_->bounds().width(),
159 container_->bounds().height()); 161 container_->bounds().height());
(...skipping 21 matching lines...) Expand all
181 183
182 void ModalContainerLayoutManager::HideModalScreen() { 184 void ModalContainerLayoutManager::HideModalScreen() {
183 Shell::GetInstance()->RemoveRootWindowEventFilter(modality_filter_.get()); 185 Shell::GetInstance()->RemoveRootWindowEventFilter(modality_filter_.get());
184 ui::LayerAnimator::ScopedSettings settings( 186 ui::LayerAnimator::ScopedSettings settings(
185 modal_screen_->GetNativeView()->layer()->GetAnimator()); 187 modal_screen_->GetNativeView()->layer()->GetAnimator());
186 modal_screen_->GetNativeView()->layer()->SetOpacity(0.0f); 188 modal_screen_->GetNativeView()->layer()->SetOpacity(0.0f);
187 } 189 }
188 190
189 } // namespace internal 191 } // namespace internal
190 } // namespace aura_shell 192 } // namespace aura_shell
OLDNEW
« no previous file with comments | « ui/aura_shell/examples/aura_shell_main.cc ('k') | ui/aura_shell/modal_container_layout_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698