Chromium Code Reviews| 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 // Register MIME type to support WebView component. | |
|
Charlie Reis
2013/01/18 05:37:07
Great. Can you add a similar --site-per-process p
nasko
2013/01/18 19:09:42
Done.
| |
| 151 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
| 152 if (command_line->HasSwitch(switches::kSitePerProcess)) { | |
| 153 webkit::WebPluginInfo webview_plugin( | |
| 154 ASCIIToUTF16("WebView Tag"), | |
| 155 FilePath(FILE_PATH_LITERAL("")), | |
| 156 ASCIIToUTF16("1.2.3.4"), | |
| 157 ASCIIToUTF16("Browser Plugin.")); | |
| 158 webview_plugin.type = webkit::WebPluginInfo::PLUGIN_TYPE_NPAPI; | |
| 159 webkit::WebPluginMimeType webview_plugin_mime_type; | |
| 160 webview_plugin_mime_type.mime_type = "application/browser-plugin"; | |
| 161 webview_plugin_mime_type.file_extensions.push_back("*"); | |
| 162 webview_plugin.mime_types.push_back(webview_plugin_mime_type); | |
| 163 RegisterInternalPlugin(webview_plugin, true); | |
| 164 } | |
| 165 | |
| 150 GetContentClient()->AddNPAPIPlugins(plugin_list_); | 166 GetContentClient()->AddNPAPIPlugins(plugin_list_); |
| 151 | 167 |
| 152 // Load any specified on the command line as well. | 168 // Load any specified on the command line as well. |
| 153 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
| 154 FilePath path = command_line->GetSwitchValuePath(switches::kLoadPlugin); | 169 FilePath path = command_line->GetSwitchValuePath(switches::kLoadPlugin); |
| 155 if (!path.empty()) | 170 if (!path.empty()) |
| 156 AddExtraPluginPath(path); | 171 AddExtraPluginPath(path); |
| 157 path = command_line->GetSwitchValuePath(switches::kExtraPluginDir); | 172 path = command_line->GetSwitchValuePath(switches::kExtraPluginDir); |
| 158 if (!path.empty()) | 173 if (!path.empty()) |
| 159 plugin_list_->AddExtraPluginDir(path); | 174 plugin_list_->AddExtraPluginDir(path); |
| 160 } | 175 } |
| 161 | 176 |
| 162 void PluginServiceImpl::StartWatchingPlugins() { | 177 void PluginServiceImpl::StartWatchingPlugins() { |
| 163 // Start watching for changes in the plugin list. This means watching | 178 // 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( | 718 void PluginServiceImpl::GetInternalPlugins( |
| 704 std::vector<webkit::WebPluginInfo>* plugins) { | 719 std::vector<webkit::WebPluginInfo>* plugins) { |
| 705 plugin_list_->GetInternalPlugins(plugins); | 720 plugin_list_->GetInternalPlugins(plugins); |
| 706 } | 721 } |
| 707 | 722 |
| 708 webkit::npapi::PluginList* PluginServiceImpl::GetPluginList() { | 723 webkit::npapi::PluginList* PluginServiceImpl::GetPluginList() { |
| 709 return plugin_list_; | 724 return plugin_list_; |
| 710 } | 725 } |
| 711 | 726 |
| 712 } // namespace content | 727 } // namespace content |
| OLD | NEW |