Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Side by Side Diff: webkit/glue/plugins/plugin_group.cc

Issue 5905006: Revert 69490 - base/version: remove wstring version... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/dll_redirector.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 if (plugin.name.find(name_matcher_) == string16::npos) { 176 if (plugin.name.find(name_matcher_) == string16::npos) {
177 return false; 177 return false;
178 } 178 }
179 179
180 if (version_ranges_.empty()) { 180 if (version_ranges_.empty()) {
181 return true; 181 return true;
182 } 182 }
183 183
184 // There's at least one version range, the plugin's version must be in it. 184 // There's at least one version range, the plugin's version must be in it.
185 scoped_ptr<Version> plugin_version( 185 scoped_ptr<Version> plugin_version(
186 Version::GetVersionFromString(UTF16ToASCII(plugin.version))); 186 Version::GetVersionFromString(UTF16ToWide(plugin.version)));
187 if (plugin_version.get() == NULL) { 187 if (plugin_version.get() == NULL) {
188 // No version could be extracted, assume we don't match the range. 188 // No version could be extracted, assume we don't match the range.
189 return false; 189 return false;
190 } 190 }
191 191
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 /* static */
203 Version* PluginGroup::CreateVersionFromString(const string16& version_string) { 203 Version* PluginGroup::CreateVersionFromString(const string16& version_string) {
204 // Remove spaces and ')' from the version string, 204 // Remove spaces and ')' from the version string,
205 // Replace any instances of 'r', ',' or '(' with a dot. 205 // Replace any instances of 'r', ',' or '(' with a dot.
206 std::wstring version = UTF16ToWide(version_string); 206 std::wstring version = UTF16ToWide(version_string);
207 RemoveChars(version, L") ", &version); 207 RemoveChars(version, L") ", &version);
208 std::replace(version.begin(), version.end(), 'r', '.'); 208 std::replace(version.begin(), version.end(), 'r', '.');
209 std::replace(version.begin(), version.end(), ',', '.'); 209 std::replace(version.begin(), version.end(), ',', '.');
210 std::replace(version.begin(), version.end(), '(', '.'); 210 std::replace(version.begin(), version.end(), '(', '.');
211 211
212 return Version::GetVersionFromString(WideToASCII(version)); 212 return Version::GetVersionFromString(version);
213 } 213 }
214 214
215 void PluginGroup::UpdateActivePlugin(const WebPluginInfo& plugin) { 215 void PluginGroup::UpdateActivePlugin(const WebPluginInfo& plugin) {
216 // A group is enabled if any of the files are enabled. 216 // A group is enabled if any of the files are enabled.
217 if (plugin.enabled) { 217 if (plugin.enabled) {
218 if (!enabled_) { 218 if (!enabled_) {
219 // If this is the first enabled plugin, use its description. 219 // If this is the first enabled plugin, use its description.
220 enabled_ = true; 220 enabled_ = true;
221 UpdateDescriptionAndVersion(plugin); 221 UpdateDescriptionAndVersion(plugin);
222 } 222 }
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 NPAPI::PluginList::Singleton()->EnablePlugin(it->path); 398 NPAPI::PluginList::Singleton()->EnablePlugin(it->path);
399 it->enabled = true; 399 it->enabled = true;
400 enabled_plugin_exists = true; 400 enabled_plugin_exists = true;
401 } else { 401 } else {
402 it->enabled = false; 402 it->enabled = false;
403 NPAPI::PluginList::Singleton()->DisablePlugin(it->path); 403 NPAPI::PluginList::Singleton()->DisablePlugin(it->path);
404 } 404 }
405 } 405 }
406 enabled_ = enabled_plugin_exists; 406 enabled_ = enabled_plugin_exists;
407 } 407 }
OLDNEW
« no previous file with comments | « chrome_frame/dll_redirector.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698