OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/lazy_instance.h" | 6 #include "base/lazy_instance.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/plugin_manager.h" | 10 #include "chrome/browser/extensions/plugin_manager.h" |
11 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 11 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/common/chrome_paths.h" | 13 #include "chrome/common/chrome_paths.h" |
14 #include "chrome/common/extensions/api/plugins/plugins_handler.h" | 14 #include "chrome/common/extensions/api/plugins/plugins_handler.h" |
15 #include "chrome/common/extensions/manifest_handlers/mime_types_handler.h" | 15 #include "chrome/common/extensions/manifest_handlers/mime_types_handler.h" |
16 #include "content/public/browser/plugin_service.h" | 16 #include "content/public/browser/plugin_service.h" |
17 #include "content/public/common/pepper_plugin_info.h" | 17 #include "content/public/common/pepper_plugin_info.h" |
18 #include "extensions/browser/extension_registry.h" | 18 #include "extensions/browser/extension_registry.h" |
19 #include "extensions/common/extension.h" | 19 #include "extensions/common/extension.h" |
20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
21 | 21 |
| 22 #if !defined(DISABLE_NACL) |
| 23 #include "components/nacl/common/nacl_constants.h" |
| 24 #endif |
| 25 |
22 using content::PluginService; | 26 using content::PluginService; |
23 | 27 |
24 #if !defined(DISABLE_NACL) | |
25 static const char kNaClPluginMimeType[] = "application/x-nacl"; | |
26 #endif | |
27 | |
28 namespace extensions { | 28 namespace extensions { |
29 | 29 |
30 PluginManager::PluginManager(content::BrowserContext* context) | 30 PluginManager::PluginManager(content::BrowserContext* context) |
31 : profile_(Profile::FromBrowserContext(context)), | 31 : profile_(Profile::FromBrowserContext(context)), |
32 extension_registry_observer_(this) { | 32 extension_registry_observer_(this) { |
33 extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); | 33 extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); |
34 } | 34 } |
35 | 35 |
36 PluginManager::~PluginManager() { | 36 PluginManager::~PluginManager() { |
37 } | 37 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 return; | 177 return; |
178 const content::PepperPluginInfo* pepper_info = | 178 const content::PepperPluginInfo* pepper_info = |
179 PluginService::GetInstance()->GetRegisteredPpapiPluginInfo(path); | 179 PluginService::GetInstance()->GetRegisteredPpapiPluginInfo(path); |
180 if (!pepper_info) | 180 if (!pepper_info) |
181 return; | 181 return; |
182 | 182 |
183 std::vector<content::WebPluginMimeType>::const_iterator mime_iter; | 183 std::vector<content::WebPluginMimeType>::const_iterator mime_iter; |
184 // Check each MIME type the plugins handle for the NaCl MIME type. | 184 // Check each MIME type the plugins handle for the NaCl MIME type. |
185 for (mime_iter = pepper_info->mime_types.begin(); | 185 for (mime_iter = pepper_info->mime_types.begin(); |
186 mime_iter != pepper_info->mime_types.end(); ++mime_iter) { | 186 mime_iter != pepper_info->mime_types.end(); ++mime_iter) { |
187 if (mime_iter->mime_type == kNaClPluginMimeType) { | 187 if (mime_iter->mime_type == nacl::kNaClPluginMimeType) { |
188 // This plugin handles "application/x-nacl". | 188 // This plugin handles "application/x-nacl". |
189 | 189 |
190 PluginService::GetInstance()->UnregisterInternalPlugin(pepper_info->path); | 190 PluginService::GetInstance()->UnregisterInternalPlugin(pepper_info->path); |
191 | 191 |
192 content::WebPluginInfo info = pepper_info->ToWebPluginInfo(); | 192 content::WebPluginInfo info = pepper_info->ToWebPluginInfo(); |
193 | 193 |
194 for (NaClModuleInfo::List::const_iterator iter = | 194 for (NaClModuleInfo::List::const_iterator iter = |
195 nacl_module_list_.begin(); | 195 nacl_module_list_.begin(); |
196 iter != nacl_module_list_.end(); ++iter) { | 196 iter != nacl_module_list_.end(); ++iter) { |
197 // Add the MIME type specified in the extension to this NaCl plugin, | 197 // Add the MIME type specified in the extension to this NaCl plugin, |
(...skipping 22 matching lines...) Expand all Loading... |
220 iter != nacl_module_list_.end(); ++iter) { | 220 iter != nacl_module_list_.end(); ++iter) { |
221 if (iter->url == url) | 221 if (iter->url == url) |
222 return iter; | 222 return iter; |
223 } | 223 } |
224 return nacl_module_list_.end(); | 224 return nacl_module_list_.end(); |
225 } | 225 } |
226 | 226 |
227 #endif // !defined(DISABLE_NACL) | 227 #endif // !defined(DISABLE_NACL) |
228 | 228 |
229 } // namespace extensions | 229 } // namespace extensions |
OLD | NEW |