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