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

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: Make windows compiler even happier. 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::set<FilePath>* visited_plugins,
274 std::vector<WebPluginInfo>* plugins, 274 std::vector<WebPluginInfo>* 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 if (cur_a < cur_b) 325 if (cur_a < cur_b)
327 return true; 326 return true;
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 (std::vector<WebPluginInfo>::iterator it = plugins->begin();
jam 2010/12/17 19:14:45 please leave as before
pastarmovj 2010/12/20 19:57:37 Done.
336 it != plugins->end();
337 ++it) {
337 std::wstring plugin1 = 338 std::wstring plugin1 =
338 StringToLowerASCII((*plugins)[i].path.BaseName().ToWStringHack()); 339 StringToLowerASCII(it->path.BaseName().ToWStringHack());
339 std::wstring plugin2 = 340 std::wstring plugin2 =
340 StringToLowerASCII(info.path.BaseName().ToWStringHack()); 341 StringToLowerASCII(info.path.BaseName().ToWStringHack());
341 if ((plugin1 == plugin2 && HaveSharedMimeType((*plugins)[i], info)) || 342 if ((plugin1 == plugin2 && HaveSharedMimeType(*it, info)) ||
342 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) || 343 (plugin1 == kJavaDeploy1 && plugin2 == kJavaDeploy2) ||
343 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) { 344 (plugin1 == kJavaDeploy2 && plugin2 == kJavaDeploy1)) {
344 if (!IsNewerVersion((*plugins)[i].version, info.version)) 345 if (!IsNewerVersion(it->version, info.version))
345 return false; // We have loaded a plugin whose version is newer. 346 return false; // We have loaded a plugin whose version is newer.
346 347
347 plugins->erase(plugins->begin() + i); 348 // TODO(pastarmovj): We can't just remove it like that. We could possibly
349 // disable it first.
350 plugins->erase(it);
348 break; 351 break;
349 } 352 }
350 } 353 }
351 354
352 // Troublemakers 355 // Troublemakers
353 356
354 std::wstring filename = StringToLowerASCII(info.path.BaseName().value()); 357 std::wstring filename = StringToLowerASCII(info.path.BaseName().value());
355 // Depends on XPCOM. 358 // Depends on XPCOM.
356 if (filename == kMozillaActiveXPlugin) 359 if (filename == kMozillaActiveXPlugin)
357 return false; 360 return false;
(...skipping 26 matching lines...) Expand all
384 } 387 }
385 } 388 }
386 389
387 // Special WMP handling 390 // Special WMP handling
388 391
389 // If both the new and old WMP plugins exist, only load the new one. 392 // If both the new and old WMP plugins exist, only load the new one.
390 if (filename == kNewWMPPlugin) { 393 if (filename == kNewWMPPlugin) {
391 if (dont_load_new_wmp_) 394 if (dont_load_new_wmp_)
392 return false; 395 return false;
393 396
394 for (size_t i = 0; i < plugins->size(); ++i) { 397 for (std::vector<WebPluginInfo>::iterator it = plugins->begin();
jam 2010/12/17 19:14:45 please leave as before
pastarmovj 2010/12/20 19:57:37 Done.
395 if ((*plugins)[i].path.BaseName().value() == kOldWMPPlugin) { 398 it != plugins->end();
396 plugins->erase(plugins->begin() + i); 399 ++it) {
400 if (it->path.BaseName().value() == kOldWMPPlugin) {
401 // TODO(pastarmovj): We can't just remove it like that. We could
402 // possibly disable it first.
jam 2010/12/17 19:14:45 why can't we remove it like this? why is this a T
pastarmovj 2010/12/20 19:57:37 Now we can again :)
403 plugins->erase(it);
397 break; 404 break;
398 } 405 }
399 } 406 }
400 } else if (filename == kOldWMPPlugin) { 407 } else if (filename == kOldWMPPlugin) {
401 for (size_t i = 0; i < plugins->size(); ++i) { 408 for (std::vector<WebPluginInfo>::iterator it = plugins->begin();
jam 2010/12/17 19:14:45 please leave as before
pastarmovj 2010/12/20 19:57:37 Done.
402 if ((*plugins)[i].path.BaseName().value() == kNewWMPPlugin) 409 it != plugins->end();
410 ++it) {
411 if (it->path.BaseName().value() == kNewWMPPlugin)
403 return false; 412 return false;
404 } 413 }
405 } 414 }
406 415
407 return true; 416 return true;
408 } 417 }
409 418
410 } // namespace NPAPI 419 } // namespace NPAPI
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698