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 #include "base/macros.h" | 5 #include "base/macros.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "mojo/examples/pepper_container_app/mojo_ppapi_globals.h" | 10 #include "mojo/examples/pepper_container_app/mojo_ppapi_globals.h" |
11 #include "mojo/examples/pepper_container_app/plugin_instance.h" | 11 #include "mojo/examples/pepper_container_app/plugin_instance.h" |
12 #include "mojo/examples/pepper_container_app/plugin_module.h" | 12 #include "mojo/examples/pepper_container_app/plugin_module.h" |
13 #include "mojo/examples/pepper_container_app/type_converters.h" | 13 #include "mojo/examples/pepper_container_app/type_converters.h" |
| 14 #include "mojo/public/cpp/application/application.h" |
14 #include "mojo/public/cpp/bindings/allocation_scope.h" | 15 #include "mojo/public/cpp/bindings/allocation_scope.h" |
15 #include "mojo/public/cpp/environment/environment.h" | 16 #include "mojo/public/cpp/environment/environment.h" |
16 #include "mojo/public/cpp/gles2/gles2.h" | 17 #include "mojo/public/cpp/gles2/gles2.h" |
17 #include "mojo/public/cpp/shell/application.h" | |
18 #include "mojo/public/cpp/system/core.h" | 18 #include "mojo/public/cpp/system/core.h" |
19 #include "mojo/public/interfaces/shell/shell.mojom.h" | 19 #include "mojo/public/interfaces/service_provider/service_provider.mojom.h" |
20 #include "mojo/services/native_viewport/native_viewport.mojom.h" | 20 #include "mojo/services/native_viewport/native_viewport.mojom.h" |
21 #include "ppapi/c/pp_rect.h" | 21 #include "ppapi/c/pp_rect.h" |
22 #include "ppapi/shared_impl/proxy_lock.h" | 22 #include "ppapi/shared_impl/proxy_lock.h" |
23 | 23 |
24 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
25 #if !defined(CDECL) | 25 #if !defined(CDECL) |
26 #define CDECL __cdecl | 26 #define CDECL __cdecl |
27 #endif | 27 #endif |
28 #define PEPPER_CONTAINER_APP_EXPORT __declspec(dllexport) | 28 #define PEPPER_CONTAINER_APP_EXPORT __declspec(dllexport) |
29 #else | 29 #else |
30 #define CDECL | 30 #define CDECL |
31 #define PEPPER_CONTAINER_APP_EXPORT __attribute__((visibility("default"))) | 31 #define PEPPER_CONTAINER_APP_EXPORT __attribute__((visibility("default"))) |
32 #endif | 32 #endif |
33 | 33 |
34 namespace mojo { | 34 namespace mojo { |
35 namespace examples { | 35 namespace examples { |
36 | 36 |
37 class PepperContainerApp: public Application, | 37 class PepperContainerApp: public Application, |
38 public NativeViewportClient, | 38 public NativeViewportClient, |
39 public MojoPpapiGlobals::Delegate { | 39 public MojoPpapiGlobals::Delegate { |
40 public: | 40 public: |
41 explicit PepperContainerApp(MojoHandle shell_handle) | 41 explicit PepperContainerApp(MojoHandle service_provider_handle) |
42 : Application(shell_handle), | 42 : Application(service_provider_handle), |
43 ppapi_globals_(this), | 43 ppapi_globals_(this), |
44 plugin_module_(new PluginModule) { | 44 plugin_module_(new PluginModule) { |
45 mojo::AllocationScope scope; | 45 mojo::AllocationScope scope; |
46 | 46 |
47 ConnectTo("mojo:mojo_native_viewport_service", &viewport_); | 47 ConnectTo("mojo:mojo_native_viewport_service", &viewport_); |
48 viewport_.set_client(this); | 48 viewport_.set_client(this); |
49 | 49 |
50 Rect::Builder rect; | 50 Rect::Builder rect; |
51 Point::Builder point; | 51 Point::Builder point; |
52 point.set_x(10); | 52 point.set_x(10); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 scoped_refptr<PluginModule> plugin_module_; | 113 scoped_refptr<PluginModule> plugin_module_; |
114 scoped_ptr<PluginInstance> plugin_instance_; | 114 scoped_ptr<PluginInstance> plugin_instance_; |
115 | 115 |
116 DISALLOW_COPY_AND_ASSIGN(PepperContainerApp); | 116 DISALLOW_COPY_AND_ASSIGN(PepperContainerApp); |
117 }; | 117 }; |
118 | 118 |
119 } // namespace examples | 119 } // namespace examples |
120 } // namespace mojo | 120 } // namespace mojo |
121 | 121 |
122 extern "C" PEPPER_CONTAINER_APP_EXPORT MojoResult CDECL MojoMain( | 122 extern "C" PEPPER_CONTAINER_APP_EXPORT MojoResult CDECL MojoMain( |
123 MojoHandle shell_handle) { | 123 MojoHandle service_provider_handle) { |
124 mojo::Environment env; | 124 mojo::Environment env; |
125 mojo::GLES2Initializer gles2; | 125 mojo::GLES2Initializer gles2; |
126 base::MessageLoop run_loop; | 126 base::MessageLoop run_loop; |
127 mojo::examples::PepperContainerApp app(shell_handle); | 127 mojo::examples::PepperContainerApp app(service_provider_handle); |
128 | 128 |
129 run_loop.Run(); | 129 run_loop.Run(); |
130 return MOJO_RESULT_OK; | 130 return MOJO_RESULT_OK; |
131 } | 131 } |
OLD | NEW |