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

Side by Side Diff: ash/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: 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
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/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
13 ForwardingLayerDelegate::ForwardingLayerDelegate(WmWindow* original_window,
14 ui::LayerDelegate* delegate)
15 : original_window_(original_window), original_delegate_(delegate) {}
Daniel Erat 2016/07/06 22:04:47 nit: do we still do one-per-line here or is this w
Evan Stade 2016/07/06 23:02:59 this patch is git cl formatted, yes
16
17 ForwardingLayerDelegate::~ForwardingLayerDelegate() {}
18
19 void ForwardingLayerDelegate::OnPaintLayer(const ui::PaintContext& context) {
20 if (!original_delegate_)
21 return;
22 // |original_delegate_| may have already been deleted or
23 // disconnected by this time. Check if |original_delegate_| is still
24 // used by the original_window tree, or skip otherwise.
25 if (IsDelegateValid(original_window_->GetLayer()))
26 original_delegate_->OnPaintLayer(context);
27 else
28 original_delegate_ = nullptr;
29 }
30
31 void ForwardingLayerDelegate::OnDelegatedFrameDamage(
32 const gfx::Rect& damage_rect_in_dip) {}
33
34 void ForwardingLayerDelegate::OnDeviceScaleFactorChanged(
35 float device_scale_factor) {
36 // Don't tell the original delegate about device scale factor change
37 // on cloned layer because the original layer is still on the same display.
38 }
39
40 base::Closure ForwardingLayerDelegate::PrepareForLayerBoundsChange() {
41 return base::Closure();
42 }
43
44 bool ForwardingLayerDelegate::IsDelegateValid(ui::Layer* layer) {
45 if (layer->delegate() == original_delegate_)
46 return true;
47 for (auto* child : layer->children()) {
48 if (IsDelegateValid(child))
49 return true;
50 }
51 return false;
52 }
53
54 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698