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

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: 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
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) {

Powered by Google App Engine
This is Rietveld 408576698