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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 DCHECK(pending_plugin_clients_.empty()); | 164 DCHECK(pending_plugin_clients_.empty()); |
165 } | 165 } |
166 | 166 |
167 void PluginServiceImpl::Init() { | 167 void PluginServiceImpl::Init() { |
168 plugin_list_token_ = BrowserThread::GetBlockingPool()->GetSequenceToken(); | 168 plugin_list_token_ = BrowserThread::GetBlockingPool()->GetSequenceToken(); |
169 PluginList::Singleton()->set_will_load_plugins_callback( | 169 PluginList::Singleton()->set_will_load_plugins_callback( |
170 base::Bind(&WillLoadPluginsCallback, plugin_list_token_)); | 170 base::Bind(&WillLoadPluginsCallback, plugin_list_token_)); |
171 | 171 |
172 RegisterPepperPlugins(); | 172 RegisterPepperPlugins(); |
173 | 173 |
174 // The --site-per-process flag enables an out-of-process iframes | 174 // Load any specified on the command line as well. |
175 // prototype, which uses WebView for rendering. We need to register the MIME | |
176 // type we use with the plugin, so the renderer can instantiate it. | |
177 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 175 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
178 if (command_line->HasSwitch(switches::kSitePerProcess)) { | |
179 WebPluginInfo webview_plugin( | |
180 ASCIIToUTF16("WebView Tag"), | |
181 base::FilePath(), | |
182 ASCIIToUTF16("1.2.3.4"), | |
183 ASCIIToUTF16("Browser Plugin.")); | |
184 webview_plugin.type = WebPluginInfo::PLUGIN_TYPE_NPAPI; | |
185 WebPluginMimeType webview_plugin_mime_type; | |
186 webview_plugin_mime_type.mime_type = "application/browser-plugin"; | |
187 webview_plugin_mime_type.file_extensions.push_back("*"); | |
188 webview_plugin.mime_types.push_back(webview_plugin_mime_type); | |
189 RegisterInternalPlugin(webview_plugin, true); | |
190 } | |
191 | |
192 // Load any specified on the command line as well. | |
193 base::FilePath path = | 176 base::FilePath path = |
194 command_line->GetSwitchValuePath(switches::kLoadPlugin); | 177 command_line->GetSwitchValuePath(switches::kLoadPlugin); |
195 if (!path.empty()) | 178 if (!path.empty()) |
196 AddExtraPluginPath(path); | 179 AddExtraPluginPath(path); |
197 path = command_line->GetSwitchValuePath(switches::kExtraPluginDir); | 180 path = command_line->GetSwitchValuePath(switches::kExtraPluginDir); |
198 if (!path.empty()) | 181 if (!path.empty()) |
199 PluginList::Singleton()->AddExtraPluginDir(path); | 182 PluginList::Singleton()->AddExtraPluginDir(path); |
200 | 183 |
201 if (command_line->HasSwitch(switches::kDisablePluginsDiscovery)) | 184 if (command_line->HasSwitch(switches::kDisablePluginsDiscovery)) |
202 PluginList::Singleton()->DisablePluginsDiscovery(); | 185 PluginList::Singleton()->DisablePluginsDiscovery(); |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 window, kPluginVersionAtomProperty, plugin_version); | 819 window, kPluginVersionAtomProperty, plugin_version); |
837 return true; | 820 return true; |
838 } | 821 } |
839 | 822 |
840 bool PluginServiceImpl::IsPluginWindow(HWND window) { | 823 bool PluginServiceImpl::IsPluginWindow(HWND window) { |
841 return gfx::GetClassName(window) == base::string16(kNativeWindowClassName); | 824 return gfx::GetClassName(window) == base::string16(kNativeWindowClassName); |
842 } | 825 } |
843 #endif | 826 #endif |
844 | 827 |
845 } // namespace content | 828 } // namespace content |
OLD | NEW |