OLD | NEW |
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" |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 return ::ppapi::thunk::GetPPB_Messaging_Thunk(); | 388 return ::ppapi::thunk::GetPPB_Messaging_Thunk(); |
389 if (strcmp(name, PPB_URLLOADER_INTERFACE_0_2) == 0) | 389 if (strcmp(name, PPB_URLLOADER_INTERFACE_0_2) == 0) |
390 return ::ppapi::thunk::GetPPB_URLLoader_Thunk(); | 390 return ::ppapi::thunk::GetPPB_URLLoader_Thunk(); |
391 if (strcmp(name, PPB_URLREQUESTINFO_INTERFACE_0_2) == 0) | 391 if (strcmp(name, PPB_URLREQUESTINFO_INTERFACE_0_2) == 0) |
392 return ::ppapi::thunk::GetPPB_URLRequestInfo_Thunk(); | 392 return ::ppapi::thunk::GetPPB_URLRequestInfo_Thunk(); |
393 if (strcmp(name, PPB_URLRESPONSEINFO_INTERFACE_0_1) == 0) | 393 if (strcmp(name, PPB_URLRESPONSEINFO_INTERFACE_0_1) == 0) |
394 return ::ppapi::thunk::GetPPB_URLResponseInfo_Thunk(); | 394 return ::ppapi::thunk::GetPPB_URLResponseInfo_Thunk(); |
395 if (strcmp(name, PPB_VAR_INTERFACE_0_5) == 0) | 395 if (strcmp(name, PPB_VAR_INTERFACE_0_5) == 0) |
396 return Var::GetInterface(); | 396 return Var::GetInterface(); |
397 | 397 |
398 // Support the 0.4 version of PPB_Instance that includes scripting, until it | |
399 // is no longer being used. | |
400 // TODO(dmichael): Remove this. | |
401 if (strcmp(name, PPB_INSTANCE_INTERFACE_0_4) == 0) | |
402 return ::ppapi::thunk::GetPPB_Instance_0_4_Thunk(); | |
403 | |
404 // Support the dev interfaces for file io, fileref and file system | 398 // Support the dev interfaces for file io, fileref and file system |
405 // until relevant tests and examples are migrated over to non-dev interfaces | 399 // until relevant tests and examples are migrated over to non-dev interfaces |
406 // in order to prevent breaking the tests and examples. | 400 // in order to prevent breaking the tests and examples. |
407 // TODO(sanga): Remove support for these dev interfaces once the relevant | 401 // TODO(sanga): Remove support for these dev interfaces once the relevant |
408 // tests and examples are migrated to non-dev interfaces. | 402 // tests and examples are migrated to non-dev interfaces. |
409 const bool support_dev_file_interfaces = true; | 403 const bool support_dev_file_interfaces = true; |
410 if (support_dev_file_interfaces) { | 404 if (support_dev_file_interfaces) { |
411 if (strcmp(name, "PPB_FileIO(Dev);0.4") == 0) | 405 if (strcmp(name, "PPB_FileIO(Dev);0.4") == 0) |
412 return ::ppapi::thunk::GetPPB_FileIO_Thunk(); | 406 return ::ppapi::thunk::GetPPB_FileIO_Thunk(); |
413 if (strcmp(name, "PPB_FileIOTrusted(Dev);0.3") == 0) | 407 if (strcmp(name, "PPB_FileIOTrusted(Dev);0.3") == 0) |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 // static | 548 // static |
555 PluginModule::GetInterfaceFunc PluginModule::GetLocalGetInterfaceFunc() { | 549 PluginModule::GetInterfaceFunc PluginModule::GetLocalGetInterfaceFunc() { |
556 return &GetInterface; | 550 return &GetInterface; |
557 } | 551 } |
558 | 552 |
559 PluginInstance* PluginModule::CreateInstance(PluginDelegate* delegate) { | 553 PluginInstance* PluginModule::CreateInstance(PluginDelegate* delegate) { |
560 PluginInstance* instance(NULL); | 554 PluginInstance* instance(NULL); |
561 const void* ppp_instance = GetPluginInterface(PPP_INSTANCE_INTERFACE_0_5); | 555 const void* ppp_instance = GetPluginInterface(PPP_INSTANCE_INTERFACE_0_5); |
562 if (ppp_instance) { | 556 if (ppp_instance) { |
563 instance = PluginInstance::Create0_5(delegate, this, ppp_instance); | 557 instance = PluginInstance::Create0_5(delegate, this, ppp_instance); |
564 } else { | |
565 // If the 0.5 interface is not supported, try retrieving 0.4. | |
566 ppp_instance = GetPluginInterface(PPP_INSTANCE_INTERFACE_0_4); | |
567 if (ppp_instance) | |
568 instance = PluginInstance::Create0_4(delegate, this, ppp_instance); | |
569 } | 558 } |
570 if (!instance) { | 559 if (!instance) { |
571 LOG(WARNING) << "Plugin doesn't support instance interface, failing."; | 560 LOG(WARNING) << "Plugin doesn't support instance interface, failing."; |
572 return NULL; | 561 return NULL; |
573 } | 562 } |
574 if (out_of_process_proxy_.get()) | 563 if (out_of_process_proxy_.get()) |
575 out_of_process_proxy_->AddInstance(instance->pp_instance()); | 564 out_of_process_proxy_->AddInstance(instance->pp_instance()); |
576 return instance; | 565 return instance; |
577 } | 566 } |
578 | 567 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
652 int retval = entry_points.initialize_module(pp_module(), &GetInterface); | 641 int retval = entry_points.initialize_module(pp_module(), &GetInterface); |
653 if (retval != 0) { | 642 if (retval != 0) { |
654 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; | 643 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; |
655 return false; | 644 return false; |
656 } | 645 } |
657 return true; | 646 return true; |
658 } | 647 } |
659 | 648 |
660 } // namespace ppapi | 649 } // namespace ppapi |
661 } // namespace webkit | 650 } // namespace webkit |
OLD | NEW |