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

Side by Side Diff: content/common/plugin_list_win.cc

Issue 1278973003: Revert of Update SplitString calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « content/common/plugin_list.cc ('k') | content/public/browser/desktop_media_id.cc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/common/plugin_list.h" 5 #include "content/common/plugin_list.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/file_version_info.h" 10 #include "base/file_version_info.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 return true; 230 return true;
231 } 231 }
232 } 232 }
233 233
234 return false; 234 return false;
235 } 235 }
236 236
237 // Compares Windows style version strings (i.e. 1,2,3,4). Returns true if b's 237 // Compares Windows style version strings (i.e. 1,2,3,4). Returns true if b's
238 // version is newer than a's, or false if it's equal or older. 238 // version is newer than a's, or false if it's equal or older.
239 bool IsNewerVersion(const base::string16& a, const base::string16& b) { 239 bool IsNewerVersion(const base::string16& a, const base::string16& b) {
240 std::vector<base::string16> a_ver = base::SplitString( 240 std::vector<base::string16> a_ver, b_ver;
241 a, base::string16(1, ','), base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 241 base::SplitString(a, ',', &a_ver);
242 std::vector<base::string16> b_ver = base::SplitString( 242 base::SplitString(b, ',', &b_ver);
243 b, base::string16(1, ','), base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
244 if (a_ver.size() == 1 && b_ver.size() == 1) { 243 if (a_ver.size() == 1 && b_ver.size() == 1) {
245 a_ver = base::SplitString( 244 base::SplitString(a, '.', &a_ver);
246 a, base::string16(1, '.'), base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); 245 base::SplitString(b, '.', &b_ver);
247 b_ver = base::SplitString(
248 b, base::string16(1, '.'), base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
249 } 246 }
250 if (a_ver.size() != b_ver.size()) 247 if (a_ver.size() != b_ver.size())
251 return false; 248 return false;
252 for (size_t i = 0; i < a_ver.size(); i++) { 249 for (size_t i = 0; i < a_ver.size(); i++) {
253 int cur_a, cur_b; 250 int cur_a, cur_b;
254 base::StringToInt(a_ver[i], &cur_a); 251 base::StringToInt(a_ver[i], &cur_a);
255 base::StringToInt(b_ver[i], &cur_b); 252 base::StringToInt(b_ver[i], &cur_b);
256 253
257 if (cur_a > cur_b) 254 if (cur_a > cur_b)
258 return false; 255 return false;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 // Disable the WangWang protocol handler plugin (npww.dll) as it crashes 435 // Disable the WangWang protocol handler plugin (npww.dll) as it crashes
439 // chrome during shutdown. Firefox also disables this plugin. 436 // chrome during shutdown. Firefox also disables this plugin.
440 // Please refer to http://code.google.com/p/chromium/issues/detail?id=3953 437 // Please refer to http://code.google.com/p/chromium/issues/detail?id=3953
441 // for more information. 438 // for more information.
442 if (filename == kWanWangProtocolHandlerPlugin) 439 if (filename == kWanWangProtocolHandlerPlugin)
443 return false; 440 return false;
444 441
445 // We only work with newer versions of the Java plugin which use NPAPI only 442 // We only work with newer versions of the Java plugin which use NPAPI only
446 // and don't depend on XPCOM. 443 // and don't depend on XPCOM.
447 if (filename == kJavaPlugin1 || filename == kJavaPlugin2) { 444 if (filename == kJavaPlugin1 || filename == kJavaPlugin2) {
448 std::vector<base::FilePath::StringType> ver = base::SplitString( 445 std::vector<base::FilePath::StringType> ver;
449 info.version, base::FilePath::StringType(1, '.'), 446 base::SplitString(info.version, '.', &ver);
450 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
451 int major, minor, update; 447 int major, minor, update;
452 if (ver.size() == 4 && 448 if (ver.size() == 4 &&
453 base::StringToInt(ver[0], &major) && 449 base::StringToInt(ver[0], &major) &&
454 base::StringToInt(ver[1], &minor) && 450 base::StringToInt(ver[1], &minor) &&
455 base::StringToInt(ver[2], &update)) { 451 base::StringToInt(ver[2], &update)) {
456 if (major == 6 && minor == 0 && update < 120) 452 if (major == 6 && minor == 0 && update < 120)
457 return false; // Java SE6 Update 11 or older. 453 return false; // Java SE6 Update 11 or older.
458 } 454 }
459 } 455 }
460 456
(...skipping 21 matching lines...) Expand all
482 return false; 478 return false;
483 #else 479 #else
484 // The plugin in question could be a 64 bit plugin which we cannot load. 480 // The plugin in question could be a 64 bit plugin which we cannot load.
485 if (!IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path))) 481 if (!IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path)))
486 return false; 482 return false;
487 #endif 483 #endif
488 return true; 484 return true;
489 } 485 }
490 486
491 } // namespace content 487 } // namespace content
OLDNEW
« no previous file with comments | « content/common/plugin_list.cc ('k') | content/public/browser/desktop_media_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698