| 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/glue/plugins/plugin_list.h" | 5 #include "webkit/glue/plugins/plugin_list.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 if (it->path == filename) { | 428 if (it->path == filename) { |
| 429 DCHECK(!it->enabled); // Should have been disabled. | 429 DCHECK(!it->enabled); // Should have been disabled. |
| 430 it->enabled = true; | 430 it->enabled = true; |
| 431 did_enable = true; | 431 did_enable = true; |
| 432 } | 432 } |
| 433 } | 433 } |
| 434 | 434 |
| 435 return did_enable; | 435 return did_enable; |
| 436 } | 436 } |
| 437 | 437 |
| 438 PluginList::~PluginList() { |
| 439 } |
| 440 |
| 438 bool PluginList::DisablePlugin(const FilePath& filename) { | 441 bool PluginList::DisablePlugin(const FilePath& filename) { |
| 439 AutoLock lock(lock_); | 442 AutoLock lock(lock_); |
| 440 | 443 |
| 441 bool did_disable = false; | 444 bool did_disable = false; |
| 442 | 445 |
| 443 if (disabled_plugins_.find(filename) != disabled_plugins_.end()) | 446 if (disabled_plugins_.find(filename) != disabled_plugins_.end()) |
| 444 return did_disable; // Early exit if plugin already in disabled list. | 447 return did_disable; // Early exit if plugin already in disabled list. |
| 445 | 448 |
| 446 disabled_plugins_.insert(filename); // Add to disabled list. | 449 disabled_plugins_.insert(filename); // Add to disabled list. |
| 447 | 450 |
| 448 // Unset enabled flags if necessary. | 451 // Unset enabled flags if necessary. |
| 449 for (std::vector<WebPluginInfo>::iterator it = plugins_.begin(); | 452 for (std::vector<WebPluginInfo>::iterator it = plugins_.begin(); |
| 450 it != plugins_.end(); | 453 it != plugins_.end(); |
| 451 ++it) { | 454 ++it) { |
| 452 if (it->path == filename) { | 455 if (it->path == filename) { |
| 453 DCHECK(it->enabled); // Should have been enabled. | 456 DCHECK(it->enabled); // Should have been enabled. |
| 454 it->enabled = false; | 457 it->enabled = false; |
| 455 did_disable = true; | 458 did_disable = true; |
| 456 } | 459 } |
| 457 } | 460 } |
| 458 | 461 |
| 459 return did_disable; | 462 return did_disable; |
| 460 } | 463 } |
| 461 | 464 |
| 462 void PluginList::Shutdown() { | 465 void PluginList::Shutdown() { |
| 463 // TODO | 466 // TODO |
| 464 } | 467 } |
| 465 | 468 |
| 466 } // namespace NPAPI | 469 } // namespace NPAPI |
| OLD | NEW |