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

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

Issue 11413200: Refactored PPB_Flash GetSettings to the new pepper 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
« no previous file with comments | « ppapi/thunk/ppb_flash_functions_api.h ('k') | webkit/plugins/ppapi/mock_plugin_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 thunk::EnterResource<thunk::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 EnterInstance 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()->GetFlashAPI()->Navigate(instance, request_id,
74 target, from_user_action); 74 target, from_user_action);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 EnterInstanceAPI<PPB_Flash_Functions_API> 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()->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 EnterInstanceAPI<PPB_Flash_Functions_API> 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()->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 EnterResource<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 }
164 164
165 const PPB_Flash_12_4 g_ppb_flash_12_4_thunk = { 165 const PPB_Flash_12_4 g_ppb_flash_12_4_thunk = {
166 &SetInstanceAlwaysOnTop, 166 &SetInstanceAlwaysOnTop,
167 &DrawGlyphs, 167 &DrawGlyphs,
168 &GetProxyForURL, 168 &GetProxyForURL,
169 &Navigate, 169 &Navigate,
(...skipping 77 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
« no previous file with comments | « ppapi/thunk/ppb_flash_functions_api.h ('k') | webkit/plugins/ppapi/mock_plugin_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698