Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: content/renderer/gamepad_shared_memory_reader.h

Issue 195873019: Gamepad API: add support for connection events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: and a missing override Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/content_common.gypi ('k') | content/renderer/gamepad_shared_memory_reader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CONTENT_RENDERER_GAMEPAD_SHARED_MEMORY_READER_H_ 5 #ifndef CONTENT_RENDERER_GAMEPAD_SHARED_MEMORY_READER_H_
6 #define CONTENT_RENDERER_GAMEPAD_SHARED_MEMORY_READER_H_ 6 #define CONTENT_RENDERER_GAMEPAD_SHARED_MEMORY_READER_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "content/common/gamepad_messages.h"
11 #include "content/public/renderer/render_process_observer.h"
10 #include "third_party/WebKit/public/platform/WebGamepads.h" 12 #include "third_party/WebKit/public/platform/WebGamepads.h"
11 13
14 namespace blink { class WebGamepadListener; }
15
12 namespace content { 16 namespace content {
13 17
14 struct GamepadHardwareBuffer; 18 struct GamepadHardwareBuffer;
15 19
16 class GamepadSharedMemoryReader { 20 class GamepadSharedMemoryReader : public RenderProcessObserver {
17 public: 21 public:
18 GamepadSharedMemoryReader(); 22 GamepadSharedMemoryReader();
19 virtual ~GamepadSharedMemoryReader(); 23 virtual ~GamepadSharedMemoryReader();
20 void SampleGamepads(blink::WebGamepads&); 24
25 void SampleGamepads(blink::WebGamepads& gamepads);
26 void SetGamepadListener(blink::WebGamepadListener* listener);
27
28 // RenderProcessObserver implementation.
29 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE;
21 30
22 private: 31 private:
32 void OnGamepadConnected(int index, const blink::WebGamepad& gamepad);
33 void OnGamepadDisconnected(int index, const blink::WebGamepad& gamepad);
34
35 void StartPollingIfNecessary();
36 void StopPollingIfNecessary();
37
23 base::SharedMemoryHandle renderer_shared_memory_handle_; 38 base::SharedMemoryHandle renderer_shared_memory_handle_;
24 scoped_ptr<base::SharedMemory> renderer_shared_memory_; 39 scoped_ptr<base::SharedMemory> renderer_shared_memory_;
25 GamepadHardwareBuffer* gamepad_hardware_buffer_; 40 GamepadHardwareBuffer* gamepad_hardware_buffer_;
41 blink::WebGamepadListener* gamepad_listener_;
26 42
43 bool is_polling_;
27 bool ever_interacted_with_; 44 bool ever_interacted_with_;
28 }; 45 };
29 46
30 } // namespace content 47 } // namespace content
31 48
32 #endif // CONTENT_RENDERER_GAMEPAD_SHARED_MEMORY_READER_H_ 49 #endif // CONTENT_RENDERER_GAMEPAD_SHARED_MEMORY_READER_H_
OLDNEW
« no previous file with comments | « content/content_common.gypi ('k') | content/renderer/gamepad_shared_memory_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698