Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "webkit/plugins/npapi/plugin_list.h" | 5 #include "webkit/plugins/npapi/plugin_list.h" |
| 6 | 6 |
| 7 #include <tchar.h> | 7 #include <tchar.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 FilePath filename = path.Append(find_file_data.cFileName); | 268 FilePath filename = path.Append(find_file_data.cFileName); |
| 269 LoadPlugin(filename, plugins); | 269 LoadPlugin(filename, plugins); |
| 270 visited_plugins->insert(filename); | 270 visited_plugins->insert(filename); |
| 271 } | 271 } |
| 272 } while (FindNextFile(find_handle, &find_file_data) != 0); | 272 } while (FindNextFile(find_handle, &find_file_data) != 0); |
| 273 | 273 |
| 274 DCHECK(GetLastError() == ERROR_NO_MORE_FILES); | 274 DCHECK(GetLastError() == ERROR_NO_MORE_FILES); |
| 275 FindClose(find_handle); | 275 FindClose(find_handle); |
| 276 } | 276 } |
| 277 | 277 |
| 278 void PluginList::LoadPluginsFromRegistry( | 278 void PluginList::LoadPluginsFromRegistry(std::vector<WebPluginInfo>* plugins, |
| 279 std::vector<WebPluginInfo>* plugins, | 279 std::set<FilePath>* visited_plugins) { |
| 280 std::set<FilePath>* visited_plugins) { | |
| 281 std::set<FilePath> plugin_dirs; | 280 std::set<FilePath> plugin_dirs; |
| 282 | 281 |
| 283 GetPluginsInRegistryDirectory( | 282 GetPluginsInRegistryDirectory( |
| 284 HKEY_CURRENT_USER, kRegistryMozillaPlugins, &plugin_dirs); | 283 HKEY_CURRENT_USER, kRegistryMozillaPlugins, &plugin_dirs); |
| 285 GetPluginsInRegistryDirectory( | 284 GetPluginsInRegistryDirectory( |
| 286 HKEY_LOCAL_MACHINE, kRegistryMozillaPlugins, &plugin_dirs); | 285 HKEY_LOCAL_MACHINE, kRegistryMozillaPlugins, &plugin_dirs); |
| 287 | 286 |
| 288 for (std::set<FilePath>::iterator i = plugin_dirs.begin(); | 287 for (std::set<FilePath>::iterator i = plugin_dirs.begin(); |
| 289 i != plugin_dirs.end(); ++i) { | 288 i != plugin_dirs.end(); ++i) { |
| 290 LoadPlugin(*i, plugins); | 289 LoadPlugin(*i, plugins); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 333 } | 332 } |
| 334 return false; | 333 return false; |
| 335 } | 334 } |
| 336 | 335 |
| 337 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info, | 336 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info, |
| 338 std::vector<WebPluginInfo>* plugins) { | 337 std::vector<WebPluginInfo>* plugins) { |
| 339 // Version check | 338 // Version check |
| 340 | 339 |
| 341 for (size_t i = 0; i < plugins->size(); ++i) { | 340 for (size_t i = 0; i < plugins->size(); ++i) { |
| 342 std::wstring plugin1 = | 341 std::wstring plugin1 = |
| 343 StringToLowerASCII((*plugins)[i].path.BaseName().ToWStringHack()); | 342 StringToLowerASCII(plugins->at(i).path.BaseName().ToWStringHack()); |
|
jam
2011/01/19 20:22:09
ditto for this file, it doesn't look like any chan
pastarmovj
2011/01/19 23:39:17
Done.
| |
| 344 std::wstring plugin2 = | 343 std::wstring plugin2 = |
| 345 StringToLowerASCII(info.path.BaseName().ToWStringHack()); | 344 StringToLowerASCII(info.path.BaseName().ToWStringHack()); |
| 346 if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[i], info)) || | 345 if ((plugin1 == plugin2 && HaveSharedMimeType(plugins->at(i), info)) || |
| 347 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || | 346 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || |
| 348 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { | 347 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { |
| 349 if (!IsNewerVersion((*plugins)[i].version, info.version)) | 348 if (!IsNewerVersion(plugins->at(i).version, info.version)) |
| 350 return false; // We have loaded a plugin whose version is newer. | 349 return false; // We have loaded a plugin whose version is newer. |
| 351 | 350 |
| 352 plugins->erase(plugins->begin() + i); | 351 plugins->erase(plugins->begin() + i); |
| 353 break; | 352 break; |
| 354 } | 353 } |
| 355 } | 354 } |
| 356 | 355 |
| 357 // Troublemakers | 356 // Troublemakers |
| 358 | 357 |
| 359 std::wstring filename = StringToLowerASCII(info.path.BaseName().value()); | 358 std::wstring filename = StringToLowerASCII(info.path.BaseName().value()); |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 390 } | 389 } |
| 391 | 390 |
| 392 // Special WMP handling | 391 // Special WMP handling |
| 393 | 392 |
| 394 // If both the new and old WMP plugins exist, only load the new one. | 393 // If both the new and old WMP plugins exist, only load the new one. |
| 395 if (filename == kNewWMPPlugin) { | 394 if (filename == kNewWMPPlugin) { |
| 396 if (dont_load_new_wmp_) | 395 if (dont_load_new_wmp_) |
| 397 return false; | 396 return false; |
| 398 | 397 |
| 399 for (size_t i = 0; i < plugins->size(); ++i) { | 398 for (size_t i = 0; i < plugins->size(); ++i) { |
| 400 if ((*plugins)[i].path.BaseName().value() == kOldWMPPlugin) { | 399 if (plugins->at(i).path.BaseName().value() == kOldWMPPlugin) { |
| 401 plugins->erase(plugins->begin() + i); | 400 plugins->erase(plugins->begin() + i); |
| 402 break; | 401 break; |
| 403 } | 402 } |
| 404 } | 403 } |
| 405 } else if (filename == kOldWMPPlugin) { | 404 } else if (filename == kOldWMPPlugin) { |
| 406 for (size_t i = 0; i < plugins->size(); ++i) { | 405 for (size_t i = 0; i < plugins->size(); ++i) { |
| 407 if ((*plugins)[i].path.BaseName().value() == kNewWMPPlugin) | 406 if (plugins->at(i).path.BaseName().value() == kNewWMPPlugin) |
| 408 return false; | 407 return false; |
| 409 } | 408 } |
| 410 } | 409 } |
| 411 | 410 |
| 412 return true; | 411 return true; |
| 413 } | 412 } |
| 414 | 413 |
| 415 } // namespace npapi | 414 } // namespace npapi |
| 416 } // namespace webkit | 415 } // namespace webkit |
| OLD | NEW |