| 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 "mojo/services/native_viewport/native_viewport_impl.h" | 5 #include "mojo/services/native_viewport/native_viewport_impl.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 event->type() == ui::ET_TOUCH_MOVED; | 28 event->type() == ui::ET_TOUCH_MOVED; |
| 29 } | 29 } |
| 30 | 30 |
| 31 } // namespace | 31 } // namespace |
| 32 | 32 |
| 33 NativeViewportImpl::NativeViewportImpl(ApplicationImpl* app, bool is_headless) | 33 NativeViewportImpl::NativeViewportImpl(ApplicationImpl* app, bool is_headless) |
| 34 : is_headless_(is_headless), | 34 : is_headless_(is_headless), |
| 35 widget_id_(0u), | 35 widget_id_(0u), |
| 36 waiting_for_event_ack_(false), | 36 waiting_for_event_ack_(false), |
| 37 weak_factory_(this) { | 37 weak_factory_(this) { |
| 38 app->ConnectToService("mojo:mojo_surfaces_service", &surfaces_service_); | 38 app->ConnectToService("mojo:surfaces_service", &surfaces_service_); |
| 39 // TODO(jamesr): Should be mojo_gpu_service | 39 // TODO(jamesr): Should be mojo_gpu_service |
| 40 app->ConnectToService("mojo:mojo_native_viewport_service", &gpu_service_); | 40 app->ConnectToService("mojo:native_viewport_service", &gpu_service_); |
| 41 } | 41 } |
| 42 | 42 |
| 43 NativeViewportImpl::~NativeViewportImpl() { | 43 NativeViewportImpl::~NativeViewportImpl() { |
| 44 // Destroy the NativeViewport early on as it may call us back during | 44 // Destroy the NativeViewport early on as it may call us back during |
| 45 // destruction and we want to be in a known state. | 45 // destruction and we want to be in a known state. |
| 46 platform_viewport_.reset(); | 46 platform_viewport_.reset(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void NativeViewportImpl::Create(SizePtr size, | 49 void NativeViewportImpl::Create(SizePtr size, |
| 50 const Callback<void(uint64_t)>& callback) { | 50 const Callback<void(uint64_t)>& callback) { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 151 } |
| 152 | 152 |
| 153 void NativeViewportImpl::ProcessOnBoundsChanged() { | 153 void NativeViewportImpl::ProcessOnBoundsChanged() { |
| 154 client()->OnSizeChanged(Size::From(size_)); | 154 client()->OnSizeChanged(Size::From(size_)); |
| 155 if (viewport_surface_) | 155 if (viewport_surface_) |
| 156 viewport_surface_->SetSize(size_); | 156 viewport_surface_->SetSize(size_); |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace mojo | 159 } // namespace mojo |
| 160 | 160 |
| OLD | NEW |