OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PPAPI_PROXY_PPB_FLASH_PROXY_H_ | 5 #ifndef PPAPI_PROXY_PPB_FLASH_PROXY_H_ |
6 #define PPAPI_PROXY_PPB_FLASH_PROXY_H_ | 6 #define PPAPI_PROXY_PPB_FLASH_PROXY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
| 11 #include "base/compiler_specific.h" |
11 #include "ipc/ipc_platform_file.h" | 12 #include "ipc/ipc_platform_file.h" |
12 #include "ppapi/c/pp_bool.h" | 13 #include "ppapi/c/pp_bool.h" |
13 #include "ppapi/c/pp_instance.h" | 14 #include "ppapi/c/pp_instance.h" |
14 #include "ppapi/c/pp_module.h" | 15 #include "ppapi/c/pp_module.h" |
15 #include "ppapi/c/pp_time.h" | 16 #include "ppapi/c/pp_time.h" |
16 #include "ppapi/c/private/ppb_flash.h" | 17 #include "ppapi/c/private/ppb_flash.h" |
17 #include "ppapi/proxy/interface_proxy.h" | 18 #include "ppapi/proxy/interface_proxy.h" |
18 #include "ppapi/shared_impl/host_resource.h" | 19 #include "ppapi/shared_impl/host_resource.h" |
| 20 #include "ppapi/thunk/ppb_flash_api.h" |
19 | 21 |
20 namespace ppapi { | 22 namespace ppapi { |
21 | 23 |
22 struct PPB_URLRequestInfo_Data; | 24 struct PPB_URLRequestInfo_Data; |
23 | 25 |
24 namespace proxy { | 26 namespace proxy { |
25 | 27 |
26 struct PPBFlash_DrawGlyphs_Params; | 28 struct PPBFlash_DrawGlyphs_Params; |
27 class SerializedVarReturnValue; | 29 class SerializedVarReturnValue; |
28 | 30 |
29 class PPB_Flash_Proxy : public InterfaceProxy { | 31 class PPB_Flash_Proxy : public InterfaceProxy, |
| 32 public thunk::PPB_Flash_API { |
30 public: | 33 public: |
31 explicit PPB_Flash_Proxy(Dispatcher* dispatcher); | 34 explicit PPB_Flash_Proxy(Dispatcher* dispatcher); |
32 virtual ~PPB_Flash_Proxy(); | 35 virtual ~PPB_Flash_Proxy(); |
33 | 36 |
34 // Returns the corresponding version of the Flash interface pointer. | |
35 static const PPB_Flash_11* GetInterface11(); | |
36 static const PPB_Flash_12_0* GetInterface12_0(); | |
37 static const PPB_Flash_12_1* GetInterface12_1(); | |
38 static const PPB_Flash_12_2* GetInterface12_2(); | |
39 | |
40 // InterfaceProxy implementation. | 37 // InterfaceProxy implementation. |
41 virtual bool OnMessageReceived(const IPC::Message& msg); | 38 virtual bool OnMessageReceived(const IPC::Message& msg); |
42 | 39 |
| 40 // PPB_Flash_API implementation. |
| 41 virtual void SetInstanceAlwaysOnTop(PP_Instance instance, |
| 42 PP_Bool on_top) OVERRIDE; |
| 43 virtual PP_Bool DrawGlyphs(PP_Instance instance, |
| 44 PP_Resource pp_image_data, |
| 45 const PP_FontDescription_Dev* font_desc, |
| 46 uint32_t color, |
| 47 const PP_Point* position, |
| 48 const PP_Rect* clip, |
| 49 const float transformation[3][3], |
| 50 PP_Bool allow_subpixel_aa, |
| 51 uint32_t glyph_count, |
| 52 const uint16_t glyph_indices[], |
| 53 const PP_Point glyph_advances[]) OVERRIDE; |
| 54 virtual PP_Var GetProxyForURL(PP_Instance instance, const char* url) OVERRIDE; |
| 55 virtual int32_t Navigate(PP_Instance instance, |
| 56 PP_Resource request_info, |
| 57 const char* target, |
| 58 PP_Bool from_user_action) OVERRIDE; |
| 59 virtual void RunMessageLoop(PP_Instance instance) OVERRIDE; |
| 60 virtual void QuitMessageLoop(PP_Instance instance) OVERRIDE; |
| 61 virtual double GetLocalTimeZoneOffset(PP_Instance instance, |
| 62 PP_Time t) OVERRIDE; |
| 63 virtual PP_Bool IsRectTopmost(PP_Instance instance, |
| 64 const PP_Rect* rect) OVERRIDE; |
| 65 virtual int32_t InvokePrinting(PP_Instance instance) OVERRIDE; |
| 66 virtual void UpdateActivity(PP_Instance instance) OVERRIDE; |
| 67 virtual PP_Var GetDeviceID(PP_Instance instance) OVERRIDE; |
| 68 virtual PP_Bool FlashIsFullscreen(PP_Instance instance) OVERRIDE; |
| 69 virtual PP_Bool FlashSetFullscreen(PP_Instance instance, |
| 70 PP_Bool fullscreen) OVERRIDE; |
| 71 virtual PP_Bool FlashGetScreenSize(PP_Instance instance, |
| 72 PP_Size* size) OVERRIDE; |
| 73 |
| 74 static const ApiID kApiID = API_ID_PPB_FLASH; |
| 75 |
43 private: | 76 private: |
44 // Message handlers. | 77 // Message handlers. |
45 void OnMsgSetInstanceAlwaysOnTop(PP_Instance instance, | 78 void OnHostMsgSetInstanceAlwaysOnTop(PP_Instance instance, |
46 PP_Bool on_top); | 79 PP_Bool on_top); |
47 void OnMsgDrawGlyphs(const PPBFlash_DrawGlyphs_Params& params, | 80 void OnHostMsgDrawGlyphs(const PPBFlash_DrawGlyphs_Params& params, |
48 PP_Bool* result); | 81 PP_Bool* result); |
49 void OnMsgGetProxyForURL(PP_Instance instance, | 82 void OnHostMsgGetProxyForURL(PP_Instance instance, |
50 const std::string& url, | 83 const std::string& url, |
51 SerializedVarReturnValue result); | 84 SerializedVarReturnValue result); |
52 void OnMsgNavigate(PP_Instance instance, | 85 void OnHostMsgNavigate(PP_Instance instance, |
53 const PPB_URLRequestInfo_Data& data, | 86 const PPB_URLRequestInfo_Data& data, |
54 const std::string& target, | 87 const std::string& target, |
55 PP_Bool from_user_action, | 88 PP_Bool from_user_action, |
56 int32_t* result); | 89 int32_t* result); |
57 void OnMsgRunMessageLoop(PP_Instance instance); | 90 void OnHostMsgRunMessageLoop(PP_Instance instance); |
58 void OnMsgQuitMessageLoop(PP_Instance instance); | 91 void OnHostMsgQuitMessageLoop(PP_Instance instance); |
59 void OnMsgGetLocalTimeZoneOffset(PP_Instance instance, PP_Time t, | 92 void OnHostMsgGetLocalTimeZoneOffset(PP_Instance instance, PP_Time t, |
60 double* result); | 93 double* result); |
61 void OnMsgIsRectTopmost(PP_Instance instance, | 94 void OnHostMsgIsRectTopmost(PP_Instance instance, |
62 PP_Rect rect, | 95 PP_Rect rect, |
63 PP_Bool* result); | 96 PP_Bool* result); |
| 97 void OnHostMsgFlashSetFullscreen(PP_Instance instance, |
| 98 PP_Bool fullscreen, |
| 99 PP_Bool* result); |
| 100 void OnHostMsgFlashGetScreenSize(PP_Instance instance, |
| 101 PP_Bool* result, |
| 102 PP_Size* size); |
64 | 103 |
65 // When this proxy is in the host side, this value caches the interface | 104 // When this proxy is in the host side, this value caches the interface |
66 // pointer so we don't have to retrieve it from the dispatcher each time. | 105 // pointer so we don't have to retrieve it from the dispatcher each time. |
67 // In the plugin, this value is always NULL. | 106 // In the plugin, this value is always NULL. |
68 const PPB_Flash* ppb_flash_impl_; | 107 const PPB_Flash* ppb_flash_impl_; |
69 | 108 |
70 DISALLOW_COPY_AND_ASSIGN(PPB_Flash_Proxy); | 109 DISALLOW_COPY_AND_ASSIGN(PPB_Flash_Proxy); |
71 }; | 110 }; |
72 | 111 |
73 } // namespace proxy | 112 } // namespace proxy |
74 } // namespace ppapi | 113 } // namespace ppapi |
75 | 114 |
76 #endif // PPAPI_PROXY_PPB_FLASH_PROXY_H_ | 115 #endif // PPAPI_PROXY_PPB_FLASH_PROXY_H_ |
OLD | NEW |