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

Side by Side Diff: ash/wm/window_mirror_view.h

Issue 2458833003: Revert of [M55] Generalize layer mirroring for phantom windows (Closed)
Patch Set: Created 4 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
« no previous file with comments | « ash/wm/drag_window_controller.cc ('k') | ash/wm/window_mirror_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 #ifndef ASH_WM_WINDOW_MIRROR_VIEW_H_ 5 #ifndef ASH_WM_WINDOW_MIRROR_VIEW_H_
6 #define ASH_WM_WINDOW_MIRROR_VIEW_H_ 6 #define ASH_WM_WINDOW_MIRROR_VIEW_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector>
9 10
10 #include "ash/ash_export.h" 11 #include "ash/ash_export.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "ui/views/view.h" 13 #include "ui/views/view.h"
13 14 #include "ui/wm/core/window_util.h"
14 namespace ui {
15 class LayerTreeOwner;
16 }
17 15
18 namespace ash { 16 namespace ash {
19 17
20 class WmWindowAura; 18 class WmWindowAura;
21 19
22 namespace wm { 20 namespace wm {
23 21
24 // A view that mirrors the client area of a single window. 22 class ForwardingLayerDelegate;
25 class WindowMirrorView : public views::View { 23
24 // A view that mirrors the client area of a single window. Layers are lifted
25 // from the underlying window (which gets new ones in their place). New paint
26 // calls, if any, are forwarded to the underlying window.
27 class WindowMirrorView : public views::View, public ::wm::LayerDelegateFactory {
26 public: 28 public:
27 explicit WindowMirrorView(WmWindowAura* window); 29 explicit WindowMirrorView(WmWindowAura* window);
28 ~WindowMirrorView() override; 30 ~WindowMirrorView() override;
29 31
30 // views::View: 32 // views::View:
31 gfx::Size GetPreferredSize() const override; 33 gfx::Size GetPreferredSize() const override;
32 void Layout() override; 34 void Layout() override;
33 bool GetNeedsNotificationWhenVisibleBoundsChange() const override; 35 bool GetNeedsNotificationWhenVisibleBoundsChange() const override;
34 void OnVisibleBoundsChanged() override; 36 void OnVisibleBoundsChanged() override;
35 37
38 // ::wm::LayerDelegateFactory:
39 ui::LayerDelegate* CreateDelegate(ui::Layer* new_layer,
40 ui::Layer* layer) override;
41
36 private: 42 private:
37 void InitLayerOwner(); 43 void InitLayerOwner();
38 44
39 // Gets the root of the layer tree that was lifted from |target_| (and is now 45 // Gets the root of the layer tree that was lifted from |target_| (and is now
40 // a child of |this->layer()|). 46 // a child of |this->layer()|).
41 ui::Layer* GetMirrorLayer(); 47 ui::Layer* GetMirrorLayer();
42 48
43 // Calculates the bounds of the client area of the Window in the widget 49 // Calculates the bounds of the client area of the Window in the widget
44 // coordinate space. 50 // coordinate space.
45 gfx::Rect GetClientAreaBounds() const; 51 gfx::Rect GetClientAreaBounds() const;
46 52
47 // The original window that is being represented by |this|. 53 // The original window that is being represented by |this|.
48 WmWindowAura* target_; 54 WmWindowAura* target_;
49 55
50 // Retains ownership of the mirror layer tree. This is lazily initialized 56 // Retains ownership of the mirror layer tree. This is lazily initialized
51 // the first time the view becomes visible. 57 // the first time the view becomes visible.
52 std::unique_ptr<ui::LayerTreeOwner> layer_owner_; 58 std::unique_ptr<ui::LayerTreeOwner> layer_owner_;
53 59
60 std::vector<std::unique_ptr<ForwardingLayerDelegate>> delegates_;
61
54 DISALLOW_COPY_AND_ASSIGN(WindowMirrorView); 62 DISALLOW_COPY_AND_ASSIGN(WindowMirrorView);
55 }; 63 };
56 64
57 } // namespace wm 65 } // namespace wm
58 } // namespace ash 66 } // namespace ash
59 67
60 #endif // ASH_WM_WINDOW_MIRROR_VIEW_H_ 68 #endif // ASH_WM_WINDOW_MIRROR_VIEW_H_
OLDNEW
« no previous file with comments | « ash/wm/drag_window_controller.cc ('k') | ash/wm/window_mirror_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698