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

Side by Side Diff: webkit/plugins/ppapi/plugin_module.cc

Issue 7248047: Migrating PPB_FileIO_Dev, PPB_FileRef_Dev, and PPB_FileSystem_Dev dependencies to PPB_FileIO, PPB... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months 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 | « webkit/plugins/ppapi/file_type_conversions.cc ('k') | webkit/plugins/ppapi/ppb_file_io_impl.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/plugins/ppapi/plugin_module.h" 5 #include "webkit/plugins/ppapi/plugin_module.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/message_loop_proxy.h" 11 #include "base/message_loop_proxy.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "ppapi/c/dev/ppb_buffer_dev.h" 15 #include "ppapi/c/dev/ppb_buffer_dev.h"
16 #include "ppapi/c/dev/ppb_char_set_dev.h" 16 #include "ppapi/c/dev/ppb_char_set_dev.h"
17 #include "ppapi/c/dev/ppb_context_3d_dev.h" 17 #include "ppapi/c/dev/ppb_context_3d_dev.h"
18 #include "ppapi/c/dev/ppb_context_3d_trusted_dev.h" 18 #include "ppapi/c/dev/ppb_context_3d_trusted_dev.h"
19 #include "ppapi/c/dev/ppb_console_dev.h" 19 #include "ppapi/c/dev/ppb_console_dev.h"
20 #include "ppapi/c/dev/ppb_crypto_dev.h" 20 #include "ppapi/c/dev/ppb_crypto_dev.h"
21 #include "ppapi/c/dev/ppb_cursor_control_dev.h" 21 #include "ppapi/c/dev/ppb_cursor_control_dev.h"
22 #include "ppapi/c/dev/ppb_directory_reader_dev.h" 22 #include "ppapi/c/dev/ppb_directory_reader_dev.h"
23 #include "ppapi/c/dev/ppb_file_chooser_dev.h" 23 #include "ppapi/c/dev/ppb_file_chooser_dev.h"
24 #include "ppapi/c/dev/ppb_file_io_dev.h"
25 #include "ppapi/c/dev/ppb_file_io_trusted_dev.h"
26 #include "ppapi/c/dev/ppb_file_ref_dev.h"
27 #include "ppapi/c/dev/ppb_file_system_dev.h"
28 #include "ppapi/c/dev/ppb_find_dev.h" 24 #include "ppapi/c/dev/ppb_find_dev.h"
29 #include "ppapi/c/dev/ppb_font_dev.h" 25 #include "ppapi/c/dev/ppb_font_dev.h"
30 #include "ppapi/c/dev/ppb_fullscreen_dev.h" 26 #include "ppapi/c/dev/ppb_fullscreen_dev.h"
31 #include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h" 27 #include "ppapi/c/dev/ppb_gles_chromium_texture_mapping_dev.h"
32 #include "ppapi/c/dev/ppb_graphics_3d_dev.h" 28 #include "ppapi/c/dev/ppb_graphics_3d_dev.h"
33 #include "ppapi/c/dev/ppb_layer_compositor_dev.h" 29 #include "ppapi/c/dev/ppb_layer_compositor_dev.h"
34 #include "ppapi/c/dev/ppb_memory_dev.h" 30 #include "ppapi/c/dev/ppb_memory_dev.h"
35 #include "ppapi/c/dev/ppb_opengles_dev.h" 31 #include "ppapi/c/dev/ppb_opengles_dev.h"
36 #include "ppapi/c/dev/ppb_scrollbar_dev.h" 32 #include "ppapi/c/dev/ppb_scrollbar_dev.h"
37 #include "ppapi/c/dev/ppb_surface_3d_dev.h" 33 #include "ppapi/c/dev/ppb_surface_3d_dev.h"
38 #include "ppapi/c/dev/ppb_testing_dev.h" 34 #include "ppapi/c/dev/ppb_testing_dev.h"
39 #include "ppapi/c/dev/ppb_transport_dev.h" 35 #include "ppapi/c/dev/ppb_transport_dev.h"
40 #include "ppapi/c/dev/ppb_url_util_dev.h" 36 #include "ppapi/c/dev/ppb_url_util_dev.h"
41 #include "ppapi/c/dev/ppb_var_deprecated.h" 37 #include "ppapi/c/dev/ppb_var_deprecated.h"
42 #include "ppapi/c/dev/ppb_video_decoder_dev.h" 38 #include "ppapi/c/dev/ppb_video_decoder_dev.h"
43 #include "ppapi/c/dev/ppb_video_layer_dev.h" 39 #include "ppapi/c/dev/ppb_video_layer_dev.h"
44 #include "ppapi/c/dev/ppb_widget_dev.h" 40 #include "ppapi/c/dev/ppb_widget_dev.h"
45 #include "ppapi/c/dev/ppb_zoom_dev.h" 41 #include "ppapi/c/dev/ppb_zoom_dev.h"
46 #include "ppapi/c/pp_module.h" 42 #include "ppapi/c/pp_module.h"
47 #include "ppapi/c/pp_resource.h" 43 #include "ppapi/c/pp_resource.h"
48 #include "ppapi/c/pp_var.h" 44 #include "ppapi/c/pp_var.h"
49 #include "ppapi/c/ppb_audio.h" 45 #include "ppapi/c/ppb_audio.h"
50 #include "ppapi/c/ppb_audio_config.h" 46 #include "ppapi/c/ppb_audio_config.h"
51 #include "ppapi/c/ppb_core.h" 47 #include "ppapi/c/ppb_core.h"
48 #include "ppapi/c/ppb_file_io.h"
49 #include "ppapi/c/ppb_file_ref.h"
50 #include "ppapi/c/ppb_file_system.h"
52 #include "ppapi/c/ppb_graphics_2d.h" 51 #include "ppapi/c/ppb_graphics_2d.h"
53 #include "ppapi/c/ppb_image_data.h" 52 #include "ppapi/c/ppb_image_data.h"
54 #include "ppapi/c/ppb_instance.h" 53 #include "ppapi/c/ppb_instance.h"
55 #include "ppapi/c/ppb_messaging.h" 54 #include "ppapi/c/ppb_messaging.h"
56 #include "ppapi/c/ppb_url_loader.h" 55 #include "ppapi/c/ppb_url_loader.h"
57 #include "ppapi/c/ppb_url_request_info.h" 56 #include "ppapi/c/ppb_url_request_info.h"
58 #include "ppapi/c/ppb_url_response_info.h" 57 #include "ppapi/c/ppb_url_response_info.h"
59 #include "ppapi/c/ppb_var.h" 58 #include "ppapi/c/ppb_var.h"
60 #include "ppapi/c/ppp.h" 59 #include "ppapi/c/ppp.h"
61 #include "ppapi/c/ppp_instance.h" 60 #include "ppapi/c/ppp_instance.h"
62 #include "ppapi/c/private/ppb_flash.h" 61 #include "ppapi/c/private/ppb_flash.h"
63 #include "ppapi/c/private/ppb_flash_clipboard.h" 62 #include "ppapi/c/private/ppb_flash_clipboard.h"
64 #include "ppapi/c/private/ppb_flash_file.h" 63 #include "ppapi/c/private/ppb_flash_file.h"
65 #include "ppapi/c/private/ppb_flash_tcp_socket.h" 64 #include "ppapi/c/private/ppb_flash_tcp_socket.h"
66 #include "ppapi/c/private/ppb_instance_private.h" 65 #include "ppapi/c/private/ppb_instance_private.h"
67 #include "ppapi/c/private/ppb_pdf.h" 66 #include "ppapi/c/private/ppb_pdf.h"
68 #include "ppapi/c/private/ppb_proxy_private.h" 67 #include "ppapi/c/private/ppb_proxy_private.h"
69 #include "ppapi/c/private/ppb_uma_private.h" 68 #include "ppapi/c/private/ppb_uma_private.h"
70 #include "ppapi/c/trusted/ppb_audio_trusted.h" 69 #include "ppapi/c/trusted/ppb_audio_trusted.h"
71 #include "ppapi/c/trusted/ppb_broker_trusted.h" 70 #include "ppapi/c/trusted/ppb_broker_trusted.h"
72 #include "ppapi/c/trusted/ppb_buffer_trusted.h" 71 #include "ppapi/c/trusted/ppb_buffer_trusted.h"
72 #include "ppapi/c/trusted/ppb_file_io_trusted.h"
73 #include "ppapi/c/trusted/ppb_image_data_trusted.h" 73 #include "ppapi/c/trusted/ppb_image_data_trusted.h"
74 #include "ppapi/c/trusted/ppb_url_loader_trusted.h" 74 #include "ppapi/c/trusted/ppb_url_loader_trusted.h"
75 #include "ppapi/thunk/enter.h" 75 #include "ppapi/thunk/enter.h"
76 #include "ppapi/thunk/thunk.h" 76 #include "ppapi/thunk/thunk.h"
77 #include "webkit/plugins/ppapi/callbacks.h" 77 #include "webkit/plugins/ppapi/callbacks.h"
78 #include "webkit/plugins/ppapi/common.h" 78 #include "webkit/plugins/ppapi/common.h"
79 #include "webkit/plugins/ppapi/ppapi_interface_factory.h" 79 #include "webkit/plugins/ppapi/ppapi_interface_factory.h"
80 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 80 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
81 #include "webkit/plugins/ppapi/ppb_console_impl.h" 81 #include "webkit/plugins/ppapi/ppb_console_impl.h"
82 #include "webkit/plugins/ppapi/ppb_crypto_impl.h" 82 #include "webkit/plugins/ppapi/ppb_crypto_impl.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 if (strcmp(name, PPB_CORE_INTERFACE) == 0) 249 if (strcmp(name, PPB_CORE_INTERFACE) == 0)
250 return &core_interface; 250 return &core_interface;
251 if (strcmp(name, PPB_CRYPTO_DEV_INTERFACE) == 0) 251 if (strcmp(name, PPB_CRYPTO_DEV_INTERFACE) == 0)
252 return PPB_Crypto_Impl::GetInterface(); 252 return PPB_Crypto_Impl::GetInterface();
253 if (strcmp(name, PPB_CURSOR_CONTROL_DEV_INTERFACE) == 0) 253 if (strcmp(name, PPB_CURSOR_CONTROL_DEV_INTERFACE) == 0)
254 return ::ppapi::thunk::GetPPB_CursorControl_Thunk(); 254 return ::ppapi::thunk::GetPPB_CursorControl_Thunk();
255 if (strcmp(name, PPB_DIRECTORYREADER_DEV_INTERFACE) == 0) 255 if (strcmp(name, PPB_DIRECTORYREADER_DEV_INTERFACE) == 0)
256 return ::ppapi::thunk::GetPPB_DirectoryReader_Thunk(); 256 return ::ppapi::thunk::GetPPB_DirectoryReader_Thunk();
257 if (strcmp(name, PPB_FILECHOOSER_DEV_INTERFACE) == 0) 257 if (strcmp(name, PPB_FILECHOOSER_DEV_INTERFACE) == 0)
258 return ::ppapi::thunk::GetPPB_FileChooser_Thunk(); 258 return ::ppapi::thunk::GetPPB_FileChooser_Thunk();
259 if (strcmp(name, PPB_FILEIO_DEV_INTERFACE) == 0) 259 if (strcmp(name, PPB_FILEIO_INTERFACE) == 0)
260 return ::ppapi::thunk::GetPPB_FileIO_Thunk(); 260 return ::ppapi::thunk::GetPPB_FileIO_Thunk();
261 if (strcmp(name, PPB_FILEIOTRUSTED_DEV_INTERFACE) == 0) 261 if (strcmp(name, PPB_FILEIOTRUSTED_INTERFACE) == 0)
262 return ::ppapi::thunk::GetPPB_FileIOTrusted_Thunk(); 262 return ::ppapi::thunk::GetPPB_FileIOTrusted_Thunk();
263 if (strcmp(name, PPB_FILEREF_DEV_INTERFACE) == 0) 263 if (strcmp(name, PPB_FILEREF_INTERFACE) == 0)
264 return ::ppapi::thunk::GetPPB_FileRef_Thunk(); 264 return ::ppapi::thunk::GetPPB_FileRef_Thunk();
265 if (strcmp(name, PPB_FILESYSTEM_DEV_INTERFACE) == 0) 265 if (strcmp(name, PPB_FILESYSTEM_INTERFACE) == 0)
266 return ::ppapi::thunk::GetPPB_FileSystem_Thunk(); 266 return ::ppapi::thunk::GetPPB_FileSystem_Thunk();
267 if (strcmp(name, PPB_FIND_DEV_INTERFACE) == 0) 267 if (strcmp(name, PPB_FIND_DEV_INTERFACE) == 0)
268 return ::ppapi::thunk::GetPPB_Find_Thunk(); 268 return ::ppapi::thunk::GetPPB_Find_Thunk();
269 if (strcmp(name, PPB_FLASH_INTERFACE) == 0) 269 if (strcmp(name, PPB_FLASH_INTERFACE) == 0)
270 return PPB_Flash_Impl::GetInterface(); 270 return PPB_Flash_Impl::GetInterface();
271 if (strcmp(name, PPB_FLASH_CLIPBOARD_INTERFACE) == 0) 271 if (strcmp(name, PPB_FLASH_CLIPBOARD_INTERFACE) == 0)
272 return PPB_Flash_Clipboard_Impl::GetInterface(); 272 return PPB_Flash_Clipboard_Impl::GetInterface();
273 if (strcmp(name, PPB_FLASH_FILE_FILEREF_INTERFACE) == 0) 273 if (strcmp(name, PPB_FLASH_FILE_FILEREF_INTERFACE) == 0)
274 return PPB_Flash_File_FileRef_Impl::GetInterface(); 274 return PPB_Flash_File_FileRef_Impl::GetInterface();
275 if (strcmp(name, PPB_FLASH_FILE_MODULELOCAL_INTERFACE) == 0) 275 if (strcmp(name, PPB_FLASH_FILE_MODULELOCAL_INTERFACE) == 0)
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 #ifdef ENABLE_FLAPPER_HACKS 352 #ifdef ENABLE_FLAPPER_HACKS
353 if (strcmp(name, PPB_FLASH_NETCONNECTOR_INTERFACE) == 0) 353 if (strcmp(name, PPB_FLASH_NETCONNECTOR_INTERFACE) == 0)
354 return ::ppapi::thunk::GetPPB_Flash_NetConnector_Thunk(); 354 return ::ppapi::thunk::GetPPB_Flash_NetConnector_Thunk();
355 #endif // ENABLE_FLAPPER_HACKS 355 #endif // ENABLE_FLAPPER_HACKS
356 356
357 #if defined(ENABLE_P2P_APIS) 357 #if defined(ENABLE_P2P_APIS)
358 if (strcmp(name, PPB_TRANSPORT_DEV_INTERFACE) == 0) 358 if (strcmp(name, PPB_TRANSPORT_DEV_INTERFACE) == 0)
359 return ::ppapi::thunk::GetPPB_Transport_Thunk(); 359 return ::ppapi::thunk::GetPPB_Transport_Thunk();
360 #endif 360 #endif
361 361
362 // Support the dev interfaces for file io, fileref and file system
363 // until relevant tests and examples are migrated over to non-dev interfaces
364 // in order to prevent breaking the tests and examples.
365 // TODO(sanga): Remove support for these dev interfaces once the relevant
366 // tests and examples are migrated to non-dev interfaces.
367 const bool support_dev_file_interfaces = true;
368 if (support_dev_file_interfaces) {
369 if (strcmp(name, "PPB_FileIO(Dev);0.4") == 0)
370 return ::ppapi::thunk::GetPPB_FileIO_Thunk();
371 if (strcmp(name, "PPB_FileIOTrusted(Dev);0.3") == 0)
372 return ::ppapi::thunk::GetPPB_FileIOTrusted_Thunk();
373 if (strcmp(name, "PPB_FileRef(Dev);0.8") == 0)
374 return ::ppapi::thunk::GetPPB_FileRef_Thunk();
375 if (strcmp(name, "PPB_FileSystem(Dev);0.6") == 0)
376 return ::ppapi::thunk::GetPPB_FileSystem_Thunk();
377 }
378
362 // Only support the testing interface when the command line switch is 379 // Only support the testing interface when the command line switch is
363 // specified. This allows us to prevent people from (ab)using this interface 380 // specified. This allows us to prevent people from (ab)using this interface
364 // in production code. 381 // in production code.
365 if (strcmp(name, PPB_TESTING_DEV_INTERFACE) == 0) { 382 if (strcmp(name, PPB_TESTING_DEV_INTERFACE) == 0) {
366 if (CommandLine::ForCurrentProcess()->HasSwitch("enable-pepper-testing")) 383 if (CommandLine::ForCurrentProcess()->HasSwitch("enable-pepper-testing"))
367 return &testing_interface; 384 return &testing_interface;
368 } 385 }
369 return NULL; 386 return NULL;
370 } 387 }
371 388
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 if (reserve_instance_id_) 576 if (reserve_instance_id_)
560 return PPBoolToBool(reserve_instance_id_(pp_module_, instance)); 577 return PPBoolToBool(reserve_instance_id_(pp_module_, instance));
561 return true; // Instance ID is usable. 578 return true; // Instance ID is usable.
562 } 579 }
563 580
564 void PluginModule::SetBroker(PluginDelegate::PpapiBroker* broker) { 581 void PluginModule::SetBroker(PluginDelegate::PpapiBroker* broker) {
565 DCHECK(!broker_ || !broker); 582 DCHECK(!broker_ || !broker);
566 broker_ = broker; 583 broker_ = broker;
567 } 584 }
568 585
569 PluginDelegate::PpapiBroker* PluginModule::GetBroker(){ 586 PluginDelegate::PpapiBroker* PluginModule::GetBroker() {
570 return broker_; 587 return broker_;
571 } 588 }
572 589
573 ::ppapi::WebKitForwarding* PluginModule::GetWebKitForwarding() { 590 ::ppapi::WebKitForwarding* PluginModule::GetWebKitForwarding() {
574 if (!webkit_forwarding_.get()) 591 if (!webkit_forwarding_.get())
575 webkit_forwarding_.reset(new WebKitForwardingImpl); 592 webkit_forwarding_.reset(new WebKitForwardingImpl);
576 return webkit_forwarding_.get(); 593 return webkit_forwarding_.get();
577 } 594 }
578 595
579 bool PluginModule::InitializeModule() { 596 bool PluginModule::InitializeModule() {
580 DCHECK(!out_of_process_proxy_.get()) << "Don't call for proxied modules."; 597 DCHECK(!out_of_process_proxy_.get()) << "Don't call for proxied modules.";
581 int retval = entry_points_.initialize_module(pp_module(), &GetInterface); 598 int retval = entry_points_.initialize_module(pp_module(), &GetInterface);
582 if (retval != 0) { 599 if (retval != 0) {
583 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; 600 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval;
584 return false; 601 return false;
585 } 602 }
586 return true; 603 return true;
587 } 604 }
588 605
589 } // namespace ppapi 606 } // namespace ppapi
590 } // namespace webkit 607 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/file_type_conversions.cc ('k') | webkit/plugins/ppapi/ppb_file_io_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698