Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2968)

Unified Diff: chrome/browser/extensions/plugin_manager.cc

Issue 340953006: Fix some DCHECKS when using BrowserPlugin for extension mime type handlers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review fixes Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/plugin_manager.h ('k') | content/browser/loader/buffered_resource_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b018c6d1e0cbe296e8ac93592b1f3b63f6c7e213 100644
--- a/chrome/browser/extensions/plugin_manager.cc
+++ b/chrome/browser/extensions/plugin_manager.cc
@@ -82,8 +82,22 @@ 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();
+
+ 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)
@@ -123,7 +137,11 @@ void PluginManager::OnExtensionUnloaded(
const MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension);
if (handler && !handler->handler_url().empty()) {
plugins_or_nacl_changed = true;
- UnregisterMimeTypeHandler(handler->extension_id());
+ base::FilePath path =
+ base::FilePath::FromUTF8Unsafe(handler->extension_id());
+ PluginService::GetInstance()->UnregisterInternalPlugin(path);
+ PluginService::GetInstance()->ForcePluginShutdown(path);
+ PluginService::GetInstance()->RefreshPlugins();
}
if (plugins_or_nacl_changed)
@@ -187,45 +205,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) {
« no previous file with comments | « chrome/browser/extensions/plugin_manager.h ('k') | content/browser/loader/buffered_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698