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 "content/renderer/pepper_plugin_delegate_impl.h" | 5 #include "content/renderer/pepper_plugin_delegate_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 #include "webkit/fileapi/file_system_callback_dispatcher.h" | 63 #include "webkit/fileapi/file_system_callback_dispatcher.h" |
64 #include "webkit/glue/context_menu.h" | 64 #include "webkit/glue/context_menu.h" |
65 #include "webkit/plugins/npapi/webplugin.h" | 65 #include "webkit/plugins/npapi/webplugin.h" |
66 #include "webkit/plugins/ppapi/file_path.h" | 66 #include "webkit/plugins/ppapi/file_path.h" |
67 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" | 67 #include "webkit/plugins/ppapi/ppb_file_io_impl.h" |
68 #include "webkit/plugins/ppapi/plugin_module.h" | 68 #include "webkit/plugins/ppapi/plugin_module.h" |
69 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 69 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
70 #include "webkit/plugins/ppapi/ppb_broker_impl.h" | 70 #include "webkit/plugins/ppapi/ppb_broker_impl.h" |
71 #include "webkit/plugins/ppapi/ppb_flash_impl.h" | 71 #include "webkit/plugins/ppapi/ppb_flash_impl.h" |
72 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h" | 72 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h" |
| 73 #include "webkit/plugins/webplugininfo.h" |
73 | 74 |
74 using WebKit::WebView; | 75 using WebKit::WebView; |
75 | 76 |
76 namespace { | 77 namespace { |
77 | 78 |
78 int32_t PlatformFileToInt(base::PlatformFile handle) { | 79 int32_t PlatformFileToInt(base::PlatformFile handle) { |
79 #if defined(OS_WIN) | 80 #if defined(OS_WIN) |
80 return static_cast<int32_t>(reinterpret_cast<intptr_t>(handle)); | 81 return static_cast<int32_t>(reinterpret_cast<intptr_t>(handle)); |
81 #elif defined(OS_POSIX) | 82 #elif defined(OS_POSIX) |
82 return handle; | 83 return handle; |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 has_saved_context_menu_action_(false), | 650 has_saved_context_menu_action_(false), |
650 saved_context_menu_action_(0), | 651 saved_context_menu_action_(0), |
651 id_generator_(0), | 652 id_generator_(0), |
652 is_pepper_plugin_focused_(false) { | 653 is_pepper_plugin_focused_(false) { |
653 } | 654 } |
654 | 655 |
655 PepperPluginDelegateImpl::~PepperPluginDelegateImpl() { | 656 PepperPluginDelegateImpl::~PepperPluginDelegateImpl() { |
656 } | 657 } |
657 | 658 |
658 scoped_refptr<webkit::ppapi::PluginModule> | 659 scoped_refptr<webkit::ppapi::PluginModule> |
659 PepperPluginDelegateImpl::CreatePepperPlugin( | 660 PepperPluginDelegateImpl::CreatePepperPluginModule( |
660 const FilePath& path, | 661 const webkit::WebPluginInfo& webplugin_info, |
661 bool* pepper_plugin_was_registered) { | 662 bool* pepper_plugin_was_registered) { |
662 *pepper_plugin_was_registered = true; | 663 *pepper_plugin_was_registered = true; |
663 | 664 |
664 // See if a module has already been loaded for this plugin. | 665 // See if a module has already been loaded for this plugin. |
| 666 FilePath path(webplugin_info.path); |
665 scoped_refptr<webkit::ppapi::PluginModule> module = | 667 scoped_refptr<webkit::ppapi::PluginModule> module = |
666 PepperPluginRegistry::GetInstance()->GetLiveModule(path); | 668 PepperPluginRegistry::GetInstance()->GetLiveModule(path); |
667 if (module) | 669 if (module) |
668 return module; | 670 return module; |
669 | 671 |
670 // In-process plugins will have always been created up-front to avoid the | 672 // In-process plugins will have always been created up-front to avoid the |
671 // sandbox restrictions. So getting here implies it doesn't exist or should | 673 // sandbox restrictions. So getting here implies it doesn't exist or should |
672 // be out of process. | 674 // be out of process. |
673 const PepperPluginInfo* info = | 675 const PepperPluginInfo* info = |
674 PepperPluginRegistry::GetInstance()->GetInfoForPlugin(path); | 676 PepperPluginRegistry::GetInstance()->GetInfoForPlugin(webplugin_info); |
675 if (!info) { | 677 if (!info) { |
676 *pepper_plugin_was_registered = false; | 678 *pepper_plugin_was_registered = false; |
677 return scoped_refptr<webkit::ppapi::PluginModule>(); | 679 return scoped_refptr<webkit::ppapi::PluginModule>(); |
678 } else if (!info->is_out_of_process) { | 680 } else if (!info->is_out_of_process) { |
679 // In-process plugin not preloaded, it probably couldn't be initialized. | 681 // In-process plugin not preloaded, it probably couldn't be initialized. |
680 return scoped_refptr<webkit::ppapi::PluginModule>(); | 682 return scoped_refptr<webkit::ppapi::PluginModule>(); |
681 } | 683 } |
682 | 684 |
683 // Out of process: have the browser start the plugin process for us. | 685 // Out of process: have the browser start the plugin process for us. |
684 base::ProcessHandle plugin_process_handle = base::kNullProcessHandle; | 686 base::ProcessHandle plugin_process_handle = base::kNullProcessHandle; |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1467 | 1469 |
1468 ppapi::Preferences PepperPluginDelegateImpl::GetPreferences() { | 1470 ppapi::Preferences PepperPluginDelegateImpl::GetPreferences() { |
1469 return ppapi::Preferences(render_view_->webkit_preferences()); | 1471 return ppapi::Preferences(render_view_->webkit_preferences()); |
1470 } | 1472 } |
1471 | 1473 |
1472 void PepperPluginDelegateImpl::PublishInitialPolicy( | 1474 void PepperPluginDelegateImpl::PublishInitialPolicy( |
1473 scoped_refptr<webkit::ppapi::PluginInstance> instance, | 1475 scoped_refptr<webkit::ppapi::PluginInstance> instance, |
1474 const std::string& policy) { | 1476 const std::string& policy) { |
1475 instance->HandlePolicyUpdate(policy); | 1477 instance->HandlePolicyUpdate(policy); |
1476 } | 1478 } |
OLD | NEW |