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/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 void PluginServiceImpl::Init() { | 140 void PluginServiceImpl::Init() { |
141 if (!plugin_list_) | 141 if (!plugin_list_) |
142 plugin_list_ = webkit::npapi::PluginList::Singleton(); | 142 plugin_list_ = webkit::npapi::PluginList::Singleton(); |
143 | 143 |
144 plugin_list_token_ = BrowserThread::GetBlockingPool()->GetSequenceToken(); | 144 plugin_list_token_ = BrowserThread::GetBlockingPool()->GetSequenceToken(); |
145 plugin_list_->set_will_load_plugins_callback( | 145 plugin_list_->set_will_load_plugins_callback( |
146 base::Bind(&WillLoadPluginsCallback, plugin_list_token_)); | 146 base::Bind(&WillLoadPluginsCallback, plugin_list_token_)); |
147 | 147 |
148 RegisterPepperPlugins(); | 148 RegisterPepperPlugins(); |
149 | 149 |
| 150 // The --site-per-process flag enables an out-of-process iframes |
| 151 // prototype, which uses WebView for rendering. We need to register the MIME |
| 152 // type we use with the plugin, so the renderer can instantiate it. |
| 153 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 154 if (command_line->HasSwitch(switches::kSitePerProcess)) { |
| 155 webkit::WebPluginInfo webview_plugin( |
| 156 ASCIIToUTF16("WebView Tag"), |
| 157 FilePath(FILE_PATH_LITERAL("")), |
| 158 ASCIIToUTF16("1.2.3.4"), |
| 159 ASCIIToUTF16("Browser Plugin.")); |
| 160 webview_plugin.type = webkit::WebPluginInfo::PLUGIN_TYPE_NPAPI; |
| 161 webkit::WebPluginMimeType webview_plugin_mime_type; |
| 162 webview_plugin_mime_type.mime_type = "application/browser-plugin"; |
| 163 webview_plugin_mime_type.file_extensions.push_back("*"); |
| 164 webview_plugin.mime_types.push_back(webview_plugin_mime_type); |
| 165 RegisterInternalPlugin(webview_plugin, true); |
| 166 } |
| 167 |
150 GetContentClient()->AddNPAPIPlugins(plugin_list_); | 168 GetContentClient()->AddNPAPIPlugins(plugin_list_); |
151 | 169 |
152 // Load any specified on the command line as well. | 170 // Load any specified on the command line as well. |
153 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
154 FilePath path = command_line->GetSwitchValuePath(switches::kLoadPlugin); | 171 FilePath path = command_line->GetSwitchValuePath(switches::kLoadPlugin); |
155 if (!path.empty()) | 172 if (!path.empty()) |
156 AddExtraPluginPath(path); | 173 AddExtraPluginPath(path); |
157 path = command_line->GetSwitchValuePath(switches::kExtraPluginDir); | 174 path = command_line->GetSwitchValuePath(switches::kExtraPluginDir); |
158 if (!path.empty()) | 175 if (!path.empty()) |
159 plugin_list_->AddExtraPluginDir(path); | 176 plugin_list_->AddExtraPluginDir(path); |
160 } | 177 } |
161 | 178 |
162 void PluginServiceImpl::StartWatchingPlugins() { | 179 void PluginServiceImpl::StartWatchingPlugins() { |
163 // Start watching for changes in the plugin list. This means watching | 180 // Start watching for changes in the plugin list. This means watching |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 void PluginServiceImpl::GetInternalPlugins( | 720 void PluginServiceImpl::GetInternalPlugins( |
704 std::vector<webkit::WebPluginInfo>* plugins) { | 721 std::vector<webkit::WebPluginInfo>* plugins) { |
705 plugin_list_->GetInternalPlugins(plugins); | 722 plugin_list_->GetInternalPlugins(plugins); |
706 } | 723 } |
707 | 724 |
708 webkit::npapi::PluginList* PluginServiceImpl::GetPluginList() { | 725 webkit::npapi::PluginList* PluginServiceImpl::GetPluginList() { |
709 return plugin_list_; | 726 return plugin_list_; |
710 } | 727 } |
711 | 728 |
712 } // namespace content | 729 } // namespace content |
OLD | NEW |