• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_PPB_CORE_PROXY_H_
6 #define PPAPI_PPB_CORE_PROXY_H_
7 
8 #include "ppapi/c/pp_completion_callback.h"
9 #include "ppapi/c/pp_resource.h"
10 #include "ppapi/c/pp_var.h"
11 #include "ppapi/c/ppb_core.h"
12 #include "ppapi/proxy/interface_proxy.h"
13 #include "ppapi/shared_impl/host_resource.h"
14 
15 namespace ppapi {
16 namespace proxy {
17 
18 class PPB_Core_Proxy : public InterfaceProxy {
19  public:
20   PPB_Core_Proxy(Dispatcher* dispatcher);
21   virtual ~PPB_Core_Proxy();
22 
23   static const PPB_Core* GetPPB_Core_Interface();
24 
25   // InterfaceProxy implementation.
26   virtual bool OnMessageReceived(const IPC::Message& msg);
27 
28   static const ApiID kApiID = API_ID_PPB_CORE;
29 
30  private:
31   // Message handlers.
32   void OnMsgAddRefResource(const ppapi::HostResource& resource);
33   void OnMsgReleaseResource(const ppapi::HostResource& resource);
34 
35   // When this proxy is in the host side, this value caches the interface
36   // pointer so we don't have to retrieve it from the dispatcher each time.
37   // In the plugin, this value is always NULL.
38   const PPB_Core* ppb_core_impl_;
39 };
40 
41 }  // namespace proxy
42 }  // namespace ppapi
43 
44 #endif  // PPAPI_PPB_CORE_PROXY_H_
45