Chromium Code Reviews| Index: chrome/browser/extensions/plugin_manager.cc |
| diff --git a/chrome/browser/extensions/plugin_manager.cc b/chrome/browser/extensions/plugin_manager.cc |
| index 641af8ef530664851e9400c9cb5ab7cba91f6f35..acc6644334eeab1efac5caf1d6fe19884df25169 100644 |
| --- a/chrome/browser/extensions/plugin_manager.cc |
| +++ b/chrome/browser/extensions/plugin_manager.cc |
| @@ -82,8 +82,23 @@ void PluginManager::OnExtensionLoaded(content::BrowserContext* browser_context, |
| const MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension); |
| if (handler && !handler->handler_url().empty()) { |
| plugins_or_nacl_changed = true; |
| - RegisterMimeTypeHandler(handler->extension_id()); |
| - UpdatePluginListWithNaClModules(); |
| + mime_type_handler_extension_ids_.insert(handler->extension_id()); |
|
Yoyo Zhou
2014/06/19 01:50:39
It doesn't look like we ever erase IDs from this.
Zachary Kuznia
2014/06/19 18:02:24
This set is no longer needed. Removed.
|
| + |
| + content::WebPluginInfo info; |
| + info.type = content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN; |
| + info.name = base::UTF8ToUTF16(handler->extension_id()); |
| + info.path = base::FilePath::FromUTF8Unsafe(handler->extension_id()); |
| + |
| + for (std::set<std::string>::const_iterator mime_type = |
| + handler->mime_type_set().begin(); |
| + mime_type != handler->mime_type_set().end(); ++mime_type) { |
| + content::WebPluginMimeType mime_type_info; |
| + mime_type_info.mime_type = *mime_type; |
| + info.mime_types.push_back(mime_type_info); |
| + } |
| + |
| + PluginService::GetInstance()->RefreshPlugins(); |
| + PluginService::GetInstance()->RegisterInternalPlugin(info, true); |
| } |
| if (plugins_or_nacl_changed) |
| @@ -122,8 +137,8 @@ void PluginManager::OnExtensionUnloaded( |
| const MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension); |
| if (handler && !handler->handler_url().empty()) { |
| - plugins_or_nacl_changed = true; |
|
Yoyo Zhou
2014/06/19 01:50:39
Why is this no longer?
Zachary Kuznia
2014/06/19 18:02:24
It looks like I was missing another call as well.
|
| - UnregisterMimeTypeHandler(handler->extension_id()); |
| + PluginService::GetInstance()->UnregisterInternalPlugin( |
| + base::FilePath::FromUTF8Unsafe(handler->extension_id())); |
| } |
| if (plugins_or_nacl_changed) |
| @@ -187,45 +202,6 @@ void PluginManager::UpdatePluginListWithNaClModules() { |
| break; |
| } |
| } |
| - |
| - for (std::set<std::string>::iterator ix = |
| - mime_type_handler_extension_ids_.begin(); |
| - ix != mime_type_handler_extension_ids_.end(); ++ix) { |
| - const std::string& extension_id = *ix; |
| - const Extension* extension = |
| - profile_->GetExtensionService()->GetExtensionById(extension_id, false); |
| - const MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension); |
| - if (handler && !handler->handler_url().empty()) { |
| - PluginService::GetInstance()->UnregisterInternalPlugin( |
| - base::FilePath::FromUTF8Unsafe(extension_id)); |
| - |
| - content::WebPluginInfo info; |
| - info.type = content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN; |
| - info.name = base::UTF8ToUTF16(extension_id); |
| - info.path = base::FilePath::FromUTF8Unsafe(extension_id); |
| - |
| - for (std::set<std::string>::const_iterator mime_type = |
| - handler->mime_type_set().begin(); |
| - mime_type != handler->mime_type_set().end(); ++mime_type) { |
| - content::WebPluginMimeType mime_type_info; |
| - mime_type_info.mime_type = *mime_type; |
| - info.mime_types.push_back(mime_type_info); |
| - } |
| - |
| - PluginService::GetInstance()->RefreshPlugins(); |
| - PluginService::GetInstance()->RegisterInternalPlugin(info, true); |
| - } |
| - } |
| -} |
| - |
| -void PluginManager::RegisterMimeTypeHandler(const std::string& extension_id) { |
| - mime_type_handler_extension_ids_.insert(extension_id); |
| -} |
| - |
| -void PluginManager::UnregisterMimeTypeHandler(const std::string& extension_id) { |
| - mime_type_handler_extension_ids_.erase(extension_id); |
| - PluginService::GetInstance()->UnregisterInternalPlugin( |
| - base::FilePath::FromUTF8Unsafe(extension_id)); |
| } |
| NaClModuleInfo::List::iterator PluginManager::FindNaClModule(const GURL& url) { |