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/memory/linked_ptr.h" | 9 #include "base/memory/linked_ptr.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 237 } |
238 } | 238 } |
239 // None of the VersionRanges matched. | 239 // None of the VersionRanges matched. |
240 return false; | 240 return false; |
241 } | 241 } |
242 | 242 |
243 /* static */ | 243 /* static */ |
244 Version* PluginGroup::CreateVersionFromString(const string16& version_string) { | 244 Version* PluginGroup::CreateVersionFromString(const string16& version_string) { |
245 // Remove spaces and ')' from the version string, | 245 // Remove spaces and ')' from the version string, |
246 // Replace any instances of 'r', ',' or '(' with a dot. | 246 // Replace any instances of 'r', ',' or '(' with a dot. |
247 std::wstring version = UTF16ToWide(version_string); | 247 std::string version = UTF16ToASCII(version_string); |
248 RemoveChars(version, L") ", &version); | 248 RemoveChars(version, ") ", &version); |
249 std::replace(version.begin(), version.end(), 'd', '.'); | 249 std::replace(version.begin(), version.end(), 'd', '.'); |
250 std::replace(version.begin(), version.end(), 'r', '.'); | 250 std::replace(version.begin(), version.end(), 'r', '.'); |
251 std::replace(version.begin(), version.end(), ',', '.'); | 251 std::replace(version.begin(), version.end(), ',', '.'); |
252 std::replace(version.begin(), version.end(), '(', '.'); | 252 std::replace(version.begin(), version.end(), '(', '.'); |
253 std::replace(version.begin(), version.end(), '_', '.'); | 253 std::replace(version.begin(), version.end(), '_', '.'); |
254 | 254 |
255 return Version::GetVersionFromString(WideToASCII(version)); | 255 return Version::GetVersionFromString(version); |
256 } | 256 } |
257 | 257 |
258 void PluginGroup::UpdateActivePlugin(const WebPluginInfo& plugin) { | 258 void PluginGroup::UpdateActivePlugin(const WebPluginInfo& plugin) { |
259 // A group is enabled if any of the files are enabled. | 259 // A group is enabled if any of the files are enabled. |
260 if (IsPluginEnabled(plugin)) { | 260 if (IsPluginEnabled(plugin)) { |
261 // The description of the group needs update either when it's state is | 261 // The description of the group needs update either when it's state is |
262 // about to change to enabled or if has never been set. | 262 // about to change to enabled or if has never been set. |
263 if (!enabled_ || description_.empty()) | 263 if (!enabled_ || description_.empty()) |
264 UpdateDescriptionAndVersion(plugin); | 264 UpdateDescriptionAndVersion(plugin); |
265 // In case an enabled plugin has been added to a group that is currently | 265 // In case an enabled plugin has been added to a group that is currently |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
630 bool PluginGroup::Disable(WebPluginInfo* plugin, int new_reason) { | 630 bool PluginGroup::Disable(WebPluginInfo* plugin, int new_reason) { |
631 DCHECK(new_reason == WebPluginInfo::USER_DISABLED || | 631 DCHECK(new_reason == WebPluginInfo::USER_DISABLED || |
632 new_reason == WebPluginInfo::POLICY_DISABLED || | 632 new_reason == WebPluginInfo::POLICY_DISABLED || |
633 new_reason == WebPluginInfo::USER_DISABLED_POLICY_DISABLED || | 633 new_reason == WebPluginInfo::USER_DISABLED_POLICY_DISABLED || |
634 new_reason == WebPluginInfo::POLICY_UNMANAGED); | 634 new_reason == WebPluginInfo::POLICY_UNMANAGED); |
635 return SetPluginState(plugin, new_reason, IsPluginEnabled(*plugin)); | 635 return SetPluginState(plugin, new_reason, IsPluginEnabled(*plugin)); |
636 } | 636 } |
637 | 637 |
638 } // namespace npapi | 638 } // namespace npapi |
639 } // namespace webkit | 639 } // namespace webkit |
OLD | NEW |