| 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/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "mojo/public/cpp/bindings/allocation_scope.h" | 10 #include "mojo/public/cpp/bindings/allocation_scope.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 class NativeViewportImpl | 30 class NativeViewportImpl |
| 31 : public ServiceConnection<mojo::NativeViewport, | 31 : public ServiceConnection<mojo::NativeViewport, |
| 32 NativeViewportImpl, | 32 NativeViewportImpl, |
| 33 shell::Context>, | 33 shell::Context>, |
| 34 public NativeViewportDelegate { | 34 public NativeViewportDelegate { |
| 35 public: | 35 public: |
| 36 NativeViewportImpl() | 36 NativeViewportImpl() |
| 37 : widget_(gfx::kNullAcceleratedWidget), | 37 : widget_(gfx::kNullAcceleratedWidget), |
| 38 waiting_for_event_ack_(false) {} | 38 waiting_for_event_ack_(false) {} |
| 39 virtual ~NativeViewportImpl() {} | 39 virtual ~NativeViewportImpl() { |
| 40 // Destroy the NativeViewport early on as it may call us back during |
| 41 // destruction and we want to be in a known state. |
| 42 native_viewport_.reset(); |
| 43 } |
| 40 | 44 |
| 41 virtual void Create(const Rect& bounds) OVERRIDE { | 45 virtual void Create(const Rect& bounds) OVERRIDE { |
| 42 native_viewport_ = | 46 native_viewport_ = |
| 43 services::NativeViewport::Create(context(), this); | 47 services::NativeViewport::Create(context(), this); |
| 44 native_viewport_->Init(bounds); | 48 native_viewport_->Init(bounds); |
| 45 client()->OnCreated(); | 49 client()->OnCreated(); |
| 46 OnBoundsChanged(bounds); | 50 OnBoundsChanged(bounds); |
| 47 } | 51 } |
| 48 | 52 |
| 49 virtual void Show() OVERRIDE { | 53 virtual void Show() OVERRIDE { |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 MOJO_NATIVE_VIEWPORT_EXPORT mojo::Application* | 191 MOJO_NATIVE_VIEWPORT_EXPORT mojo::Application* |
| 188 CreateNativeViewportService(mojo::shell::Context* context, | 192 CreateNativeViewportService(mojo::shell::Context* context, |
| 189 mojo::ScopedShellHandle shell_handle) { | 193 mojo::ScopedShellHandle shell_handle) { |
| 190 mojo::Application* app = new mojo::Application(shell_handle.Pass()); | 194 mojo::Application* app = new mojo::Application(shell_handle.Pass()); |
| 191 app->AddServiceConnector( | 195 app->AddServiceConnector( |
| 192 new mojo::ServiceConnector<mojo::services::NativeViewportImpl, | 196 new mojo::ServiceConnector<mojo::services::NativeViewportImpl, |
| 193 mojo::shell::Context>(context)); | 197 mojo::shell::Context>(context)); |
| 194 return app; | 198 return app; |
| 195 } | 199 } |
| 196 | 200 |
| OLD | NEW |