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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 return; | 239 return; |
240 } | 240 } |
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();) { |
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); |
252 did_remove = true; | 252 did_remove = true; |
| 253 } else { |
| 254 UpdateActivePlugin(web_plugin_infos_[i]); |
| 255 i++; |
253 } | 256 } |
254 UpdateActivePlugin(web_plugin_infos_[i]); | |
255 } | 257 } |
256 return did_remove; | 258 return did_remove; |
257 } | 259 } |
258 | 260 |
259 bool PluginGroup::EnablePlugin(const FilePath& filename) { | 261 bool PluginGroup::EnablePlugin(const FilePath& filename) { |
260 bool did_enable = false; | 262 bool did_enable = false; |
261 ResetGroupState(); | 263 ResetGroupState(); |
262 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { | 264 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { |
263 if (web_plugin_infos_[i].path == filename) | 265 if (web_plugin_infos_[i].path == filename) |
264 did_enable = Enable(&web_plugin_infos_[i], WebPluginInfo::USER_ENABLED); | 266 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. | 523 // Only changeable if not managed. |
522 if (plugin->enabled & WebPluginInfo::MANAGED_MASK) | 524 if (plugin->enabled & WebPluginInfo::MANAGED_MASK) |
523 return false; | 525 return false; |
524 plugin->enabled = new_reason; | 526 plugin->enabled = new_reason; |
525 } | 527 } |
526 return true; | 528 return true; |
527 } | 529 } |
528 | 530 |
529 } // namespace npapi | 531 } // namespace npapi |
530 } // namespace webkit | 532 } // namespace webkit |
OLD | NEW |