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

Side by Side Diff: ui/wm/core/window_util.cc

Issue 2254733003: Add ui::LayerObserver and use it to update Alt+Tab previews as needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: layer owner Created 4 years, 4 months 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
« ui/compositor/layer_observer.h ('K') | « ui/wm/core/window_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/wm/core/window_util.h" 5 #include "ui/wm/core/window_util.h"
6 6
7 #include "ui/aura/window.h" 7 #include "ui/aura/window.h"
8 #include "ui/compositor/layer.h" 8 #include "ui/compositor/layer.h"
9 #include "ui/compositor/layer_tree_owner.h" 9 #include "ui/compositor/layer_tree_owner.h"
10 #include "ui/wm/core/transient_window_manager.h" 10 #include "ui/wm/core/transient_window_manager.h"
(...skipping 10 matching lines...) Expand all
21 wm::LayerDelegateFactory* factory) { 21 wm::LayerDelegateFactory* factory) {
22 typedef std::vector<ui::Layer*> Layers; 22 typedef std::vector<ui::Layer*> Layers;
23 // Make a copy of the children since RecreateLayer() mutates it. 23 // Make a copy of the children since RecreateLayer() mutates it.
24 Layers children(to_clone->children()); 24 Layers children(to_clone->children());
25 for (Layers::const_iterator i = children.begin(); i != children.end(); ++i) { 25 for (Layers::const_iterator i = children.begin(); i != children.end(); ++i) {
26 ui::LayerOwner* owner = (*i)->owner(); 26 ui::LayerOwner* owner = (*i)->owner();
27 ui::Layer* old_layer = owner ? owner->RecreateLayer().release() : NULL; 27 ui::Layer* old_layer = owner ? owner->RecreateLayer().release() : NULL;
28 if (old_layer) { 28 if (old_layer) {
29 if (factory && owner->layer()->delegate()) 29 if (factory && owner->layer()->delegate())
30 old_layer->set_delegate( 30 old_layer->set_delegate(
31 factory->CreateDelegate(owner->layer()->delegate())); 31 factory->CreateDelegate(old_layer, owner->layer()));
32 parent->Add(old_layer); 32 parent->Add(old_layer);
33 // RecreateLayer() moves the existing children to the new layer. Create a 33 // RecreateLayer() moves the existing children to the new layer. Create a
34 // copy of those. 34 // copy of those.
35 CloneChildren(owner->layer(), old_layer, factory); 35 CloneChildren(owner->layer(), old_layer, factory);
36 } 36 }
37 } 37 }
38 } 38 }
39 39
40 } // namespace 40 } // namespace
41 41
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 aura::client::GetActivationClient(window->GetRootWindow()); 84 aura::client::GetActivationClient(window->GetRootWindow());
85 return client ? client->GetToplevelWindow(window) : NULL; 85 return client ? client->GetToplevelWindow(window) : NULL;
86 } 86 }
87 87
88 std::unique_ptr<ui::LayerTreeOwner> RecreateLayers( 88 std::unique_ptr<ui::LayerTreeOwner> RecreateLayers(
89 ui::LayerOwner* root, 89 ui::LayerOwner* root,
90 LayerDelegateFactory* factory) { 90 LayerDelegateFactory* factory) {
91 std::unique_ptr<ui::LayerTreeOwner> old_layer( 91 std::unique_ptr<ui::LayerTreeOwner> old_layer(
92 new ui::LayerTreeOwner(root->RecreateLayer().release())); 92 new ui::LayerTreeOwner(root->RecreateLayer().release()));
93 if (old_layer->root()) { 93 if (old_layer->root()) {
94 if (factory) { 94 if (factory)
sky 2016/08/23 17:15:07 optional: personally I would leave the {} here as
Evan Stade 2016/08/29 23:51:54 oops, this was not intentional
95 old_layer->root()->set_delegate( 95 old_layer->root()->set_delegate(
96 factory->CreateDelegate(root->layer()->delegate())); 96 factory->CreateDelegate(old_layer->root(), root->layer()));
97 }
98 CloneChildren(root->layer(), old_layer->root(), factory); 97 CloneChildren(root->layer(), old_layer->root(), factory);
99 } 98 }
100 return old_layer; 99 return old_layer;
101 } 100 }
102 101
103 aura::Window* GetTransientParent(aura::Window* window) { 102 aura::Window* GetTransientParent(aura::Window* window) {
104 return const_cast<aura::Window*>(GetTransientParent( 103 return const_cast<aura::Window*>(GetTransientParent(
105 const_cast<const aura::Window*>(window))); 104 const_cast<const aura::Window*>(window)));
106 } 105 }
107 106
(...skipping 23 matching lines...) Expand all
131 bool HasTransientAncestor(const aura::Window* window, 130 bool HasTransientAncestor(const aura::Window* window,
132 const aura::Window* ancestor) { 131 const aura::Window* ancestor) {
133 const aura::Window* transient_parent = GetTransientParent(window); 132 const aura::Window* transient_parent = GetTransientParent(window);
134 if (transient_parent == ancestor) 133 if (transient_parent == ancestor)
135 return true; 134 return true;
136 return transient_parent ? 135 return transient_parent ?
137 HasTransientAncestor(transient_parent, ancestor) : false; 136 HasTransientAncestor(transient_parent, ancestor) : false;
138 } 137 }
139 138
140 } // namespace wm 139 } // namespace wm
OLDNEW
« ui/compositor/layer_observer.h ('K') | « ui/wm/core/window_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698