| 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_group.h" | 5 #include "webkit/glue/plugins/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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // Match if the plugin is contained in any of the defined VersionRanges. | 192 // Match if the plugin is contained in any of the defined VersionRanges. |
| 193 for (size_t i = 0; i < version_ranges_.size(); ++i) { | 193 for (size_t i = 0; i < version_ranges_.size(); ++i) { |
| 194 if (IsVersionInRange(*plugin_version, version_ranges_[i])) { | 194 if (IsVersionInRange(*plugin_version, version_ranges_[i])) { |
| 195 return true; | 195 return true; |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 // None of the VersionRanges matched. | 198 // None of the VersionRanges matched. |
| 199 return false; | 199 return false; |
| 200 } | 200 } |
| 201 | 201 |
| 202 /* static */ |
| 202 Version* PluginGroup::CreateVersionFromString(const string16& version_string) { | 203 Version* PluginGroup::CreateVersionFromString(const string16& version_string) { |
| 203 // Remove spaces and ')' from the version string, | 204 // Remove spaces and ')' from the version string, |
| 204 // Replace any instances of 'r', ',' or '(' with a dot. | 205 // Replace any instances of 'r', ',' or '(' with a dot. |
| 205 std::wstring version = UTF16ToWide(version_string); | 206 std::wstring version = UTF16ToWide(version_string); |
| 206 RemoveChars(version, L") ", &version); | 207 RemoveChars(version, L") ", &version); |
| 207 std::replace(version.begin(), version.end(), 'r', '.'); | 208 std::replace(version.begin(), version.end(), 'r', '.'); |
| 208 std::replace(version.begin(), version.end(), ',', '.'); | 209 std::replace(version.begin(), version.end(), ',', '.'); |
| 209 std::replace(version.begin(), version.end(), '(', '.'); | 210 std::replace(version.begin(), version.end(), '(', '.'); |
| 210 | 211 |
| 211 return Version::GetVersionFromString(version); | 212 return Version::GetVersionFromString(version); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 NPAPI::PluginList::Singleton()->EnablePlugin(it->path); | 398 NPAPI::PluginList::Singleton()->EnablePlugin(it->path); |
| 398 it->enabled = true; | 399 it->enabled = true; |
| 399 enabled_plugin_exists = true; | 400 enabled_plugin_exists = true; |
| 400 } else { | 401 } else { |
| 401 it->enabled = false; | 402 it->enabled = false; |
| 402 NPAPI::PluginList::Singleton()->DisablePlugin(it->path); | 403 NPAPI::PluginList::Singleton()->DisablePlugin(it->path); |
| 403 } | 404 } |
| 404 } | 405 } |
| 405 enabled_ = enabled_plugin_exists; | 406 enabled_ = enabled_plugin_exists; |
| 406 } | 407 } |
| OLD | NEW |