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

Side by Side Diff: content/browser/gamepad/gamepad_provider.cc

Issue 8799022: Add Mac implementation of data_fetcher for gamepad. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: some renaming per usb hid spec Created 9 years 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
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 #include <cmath> 5 #include <cmath>
6 #include <set> 6 #include <set>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/task.h" 12 #include "base/task.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 #include "base/threading/thread_restrictions.h" 14 #include "base/threading/thread_restrictions.h"
15 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
16 #include "content/browser/gamepad/gamepad_provider.h" 16 #include "content/browser/gamepad/gamepad_provider.h"
17 #include "content/browser/gamepad/data_fetcher.h" 17 #include "content/browser/gamepad/data_fetcher.h"
18 #include "content/common/gamepad_messages.h" 18 #include "content/common/gamepad_messages.h"
19 19
20 #if defined(OS_WIN) 20 #if defined(OS_WIN)
21 #include "content/browser/gamepad/data_fetcher_win.h" 21 #include "content/browser/gamepad/data_fetcher_win.h"
22 #elif defined(OS_MACOSX)
23 #include "content/browser/gamepad/data_fetcher_mac.h"
22 #endif 24 #endif
23 25
24 namespace content { 26 namespace content {
25 27
26 // Define the default data fetcher that GamepadProvider will use if none is 28 // Define the default data fetcher that GamepadProvider will use if none is
27 // supplied. (GamepadPlatformDataFetcher). 29 // supplied. (GamepadPlatformDataFetcher).
28 #if defined(OS_WIN) 30 #if defined(OS_WIN)
29 31
30 typedef GamepadDataFetcherWindows GamepadPlatformDataFetcher; 32 typedef GamepadDataFetcherWindows GamepadPlatformDataFetcher;
31 33
34 #elif defined(OS_MACOSX)
35
36 typedef GamepadDataFetcherMac GamepadPlatformDataFetcher;
37
32 #else 38 #else
33 39
34 class GamepadEmptyDataFetcher : public GamepadDataFetcher { 40 class GamepadEmptyDataFetcher : public GamepadDataFetcher {
35 public: 41 public:
36 void GetGamepadData(WebKit::WebGamepads* pads, bool) { 42 void GetGamepadData(WebKit::WebGamepads* pads, bool) {
37 pads->length = 0; 43 pads->length = 0;
38 } 44 }
39 }; 45 };
40 typedef GamepadEmptyDataFetcher GamepadPlatformDataFetcher; 46 typedef GamepadEmptyDataFetcher GamepadPlatformDataFetcher;
41 47
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 kDesiredSamplingIntervalMs); 163 kDesiredSamplingIntervalMs);
158 } 164 }
159 165
160 GamepadHardwareBuffer* GamepadProvider::SharedMemoryAsHardwareBuffer() { 166 GamepadHardwareBuffer* GamepadProvider::SharedMemoryAsHardwareBuffer() {
161 void* mem = gamepad_shared_memory_.memory(); 167 void* mem = gamepad_shared_memory_.memory();
162 DCHECK(mem); 168 DCHECK(mem);
163 return static_cast<GamepadHardwareBuffer*>(mem); 169 return static_cast<GamepadHardwareBuffer*>(mem);
164 } 170 }
165 171
166 } // namespace content 172 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698