| 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 "webkit/plugins/npapi/plugin_group.h" | 5 #include "webkit/plugins/npapi/plugin_group.h" |
| 6 | 6 |
| 7 #include "base/linked_ptr.h" | 7 #include "base/linked_ptr.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 return; | 231 return; |
| 232 } | 232 } |
| 233 } | 233 } |
| 234 web_plugin_infos_.push_back(plugin); | 234 web_plugin_infos_.push_back(plugin); |
| 235 UpdateActivePlugin(web_plugin_infos_.back()); | 235 UpdateActivePlugin(web_plugin_infos_.back()); |
| 236 } | 236 } |
| 237 | 237 |
| 238 bool PluginGroup::RemovePlugin(const FilePath& filename) { | 238 bool PluginGroup::RemovePlugin(const FilePath& filename) { |
| 239 bool did_remove = false; | 239 bool did_remove = false; |
| 240 ResetGroupState(); | 240 ResetGroupState(); |
| 241 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { | 241 for (size_t i = 0; i < web_plugin_infos_.size();) { |
| 242 if (web_plugin_infos_[i].path == filename) { | 242 if (web_plugin_infos_[i].path == filename) { |
| 243 web_plugin_infos_.erase(web_plugin_infos_.begin() + i); | 243 web_plugin_infos_.erase(web_plugin_infos_.begin() + i); |
| 244 did_remove = true; | 244 did_remove = true; |
| 245 } else { |
| 246 UpdateActivePlugin(web_plugin_infos_[i]); |
| 247 i++; |
| 245 } | 248 } |
| 246 UpdateActivePlugin(web_plugin_infos_[i]); | |
| 247 } | 249 } |
| 248 return did_remove; | 250 return did_remove; |
| 249 } | 251 } |
| 250 | 252 |
| 251 bool PluginGroup::EnablePlugin(const FilePath& filename) { | 253 bool PluginGroup::EnablePlugin(const FilePath& filename) { |
| 252 bool did_enable = false; | 254 bool did_enable = false; |
| 253 ResetGroupState(); | 255 ResetGroupState(); |
| 254 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { | 256 for (size_t i = 0; i < web_plugin_infos_.size(); ++i) { |
| 255 if (web_plugin_infos_[i].path == filename) | 257 if (web_plugin_infos_[i].path == filename) |
| 256 did_enable = Enable(&web_plugin_infos_[i], WebPluginInfo::USER_ENABLED); | 258 did_enable = Enable(&web_plugin_infos_[i], WebPluginInfo::USER_ENABLED); |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 // Only changeable if not managed. | 506 // Only changeable if not managed. |
| 505 if (plugin->enabled & WebPluginInfo::MANAGED_MASK) | 507 if (plugin->enabled & WebPluginInfo::MANAGED_MASK) |
| 506 return false; | 508 return false; |
| 507 plugin->enabled = new_reason; | 509 plugin->enabled = new_reason; |
| 508 } | 510 } |
| 509 return true; | 511 return true; |
| 510 } | 512 } |
| 511 | 513 |
| 512 } // namespace npapi | 514 } // namespace npapi |
| 513 } // namespace webkit | 515 } // namespace webkit |
| OLD | NEW |