Chromium Code Reviews| Index: webkit/glue/plugins/plugin_list_win.cc |
| diff --git a/webkit/glue/plugins/plugin_list_win.cc b/webkit/glue/plugins/plugin_list_win.cc |
| index 486926251b8cb48774389c3a4d9e8824307a2c25..7da186229aa4b512772eb5c36352c8ea69d6dfbd 100644 |
| --- a/webkit/glue/plugins/plugin_list_win.cc |
| +++ b/webkit/glue/plugins/plugin_list_win.cc |
| @@ -245,7 +245,7 @@ void PluginList::GetPluginDirectories(std::vector<FilePath>* plugin_dirs) { |
| } |
| void PluginList::LoadPluginsFromDir(const FilePath &path, |
| - std::vector<WebPluginInfo>* plugins, |
| + std::vector<WebPluginInfo*>* plugins, |
| std::set<FilePath>* visited_plugins) { |
| WIN32_FIND_DATA find_file_data; |
| HANDLE find_handle; |
| @@ -270,9 +270,8 @@ void PluginList::LoadPluginsFromDir(const FilePath &path, |
| FindClose(find_handle); |
| } |
| -void PluginList::LoadPluginsFromRegistry( |
| - std::vector<WebPluginInfo>* plugins, |
| - std::set<FilePath>* visited_plugins) { |
| +void PluginList::LoadPluginsFromRegistry(std::set<FilePath>* visited_plugins, |
| + std::vector<WebPluginInfo*>* plugins) { |
| std::set<FilePath> plugin_dirs; |
| GetPluginsInRegistryDirectory( |
| @@ -330,21 +329,25 @@ bool IsNewerVersion(const std::wstring& a, const std::wstring& b) { |
| } |
| bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info, |
| - std::vector<WebPluginInfo>* plugins) { |
| + std::vector<WebPluginInfo*>* plugins) { |
| // Version check |
| - for (size_t i = 0; i < plugins->size(); ++i) { |
| + for (std::vector<WebPluginInfo*>::iterator it = plugins->begin(); |
|
jam
2010/12/15 18:25:50
I think the former code is more readable. please
pastarmovj
2010/12/15 21:56:04
Actually I only tried to bring in some consistency
|
| + it != plugins->end(); |
| + ++it) { |
| std::wstring plugin1 = |
| - StringToLowerASCII((*plugins)[i].path.BaseName().ToWStringHack()); |
| + StringToLowerASCII((*it)->path.BaseName().ToWStringHack()); |
| std::wstring plugin2 = |
| StringToLowerASCII(info.path.BaseName().ToWStringHack()); |
| - if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[i], info)) || |
| + if ((plugin1 == plugin2 && HaveSharedMimeType(**it, info)) || |
| (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || |
| (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { |
| - if (!IsNewerVersion((*plugins)[i].version, info.version)) |
| + if (!IsNewerVersion((*it)->version, info.version)) |
| return false; // We have loaded a plugin whose version is newer. |
| - plugins->erase(plugins->begin() + i); |
| + // TODO(pastarmovj): We can't just remove it like that. We could possibly |
| + // disable it first. |
| + plugins->erase(it); |
| break; |
| } |
| } |
| @@ -391,15 +394,21 @@ bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info, |
| if (dont_load_new_wmp_) |
| return false; |
| - for (size_t i = 0; i < plugins->size(); ++i) { |
| - if ((*plugins)[i].path.BaseName().value() == kOldWMPPlugin) { |
| - plugins->erase(plugins->begin() + i); |
| + for (std::vector<WebPluginInfo*>::iterator it = plugins->begin(); |
|
jam
2010/12/15 18:25:50
ditto
|
| + it != plugins->end(); |
| + ++it) { |
| + if ((*it)->path.BaseName().value() == kOldWMPPlugin) { |
| + // TODO(pastarmovj): We can't just remove it like that. We could |
| + // possibly disable it first. |
| + plugins->erase(it); |
| break; |
| } |
| } |
| } else if (filename == kOldWMPPlugin) { |
| - for (size_t i = 0; i < plugins->size(); ++i) { |
| - if ((*plugins)[i].path.BaseName().value() == kNewWMPPlugin) |
| + for (std::vector<WebPluginInfo*>::iterator it = plugins->begin(); |
|
jam
2010/12/15 18:25:50
ditto
|
| + it != plugins->end(); |
| + ++it) { |
| + if ((*it)->path.BaseName().value() == kNewWMPPlugin) |
| return false; |
| } |
| } |