summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/ppb_flash_clipboard_proxy.h
blob: 08db677a64b7ea59ea2b58379a22cea6c656c32b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef PPAPI_PROXY_PPB_FLASH_CLIPBOARD_PROXY_H_
#define PPAPI_PROXY_PPB_FLASH_CLIPBOARD_PROXY_H_

#include "ppapi/c/pp_instance.h"
#include "ppapi/proxy/interface_proxy.h"
#include "ppapi/thunk/ppb_flash_clipboard_api.h"

namespace ppapi {
namespace proxy {

class SerializedVarReceiveInput;
class SerializedVarReturnValue;

class PPB_Flash_Clipboard_Proxy
    : public InterfaceProxy,
      public thunk::PPB_Flash_Clipboard_FunctionAPI {
 public:
  PPB_Flash_Clipboard_Proxy(Dispatcher* dispatcher);
  virtual ~PPB_Flash_Clipboard_Proxy();

  // FunctionGroupBase overrides.
  thunk::PPB_Flash_Clipboard_FunctionAPI* AsPPB_Flash_Clipboard_FunctionAPI()
      OVERRIDE;

  // PPB_Flash_Clipboard_FunctionAPI implementation.
  virtual PP_Bool IsFormatAvailable(PP_Instance instance,
                                    PP_Flash_Clipboard_Type clipboard_type,
                                    PP_Flash_Clipboard_Format format) OVERRIDE;
  virtual PP_Var ReadPlainText(PP_Instance instance,
                               PP_Flash_Clipboard_Type clipboard_type) OVERRIDE;
  virtual int32_t WritePlainText(PP_Instance instance,
                                 PP_Flash_Clipboard_Type clipboard_type,
                                 const PP_Var& text) OVERRIDE;

  // InterfaceProxy implementation.
  virtual bool OnMessageReceived(const IPC::Message& msg);

  static const ApiID kApiID = API_ID_PPB_FLASH_CLIPBOARD;

 private:
  // Message handlers.
  void OnMsgIsFormatAvailable(PP_Instance instance,
                              int clipboard_type,
                              int format,
                              bool* result);
  void OnMsgReadPlainText(PP_Instance instance,
                          int clipboard_type,
                          SerializedVarReturnValue result);
  void OnMsgWritePlainText(PP_Instance instance,
                           int clipboard_type,
                           SerializedVarReceiveInput text);
};

}  // namespace proxy
}  // namespace ppapi

#endif  // PPAPI_PROXY_PPB_FLASH_CLIPBOARD_PROXY_H_