OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_RENDERER_RENDER_WIDGET_MUS_CONNECTION_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_WIDGET_MUS_CONNECTION_H_ |
6 #define CONTENT_RENDERER_RENDER_WIDGET_MUS_CONNECTION_H_ | 6 #define CONTENT_RENDERER_RENDER_WIDGET_MUS_CONNECTION_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "cc/output/output_surface.h" | |
9 #include "components/mus/public/cpp/window.h" | 10 #include "components/mus/public/cpp/window.h" |
10 #include "components/mus/public/cpp/window_observer.h" | 11 #include "components/mus/public/cpp/window_observer.h" |
11 #include "components/mus/public/cpp/window_surface.h" | 12 #include "components/mus/public/cpp/window_surface.h" |
12 #include "components/mus/public/cpp/window_tree_connection.h" | 13 #include "components/mus/public/cpp/window_tree_connection.h" |
13 #include "components/mus/public/cpp/window_tree_delegate.h" | 14 #include "components/mus/public/cpp/window_tree_delegate.h" |
14 #include "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 | 18 |
18 class RenderWidgetMusConnection : public mus::WindowTreeDelegate, | 19 class RenderWidgetMusConnection : public mus::WindowTreeDelegate, |
19 public mus::WindowObserver { | 20 public mus::WindowObserver { |
20 public: | 21 public: |
21 RenderWidgetMusConnection( | 22 RenderWidgetMusConnection( |
Fady Samuel
2015/11/30 23:06:55
nit: explicit
Peng
2015/12/01 15:22:47
Done.
| |
22 int routing_id, | 23 int routing_id); |
23 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request); | |
24 ~RenderWidgetMusConnection() override; | 24 ~RenderWidgetMusConnection() override; |
25 | 25 |
26 // Connect to a WindowTreeClient request. | |
27 void Connect(mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request); | |
28 | |
29 // Create a cc output surface. | |
30 scoped_ptr<cc::OutputSurface> CreateOutputSurface(); | |
31 | |
32 // Get the connection from a routing_id, if the connection doesn't exist, | |
33 // a new connection will be created. | |
34 static RenderWidgetMusConnection* Get(int routing_id); | |
Fady Samuel
2015/11/30 23:19:19
nit: I usually prefer GetOrCreate for accessors th
Peng
2015/12/01 15:22:47
Done.
| |
35 | |
26 private: | 36 private: |
27 void SubmitCompositorFrame(); | |
28 | |
29 // WindowTreeDelegate implementation: | 37 // WindowTreeDelegate implementation: |
30 void OnConnectionLost(mus::WindowTreeConnection* connection) override; | 38 void OnConnectionLost(mus::WindowTreeConnection* connection) override; |
31 void OnEmbed(mus::Window* root) override; | 39 void OnEmbed(mus::Window* root) override; |
32 void OnUnembed() override; | 40 void OnUnembed() override; |
33 void OnWindowBoundsChanged(mus::Window* window, | 41 void OnWindowBoundsChanged(mus::Window* window, |
34 const gfx::Rect& old_bounds, | 42 const gfx::Rect& old_bounds, |
35 const gfx::Rect& new_bounds) override; | 43 const gfx::Rect& new_bounds) override; |
36 | 44 |
37 const int routing_id_; | 45 const int routing_id_; |
46 bool connected_; | |
Fady Samuel
2015/11/30 23:06:55
Remove.
Peng
2015/12/01 15:22:47
Done.
| |
38 mus::Window* root_; | 47 mus::Window* root_; |
39 scoped_ptr<mus::WindowSurface> surface_; | 48 scoped_ptr<mus::WindowSurfaceBinding> window_surface_binding_; |
40 | 49 |
41 DISALLOW_COPY_AND_ASSIGN(RenderWidgetMusConnection); | 50 DISALLOW_COPY_AND_ASSIGN(RenderWidgetMusConnection); |
42 }; | 51 }; |
43 | 52 |
44 } // namespace content | 53 } // namespace content |
45 | 54 |
46 #endif // CONTENT_RENDERER_RENDER_WIDGET_MUS_CONNECTION_H_ | 55 #endif // CONTENT_RENDERER_RENDER_WIDGET_MUS_CONNECTION_H_ |
OLD | NEW |