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

Side by Side Diff: ppapi/proxy/ppb_instance_proxy.cc

Issue 11359097: Refactored the PPB_Flash_File_ModuleLocal/FileRef to the new ppapi resource model (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month 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 "ppapi/proxy/ppb_instance_proxy.h" 5 #include "ppapi/proxy/ppb_instance_proxy.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/pp_time.h" 9 #include "ppapi/c/pp_time.h"
10 #include "ppapi/c/pp_var.h" 10 #include "ppapi/c/pp_var.h"
11 #include "ppapi/c/ppb_audio_config.h" 11 #include "ppapi/c/ppb_audio_config.h"
12 #include "ppapi/c/ppb_instance.h" 12 #include "ppapi/c/ppb_instance.h"
13 #include "ppapi/c/ppb_messaging.h" 13 #include "ppapi/c/ppb_messaging.h"
14 #include "ppapi/c/ppb_mouse_lock.h" 14 #include "ppapi/c/ppb_mouse_lock.h"
15 #include "ppapi/c/private/pp_content_decryptor.h" 15 #include "ppapi/c/private/pp_content_decryptor.h"
16 #include "ppapi/proxy/content_decryptor_private_serializer.h" 16 #include "ppapi/proxy/content_decryptor_private_serializer.h"
17 #include "ppapi/proxy/enter_proxy.h" 17 #include "ppapi/proxy/enter_proxy.h"
18 #include "ppapi/proxy/flash_clipboard_resource.h" 18 #include "ppapi/proxy/flash_clipboard_resource.h"
19 #include "ppapi/proxy/flash_file_resource.h"
19 #include "ppapi/proxy/flash_resource.h" 20 #include "ppapi/proxy/flash_resource.h"
20 #include "ppapi/proxy/gamepad_resource.h" 21 #include "ppapi/proxy/gamepad_resource.h"
21 #include "ppapi/proxy/host_dispatcher.h" 22 #include "ppapi/proxy/host_dispatcher.h"
22 #include "ppapi/proxy/plugin_dispatcher.h" 23 #include "ppapi/proxy/plugin_dispatcher.h"
23 #include "ppapi/proxy/plugin_proxy_delegate.h" 24 #include "ppapi/proxy/plugin_proxy_delegate.h"
24 #include "ppapi/proxy/ppapi_messages.h" 25 #include "ppapi/proxy/ppapi_messages.h"
25 #include "ppapi/proxy/ppb_flash_proxy.h" 26 #include "ppapi/proxy/ppb_flash_proxy.h"
26 #include "ppapi/proxy/serialized_var.h" 27 #include "ppapi/proxy/serialized_var.h"
27 #include "ppapi/shared_impl/ppapi_globals.h" 28 #include "ppapi/shared_impl/ppapi_globals.h"
28 #include "ppapi/shared_impl/ppb_url_util_shared.h" 29 #include "ppapi/shared_impl/ppb_url_util_shared.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 return result; 327 return result;
327 } 328 }
328 329
329 thunk::PPB_Flash_API* PPB_Instance_Proxy::GetFlashAPI() { 330 thunk::PPB_Flash_API* PPB_Instance_Proxy::GetFlashAPI() {
330 InterfaceProxy* ip = dispatcher()->GetInterfaceProxy(API_ID_PPB_FLASH); 331 InterfaceProxy* ip = dispatcher()->GetInterfaceProxy(API_ID_PPB_FLASH);
331 return static_cast<PPB_Flash_Proxy*>(ip); 332 return static_cast<PPB_Flash_Proxy*>(ip);
332 } 333 }
333 334
334 // TODO(raymes): We can most likely cut down this boilerplate for grabbing 335 // TODO(raymes): We can most likely cut down this boilerplate for grabbing
335 // singleton resource APIs. 336 // singleton resource APIs.
336 thunk::PPB_Flash_Functions_API* PPB_Instance_Proxy::GetFlashFunctionsAPI( 337 thunk::PPB_Flash_Clipboard_API* PPB_Instance_Proxy::GetFlashClipboardAPI(
337 PP_Instance instance) { 338 PP_Instance instance) {
338 #if !defined(OS_NACL) && !defined(NACL_WIN64) 339 #if !defined(OS_NACL) && !defined(NACL_WIN64)
339 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> 340 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
340 GetInstanceData(instance); 341 GetInstanceData(instance);
341 if (!data) 342 if (!data)
342 return NULL; 343 return NULL;
343 344
344 if (!data->flash_resource.get()) { 345 if (!data->flash_clipboard_resource.get()) {
345 Connection connection( 346 Connection connection(
346 PluginGlobals::Get()->plugin_proxy_delegate()->GetBrowserSender(), 347 PluginGlobals::Get()->plugin_proxy_delegate()->GetBrowserSender(),
347 dispatcher()); 348 dispatcher());
348 data->flash_resource = new FlashResource(connection, instance); 349 data->flash_clipboard_resource =
350 new FlashClipboardResource(connection, instance);
349 } 351 }
350 return data->flash_resource.get(); 352 return data->flash_clipboard_resource.get();
351 #else 353 #else
352 // Flash functions aren't implemented for nacl. 354 // Flash functions aren't implemented for nacl.
353 NOTIMPLEMENTED(); 355 NOTIMPLEMENTED();
354 return NULL; 356 return NULL;
355 #endif // !defined(OS_NACL) && !defined(NACL_WIN64) 357 #endif // !defined(OS_NACL) && !defined(NACL_WIN64)
356 } 358 }
357 359
358 thunk::PPB_Flash_Clipboard_API* PPB_Instance_Proxy::GetFlashClipboardAPI( 360 thunk::PPB_Flash_File_API* PPB_Instance_Proxy::GetFlashFileAPI(
359 PP_Instance instance) { 361 PP_Instance instance) {
360 #if !defined(OS_NACL) && !defined(NACL_WIN64) 362 #if !defined(OS_NACL) && !defined(NACL_WIN64)
361 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> 363 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
362 GetInstanceData(instance); 364 GetInstanceData(instance);
363 if (!data) 365 if (!data)
364 return NULL; 366 return NULL;
365 367
366 if (!data->flash_clipboard_resource.get()) { 368 if (!data->flash_file_resource.get()) {
367 Connection connection( 369 Connection connection(
368 PluginGlobals::Get()->plugin_proxy_delegate()->GetBrowserSender(), 370 PluginGlobals::Get()->plugin_proxy_delegate()->GetBrowserSender(),
369 dispatcher()); 371 dispatcher());
370 data->flash_clipboard_resource = 372 data->flash_file_resource =
371 new FlashClipboardResource(connection, instance); 373 new FlashFileResource(connection, instance);
372 } 374 }
373 return data->flash_clipboard_resource.get(); 375 return data->flash_file_resource.get();
374 #else 376 #else
375 // Flash functions aren't implemented for nacl. 377 // Flash functions aren't implemented for nacl.
376 NOTIMPLEMENTED(); 378 NOTIMPLEMENTED();
379 return NULL;
380 #endif // !defined(OS_NACL) && !defined(NACL_WIN64)
381 }
382
383 thunk::PPB_Flash_Functions_API* PPB_Instance_Proxy::GetFlashFunctionsAPI(
384 PP_Instance instance) {
385 #if !defined(OS_NACL) && !defined(NACL_WIN64)
386 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
387 GetInstanceData(instance);
388 if (!data)
389 return NULL;
390
391 if (!data->flash_resource.get()) {
392 Connection connection(
393 PluginGlobals::Get()->plugin_proxy_delegate()->GetBrowserSender(),
394 dispatcher());
395 data->flash_resource = new FlashResource(connection, instance);
396 }
397 return data->flash_resource.get();
398 #else
399 // Flash functions aren't implemented for nacl.
400 NOTIMPLEMENTED();
377 return NULL; 401 return NULL;
378 #endif // !defined(OS_NACL) && !defined(NACL_WIN64) 402 #endif // !defined(OS_NACL) && !defined(NACL_WIN64)
379 } 403 }
380 404
381 thunk::PPB_Gamepad_API* PPB_Instance_Proxy::GetGamepadAPI( 405 thunk::PPB_Gamepad_API* PPB_Instance_Proxy::GetGamepadAPI(
382 PP_Instance instance) { 406 PP_Instance instance) {
383 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> 407 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
384 GetInstanceData(instance); 408 GetInstanceData(instance);
385 if (!data) 409 if (!data)
386 return NULL; 410 return NULL;
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
1192 PP_Instance instance) { 1216 PP_Instance instance) {
1193 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> 1217 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
1194 GetInstanceData(instance); 1218 GetInstanceData(instance);
1195 if (!data) 1219 if (!data)
1196 return; // Instance was probably deleted. 1220 return; // Instance was probably deleted.
1197 data->should_do_request_surrounding_text = false; 1221 data->should_do_request_surrounding_text = false;
1198 } 1222 }
1199 1223
1200 } // namespace proxy 1224 } // namespace proxy
1201 } // namespace ppapi 1225 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698