| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 MOJO_EXAMPLES_SURFACES_APP_CHILD_IMPL_H_ | 5 #ifndef MOJO_EXAMPLES_SURFACES_APP_CHILD_IMPL_H_ |
| 6 #define MOJO_EXAMPLES_SURFACES_APP_CHILD_IMPL_H_ | 6 #define MOJO_EXAMPLES_SURFACES_APP_CHILD_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "cc/surfaces/surface_id.h" | 9 #include "cc/surfaces/surface_id.h" |
| 10 #include "cc/surfaces/surface_id_allocator.h" | 10 #include "cc/surfaces/surface_id_allocator.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 namespace mojo { | 22 namespace mojo { |
| 23 | 23 |
| 24 class ApplicationConnection; | 24 class ApplicationConnection; |
| 25 | 25 |
| 26 namespace surfaces { | 26 namespace surfaces { |
| 27 class Surface; | 27 class Surface; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace examples { | 30 namespace examples { |
| 31 | 31 |
| 32 class SurfaceClientImpl; | |
| 33 | |
| 34 // Simple example of a child app using surfaces. | 32 // Simple example of a child app using surfaces. |
| 35 class ChildImpl : public InterfaceImpl<Child> { | 33 class ChildImpl : public InterfaceImpl<Child>, public surfaces::SurfaceClient { |
| 36 public: | 34 public: |
| 37 class Context { | 35 class Context { |
| 38 public: | 36 public: |
| 39 virtual ApplicationConnection* ShellConnection( | 37 virtual ApplicationConnection* ShellConnection( |
| 40 const mojo::String& application_url) = 0; | 38 const mojo::String& application_url) = 0; |
| 41 }; | 39 }; |
| 42 ChildImpl(ApplicationConnection* connection, Context* context); | 40 explicit ChildImpl(ApplicationConnection* surfaces_service_connection); |
| 43 virtual ~ChildImpl(); | 41 virtual ~ChildImpl(); |
| 44 | 42 |
| 45 void SetIdNamespace(uint32_t id_namespace); | 43 // surfaces::SurfaceClient implementation |
| 44 virtual void SetIdNamespace(uint32_t id_namespace) OVERRIDE; |
| 45 virtual void ReturnResources( |
| 46 Array<surfaces::ReturnedResourcePtr> resources) OVERRIDE; |
| 46 | 47 |
| 47 private: | 48 private: |
| 48 // Child implementation. | 49 // Child implementation. |
| 49 virtual void ProduceFrame( | 50 virtual void ProduceFrame( |
| 50 surfaces::ColorPtr color, | 51 surfaces::ColorPtr color, |
| 51 SizePtr size, | 52 SizePtr size, |
| 52 const mojo::Callback<void(surfaces::SurfaceIdPtr id)>& callback) OVERRIDE; | 53 const mojo::Callback<void(surfaces::SurfaceIdPtr id)>& callback) OVERRIDE; |
| 53 | 54 |
| 54 void Draw(); | 55 void Draw(); |
| 55 | 56 |
| 56 SkColor color_; | 57 SkColor color_; |
| 57 gfx::Size size_; | 58 gfx::Size size_; |
| 58 scoped_ptr<cc::SurfaceIdAllocator> allocator_; | 59 scoped_ptr<cc::SurfaceIdAllocator> allocator_; |
| 59 surfaces::SurfacePtr surface_; | 60 surfaces::SurfacePtr surface_; |
| 60 cc::SurfaceId id_; | 61 cc::SurfaceId id_; |
| 61 scoped_ptr<SurfaceClientImpl> surface_client_; | |
| 62 mojo::Callback<void(surfaces::SurfaceIdPtr id)> produce_callback_; | 62 mojo::Callback<void(surfaces::SurfaceIdPtr id)> produce_callback_; |
| 63 | 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(ChildImpl); | 64 DISALLOW_COPY_AND_ASSIGN(ChildImpl); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 } // namespace examples | 67 } // namespace examples |
| 68 } // namespace mojo | 68 } // namespace mojo |
| 69 | 69 |
| 70 #endif // MOJO_EXAMPLES_SURFACES_APP_CHILD_IMPL_H_ | 70 #endif // MOJO_EXAMPLES_SURFACES_APP_CHILD_IMPL_H_ |
| OLD | NEW |