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

Side by Side Diff: ppapi/proxy/gamepad_resource.h

Issue 10824272: Add a skeleton gamepad resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef PPAPI_PROXY_GAMEPAD_RESOURCE_H_
6 #define PPAPI_PROXY_GAMEPAD_RESOURCE_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/shared_memory.h"
12 #include "ppapi/proxy/plugin_resource.h"
13 #include "ppapi/proxy/ppapi_proxy_export.h"
14 #include "ppapi/thunk/ppb_gamepad_api.h"
15
16 struct PP_GamepadsSampleData;
17
18 namespace base {
19 class SharedMemory;
20 }
21
22 namespace ppapi {
23 namespace proxy {
24
25 // This class is a bit weird. It isn't a true resource from the plugin's
26 // perspective. But we need to make requests to the browser and get replies.
27 // It's more convenient to do this as a resource, so the instance just
28 // maintains an internal lazily instantiated copy of this resource.
29 class PPAPI_PROXY_EXPORT GamepadResource
30 : public PluginResource,
31 public thunk::PPB_Gamepad_API {
32 public:
33 GamepadResource(Connection connection, PP_Instance instance);
34 virtual ~GamepadResource();
35
36 // PPB_Gamepad_API.
37 virtual void Sample(PP_GamepadsSampleData* data) OVERRIDE;
38
39 private:
40 // PluginResource override.
41 virtual void OnReplyReceived(const ResourceMessageReplyParams& params,
42 const IPC::Message& msg) OVERRIDE;
43
44 void OnPluginMsgSendMemory(const ResourceMessageReplyParams& params,
45 base::SharedMemoryHandle shared_memory_handle);
46
47 scoped_ptr<base::SharedMemory> shared_memory_;
48 void* buffer_;
49
50 DISALLOW_COPY_AND_ASSIGN(GamepadResource);
51 };
52
53 } // namespace proxy
54 } // namespace ppapi
55
56 #endif // PPAPI_PROXY_GAMEPAD_RESOURCE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698