| 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 EXAMPLES_SURFACES_APP_CHILD_IMPL_H_ | 5 #ifndef EXAMPLES_SURFACES_APP_CHILD_IMPL_H_ |
| 6 #define EXAMPLES_SURFACES_APP_CHILD_IMPL_H_ | 6 #define EXAMPLES_SURFACES_APP_CHILD_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class CompositorFrame; | 21 class CompositorFrame; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace mojo { | 24 namespace mojo { |
| 25 | 25 |
| 26 class ApplicationConnection; | 26 class ApplicationConnection; |
| 27 | 27 |
| 28 namespace examples { | 28 namespace examples { |
| 29 | 29 |
| 30 // Simple example of a child app using surfaces. | 30 // Simple example of a child app using surfaces. |
| 31 class ChildImpl : public InterfaceImpl<Child>, public SurfaceClient { | 31 class ChildImpl : public InterfaceImpl<Child> { |
| 32 public: | 32 public: |
| 33 class Context { | 33 class Context { |
| 34 public: | 34 public: |
| 35 virtual ApplicationConnection* ShellConnection( | 35 virtual ApplicationConnection* ShellConnection( |
| 36 const mojo::String& application_url) = 0; | 36 const mojo::String& application_url) = 0; |
| 37 }; | 37 }; |
| 38 explicit ChildImpl(ApplicationConnection* surfaces_service_connection); | 38 explicit ChildImpl(ApplicationConnection* surfaces_service_connection); |
| 39 ~ChildImpl() override; | 39 ~ChildImpl() override; |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 using ProduceCallback = mojo::Callback<void(SurfaceIdPtr id)>; | 42 using ProduceCallback = mojo::Callback<void(SurfaceIdPtr id)>; |
| 43 | 43 |
| 44 // SurfaceClient implementation | 44 void SetIdNamespace(uint32_t id_namespace); |
| 45 void SetIdNamespace(uint32_t id_namespace) override; | |
| 46 void ReturnResources(Array<ReturnedResourcePtr> resources) override; | |
| 47 | 45 |
| 48 // Child implementation. | 46 // Child implementation. |
| 49 void ProduceFrame(ColorPtr color, | 47 void ProduceFrame(ColorPtr color, |
| 50 SizePtr size, | 48 SizePtr size, |
| 51 const ProduceCallback& callback) override; | 49 const ProduceCallback& callback) override; |
| 52 | 50 |
| 53 scoped_ptr<cc::SurfaceIdAllocator> allocator_; | 51 scoped_ptr<cc::SurfaceIdAllocator> allocator_; |
| 54 SurfacePtr surface_; | 52 SurfacePtr surface_; |
| 55 uint32_t id_namespace_; | 53 uint32_t id_namespace_; |
| 56 | 54 |
| 57 DISALLOW_COPY_AND_ASSIGN(ChildImpl); | 55 DISALLOW_COPY_AND_ASSIGN(ChildImpl); |
| 58 }; | 56 }; |
| 59 | 57 |
| 60 } // namespace examples | 58 } // namespace examples |
| 61 } // namespace mojo | 59 } // namespace mojo |
| 62 | 60 |
| 63 #endif // EXAMPLES_SURFACES_APP_CHILD_IMPL_H_ | 61 #endif // EXAMPLES_SURFACES_APP_CHILD_IMPL_H_ |
| OLD | NEW |