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_PPB_TESTING_PROXY_H_
6#define PPAPI_PROXY_PPB_TESTING_PROXY_H_
7
8#include "base/basictypes.h"
9#include "ppapi/c/pp_instance.h"
10#include "ppapi/c/pp_resource.h"
11#include "ppapi/c/private/ppb_testing_private.h"
12#include "ppapi/proxy/interface_proxy.h"
13#include "ppapi/shared_impl/host_resource.h"
14
15struct PP_Point;
16
17namespace ppapi {
18
19struct InputEventData;
20
21namespace proxy {
22
23class PPB_Testing_Proxy : public InterfaceProxy {
24 public:
25  PPB_Testing_Proxy(Dispatcher* dispatcher);
26  virtual ~PPB_Testing_Proxy();
27
28  static const PPB_Testing_Private* GetProxyInterface();
29
30  // InterfaceProxy implementation.
31  virtual bool OnMessageReceived(const IPC::Message& msg);
32
33 private:
34  // Message handlers.
35  void OnMsgReadImageData(const ppapi::HostResource& device_context_2d,
36                          const ppapi::HostResource& image,
37                          const PP_Point& top_left,
38                          PP_Bool* result);
39  void OnMsgRunMessageLoop(PP_Instance instance);
40  void OnMsgQuitMessageLoop(PP_Instance instance);
41  void OnMsgGetLiveObjectsForInstance(PP_Instance instance, uint32_t* result);
42  void OnMsgSimulateInputEvent(PP_Instance instance,
43                               const ppapi::InputEventData& input_event);
44  void OnMsgSetMinimumArrayBufferSizeForShmem(uint32_t threshold);
45
46  // When this proxy is in the host side, this value caches the interface
47  // pointer so we don't have to retrieve it from the dispatcher each time.
48  // In the plugin, this value is always NULL.
49  const PPB_Testing_Private* ppb_testing_impl_;
50
51  DISALLOW_COPY_AND_ASSIGN(PPB_Testing_Proxy);
52};
53
54}  // namespace proxy
55}  // namespace ppapi
56
57#endif  // PPAPI_PROXY_PPB_TESTING_PROXY_H_
58