OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "mojo/services/native_viewport/native_viewport_service.h" | 5 #include "mojo/services/native_viewport/native_viewport_service.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "mojo/public/bindings/allocation_scope.h" | 9 #include "mojo/public/bindings/allocation_scope.h" |
10 #include "mojo/services/gles2/command_buffer_impl.h" | 10 #include "mojo/services/gles2/command_buffer_impl.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 : widget_(gfx::kNullAcceleratedWidget), | 34 : widget_(gfx::kNullAcceleratedWidget), |
35 waiting_for_event_ack_(false), | 35 waiting_for_event_ack_(false), |
36 pending_event_timestamp_(0) {} | 36 pending_event_timestamp_(0) {} |
37 virtual ~NativeViewportImpl() {} | 37 virtual ~NativeViewportImpl() {} |
38 | 38 |
39 virtual void Create(const Rect& bounds) MOJO_OVERRIDE { | 39 virtual void Create(const Rect& bounds) MOJO_OVERRIDE { |
40 native_viewport_ = | 40 native_viewport_ = |
41 services::NativeViewport::Create(context(), this); | 41 services::NativeViewport::Create(context(), this); |
42 native_viewport_->Init(bounds); | 42 native_viewport_->Init(bounds); |
43 client()->OnCreated(); | 43 client()->OnCreated(); |
| 44 OnBoundsChanged(bounds); |
44 } | 45 } |
45 | 46 |
46 virtual void Show() MOJO_OVERRIDE { | 47 virtual void Show() MOJO_OVERRIDE { |
47 native_viewport_->Show(); | 48 native_viewport_->Show(); |
48 } | 49 } |
49 | 50 |
50 virtual void Hide() MOJO_OVERRIDE { | 51 virtual void Hide() MOJO_OVERRIDE { |
51 native_viewport_->Hide(); | 52 native_viewport_->Hide(); |
52 } | 53 } |
53 | 54 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 base::MessageLoopForUI loop; | 203 base::MessageLoopForUI loop; |
203 mojo::Application app(shell_handle); | 204 mojo::Application app(shell_handle); |
204 app.AddServiceFactory( | 205 app.AddServiceFactory( |
205 new mojo::ServiceFactory<mojo::services::NativeViewportImpl, | 206 new mojo::ServiceFactory<mojo::services::NativeViewportImpl, |
206 mojo::shell::Context>); | 207 mojo::shell::Context>); |
207 loop.Run(); | 208 loop.Run(); |
208 return MOJO_RESULT_OK; | 209 return MOJO_RESULT_OK; |
209 } | 210 } |
210 | 211 |
211 #endif // !OS_ANDROID | 212 #endif // !OS_ANDROID |
OLD | NEW |