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

Side by Side Diff: ui/aura/mus/client_surface_embedder.h

Issue 2797263002: Aura-Mus: Implement gutter in the embedder. (Closed)
Patch Set: Addressed sadrul's comments Created 3 years, 8 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
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 <memory> 5 #include <memory>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "ui/gfx/geometry/insets.h"
8 9
9 namespace cc { 10 namespace cc {
10 class SurfaceInfo; 11 class SurfaceInfo;
11 } 12 }
12 13
14 namespace gfx {
15 class Insets;
16 }
17
13 namespace ui { 18 namespace ui {
14 class Layer; 19 class Layer;
15 } 20 }
16 21
17 namespace aura { 22 namespace aura {
18 23
19 class Window; 24 class Window;
20 25
21 // Used by WindowPortMus when it is embedding a client. Responsible for setting 26 // Used by WindowPortMus when it is embedding a client. Responsible for setting
22 // up layers containing content from the client, parenting them to the window's 27 // up layers containing content from the client, parenting them to the window's
23 // layer, and updating them when the client submits new surfaces. 28 // layer, and updating them when the client submits new surfaces.
24 class ClientSurfaceEmbedder { 29 class ClientSurfaceEmbedder {
25 public: 30 public:
26 explicit ClientSurfaceEmbedder(Window* window); 31 // TODO(fsamuel): Insets might differ when the window is maximized. We should
32 // deal with that case as well.
33 ClientSurfaceEmbedder(Window* window, const gfx::Insets& client_area_insets);
27 ~ClientSurfaceEmbedder(); 34 ~ClientSurfaceEmbedder();
28 35
29 // Updates the clip layer and primary SurfaceInfo of the surface layer based 36 // Updates the clip layer and primary SurfaceInfo of the surface layer based
30 // on the provided |surface_info|. 37 // on the provided |surface_info|.
31 void SetPrimarySurfaceInfo(const cc::SurfaceInfo& surface_info); 38 void SetPrimarySurfaceInfo(const cc::SurfaceInfo& surface_info);
32 39
33 // Sets the fallback SurfaceInfo of the surface layer. The clip layer is not 40 // Sets the fallback SurfaceInfo of the surface layer. The clip layer is not
34 // updated. 41 // updated.
35 void SetFallbackSurfaceInfo(const cc::SurfaceInfo& surface_info); 42 void SetFallbackSurfaceInfo(const cc::SurfaceInfo& surface_info);
36 43
44 // Update the surface layer size and the right and bottom gutter layers for
45 // the current window size.
46 void UpdateSizeAndGutters();
47
48 ui::Layer* RightGutterForTesting() { return right_gutter_.get(); }
49
50 ui::Layer* BottomGutterForTesting() { return bottom_gutter_.get(); }
51
37 private: 52 private:
38 // The window which embeds the client. 53 // The window which embeds the client.
39 Window* window_; 54 Window* window_;
40 55
41 // Contains the client's content. 56 // Contains the client's content.
42 std::unique_ptr<ui::Layer> surface_layer_; 57 std::unique_ptr<ui::Layer> surface_layer_;
43 58
44 // Used for clipping the surface layer to the window bounds. 59 // Used for showing a gutter when the content is not available.
45 std::unique_ptr<ui::Layer> clip_layer_; 60 std::unique_ptr<ui::Layer> right_gutter_;
61 std::unique_ptr<ui::Layer> bottom_gutter_;
62
63 gfx::Insets client_area_insets_;
46 64
47 DISALLOW_COPY_AND_ASSIGN(ClientSurfaceEmbedder); 65 DISALLOW_COPY_AND_ASSIGN(ClientSurfaceEmbedder);
48 }; 66 };
49 67
50 } // namespace aura 68 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | ui/aura/mus/client_surface_embedder.cc » ('j') | ui/aura/mus/client_surface_embedder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698