| 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 explicit RenderWidgetMusConnection(int routing_id); |
| 22 int routing_id, | |
| 23 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request); | |
| 24 ~RenderWidgetMusConnection() override; | 23 ~RenderWidgetMusConnection() override; |
| 25 | 24 |
| 25 // Connect to a WindowTreeClient request. |
| 26 void Bind(mojo::InterfaceRequest<mus::mojom::WindowTreeClient> request); |
| 27 |
| 28 // Create a cc output surface. |
| 29 scoped_ptr<cc::OutputSurface> CreateOutputSurface(); |
| 30 |
| 31 // Get the connection from a routing_id, if the connection doesn't exist, |
| 32 // a new connection will be created. |
| 33 static RenderWidgetMusConnection* GetOrCreate(int routing_id); |
| 34 |
| 26 private: | 35 private: |
| 27 void SubmitCompositorFrame(); | |
| 28 | |
| 29 // WindowTreeDelegate implementation: | 36 // WindowTreeDelegate implementation: |
| 30 void OnConnectionLost(mus::WindowTreeConnection* connection) override; | 37 void OnConnectionLost(mus::WindowTreeConnection* connection) override; |
| 31 void OnEmbed(mus::Window* root) override; | 38 void OnEmbed(mus::Window* root) override; |
| 32 void OnUnembed() override; | 39 void OnUnembed() override; |
| 33 void OnWindowBoundsChanged(mus::Window* window, | 40 void OnWindowBoundsChanged(mus::Window* window, |
| 34 const gfx::Rect& old_bounds, | 41 const gfx::Rect& old_bounds, |
| 35 const gfx::Rect& new_bounds) override; | 42 const gfx::Rect& new_bounds) override; |
| 36 | 43 |
| 37 const int routing_id_; | 44 const int routing_id_; |
| 38 mus::Window* root_; | 45 mus::Window* root_; |
| 39 scoped_ptr<mus::WindowSurface> surface_; | 46 scoped_ptr<mus::WindowSurfaceBinding> window_surface_binding_; |
| 40 | 47 |
| 41 DISALLOW_COPY_AND_ASSIGN(RenderWidgetMusConnection); | 48 DISALLOW_COPY_AND_ASSIGN(RenderWidgetMusConnection); |
| 42 }; | 49 }; |
| 43 | 50 |
| 44 } // namespace content | 51 } // namespace content |
| 45 | 52 |
| 46 #endif // CONTENT_RENDERER_RENDER_WIDGET_MUS_CONNECTION_H_ | 53 #endif // CONTENT_RENDERER_RENDER_WIDGET_MUS_CONNECTION_H_ |
| OLD | NEW |