Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(982)

Side by Side Diff: ppapi/thunk/ppb_flash_thunk.cc

Issue 11415140: Refactor 3 PPB_Flash functions to the new resource model. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 30 matching lines...) Expand all
41 const PP_Point glyph_advances[]) { 41 const PP_Point glyph_advances[]) {
42 EnterInstance enter(instance); 42 EnterInstance 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()->GetFlashAPI()->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 EnterInstance enter(instance); 51 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
victorhsieh 2012/11/28 07:09:50 Where is EnterInstanceAPI defined?
raymes 2012/11/29 00:08:08 In enter.h. This is based on another change which
52 if (enter.failed()) 52 if (enter.failed())
53 return PP_MakeUndefined(); 53 return PP_MakeUndefined();
54 return enter.functions()->GetFlashAPI()->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 thunk::EnterResource<thunk::PPB_URLRequestInfo_API> enter(request_id, true); 64 thunk::EnterResource<thunk::PPB_URLRequestInfo_API> enter(request_id, true);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 return PP_FALSE; 112 return PP_FALSE;
113 return enter.functions()->GetFlashAPI()->IsRectTopmost(instance, rect); 113 return enter.functions()->GetFlashAPI()->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 EnterInstance enter(instance); 122 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
123 if (enter.failed()) 123 if (enter.failed())
124 return; 124 return;
125 enter.functions()->GetFlashAPI()->UpdateActivity(instance); 125 enter.functions()->UpdateActivity(instance);
126 } 126 }
127 127
128 PP_Var GetDeviceID(PP_Instance instance) { 128 PP_Var GetDeviceID(PP_Instance instance) {
129 // Deprecated. 129 // Deprecated.
130 NOTREACHED(); 130 NOTREACHED();
131 return PP_MakeUndefined(); 131 return PP_MakeUndefined();
132 } 132 }
133 133
134 int32_t GetSettingInt(PP_Instance instance, PP_FlashSetting setting) { 134 int32_t GetSettingInt(PP_Instance instance, PP_FlashSetting setting) {
135 // Deprecated. 135 // Deprecated.
136 NOTREACHED(); 136 NOTREACHED();
137 return -1; 137 return -1;
138 } 138 }
139 139
140 PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting) { 140 PP_Var GetSetting(PP_Instance instance, PP_FlashSetting setting) {
141 EnterInstance enter(instance); 141 EnterInstance enter(instance);
142 if (enter.failed()) 142 if (enter.failed())
143 return PP_MakeUndefined(); 143 return PP_MakeUndefined();
144 return enter.functions()->GetFlashAPI()->GetSetting(instance, setting); 144 return enter.functions()->GetFlashAPI()->GetSetting(instance, setting);
145 } 145 }
146 146
147 PP_Bool SetCrashData(PP_Instance instance, 147 PP_Bool SetCrashData(PP_Instance instance,
148 PP_FlashCrashKey key, 148 PP_FlashCrashKey key,
149 PP_Var value) { 149 PP_Var value) {
150 EnterInstance enter(instance); 150 EnterInstanceAPI<PPB_Flash_Functions_API> enter(instance);
151 if (enter.failed()) 151 if (enter.failed())
152 return PP_FALSE; 152 return PP_FALSE;
153 return enter.functions()->GetFlashAPI()->SetCrashData(instance, key, value); 153 return enter.functions()->SetCrashData(instance, key, value);
154 } 154 }
155 155
156 int32_t EnumerateVideoCaptureDevices(PP_Instance instance, 156 int32_t EnumerateVideoCaptureDevices(PP_Instance instance,
157 PP_Resource video_capture, 157 PP_Resource video_capture,
158 PP_ArrayOutput devices) { 158 PP_ArrayOutput devices) {
159 thunk::EnterResource<thunk::PPB_VideoCapture_API> enter(video_capture, true); 159 thunk::EnterResource<thunk::PPB_VideoCapture_API> enter(video_capture, true);
160 if (enter.failed()) 160 if (enter.failed())
161 return enter.retval(); 161 return enter.retval();
162 return enter.object()->EnumerateDevicesSync(devices); 162 return enter.object()->EnumerateDevicesSync(devices);
163 } 163 }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698