| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/gamepad_shared_memory_reader.h" | 5 #include "content/renderer/gamepad_shared_memory_reader.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "content/public/renderer/render_thread.h" | 9 #include "content/public/renderer/render_thread.h" |
| 10 #include "content/renderer/renderer_blink_platform_impl.h" | 10 #include "content/renderer/renderer_blink_platform_impl.h" |
| 11 #include "ipc/ipc_sync_message_filter.h" | 11 #include "ipc/ipc_sync_message_filter.h" |
| 12 #include "services/service_manager/public/cpp/interface_provider.h" | 12 #include "services/service_manager/public/cpp/interface_provider.h" |
| 13 #include "third_party/WebKit/public/platform/WebGamepadListener.h" | 13 #include "third_party/WebKit/public/platform/WebGamepadListener.h" |
| 14 #include "third_party/WebKit/public/platform/WebPlatformEventListener.h" | 14 #include "third_party/WebKit/public/platform/WebPlatformEventListener.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 GamepadSharedMemoryReader::GamepadSharedMemoryReader(RenderThread* thread) | 18 GamepadSharedMemoryReader::GamepadSharedMemoryReader(RenderThread* thread) |
| 19 : RendererGamepadProvider(thread), | 19 : RendererGamepadProvider(thread), |
| 20 gamepad_hardware_buffer_(NULL), | 20 gamepad_hardware_buffer_(NULL), |
| 21 ever_interacted_with_(false), | 21 ever_interacted_with_(false), |
| 22 binding_(this) { | 22 binding_(this) { |
| 23 if (thread) { | 23 if (thread) { |
| 24 thread->GetRemoteInterfaces()->GetInterface( | 24 thread->GetRemoteInterfaces()->GetInterface( |
| 25 mojo::GetProxy(&gamepad_monitor_)); | 25 mojo::MakeRequest(&gamepad_monitor_)); |
| 26 gamepad_monitor_->SetObserver(binding_.CreateInterfacePtrAndBind()); | 26 gamepad_monitor_->SetObserver(binding_.CreateInterfacePtrAndBind()); |
| 27 } | 27 } |
| 28 } | 28 } |
| 29 | 29 |
| 30 void GamepadSharedMemoryReader::SendStartMessage() { | 30 void GamepadSharedMemoryReader::SendStartMessage() { |
| 31 if (gamepad_monitor_) { | 31 if (gamepad_monitor_) { |
| 32 gamepad_monitor_->GamepadStartPolling(&renderer_shared_buffer_handle_); | 32 gamepad_monitor_->GamepadStartPolling(&renderer_shared_buffer_handle_); |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 | 35 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 } | 126 } |
| 127 | 127 |
| 128 void GamepadSharedMemoryReader::GamepadDisconnected( | 128 void GamepadSharedMemoryReader::GamepadDisconnected( |
| 129 int index, | 129 int index, |
| 130 const blink::WebGamepad& gamepad) { | 130 const blink::WebGamepad& gamepad) { |
| 131 if (listener()) | 131 if (listener()) |
| 132 listener()->didDisconnectGamepad(index, gamepad); | 132 listener()->didDisconnectGamepad(index, gamepad); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace content | 135 } // namespace content |
| OLD | NEW |