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

Side by Side Diff: ash/common/wm/forwarding_layer_delegate.cc

Issue 2129773002: [CrOS] Initial rough cut of alt-tab window cycling UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: function rename Created 4 years, 5 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
« no previous file with comments | « ash/common/wm/forwarding_layer_delegate.h ('k') | ash/wm/drag_window_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ash/common/wm/forwarding_layer_delegate.h"
6
7 #include "ash/common/wm_window.h"
8 #include "base/callback.h"
9 #include "ui/compositor/layer.h"
10
11 namespace ash {
12 namespace wm {
13
14 ForwardingLayerDelegate::ForwardingLayerDelegate(WmWindow* original_window,
15 ui::LayerDelegate* delegate)
16 : original_window_(original_window), original_delegate_(delegate) {}
17
18 ForwardingLayerDelegate::~ForwardingLayerDelegate() {}
19
20 void ForwardingLayerDelegate::OnPaintLayer(const ui::PaintContext& context) {
21 if (!original_delegate_)
22 return;
23 // |original_delegate_| may have already been deleted or
24 // disconnected by this time. Check if |original_delegate_| is still
25 // used by the original_window tree, or skip otherwise.
26 if (IsDelegateValid(original_window_->GetLayer()))
27 original_delegate_->OnPaintLayer(context);
28 else
29 original_delegate_ = nullptr;
30 }
31
32 void ForwardingLayerDelegate::OnDelegatedFrameDamage(
33 const gfx::Rect& damage_rect_in_dip) {}
34
35 void ForwardingLayerDelegate::OnDeviceScaleFactorChanged(
36 float device_scale_factor) {
37 // Don't tell the original delegate about device scale factor change
38 // on cloned layer because the original layer is still on the same display.
39 }
40
41 base::Closure ForwardingLayerDelegate::PrepareForLayerBoundsChange() {
42 return base::Closure();
43 }
44
45 bool ForwardingLayerDelegate::IsDelegateValid(ui::Layer* layer) const {
46 if (layer->delegate() == original_delegate_)
47 return true;
48 for (auto* child : layer->children()) {
49 if (IsDelegateValid(child))
50 return true;
51 }
52 return false;
53 }
54
55 } // namespace wm
56 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/forwarding_layer_delegate.h ('k') | ash/wm/drag_window_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698