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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 if (plugin_version.get() == NULL) { | 243 if (plugin_version.get() == NULL) { |
244 // No version could be extracted, assume we don't match the range. | 244 // No version could be extracted, assume we don't match the range. |
245 return false; | 245 return false; |
246 } | 246 } |
247 | 247 |
248 // We match if we are in the range: [low, high) | 248 // We match if we are in the range: [low, high) |
249 return (version_range_low_->CompareTo(*plugin_version) <= 0 && | 249 return (version_range_low_->CompareTo(*plugin_version) <= 0 && |
250 version_range_high_->CompareTo(*plugin_version) > 0); | 250 version_range_high_->CompareTo(*plugin_version) > 0); |
251 } | 251 } |
252 | 252 |
| 253 /* static */ |
253 Version* PluginGroup::CreateVersionFromString(const string16& version_string) { | 254 Version* PluginGroup::CreateVersionFromString(const string16& version_string) { |
254 // Remove spaces and ')' from the version string, | 255 // Remove spaces and ')' from the version string, |
255 // Replace any instances of 'r', ',' or '(' with a dot. | 256 // Replace any instances of 'r', ',' or '(' with a dot. |
256 std::wstring version = UTF16ToWide(version_string); | 257 std::wstring version = UTF16ToWide(version_string); |
257 RemoveChars(version, L") ", &version); | 258 RemoveChars(version, L") ", &version); |
258 std::replace(version.begin(), version.end(), 'r', '.'); | 259 std::replace(version.begin(), version.end(), 'r', '.'); |
259 std::replace(version.begin(), version.end(), ',', '.'); | 260 std::replace(version.begin(), version.end(), ',', '.'); |
260 std::replace(version.begin(), version.end(), '(', '.'); | 261 std::replace(version.begin(), version.end(), '(', '.'); |
261 | 262 |
262 return Version::GetVersionFromString(version); | 263 return Version::GetVersionFromString(version); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 for (std::vector<WebPluginInfo>::const_iterator it = | 411 for (std::vector<WebPluginInfo>::const_iterator it = |
411 web_plugin_infos_.begin(); | 412 web_plugin_infos_.begin(); |
412 it != web_plugin_infos_.end(); ++it) { | 413 it != web_plugin_infos_.end(); ++it) { |
413 if (enable && !IsPluginNameDisabledByPolicy(it->name)) { | 414 if (enable && !IsPluginNameDisabledByPolicy(it->name)) { |
414 NPAPI::PluginList::Singleton()->EnablePlugin(it->path); | 415 NPAPI::PluginList::Singleton()->EnablePlugin(it->path); |
415 } else { | 416 } else { |
416 NPAPI::PluginList::Singleton()->DisablePlugin(it->path); | 417 NPAPI::PluginList::Singleton()->DisablePlugin(it->path); |
417 } | 418 } |
418 } | 419 } |
419 } | 420 } |
OLD | NEW |