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

Unified Diff: webkit/plugins/npapi/plugin_group.cc

Issue 10823434: [6] Moves CreateVersionFromString to plugin_utils and updates the callers. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added missing include <algorithm> Created 8 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/plugins/npapi/plugin_group.h ('k') | webkit/plugins/npapi/plugin_group_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/npapi/plugin_group.cc
diff --git a/webkit/plugins/npapi/plugin_group.cc b/webkit/plugins/npapi/plugin_group.cc
index 2f62a294baa0efbe07ede3c98e5d209693d15630..8cd33996f14a61240e56462d1fdb08e73b01f694 100644
--- a/webkit/plugins/npapi/plugin_group.cc
+++ b/webkit/plugins/npapi/plugin_group.cc
@@ -100,46 +100,6 @@ bool PluginGroup::Match(const WebPluginInfo& plugin) const {
return true;
}
-/* static */
-std::string PluginGroup::RemoveLeadingZerosFromVersionComponents(
- const std::string& version) {
- std::string no_leading_zeros_version;
- std::vector<std::string> numbers;
- base::SplitString(version, '.', &numbers);
- for (size_t i = 0; i < numbers.size(); ++i) {
- size_t n = numbers[i].size();
- size_t j = 0;
- while (j < n && numbers[i][j] == '0') {
- ++j;
- }
- no_leading_zeros_version += (j < n) ? numbers[i].substr(j) : "0";
- if (i != numbers.size() - 1) {
- no_leading_zeros_version += ".";
- }
- }
-
- return no_leading_zeros_version;
-}
-
-/* static */
-void PluginGroup::CreateVersionFromString(const string16& version_string,
- Version* parsed_version) {
- // Remove spaces and ')' from the version string,
- // Replace any instances of 'r', ',' or '(' with a dot.
- std::string version = UTF16ToASCII(version_string);
- RemoveChars(version, ") ", &version);
- std::replace(version.begin(), version.end(), 'd', '.');
- std::replace(version.begin(), version.end(), 'r', '.');
- std::replace(version.begin(), version.end(), ',', '.');
- std::replace(version.begin(), version.end(), '(', '.');
- std::replace(version.begin(), version.end(), '_', '.');
-
- // Remove leading zeros from each of the version components.
- version = RemoveLeadingZerosFromVersionComponents(version);
-
- *parsed_version = Version(version);
-}
-
void PluginGroup::AddPlugin(const WebPluginInfo& plugin) {
// Check if this group already contains this plugin.
for (size_t i = 0; i < web_plugin_infos_.size(); ++i) {
« no previous file with comments | « webkit/plugins/npapi/plugin_group.h ('k') | webkit/plugins/npapi/plugin_group_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698