| 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 23 matching lines...) Expand all Loading... |
| 34 NativeViewportImpl(shell::Context* context) | 34 NativeViewportImpl(shell::Context* context) |
| 35 : context_(context), | 35 : context_(context), |
| 36 widget_(gfx::kNullAcceleratedWidget), | 36 widget_(gfx::kNullAcceleratedWidget), |
| 37 waiting_for_event_ack_(false) {} | 37 waiting_for_event_ack_(false) {} |
| 38 virtual ~NativeViewportImpl() { | 38 virtual ~NativeViewportImpl() { |
| 39 // Destroy the NativeViewport early on as it may call us back during | 39 // Destroy the NativeViewport early on as it may call us back during |
| 40 // destruction and we want to be in a known state. | 40 // destruction and we want to be in a known state. |
| 41 native_viewport_.reset(); | 41 native_viewport_.reset(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 virtual void OnConnectionError() OVERRIDE {} | |
| 45 | |
| 46 virtual void Create(const Rect& bounds) OVERRIDE { | 44 virtual void Create(const Rect& bounds) OVERRIDE { |
| 47 native_viewport_ = | 45 native_viewport_ = |
| 48 services::NativeViewport::Create(context_, this); | 46 services::NativeViewport::Create(context_, this); |
| 49 native_viewport_->Init(bounds); | 47 native_viewport_->Init(bounds); |
| 50 client()->OnCreated(); | 48 client()->OnCreated(); |
| 51 OnBoundsChanged(bounds); | 49 OnBoundsChanged(bounds); |
| 52 } | 50 } |
| 53 | 51 |
| 54 virtual void Show() OVERRIDE { | 52 virtual void Show() OVERRIDE { |
| 55 native_viewport_->Show(); | 53 native_viewport_->Show(); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 186 |
| 189 | 187 |
| 190 MOJO_NATIVE_VIEWPORT_EXPORT mojo::Application* | 188 MOJO_NATIVE_VIEWPORT_EXPORT mojo::Application* |
| 191 CreateNativeViewportService(mojo::shell::Context* context, | 189 CreateNativeViewportService(mojo::shell::Context* context, |
| 192 mojo::ScopedMessagePipeHandle shell_handle) { | 190 mojo::ScopedMessagePipeHandle shell_handle) { |
| 193 mojo::Application* app = new mojo::Application(shell_handle.Pass()); | 191 mojo::Application* app = new mojo::Application(shell_handle.Pass()); |
| 194 app->AddService<mojo::services::NativeViewportImpl>(context); | 192 app->AddService<mojo::services::NativeViewportImpl>(context); |
| 195 return app; | 193 return app; |
| 196 } | 194 } |
| 197 | 195 |
| OLD | NEW |