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/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 SizePtr size(Size::New()); | 47 SizePtr size(Size::New()); |
48 size->width = 800; | 48 size->width = 800; |
49 size->height = 600; | 49 size->height = 600; |
50 viewport_->Create(size.Pass(), | 50 viewport_->Create(size.Pass(), |
51 base::Bind(&PepperContainerApp::OnCreatedNativeViewport, | 51 base::Bind(&PepperContainerApp::OnCreatedNativeViewport, |
52 weak_factory_.GetWeakPtr())); | 52 weak_factory_.GetWeakPtr())); |
53 viewport_->Show(); | 53 viewport_->Show(); |
54 } | 54 } |
55 | 55 |
56 // NativeViewportClient implementation. | 56 // NativeViewportClient implementation. |
57 virtual void OnDestroyed() OVERRIDE { | 57 virtual void OnDestroyed() override { |
58 ppapi::ProxyAutoLock lock; | 58 ppapi::ProxyAutoLock lock; |
59 | 59 |
60 if (plugin_instance_) { | 60 if (plugin_instance_) { |
61 plugin_instance_->DidDestroy(); | 61 plugin_instance_->DidDestroy(); |
62 plugin_instance_.reset(); | 62 plugin_instance_.reset(); |
63 } | 63 } |
64 | 64 |
65 base::MessageLoop::current()->Quit(); | 65 base::MessageLoop::current()->Quit(); |
66 } | 66 } |
67 | 67 |
68 virtual void OnSizeChanged(SizePtr size) OVERRIDE { | 68 virtual void OnSizeChanged(SizePtr size) override { |
69 ppapi::ProxyAutoLock lock; | 69 ppapi::ProxyAutoLock lock; |
70 | 70 |
71 if (plugin_instance_) { | 71 if (plugin_instance_) { |
72 PP_Rect pp_rect = {{0, 0}, {size->width, size->height}}; | 72 PP_Rect pp_rect = {{0, 0}, {size->width, size->height}}; |
73 plugin_instance_->DidChangeView(pp_rect); | 73 plugin_instance_->DidChangeView(pp_rect); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 virtual void OnEvent(EventPtr event, | 77 virtual void OnEvent(EventPtr event, |
78 const mojo::Callback<void()>& callback) OVERRIDE { | 78 const mojo::Callback<void()>& callback) override { |
79 if (!event->location_data.is_null()) { | 79 if (!event->location_data.is_null()) { |
80 ppapi::ProxyAutoLock lock; | 80 ppapi::ProxyAutoLock lock; |
81 | 81 |
82 // TODO(yzshen): Handle events. | 82 // TODO(yzshen): Handle events. |
83 } | 83 } |
84 callback.Run(); | 84 callback.Run(); |
85 } | 85 } |
86 | 86 |
87 // MojoPpapiGlobals::Delegate implementation. | 87 // MojoPpapiGlobals::Delegate implementation. |
88 virtual ScopedMessagePipeHandle CreateGLES2Context() OVERRIDE { | 88 virtual ScopedMessagePipeHandle CreateGLES2Context() override { |
89 CommandBufferPtr command_buffer; | 89 CommandBufferPtr command_buffer; |
90 SizePtr size = Size::New(); | 90 SizePtr size = Size::New(); |
91 size->width = 800; | 91 size->width = 800; |
92 size->width = 600; | 92 size->width = 600; |
93 // TODO(jamesr): Output a surface to the native viewport instead. | 93 // TODO(jamesr): Output a surface to the native viewport instead. |
94 gpu_service_->CreateOnscreenGLES2Context( | 94 gpu_service_->CreateOnscreenGLES2Context( |
95 native_viewport_id_, size.Pass(), Get(&command_buffer)); | 95 native_viewport_id_, size.Pass(), Get(&command_buffer)); |
96 return command_buffer.PassMessagePipe(); | 96 return command_buffer.PassMessagePipe(); |
97 } | 97 } |
98 | 98 |
(...skipping 22 matching lines...) Expand all Loading... |
121 | 121 |
122 } // namespace examples | 122 } // namespace examples |
123 } // namespace mojo | 123 } // namespace mojo |
124 | 124 |
125 MojoResult MojoMain(MojoHandle shell_handle) { | 125 MojoResult MojoMain(MojoHandle shell_handle) { |
126 mojo::ApplicationRunnerChromium runner( | 126 mojo::ApplicationRunnerChromium runner( |
127 new mojo::examples::PepperContainerApp); | 127 new mojo::examples::PepperContainerApp); |
128 return runner.Run(shell_handle); | 128 return runner.Run(shell_handle); |
129 } | 129 } |
130 | 130 |
OLD | NEW |