Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "webkit/plugins/npapi/plugin_group.h" | 7 #include "webkit/plugins/npapi/plugin_group.h" |
| 8 | 8 |
| 9 #include "base/linked_ptr.h" | 9 #include "base/linked_ptr.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 } | 241 } |
| 242 web_plugin_infos_.push_back(plugin); | 242 web_plugin_infos_.push_back(plugin); |
| 243 UpdateActivePlugin(web_plugin_infos_.back()); | 243 UpdateActivePlugin(web_plugin_infos_.back()); |
| 244 } | 244 } |
| 245 | 245 |
| 246 bool PluginGroup::RemovePlugin(const FilePath& filename) { | 246 bool PluginGroup::RemovePlugin(const FilePath& filename) { |
| 247 bool did_remove = false; | 247 bool did_remove = false; |
| 248 ResetGroupState(); | 248 ResetGroupState(); |
| 249 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { | 249 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { |
| 250 if (web_plugin_infos_[i].path == filename) { | 250 if (web_plugin_infos_[i].path == filename) { |
| 251 web_plugin_infos_.erase(web_plugin_infos_.begin() + i); | 251 web_plugin_infos_.erase(web_plugin_infos_.begin() + i--); |
|
jam
2011/02/23 19:49:59
nit: usually i've seen this be done by not having
| |
| 252 did_remove = true; | 252 did_remove = true; |
| 253 } else { | |
| 254 UpdateActivePlugin(web_plugin_infos_[i]); | |
| 253 } | 255 } |
| 254 UpdateActivePlugin(web_plugin_infos_[i]); | |
| 255 } | 256 } |
| 256 return did_remove; | 257 return did_remove; |
| 257 } | 258 } |
| 258 | 259 |
| 259 bool PluginGroup::EnablePlugin(const FilePath& filename) { | 260 bool PluginGroup::EnablePlugin(const FilePath& filename) { |
| 260 bool did_enable = false; | 261 bool did_enable = false; |
| 261 ResetGroupState(); | 262 ResetGroupState(); |
| 262 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { | 263 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { |
| 263 if (web_plugin_infos_[i].path == filename) | 264 if (web_plugin_infos_[i].path == filename) |
| 264 did_enable = Enable(&web_plugin_infos_[i], WebPluginInfo::USER_ENABLED); | 265 did_enable = Enable(&web_plugin_infos_[i], WebPluginInfo::USER_ENABLED); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 521 // Only changeable if not managed. | 522 // Only changeable if not managed. |
| 522 if (plugin->enabled & WebPluginInfo::MANAGED_MASK) | 523 if (plugin->enabled & WebPluginInfo::MANAGED_MASK) |
| 523 return false; | 524 return false; |
| 524 plugin->enabled = new_reason; | 525 plugin->enabled = new_reason; |
| 525 } | 526 } |
| 526 return true; | 527 return true; |
| 527 } | 528 } |
| 528 | 529 |
| 529 } // namespace npapi | 530 } // namespace npapi |
| 530 } // namespace webkit | 531 } // namespace webkit |
| OLD | NEW |