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 #include "base/logging.h" | 5 #include "base/logging.h" |
6 #include "ppapi/c/pp_array_output.h" | 6 #include "ppapi/c/pp_array_output.h" |
7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
8 #include "ppapi/c/private/ppb_flash.h" | 8 #include "ppapi/c/private/ppb_flash.h" |
9 #include "ppapi/shared_impl/ppapi_globals.h" | 9 #include "ppapi/shared_impl/ppapi_globals.h" |
10 #include "ppapi/shared_impl/proxy_lock.h" | 10 #include "ppapi/shared_impl/proxy_lock.h" |
11 #include "ppapi/shared_impl/var.h" | 11 #include "ppapi/shared_impl/var.h" |
12 #include "ppapi/thunk/enter.h" | 12 #include "ppapi/thunk/enter.h" |
13 #include "ppapi/thunk/ppb_flash_api.h" | 13 #include "ppapi/thunk/ppb_flash_api.h" |
14 #include "ppapi/thunk/ppb_flash_functions_api.h" | 14 #include "ppapi/thunk/ppb_flash_functions_api.h" |
15 #include "ppapi/thunk/ppb_instance_api.h" | 15 #include "ppapi/thunk/ppb_instance_api.h" |
16 #include "ppapi/thunk/ppb_video_capture_api.h" | 16 #include "ppapi/thunk/ppb_video_capture_api.h" |
17 #include "ppapi/thunk/thunk.h" | 17 #include "ppapi/thunk/thunk.h" |
18 | 18 |
19 namespace ppapi { | 19 namespace ppapi { |
20 namespace thunk { | 20 namespace thunk { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 void SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) { | 24 void SetInstanceAlwaysOnTop(PP_Instance instance, PP_Bool on_top) { |
25 EnterInstance enter(instance); | 25 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); |
26 if (enter.failed()) | 26 if (enter.failed()) |
27 return; | 27 return; |
28 enter.functions()->GetFlashAPI()->SetInstanceAlwaysOnTop(instance, on_top); | 28 enter.functions()->SetInstanceAlwaysOnTop(instance, on_top); |
29 } | 29 } |
30 | 30 |
31 PP_Bool DrawGlyphs(PP_Instance instance, | 31 PP_Bool DrawGlyphs(PP_Instance instance, |
32 PP_Resource pp_image_data, | 32 PP_Resource pp_image_data, |
33 const PP_BrowserFont_Trusted_Description* font_desc, | 33 const PP_BrowserFont_Trusted_Description* font_desc, |
34 uint32_t color, | 34 uint32_t color, |
35 const PP_Point* position, | 35 const PP_Point* position, |
36 const PP_Rect* clip, | 36 const PP_Rect* clip, |
37 const float transformation[3][3], | 37 const float transformation[3][3], |
38 PP_Bool allow_subpixel_aa, | 38 PP_Bool allow_subpixel_aa, |
39 uint32_t glyph_count, | 39 uint32_t glyph_count, |
40 const uint16_t glyph_indices[], | 40 const uint16_t glyph_indices[], |
41 const PP_Point glyph_advances[]) { | 41 const PP_Point glyph_advances[]) { |
42 EnterInstance enter(instance); | 42 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); |
43 if (enter.failed()) | 43 if (enter.failed()) |
44 return PP_FALSE; | 44 return PP_FALSE; |
45 return enter.functions()->GetFlashAPI()->DrawGlyphs( | 45 return enter.functions()->DrawGlyphs( |
46 instance, pp_image_data, font_desc, color, position, clip, transformation, | 46 instance, pp_image_data, font_desc, color, position, clip, transformation, |
47 allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances); | 47 allow_subpixel_aa, glyph_count, glyph_indices, glyph_advances); |
48 } | 48 } |
49 | 49 |
50 PP_Var GetProxyForURL(PP_Instance instance, const char* url) { | 50 PP_Var GetProxyForURL(PP_Instance instance, const char* url) { |
51 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); | 51 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); |
52 if (enter.failed()) | 52 if (enter.failed()) |
53 return PP_MakeUndefined(); | 53 return PP_MakeUndefined(); |
54 return enter.functions()->GetProxyForURL(instance, url); | 54 return enter.functions()->GetProxyForURL(instance, url); |
55 } | 55 } |
56 | 56 |
57 int32_t Navigate(PP_Resource request_id, | 57 int32_t Navigate(PP_Resource request_id, |
58 const char* target, | 58 const char* target, |
59 PP_Bool from_user_action) { | 59 PP_Bool from_user_action) { |
60 // TODO(brettw): this function should take an instance. | 60 // TODO(brettw): this function should take an instance. |
61 // To work around this, use the PP_Instance from the resource. | 61 // To work around this, use the PP_Instance from the resource. |
62 PP_Instance instance; | 62 PP_Instance instance; |
63 { | 63 { |
64 EnterResource<PPB_URLRequestInfo_API> enter(request_id, true); | 64 EnterResource<PPB_URLRequestInfo_API> enter(request_id, true); |
65 if (enter.failed()) | 65 if (enter.failed()) |
66 return PP_ERROR_BADRESOURCE; | 66 return PP_ERROR_BADRESOURCE; |
67 instance = enter.resource()->pp_instance(); | 67 instance = enter.resource()->pp_instance(); |
68 } | 68 } |
69 | 69 |
70 EnterInstance enter(instance); | 70 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); |
71 if (enter.failed()) | 71 if (enter.failed()) |
72 return PP_ERROR_BADARGUMENT; | 72 return PP_ERROR_BADARGUMENT; |
73 return enter.functions()->GetFlashAPI()->Navigate(instance, request_id, | 73 return enter.functions()->Navigate(instance, request_id, target, |
74 target, from_user_action); | 74 from_user_action); |
75 } | 75 } |
76 | 76 |
77 void RunMessageLoop(PP_Instance instance) { | 77 void RunMessageLoop(PP_Instance instance) { |
78 // Deprecated. | 78 // Deprecated. |
79 NOTREACHED(); | 79 NOTREACHED(); |
80 return; | 80 return; |
81 } | 81 } |
82 | 82 |
83 void QuitMessageLoop(PP_Instance instance) { | 83 void QuitMessageLoop(PP_Instance instance) { |
84 // Deprecated. | 84 // Deprecated. |
(...skipping 15 matching lines...) Expand all Loading... |
100 } | 100 } |
101 | 101 |
102 void PreLoadFontWin(const void* logfontw) { | 102 void PreLoadFontWin(const void* logfontw) { |
103 // There's no instance so we have to reach into the delegate without | 103 // There's no instance so we have to reach into the delegate without |
104 // thunking. | 104 // thunking. |
105 ProxyAutoLock lock; | 105 ProxyAutoLock lock; |
106 PpapiGlobals::Get()->PreCacheFontForFlash(logfontw); | 106 PpapiGlobals::Get()->PreCacheFontForFlash(logfontw); |
107 } | 107 } |
108 | 108 |
109 PP_Bool IsRectTopmost(PP_Instance instance, const PP_Rect* rect) { | 109 PP_Bool IsRectTopmost(PP_Instance instance, const PP_Rect* rect) { |
110 EnterInstance enter(instance); | 110 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); |
111 if (enter.failed()) | 111 if (enter.failed()) |
112 return PP_FALSE; | 112 return PP_FALSE; |
113 return enter.functions()->GetFlashAPI()->IsRectTopmost(instance, rect); | 113 return enter.functions()->IsRectTopmost(instance, rect); |
114 } | 114 } |
115 | 115 |
116 int32_t InvokePrinting(PP_Instance instance) { | 116 int32_t InvokePrinting(PP_Instance instance) { |
117 // This function is no longer supported, use PPB_Flash_Print instead. | 117 // This function is no longer supported, use PPB_Flash_Print instead. |
118 return PP_ERROR_NOTSUPPORTED; | 118 return PP_ERROR_NOTSUPPORTED; |
119 } | 119 } |
120 | 120 |
121 void UpdateActivity(PP_Instance instance) { | 121 void UpdateActivity(PP_Instance instance) { |
122 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); | 122 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance); |
123 if (enter.failed()) | 123 if (enter.failed()) |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 const PPB_Flash_12_6* GetPPB_Flash_12_6_Thunk() { | 247 const PPB_Flash_12_6* GetPPB_Flash_12_6_Thunk() { |
248 return &g_ppb_flash_12_6_thunk; | 248 return &g_ppb_flash_12_6_thunk; |
249 } | 249 } |
250 | 250 |
251 const PPB_Flash_13_0* GetPPB_Flash_13_0_Thunk() { | 251 const PPB_Flash_13_0* GetPPB_Flash_13_0_Thunk() { |
252 return &g_ppb_flash_13_0_thunk; | 252 return &g_ppb_flash_13_0_thunk; |
253 } | 253 } |
254 | 254 |
255 } // namespace thunk | 255 } // namespace thunk |
256 } // namespace ppapi | 256 } // namespace ppapi |
OLD | NEW |