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

Side by Side Diff: trunk/src/ash/display/output_configurator_animation.cc

Issue 59153004: Revert 233787 "Eliminate Shell::RootWindowList in favor of aura:..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/display/output_configurator_animation.h" 5 #include "ash/display/output_configurator_animation.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/shell_window_ids.h" 8 #include "ash/shell_window_ids.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 void OutputConfiguratorAnimation::StartFadeOutAnimation( 108 void OutputConfiguratorAnimation::StartFadeOutAnimation(
109 base::Closure callback) { 109 base::Closure callback) {
110 CallbackRunningObserver* observer = new CallbackRunningObserver(callback); 110 CallbackRunningObserver* observer = new CallbackRunningObserver(callback);
111 ClearHidingLayers(); 111 ClearHidingLayers();
112 112
113 // Make the fade-out animation for all root windows. Instead of actually 113 // Make the fade-out animation for all root windows. Instead of actually
114 // hiding the root windows, we put a black layer over a root window for 114 // hiding the root windows, we put a black layer over a root window for
115 // safety. These layers remain to hide root windows and will be deleted 115 // safety. These layers remain to hide root windows and will be deleted
116 // after the animation of OnDisplayModeChanged(). 116 // after the animation of OnDisplayModeChanged().
117 aura::Window::Windows root_windows = 117 Shell::RootWindowList root_windows =
118 Shell::GetInstance()->GetAllRootWindows(); 118 Shell::GetInstance()->GetAllRootWindows();
119 for (aura::Window::Windows::const_iterator it = root_windows.begin(); 119 for (Shell::RootWindowList::const_iterator it = root_windows.begin();
120 it != root_windows.end(); ++it) { 120 it != root_windows.end(); ++it) {
121 aura::Window* root_window = *it; 121 aura::RootWindow* root_window = *it;
122 ui::Layer* hiding_layer = new ui::Layer(ui::LAYER_SOLID_COLOR); 122 ui::Layer* hiding_layer = new ui::Layer(ui::LAYER_SOLID_COLOR);
123 hiding_layer->SetColor(SK_ColorBLACK); 123 hiding_layer->SetColor(SK_ColorBLACK);
124 hiding_layer->SetBounds(root_window->bounds()); 124 hiding_layer->SetBounds(root_window->bounds());
125 ui::Layer* parent = ash::Shell::GetContainer( 125 ui::Layer* parent = ash::Shell::GetContainer(
126 root_window, 126 root_window,
127 ash::internal::kShellWindowId_OverlayContainer)->layer(); 127 ash::internal::kShellWindowId_OverlayContainer)->layer();
128 parent->Add(hiding_layer); 128 parent->Add(hiding_layer);
129 129
130 hiding_layer->SetOpacity(0.0); 130 hiding_layer->SetOpacity(0.0);
131 131
(...skipping 19 matching lines...) Expand all
151 void OutputConfiguratorAnimation::StartFadeInAnimation() { 151 void OutputConfiguratorAnimation::StartFadeInAnimation() {
152 // We want to make sure clearing all of hiding layers after the animation 152 // We want to make sure clearing all of hiding layers after the animation
153 // finished. Note that this callback can be canceled, but the cancel only 153 // finished. Note that this callback can be canceled, but the cancel only
154 // happens when the next animation is scheduled. Thus the hiding layers 154 // happens when the next animation is scheduled. Thus the hiding layers
155 // should be deleted eventually. 155 // should be deleted eventually.
156 CallbackRunningObserver* observer = new CallbackRunningObserver( 156 CallbackRunningObserver* observer = new CallbackRunningObserver(
157 base::Bind(&OutputConfiguratorAnimation::ClearHidingLayers, 157 base::Bind(&OutputConfiguratorAnimation::ClearHidingLayers,
158 base::Unretained(this))); 158 base::Unretained(this)));
159 159
160 // Ensure that layers are not animating. 160 // Ensure that layers are not animating.
161 for (std::map<aura::Window*, ui::Layer*>::iterator it = 161 for (std::map<aura::RootWindow*, ui::Layer*>::iterator it =
162 hiding_layers_.begin(); it != hiding_layers_.end(); ++it) { 162 hiding_layers_.begin(); it != hiding_layers_.end(); ++it) {
163 ui::LayerAnimator* animator = it->second->GetAnimator(); 163 ui::LayerAnimator* animator = it->second->GetAnimator();
164 if (animator->is_animating()) 164 if (animator->is_animating())
165 animator->StopAnimating(); 165 animator->StopAnimating();
166 } 166 }
167 167
168 // Schedules the fade-in effect for all root windows. Because we put the 168 // Schedules the fade-in effect for all root windows. Because we put the
169 // black layers for fade-out, here we actually turn those black layers 169 // black layers for fade-out, here we actually turn those black layers
170 // invisible. 170 // invisible.
171 aura::Window::Windows root_windows = 171 Shell::RootWindowList root_windows =
172 Shell::GetInstance()->GetAllRootWindows(); 172 Shell::GetInstance()->GetAllRootWindows();
173 for (aura::Window::Windows::const_iterator it = root_windows.begin(); 173 for (Shell::RootWindowList::const_iterator it = root_windows.begin();
174 it != root_windows.end(); ++it) { 174 it != root_windows.end(); ++it) {
175 aura::Window* root_window = *it; 175 aura::RootWindow* root_window = *it;
176 ui::Layer* hiding_layer = NULL; 176 ui::Layer* hiding_layer = NULL;
177 if (hiding_layers_.find(root_window) == hiding_layers_.end()) { 177 if (hiding_layers_.find(root_window) == hiding_layers_.end()) {
178 // In case of the transition from mirroring->non-mirroring, new root 178 // In case of the transition from mirroring->non-mirroring, new root
179 // windows appear and we do not have the black layers for them. Thus 179 // windows appear and we do not have the black layers for them. Thus
180 // we need to create the layer and make it visible. 180 // we need to create the layer and make it visible.
181 hiding_layer = new ui::Layer(ui::LAYER_SOLID_COLOR); 181 hiding_layer = new ui::Layer(ui::LAYER_SOLID_COLOR);
182 hiding_layer->SetColor(SK_ColorBLACK); 182 hiding_layer->SetColor(SK_ColorBLACK);
183 hiding_layer->SetBounds(root_window->bounds()); 183 hiding_layer->SetBounds(root_window->bounds());
184 ui::Layer* parent = ash::Shell::GetContainer( 184 ui::Layer* parent = ash::Shell::GetContainer(
185 root_window, 185 root_window,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 timer_->Stop(); 220 timer_->Stop();
221 timer_.reset(); 221 timer_.reset();
222 } 222 }
223 STLDeleteContainerPairSecondPointers( 223 STLDeleteContainerPairSecondPointers(
224 hiding_layers_.begin(), hiding_layers_.end()); 224 hiding_layers_.begin(), hiding_layers_.end());
225 hiding_layers_.clear(); 225 hiding_layers_.clear();
226 } 226 }
227 227
228 } // namespace internal 228 } // namespace internal
229 } // namespace ash 229 } // namespace ash
OLDNEW
« no previous file with comments | « trunk/src/ash/display/output_configurator_animation.h ('k') | trunk/src/ash/display/root_window_transformers_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698