OLD | NEW |
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 "content/browser/plugin_service_impl.h" | 5 #include "content/browser/plugin_service_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 }; | 61 }; |
62 | 62 |
63 bool LoadPluginListInProcess() { | 63 bool LoadPluginListInProcess() { |
64 #if defined(OS_WIN) | 64 #if defined(OS_WIN) |
65 return true; | 65 return true; |
66 #else | 66 #else |
67 // If on POSIX, we don't want to load the list of NPAPI plugins in-process as | 67 // If on POSIX, we don't want to load the list of NPAPI plugins in-process as |
68 // that causes instability. | 68 // that causes instability. |
69 | 69 |
70 // Can't load the plugins on the utility thread when in single process mode | 70 // Can't load the plugins on the utility thread when in single process mode |
71 // since that requires using WebKit and GTK and they can only be used on the | 71 // since that requires GTK which can only be used on the main thread. |
72 // main thread. | |
73 if (RenderProcessHost::run_renderer_in_process()) | 72 if (RenderProcessHost::run_renderer_in_process()) |
74 return true; | 73 return true; |
75 | 74 |
76 return !webkit::npapi::NPAPIPluginsSupported(); | 75 return !webkit::npapi::NPAPIPluginsSupported(); |
77 #endif | 76 #endif |
78 } | 77 } |
79 | 78 |
80 // Callback set on the PluginList to assert that plugin loading happens on the | 79 // Callback set on the PluginList to assert that plugin loading happens on the |
81 // correct thread. | 80 // correct thread. |
82 void WillLoadPluginsCallback( | 81 void WillLoadPluginsCallback( |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 ASCIIToUTF16("1.2.3.4"), | 185 ASCIIToUTF16("1.2.3.4"), |
187 ASCIIToUTF16("Browser Plugin.")); | 186 ASCIIToUTF16("Browser Plugin.")); |
188 webview_plugin.type = webkit::WebPluginInfo::PLUGIN_TYPE_NPAPI; | 187 webview_plugin.type = webkit::WebPluginInfo::PLUGIN_TYPE_NPAPI; |
189 webkit::WebPluginMimeType webview_plugin_mime_type; | 188 webkit::WebPluginMimeType webview_plugin_mime_type; |
190 webview_plugin_mime_type.mime_type = "application/browser-plugin"; | 189 webview_plugin_mime_type.mime_type = "application/browser-plugin"; |
191 webview_plugin_mime_type.file_extensions.push_back("*"); | 190 webview_plugin_mime_type.file_extensions.push_back("*"); |
192 webview_plugin.mime_types.push_back(webview_plugin_mime_type); | 191 webview_plugin.mime_types.push_back(webview_plugin_mime_type); |
193 RegisterInternalPlugin(webview_plugin, true); | 192 RegisterInternalPlugin(webview_plugin, true); |
194 } | 193 } |
195 | 194 |
196 GetContentClient()->AddNPAPIPlugins(plugin_list_); | |
197 | |
198 // Load any specified on the command line as well. | 195 // Load any specified on the command line as well. |
199 base::FilePath path = | 196 base::FilePath path = |
200 command_line->GetSwitchValuePath(switches::kLoadPlugin); | 197 command_line->GetSwitchValuePath(switches::kLoadPlugin); |
201 if (!path.empty()) | 198 if (!path.empty()) |
202 AddExtraPluginPath(path); | 199 AddExtraPluginPath(path); |
203 path = command_line->GetSwitchValuePath(switches::kExtraPluginDir); | 200 path = command_line->GetSwitchValuePath(switches::kExtraPluginDir); |
204 if (!path.empty()) | 201 if (!path.empty()) |
205 plugin_list_->AddExtraPluginDir(path); | 202 plugin_list_->AddExtraPluginDir(path); |
206 | 203 |
207 if (command_line->HasSwitch(switches::kDisablePluginsDiscovery)) | 204 if (command_line->HasSwitch(switches::kDisablePluginsDiscovery)) |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 void PluginServiceImpl::GetInternalPlugins( | 791 void PluginServiceImpl::GetInternalPlugins( |
795 std::vector<webkit::WebPluginInfo>* plugins) { | 792 std::vector<webkit::WebPluginInfo>* plugins) { |
796 plugin_list_->GetInternalPlugins(plugins); | 793 plugin_list_->GetInternalPlugins(plugins); |
797 } | 794 } |
798 | 795 |
799 webkit::npapi::PluginList* PluginServiceImpl::GetPluginList() { | 796 webkit::npapi::PluginList* PluginServiceImpl::GetPluginList() { |
800 return plugin_list_; | 797 return plugin_list_; |
801 } | 798 } |
802 | 799 |
803 } // namespace content | 800 } // namespace content |
OLD | NEW |