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

Side by Side Diff: webkit/glue/plugins/plugin_list_win.cc

Issue 5699005: Policy: Re-enabled plugin still disabled (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More fixes and cleanups. Created 10 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/glue/plugins/plugin_list.h" 5 #include "webkit/glue/plugins/plugin_list.h"
6 6
7 #include <tchar.h> 7 #include <tchar.h>
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 FilePath filename = path.Append(find_file_data.cFileName); 263 FilePath filename = path.Append(find_file_data.cFileName);
264 LoadPlugin(filename, plugins); 264 LoadPlugin(filename, plugins);
265 visited_plugins->insert(filename); 265 visited_plugins->insert(filename);
266 } 266 }
267 } while (FindNextFile(find_handle, &find_file_data) != 0); 267 } while (FindNextFile(find_handle, &find_file_data) != 0);
268 268
269 DCHECK(GetLastError() == ERROR_NO_MORE_FILES); 269 DCHECK(GetLastError() == ERROR_NO_MORE_FILES);
270 FindClose(find_handle); 270 FindClose(find_handle);
271 } 271 }
272 272
273 void PluginList::LoadPluginsFromRegistry( 273 void PluginList::LoadPluginsFromRegistry(std::vector<WebPluginInfo>* plugins,
274 std::vector<WebPluginInfo>* plugins, 274 std::set<FilePath>* visited_plugins) {
275 std::set<FilePath>* visited_plugins) {
276 std::set<FilePath> plugin_dirs; 275 std::set<FilePath> plugin_dirs;
277 276
278 GetPluginsInRegistryDirectory( 277 GetPluginsInRegistryDirectory(
279 HKEY_CURRENT_USER, kRegistryMozillaPlugins, &plugin_dirs); 278 HKEY_CURRENT_USER, kRegistryMozillaPlugins, &plugin_dirs);
280 GetPluginsInRegistryDirectory( 279 GetPluginsInRegistryDirectory(
281 HKEY_LOCAL_MACHINE, kRegistryMozillaPlugins, &plugin_dirs); 280 HKEY_LOCAL_MACHINE, kRegistryMozillaPlugins, &plugin_dirs);
282 281
283 for (std::set<FilePath>::iterator i = plugin_dirs.begin(); 282 for (std::set<FilePath>::iterator i = plugin_dirs.begin();
284 i != plugin_dirs.end(); ++i) { 283 i != plugin_dirs.end(); ++i) {
285 LoadPlugin(*i, plugins); 284 LoadPlugin(*i, plugins);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } 327 }
329 return false; 328 return false;
330 } 329 }
331 330
332 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info, 331 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info,
333 std::vector<WebPluginInfo>* plugins) { 332 std::vector<WebPluginInfo>* plugins) {
334 // Version check 333 // Version check
335 334
336 for (size_t i = 0; i < plugins->size(); ++i) { 335 for (size_t i = 0; i < plugins->size(); ++i) {
337 std::wstring plugin1 = 336 std::wstring plugin1 =
338 StringToLowerASCII((*plugins)[i].path.BaseName().ToWStringHack()); 337 StringToLowerASCII(plugins->at(i).path.BaseName().ToWStringHack());
339 std::wstring plugin2 = 338 std::wstring plugin2 =
340 StringToLowerASCII(info.path.BaseName().ToWStringHack()); 339 StringToLowerASCII(info.path.BaseName().ToWStringHack());
341 if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[i], info)) || 340 if ((plugin1 == plugin2 && HaveSharedMimeType(plugins->at(i), info)) ||
342 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || 341 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) ||
343 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { 342 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) {
344 if (!IsNewerVersion((*plugins)[i].version, info.version)) 343 if (!IsNewerVersion(plugins->at(i).version, info.version))
345 return false; // We have loaded a plugin whose version is newer. 344 return false; // We have loaded a plugin whose version is newer.
346 345
347 plugins->erase(plugins->begin() + i); 346 plugins->erase(plugins->begin() + i);
348 break; 347 break;
349 } 348 }
350 } 349 }
351 350
352 // Troublemakers 351 // Troublemakers
353 352
354 std::wstring filename = StringToLowerASCII(info.path.BaseName().value()); 353 std::wstring filename = StringToLowerASCII(info.path.BaseName().value());
(...skipping 30 matching lines...) Expand all
385 } 384 }
386 385
387 // Special WMP handling 386 // Special WMP handling
388 387
389 // If both the new and old WMP plugins exist, only load the new one. 388 // If both the new and old WMP plugins exist, only load the new one.
390 if (filename == kNewWMPPlugin) { 389 if (filename == kNewWMPPlugin) {
391 if (dont_load_new_wmp_) 390 if (dont_load_new_wmp_)
392 return false; 391 return false;
393 392
394 for (size_t i = 0; i < plugins->size(); ++i) { 393 for (size_t i = 0; i < plugins->size(); ++i) {
395 if ((*plugins)[i].path.BaseName().value() == kOldWMPPlugin) { 394 if (plugins->at(i).path.BaseName().value() == kOldWMPPlugin) {
396 plugins->erase(plugins->begin() + i); 395 plugins->erase(plugins->begin() + i);
397 break; 396 break;
398 } 397 }
399 } 398 }
400 } else if (filename == kOldWMPPlugin) { 399 } else if (filename == kOldWMPPlugin) {
401 for (size_t i = 0; i < plugins->size(); ++i) { 400 for (size_t i = 0; i < plugins->size(); ++i) {
402 if ((*plugins)[i].path.BaseName().value() == kNewWMPPlugin) 401 if (plugins->at(i).path.BaseName().value() == kNewWMPPlugin)
403 return false; 402 return false;
404 } 403 }
405 } 404 }
406 405
407 return true; 406 return true;
408 } 407 }
409 408
410 } // namespace NPAPI 409 } // namespace NPAPI
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698