diff options
Diffstat (limited to 'chrome/browser/plugins/plugin_finder.cc')
-rw-r--r-- | chrome/browser/plugins/plugin_finder.cc | 51 |
1 files changed, 17 insertions, 34 deletions
diff --git a/chrome/browser/plugins/plugin_finder.cc b/chrome/browser/plugins/plugin_finder.cc index aded8b6..be73b16 100644 --- a/chrome/browser/plugins/plugin_finder.cc +++ b/chrome/browser/plugins/plugin_finder.cc @@ -84,7 +84,7 @@ void PluginFinder::Init() { identifier_plugin_[identifier] = metadata; #if defined(ENABLE_PLUGIN_INSTALLATION) - installers_[identifier] = new PluginInstaller(); + installers_[identifier] = new PluginInstaller(metadata); #endif } } @@ -122,13 +122,10 @@ PluginFinder::~PluginFinder() { } #if defined(ENABLE_PLUGIN_INSTALLATION) -bool PluginFinder::FindPlugin( - const std::string& mime_type, - const std::string& language, - PluginInstaller** installer, - scoped_ptr<PluginMetadata>* plugin_metadata) { +PluginInstaller* PluginFinder::FindPlugin(const std::string& mime_type, + const std::string& language) { if (g_browser_process->local_state()->GetBoolean(prefs::kDisablePluginFinder)) - return false; + return NULL; for (DictionaryValue::Iterator plugin_it(*plugin_list_); plugin_it.HasNext(); plugin_it.Advance()) { const DictionaryValue* plugin = NULL; @@ -152,40 +149,26 @@ bool PluginFinder::FindPlugin( std::string identifier = plugin_it.key(); { base::AutoLock lock(mutex_); - std::map<std::string, PluginMetadata*>::const_iterator metadata_it = - identifier_plugin_.find(identifier); - DCHECK(metadata_it != identifier_plugin_.end()); - *plugin_metadata = metadata_it->second->Clone(); - - std::map<std::string, PluginInstaller*>::const_iterator installer_it = + std::map<std::string, PluginInstaller*>::const_iterator installer = installers_.find(identifier); - DCHECK(installer_it != installers_.end()); - *installer = installer_it->second; - return true; + DCHECK(installer != installers_.end()); + return installer->second; } } } } - return false; + return NULL; } -bool PluginFinder::FindPluginWithIdentifier( - const std::string& identifier, - PluginInstaller** installer, - scoped_ptr<PluginMetadata>* plugin_metadata) { +PluginInstaller* PluginFinder::FindPluginWithIdentifier( + const std::string& identifier) { base::AutoLock lock(mutex_); std::map<std::string, PluginInstaller*>::const_iterator it = installers_.find(identifier); - if (it != installers_.end()) { - *installer = it->second; - std::map<std::string, PluginMetadata*>::const_iterator metadata_it = - identifier_plugin_.find(identifier); - DCHECK(metadata_it != identifier_plugin_.end()); - *plugin_metadata = metadata_it->second->Clone(); - return true; - } + if (it != installers_.end()) + return it->second; - return false; + return NULL; } #endif @@ -250,11 +233,11 @@ PluginMetadata* PluginFinder::CreatePluginMetadata( return plugin; } -scoped_ptr<PluginMetadata> PluginFinder::GetPluginMetadata( +PluginMetadata* PluginFinder::GetPluginMetadata( const webkit::WebPluginInfo& plugin) { base::AutoLock lock(mutex_); if (name_plugin_.find(plugin.name) != name_plugin_.end()) - return name_plugin_[plugin.name]->Clone(); + return name_plugin_[plugin.name]; // Use the group name matcher to find the plug-in metadata we want. for (std::map<std::string, PluginMetadata*>::const_iterator it = @@ -263,7 +246,7 @@ scoped_ptr<PluginMetadata> PluginFinder::GetPluginMetadata( continue; name_plugin_[plugin.name] = it->second; - return it->second->Clone(); + return it->second; } // The plug-in metadata was not found, create a dummy one holding @@ -276,5 +259,5 @@ scoped_ptr<PluginMetadata> PluginFinder::GetPluginMetadata( name_plugin_[plugin.name] = metadata; identifier_plugin_[identifier] = metadata; - return metadata->Clone(); + return metadata; } |