ppp_instance_proxy.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
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
3// found in the LICENSE file.
4
5#ifndef PPAPI_PROXY_PPP_INSTANCE_PROXY_H_
6#define PPAPI_PROXY_PPP_INSTANCE_PROXY_H_
7
8#include <string>
9#include <vector>
10
11#include "base/memory/scoped_ptr.h"
12#include "ppapi/c/pp_instance.h"
13#include "ppapi/c/pp_resource.h"
14#include "ppapi/c/pp_var.h"
15#include "ppapi/proxy/interface_proxy.h"
16#include "ppapi/shared_impl/host_resource.h"
17#include "ppapi/shared_impl/ppp_instance_combined.h"
18
19struct PP_Rect;
20
21namespace ppapi {
22
23struct ViewData;
24
25namespace proxy {
26
27class PPP_Instance_Proxy : public InterfaceProxy {
28 public:
29  explicit PPP_Instance_Proxy(Dispatcher* dispatcher);
30  virtual ~PPP_Instance_Proxy();
31
32  static const PPP_Instance* GetInstanceInterface();
33
34  PPP_Instance_Combined* ppp_instance_target() const {
35    return combined_interface_.get();
36  }
37
38  // InterfaceProxy implementation.
39  virtual bool OnMessageReceived(const IPC::Message& msg);
40
41 private:
42  // Message handlers.
43  void OnPluginMsgDidCreate(PP_Instance instance,
44                            const std::vector<std::string>& argn,
45                            const std::vector<std::string>& argv,
46                            PP_Bool* result);
47  void OnPluginMsgDidDestroy(PP_Instance instance);
48  void OnPluginMsgDidChangeView(PP_Instance instance,
49                                const ViewData& new_data,
50                                PP_Bool flash_fullscreen);
51  void OnPluginMsgDidChangeFocus(PP_Instance instance, PP_Bool has_focus);
52  void OnPluginMsgHandleDocumentLoad(PP_Instance instance,
53                                     const HostResource& url_loader,
54                                     PP_Bool* result);
55  scoped_ptr<PPP_Instance_Combined> combined_interface_;
56};
57
58}  // namespace proxy
59}  // namespace ppapi
60
61#endif  // PPAPI_PROXY_PPP_INSTANCE_PROXY_H_
62