| OLD | NEW |
| 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 Loading... |
| 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, b_ver; | 240 std::vector<base::string16> a_ver = base::SplitString( |
| 241 base::SplitString(a, ',', &a_ver); | 241 a, base::string16(1, ','), base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 242 base::SplitString(b, ',', &b_ver); | 242 std::vector<base::string16> b_ver = base::SplitString( |
| 243 b, base::string16(1, ','), base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 243 if (a_ver.size() == 1 && b_ver.size() == 1) { | 244 if (a_ver.size() == 1 && b_ver.size() == 1) { |
| 244 base::SplitString(a, '.', &a_ver); | 245 a_ver = base::SplitString( |
| 245 base::SplitString(b, '.', &b_ver); | 246 a, base::string16(1, '.'), base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 247 b_ver = base::SplitString( |
| 248 b, base::string16(1, '.'), base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 246 } | 249 } |
| 247 if (a_ver.size() != b_ver.size()) | 250 if (a_ver.size() != b_ver.size()) |
| 248 return false; | 251 return false; |
| 249 for (size_t i = 0; i < a_ver.size(); i++) { | 252 for (size_t i = 0; i < a_ver.size(); i++) { |
| 250 int cur_a, cur_b; | 253 int cur_a, cur_b; |
| 251 base::StringToInt(a_ver[i], &cur_a); | 254 base::StringToInt(a_ver[i], &cur_a); |
| 252 base::StringToInt(b_ver[i], &cur_b); | 255 base::StringToInt(b_ver[i], &cur_b); |
| 253 | 256 |
| 254 if (cur_a > cur_b) | 257 if (cur_a > cur_b) |
| 255 return false; | 258 return false; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 // Disable the WangWang protocol handler plugin (npww.dll) as it crashes | 438 // Disable the WangWang protocol handler plugin (npww.dll) as it crashes |
| 436 // chrome during shutdown. Firefox also disables this plugin. | 439 // chrome during shutdown. Firefox also disables this plugin. |
| 437 // Please refer to http://code.google.com/p/chromium/issues/detail?id=3953 | 440 // Please refer to http://code.google.com/p/chromium/issues/detail?id=3953 |
| 438 // for more information. | 441 // for more information. |
| 439 if (filename == kWanWangProtocolHandlerPlugin) | 442 if (filename == kWanWangProtocolHandlerPlugin) |
| 440 return false; | 443 return false; |
| 441 | 444 |
| 442 // We only work with newer versions of the Java plugin which use NPAPI only | 445 // We only work with newer versions of the Java plugin which use NPAPI only |
| 443 // and don't depend on XPCOM. | 446 // and don't depend on XPCOM. |
| 444 if (filename == kJavaPlugin1 || filename == kJavaPlugin2) { | 447 if (filename == kJavaPlugin1 || filename == kJavaPlugin2) { |
| 445 std::vector<base::FilePath::StringType> ver; | 448 std::vector<base::FilePath::StringType> ver = base::SplitString( |
| 446 base::SplitString(info.version, '.', &ver); | 449 info.version, base::FilePath::StringType(1, '.'), |
| 450 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 447 int major, minor, update; | 451 int major, minor, update; |
| 448 if (ver.size() == 4 && | 452 if (ver.size() == 4 && |
| 449 base::StringToInt(ver[0], &major) && | 453 base::StringToInt(ver[0], &major) && |
| 450 base::StringToInt(ver[1], &minor) && | 454 base::StringToInt(ver[1], &minor) && |
| 451 base::StringToInt(ver[2], &update)) { | 455 base::StringToInt(ver[2], &update)) { |
| 452 if (major == 6 && minor == 0 && update < 120) | 456 if (major == 6 && minor == 0 && update < 120) |
| 453 return false; // Java SE6 Update 11 or older. | 457 return false; // Java SE6 Update 11 or older. |
| 454 } | 458 } |
| 455 } | 459 } |
| 456 | 460 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 478 return false; | 482 return false; |
| 479 #else | 483 #else |
| 480 // The plugin in question could be a 64 bit plugin which we cannot load. | 484 // The plugin in question could be a 64 bit plugin which we cannot load. |
| 481 if (!IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path))) | 485 if (!IsValid32BitImage(base::MakeAbsoluteFilePath(plugin_path))) |
| 482 return false; | 486 return false; |
| 483 #endif | 487 #endif |
| 484 return true; | 488 return true; |
| 485 } | 489 } |
| 486 | 490 |
| 487 } // namespace content | 491 } // namespace content |
| OLD | NEW |