Revert 268405 "Make sure that ScratchBuffer::Allocate() always r..."
[chromium-blink-merge.git] / content / browser / renderer_host / pepper / pepper_gamepad_host.h
blob1db73aa694a5ebbfba38f200bc2b84cc268f0a3e
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.
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_GAMEPAD_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_GAMEPAD_HOST_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h"
10 #include "content/common/content_export.h"
11 #include "ppapi/host/resource_host.h"
13 namespace ppapi {
14 namespace host {
15 struct ReplyMessageContext;
19 namespace content {
21 class BrowserPpapiHost;
22 class GamepadService;
24 class CONTENT_EXPORT PepperGamepadHost : public ppapi::host::ResourceHost {
25 public:
26 PepperGamepadHost(BrowserPpapiHost* host,
27 PP_Instance instance,
28 PP_Resource resource);
30 // Allows tests to specify a gamepad service to use rather than the global
31 // singleton. The caller owns the gamepad_service pointer.
32 PepperGamepadHost(GamepadService* gamepad_service,
33 BrowserPpapiHost* host,
34 PP_Instance instance,
35 PP_Resource resource);
37 virtual ~PepperGamepadHost();
39 virtual int32_t OnResourceMessageReceived(
40 const IPC::Message& msg,
41 ppapi::host::HostMessageContext* context) OVERRIDE;
43 private:
44 int32_t OnRequestMemory(ppapi::host::HostMessageContext* context);
46 void GotUserGesture(const ppapi::host::ReplyMessageContext& in_context);
48 BrowserPpapiHost* browser_ppapi_host_;
50 GamepadService* gamepad_service_;
52 bool is_started_;
54 base::WeakPtrFactory<PepperGamepadHost> weak_factory_;
56 DISALLOW_COPY_AND_ASSIGN(PepperGamepadHost);
59 } // namespace content
61 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_PEPPER_GAMEPAD_HOST_H_