summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy/ppb_flash_proxy.h
blob: c44145522ae999e43df93798e4a43206300f8d99 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
// 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_PROXY_H_
#define PPAPI_PROXY_PPB_FLASH_PROXY_H_

#include <string>
#include <vector>

#include "base/compiler_specific.h"
#include "ipc/ipc_platform_file.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_module.h"
#include "ppapi/c/pp_time.h"
#include "ppapi/c/private/ppb_flash.h"
#include "ppapi/proxy/interface_proxy.h"
#include "ppapi/proxy/serialized_var.h"
#include "ppapi/shared_impl/host_resource.h"
#include "ppapi/shared_impl/ppb_flash_shared.h"

struct PPB_Flash_Print_1_0;

namespace ppapi {

struct PPB_URLRequestInfo_Data;

namespace proxy {

struct PPBFlash_DrawGlyphs_Params;
struct SerializedDirEntry;
class SerializedVarReturnValue;

class PPB_Flash_Proxy : public InterfaceProxy, public PPB_Flash_Shared {
 public:
  explicit PPB_Flash_Proxy(Dispatcher* dispatcher);
  virtual ~PPB_Flash_Proxy();

  // This flash proxy also proxies the PPB_Flash_Print interface. This one
  // doesn't use the regular thunk system because the _impl side is actually in
  // Chrome rather than with the rest of the interface implementations.
  static const PPB_Flash_Print_1_0* GetFlashPrintInterface();

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

  // PPB_Flash_API implementation.
  virtual void SetInstanceAlwaysOnTop(PP_Instance instance,
                                      PP_Bool on_top) OVERRIDE;
  virtual PP_Bool DrawGlyphs(PP_Instance instance,
                             PP_Resource pp_image_data,
                             const PP_FontDescription_Dev* font_desc,
                             uint32_t color,
                             const PP_Point* position,
                             const PP_Rect* clip,
                             const float transformation[3][3],
                             PP_Bool allow_subpixel_aa,
                             uint32_t glyph_count,
                             const uint16_t glyph_indices[],
                             const PP_Point glyph_advances[]) OVERRIDE;
  virtual PP_Var GetProxyForURL(PP_Instance instance, const char* url) OVERRIDE;
  virtual int32_t Navigate(PP_Instance instance,
                           PP_Resource request_info,
                           const char* target,
                           PP_Bool from_user_action) OVERRIDE;
  virtual void RunMessageLoop(PP_Instance instance) OVERRIDE;
  virtual void QuitMessageLoop(PP_Instance instance) OVERRIDE;
  virtual double GetLocalTimeZoneOffset(PP_Instance instance,
                                        PP_Time t) OVERRIDE;
  virtual PP_Bool IsRectTopmost(PP_Instance instance,
                                const PP_Rect* rect) OVERRIDE;
  virtual void UpdateActivity(PP_Instance instance) OVERRIDE;
  virtual PP_Var GetDeviceID(PP_Instance instance) OVERRIDE;
  virtual int32_t GetSettingInt(PP_Instance instance,
                                PP_FlashSetting setting) OVERRIDE;
  virtual PP_Var GetSetting(PP_Instance instance,
                            PP_FlashSetting setting) OVERRIDE;
  virtual PP_Bool IsClipboardFormatAvailable(
      PP_Instance instance,
      PP_Flash_Clipboard_Type clipboard_type,
      PP_Flash_Clipboard_Format format) OVERRIDE;
  virtual PP_Var ReadClipboardData(PP_Instance instance,
                                   PP_Flash_Clipboard_Type clipboard_type,
                                   PP_Flash_Clipboard_Format format) OVERRIDE;
  virtual int32_t WriteClipboardData(PP_Instance instance,
                                     PP_Flash_Clipboard_Type clipboard_type,
                                     uint32_t data_item_count,
                                     const PP_Flash_Clipboard_Format formats[],
                                     const PP_Var data_items[]) OVERRIDE;
  virtual bool CreateThreadAdapterForInstance(PP_Instance instance) OVERRIDE;
  virtual void ClearThreadAdapterForInstance(PP_Instance instance) OVERRIDE;
  virtual int32_t OpenFile(PP_Instance instance,
                           const char* path,
                           int32_t mode,
                           PP_FileHandle* file) OVERRIDE;
  virtual int32_t RenameFile(PP_Instance instance,
                             const char* path_from,
                             const char* path_to) OVERRIDE;
  virtual int32_t DeleteFileOrDir(PP_Instance instance,
                                  const char* path,
                                  PP_Bool recursive) OVERRIDE;
  virtual int32_t CreateDir(PP_Instance instance, const char* path) OVERRIDE;
  virtual int32_t QueryFile(PP_Instance instance,
                            const char* path,
                            PP_FileInfo* info) OVERRIDE;
  virtual int32_t GetDirContents(PP_Instance instance,
                                 const char* path,
                                 PP_DirContents_Dev** contents) OVERRIDE;
  virtual int32_t CreateTemporaryFile(PP_Instance instance,
                                      PP_FileHandle* file) OVERRIDE;
  virtual int32_t OpenFileRef(PP_Instance instance,
                              PP_Resource file_ref,
                              int32_t mode,
                              PP_FileHandle* file) OVERRIDE;
  virtual int32_t QueryFileRef(PP_Instance instance,
                               PP_Resource file_ref,
                               PP_FileInfo* info) OVERRIDE;
  virtual PP_Bool FlashIsFullscreen(PP_Instance instance) OVERRIDE;
  virtual PP_Bool FlashSetFullscreen(PP_Instance instance,
                                     PP_Bool fullscreen) OVERRIDE;
  virtual PP_Bool FlashGetScreenSize(PP_Instance instance,
                                     PP_Size* size) OVERRIDE;

  static const ApiID kApiID = API_ID_PPB_FLASH;

 private:
  // Message handlers.
  void OnHostMsgSetInstanceAlwaysOnTop(PP_Instance instance,
                                       PP_Bool on_top);
  void OnHostMsgDrawGlyphs(PP_Instance instance,
                           const PPBFlash_DrawGlyphs_Params& params,
                           PP_Bool* result);
  void OnHostMsgGetProxyForURL(PP_Instance instance,
                               const std::string& url,
                               SerializedVarReturnValue result);
  void OnHostMsgNavigate(PP_Instance instance,
                         const PPB_URLRequestInfo_Data& data,
                         const std::string& target,
                         PP_Bool from_user_action,
                         int32_t* result);
  void OnHostMsgRunMessageLoop(PP_Instance instance);
  void OnHostMsgQuitMessageLoop(PP_Instance instance);
  void OnHostMsgGetLocalTimeZoneOffset(PP_Instance instance, PP_Time t,
                                       double* result);
  void OnHostMsgIsRectTopmost(PP_Instance instance,
                              PP_Rect rect,
                              PP_Bool* result);
  void OnHostMsgFlashSetFullscreen(PP_Instance instance,
                                   PP_Bool fullscreen,
                                   PP_Bool* result);
  void OnHostMsgFlashGetScreenSize(PP_Instance instance,
                                   PP_Bool* result,
                                   PP_Size* size);
  void OnHostMsgIsClipboardFormatAvailable(PP_Instance instance,
                                           int clipboard_type,
                                           int format,
                                           bool* result);
  void OnHostMsgReadClipboardData(PP_Instance instance,
                                  int clipboard_type,
                                  int format,
                                  SerializedVarReturnValue result);
  void OnHostMsgWriteClipboardData(PP_Instance instance,
                                   int clipboard_type,
                                   const std::vector<int>& formats,
                                   SerializedVarVectorReceiveInput data_items);
  void OnHostMsgOpenFileRef(PP_Instance instance,
                            const ppapi::HostResource& host_resource,
                            int32_t mode,
                            IPC::PlatformFileForTransit* file_handle,
                            int32_t* result);
  void OnHostMsgQueryFileRef(PP_Instance instance,
                             const ppapi::HostResource& host_resource,
                             PP_FileInfo* info,
                             int32_t* result);
  void OnHostMsgGetDeviceID(PP_Instance instance,
                            SerializedVarReturnValue id);
  void OnHostMsgInvokePrinting(PP_Instance instance);

  DISALLOW_COPY_AND_ASSIGN(PPB_Flash_Proxy);
};

}  // namespace proxy
}  // namespace ppapi

#endif  // PPAPI_PROXY_PPB_FLASH_PROXY_H_