| 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 "content/public/browser/plugin_service.h" | |
| 16 #include "content/public/common/pepper_plugin_info.h" | |
| 17 #include "extensions/browser/extension_registry.h" | 15 #include "extensions/browser/extension_registry.h" |
| 18 #include "extensions/common/extension.h" | 16 #include "extensions/common/extension.h" |
| 19 #include "extensions/common/manifest_handlers/mime_types_handler.h" | 17 #include "extensions/common/manifest_handlers/mime_types_handler.h" |
| 20 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 21 | 19 |
| 22 #if !defined(DISABLE_NACL) | 20 #if !defined(DISABLE_NACL) |
| 23 #include "components/nacl/common/nacl_constants.h" | 21 #include "components/nacl/common/nacl_constants.h" |
| 24 #endif | 22 #endif |
| 25 | 23 |
| 24 #if defined(ENABLE_PLUGINS) |
| 25 #include "content/public/browser/plugin_service.h" |
| 26 #endif |
| 27 |
| 28 // Disabled due to error: "Plugins should be enabled" |
| 29 #if !defined(OS_ANDROID) |
| 30 #include "content/public/common/pepper_plugin_info.h" |
| 31 #endif |
| 32 |
| 26 using content::PluginService; | 33 using content::PluginService; |
| 27 | 34 |
| 28 namespace extensions { | 35 namespace extensions { |
| 29 | 36 |
| 30 PluginManager::PluginManager(content::BrowserContext* context) | 37 PluginManager::PluginManager(content::BrowserContext* context) |
| 31 : profile_(Profile::FromBrowserContext(context)), | 38 : profile_(Profile::FromBrowserContext(context)), |
| 32 extension_registry_observer_(this) { | 39 extension_registry_observer_(this) { |
| 33 extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); | 40 extension_registry_observer_.Add(ExtensionRegistry::Get(profile_)); |
| 34 } | 41 } |
| 35 | 42 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 nacl_module_list_.push_front(info); | 172 nacl_module_list_.push_front(info); |
| 166 } | 173 } |
| 167 | 174 |
| 168 void PluginManager::UnregisterNaClModule(const NaClModuleInfo& info) { | 175 void PluginManager::UnregisterNaClModule(const NaClModuleInfo& info) { |
| 169 NaClModuleInfo::List::iterator iter = FindNaClModule(info.url); | 176 NaClModuleInfo::List::iterator iter = FindNaClModule(info.url); |
| 170 DCHECK(iter != nacl_module_list_.end()); | 177 DCHECK(iter != nacl_module_list_.end()); |
| 171 nacl_module_list_.erase(iter); | 178 nacl_module_list_.erase(iter); |
| 172 } | 179 } |
| 173 | 180 |
| 174 void PluginManager::UpdatePluginListWithNaClModules() { | 181 void PluginManager::UpdatePluginListWithNaClModules() { |
| 182 // Disabled due to error: "Plugins should be enabled" |
| 183 #if !defined(OS_ANDROID) |
| 175 // An extension has been added which has a nacl_module component, which means | 184 // An extension has been added which has a nacl_module component, which means |
| 176 // there is a MIME type that module wants to handle, so we need to add that | 185 // there is a MIME type that module wants to handle, so we need to add that |
| 177 // MIME type to plugins which handle NaCl modules in order to allow the | 186 // MIME type to plugins which handle NaCl modules in order to allow the |
| 178 // individual modules to handle these types. | 187 // individual modules to handle these types. |
| 179 base::FilePath path; | 188 base::FilePath path; |
| 180 if (!PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) | 189 if (!PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) |
| 181 return; | 190 return; |
| 182 const content::PepperPluginInfo* pepper_info = | 191 const content::PepperPluginInfo* pepper_info = |
| 183 PluginService::GetInstance()->GetRegisteredPpapiPluginInfo(path); | 192 PluginService::GetInstance()->GetRegisteredPpapiPluginInfo(path); |
| 184 if (!pepper_info) | 193 if (!pepper_info) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 210 info.mime_types.push_back(mime_type_info); | 219 info.mime_types.push_back(mime_type_info); |
| 211 } | 220 } |
| 212 | 221 |
| 213 PluginService::GetInstance()->RefreshPlugins(); | 222 PluginService::GetInstance()->RefreshPlugins(); |
| 214 PluginService::GetInstance()->RegisterInternalPlugin(info, true); | 223 PluginService::GetInstance()->RegisterInternalPlugin(info, true); |
| 215 // This plugin has been modified, no need to check the rest of its | 224 // This plugin has been modified, no need to check the rest of its |
| 216 // types, but continue checking other plugins. | 225 // types, but continue checking other plugins. |
| 217 break; | 226 break; |
| 218 } | 227 } |
| 219 } | 228 } |
| 229 #endif |
| 220 } | 230 } |
| 221 | 231 |
| 222 NaClModuleInfo::List::iterator PluginManager::FindNaClModule(const GURL& url) { | 232 NaClModuleInfo::List::iterator PluginManager::FindNaClModule(const GURL& url) { |
| 223 for (NaClModuleInfo::List::iterator iter = nacl_module_list_.begin(); | 233 for (NaClModuleInfo::List::iterator iter = nacl_module_list_.begin(); |
| 224 iter != nacl_module_list_.end(); ++iter) { | 234 iter != nacl_module_list_.end(); ++iter) { |
| 225 if (iter->url == url) | 235 if (iter->url == url) |
| 226 return iter; | 236 return iter; |
| 227 } | 237 } |
| 228 return nacl_module_list_.end(); | 238 return nacl_module_list_.end(); |
| 229 } | 239 } |
| 230 | 240 |
| 231 #endif // !defined(DISABLE_NACL) | 241 #endif // !defined(DISABLE_NACL) |
| 232 | 242 |
| 233 } // namespace extensions | 243 } // namespace extensions |
| OLD | NEW |