| OLD | NEW |
| 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/plugins/npapi/plugin_list.h" | 5 #include "webkit/plugins/npapi/plugin_list.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/stl_util-inl.h" | 12 #include "base/stl_util-inl.h" |
| 13 #include "base/string_split.h" | 13 #include "base/string_split.h" |
| 14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
| 15 #include "base/sys_string_conversions.h" | 15 #include "base/sys_string_conversions.h" |
| 16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 18 #include "net/base/mime_util.h" | 18 #include "net/base/mime_util.h" |
| 19 #include "webkit/glue/webkit_glue.h" | 19 #include "webkit/glue/webkit_glue.h" |
| 20 #include "webkit/plugins/npapi/plugin_constants_win.h" | 20 #include "webkit/plugins/npapi/plugin_constants_win.h" |
| 21 #include "webkit/plugins/npapi/plugin_lib.h" | 21 #include "webkit/plugins/npapi/plugin_lib.h" |
| 22 #include "webkit/plugins/plugin_switches.h" | 22 #include "webkit/plugins/plugin_switches.h" |
| 23 | 23 |
| 24 namespace webkit { | 24 namespace webkit { |
| 25 namespace npapi { | 25 namespace npapi { |
| 26 | 26 |
| 27 FilePath::CharType kDefaultPluginLibraryName[] = | 27 FilePath::CharType kDefaultPluginLibraryName[] = |
| 28 FILE_PATH_LITERAL("default_plugin"); | 28 FILE_PATH_LITERAL("default_plugin"); |
| 29 | 29 |
| 30 // Some version ranges can be shared across operating systems. This should be |
| 31 // done where possible to avoid duplication. |
| 32 static const VersionRangeDefinition kFlashVersionRange[] = { |
| 33 { "", "", "10.1.102" } |
| 34 }; |
| 35 |
| 36 // Similarly, try and share the group definition for plug-ins that are |
| 37 // very consistent across OS'es. |
| 38 static const PluginGroupDefinition kFlashDefinition = { |
| 39 "adobe-flash-player", "Flash", "Shockwave Flash", kFlashVersionRange, |
| 40 arraysize(kFlashVersionRange), "http://get.adobe.com/flashplayer/" }; |
| 41 |
| 30 #if defined(OS_MACOSX) | 42 #if defined(OS_MACOSX) |
| 31 // Plugin Groups for Mac. | 43 // Plugin Groups for Mac. |
| 32 // Plugins are listed here as soon as vulnerabilities and solutions | 44 // Plugins are listed here as soon as vulnerabilities and solutions |
| 33 // (new versions) are published. | 45 // (new versions) are published. |
| 34 // TODO(panayiotis): Get the Real Player version on Mac, somehow. | 46 // TODO(panayiotis): Get the Real Player version on Mac, somehow. |
| 35 static const VersionRangeDefinition kQuicktimeVersionRange[] = { | 47 static const VersionRangeDefinition kQuicktimeVersionRange[] = { |
| 36 { "", "", "7.6.6" } | 48 { "", "", "7.6.6" } |
| 37 }; | 49 }; |
| 38 static const VersionRangeDefinition kJavaVersionRange[] = { | 50 static const VersionRangeDefinition kJavaVersionRange[] = { |
| 39 { "", "", "" } | 51 { "13.0", "14.0", "13.3.0" } // Snow Leopard |
| 40 }; | |
| 41 static const VersionRangeDefinition kFlashVersionRange[] = { | |
| 42 { "", "", "10.1.102" } | |
| 43 }; | 52 }; |
| 44 static const VersionRangeDefinition kSilverlightVersionRange[] = { | 53 static const VersionRangeDefinition kSilverlightVersionRange[] = { |
| 45 { "0", "4", "3.0.50106.0" }, | 54 { "0", "4", "3.0.50106.0" }, |
| 46 { "4", "5", "" } | 55 { "4", "5", "" } |
| 47 }; | 56 }; |
| 48 static const VersionRangeDefinition kFlip4MacVersionRange[] = { | 57 static const VersionRangeDefinition kFlip4MacVersionRange[] = { |
| 49 { "", "", "2.2.1" } | 58 { "", "", "2.2.1" } |
| 50 }; | 59 }; |
| 51 static const VersionRangeDefinition kShockwaveVersionRange[] = { | 60 static const VersionRangeDefinition kShockwaveVersionRange[] = { |
| 52 { "", "", "11.5.9.615" } | 61 { "", "", "11.5.9.615" } |
| 53 }; | 62 }; |
| 54 static const PluginGroupDefinition kGroupDefinitions[] = { | 63 static const PluginGroupDefinition kGroupDefinitions[] = { |
| 64 kFlashDefinition, |
| 55 { "apple-quicktime", "Quicktime", "QuickTime Plug-in", kQuicktimeVersionRange, | 65 { "apple-quicktime", "Quicktime", "QuickTime Plug-in", kQuicktimeVersionRange, |
| 56 arraysize(kQuicktimeVersionRange), | 66 arraysize(kQuicktimeVersionRange), |
| 57 "http://www.apple.com/quicktime/download/" }, | 67 "http://www.apple.com/quicktime/download/" }, |
| 58 { "java-runtime-environment", "Java", "Java", kJavaVersionRange, | 68 { "java-runtime-environment", "Java", "Java", kJavaVersionRange, |
| 59 arraysize(kJavaVersionRange), "http://support.apple.com/kb/HT1338" }, | 69 arraysize(kJavaVersionRange), "http://support.apple.com/kb/HT1338" }, |
| 60 { "adobe-flash-player", "Flash", "Shockwave Flash", kFlashVersionRange, | |
| 61 arraysize(kFlashVersionRange), "http://get.adobe.com/flashplayer/" }, | |
| 62 { "silverlight", "Silverlight", "Silverlight", kSilverlightVersionRange, | 70 { "silverlight", "Silverlight", "Silverlight", kSilverlightVersionRange, |
| 63 arraysize(kSilverlightVersionRange), | 71 arraysize(kSilverlightVersionRange), |
| 64 "http://www.microsoft.com/getsilverlight/" }, | 72 "http://www.microsoft.com/getsilverlight/" }, |
| 65 { "flip4mac", "Flip4Mac", "Flip4Mac", kFlip4MacVersionRange, | 73 { "flip4mac", "Flip4Mac", "Flip4Mac", kFlip4MacVersionRange, |
| 66 arraysize(kFlip4MacVersionRange), | 74 arraysize(kFlip4MacVersionRange), |
| 67 "http://www.telestream.net/flip4mac-wmv/overview.htm" }, | 75 "http://www.telestream.net/flip4mac-wmv/overview.htm" }, |
| 68 { "shockwave", "Shockwave", "Shockwave for Director", kShockwaveVersionRange, | 76 { "shockwave", "Shockwave", "Shockwave for Director", kShockwaveVersionRange, |
| 69 arraysize(kShockwaveVersionRange), | 77 arraysize(kShockwaveVersionRange), |
| 70 "http://www.adobe.com/shockwave/download/" } | 78 "http://www.adobe.com/shockwave/download/" } |
| 71 }; | 79 }; |
| 72 | 80 |
| 73 #elif defined(OS_WIN) | 81 #elif defined(OS_WIN) |
| 74 // TODO(panayiotis): We should group "RealJukebox NS Plugin" with the rest of | 82 // TODO(panayiotis): We should group "RealJukebox NS Plugin" with the rest of |
| 75 // the RealPlayer files. | 83 // the RealPlayer files. |
| 76 static const VersionRangeDefinition kQuicktimeVersionRange[] = { | 84 static const VersionRangeDefinition kQuicktimeVersionRange[] = { |
| 77 { "", "", "7.6.8" } | 85 { "", "", "7.6.8" } |
| 78 }; | 86 }; |
| 79 static const VersionRangeDefinition kJavaVersionRange[] = { | 87 static const VersionRangeDefinition kJavaVersionRange[] = { |
| 80 { "0", "7", "6.0.220" } // "220" is not a typo. | 88 { "0", "7", "6.0.220" } // "220" is not a typo. |
| 81 }; | 89 }; |
| 82 static const VersionRangeDefinition kAdobeReaderVersionRange[] = { | 90 static const VersionRangeDefinition kAdobeReaderVersionRange[] = { |
| 83 { "10", "11", "" }, | 91 { "10", "11", "" }, |
| 84 { "9", "10", "9.4.1" }, | 92 { "9", "10", "9.4.1" }, |
| 85 { "0", "9", "8.2.5" } | 93 { "0", "9", "8.2.5" } |
| 86 }; | 94 }; |
| 87 static const VersionRangeDefinition kFlashVersionRange[] = { | |
| 88 { "", "", "10.1.102" } | |
| 89 }; | |
| 90 static const VersionRangeDefinition kSilverlightVersionRange[] = { | 95 static const VersionRangeDefinition kSilverlightVersionRange[] = { |
| 91 { "0", "4", "3.0.50106.0" }, | 96 { "0", "4", "3.0.50106.0" }, |
| 92 { "4", "5", "" } | 97 { "4", "5", "" } |
| 93 }; | 98 }; |
| 94 static const VersionRangeDefinition kShockwaveVersionRange[] = { | 99 static const VersionRangeDefinition kShockwaveVersionRange[] = { |
| 95 { "", "", "11.5.9.615" } | 100 { "", "", "11.5.9.615" } |
| 96 }; | 101 }; |
| 97 static const VersionRangeDefinition kDivXVersionRange[] = { | 102 static const VersionRangeDefinition kDivXVersionRange[] = { |
| 98 { "", "", "1.4.3.4" } | 103 { "", "", "1.4.3.4" } |
| 99 }; | 104 }; |
| 100 static const PluginGroupDefinition kGroupDefinitions[] = { | 105 static const PluginGroupDefinition kGroupDefinitions[] = { |
| 106 kFlashDefinition, |
| 101 { "apple-quicktime", "Quicktime", "QuickTime Plug-in", kQuicktimeVersionRange, | 107 { "apple-quicktime", "Quicktime", "QuickTime Plug-in", kQuicktimeVersionRange, |
| 102 arraysize(kQuicktimeVersionRange), | 108 arraysize(kQuicktimeVersionRange), |
| 103 "http://www.apple.com/quicktime/download/" }, | 109 "http://www.apple.com/quicktime/download/" }, |
| 104 { "java-runtime-environment", "Java 6", "Java", kJavaVersionRange, | 110 { "java-runtime-environment", "Java 6", "Java", kJavaVersionRange, |
| 105 arraysize(kJavaVersionRange), "http://www.java.com/" }, | 111 arraysize(kJavaVersionRange), "http://www.java.com/" }, |
| 106 { "adobe-reader", PluginGroup::kAdobeReaderGroupName, "Adobe Acrobat", | 112 { "adobe-reader", PluginGroup::kAdobeReaderGroupName, "Adobe Acrobat", |
| 107 kAdobeReaderVersionRange, arraysize(kAdobeReaderVersionRange), | 113 kAdobeReaderVersionRange, arraysize(kAdobeReaderVersionRange), |
| 108 "http://get.adobe.com/reader/" }, | 114 "http://get.adobe.com/reader/" }, |
| 109 { "adobe-flash-player", "Flash", "Shockwave Flash", kFlashVersionRange, | |
| 110 arraysize(kFlashVersionRange), "http://get.adobe.com/flashplayer/" }, | |
| 111 { "silverlight", "Silverlight", "Silverlight", kSilverlightVersionRange, | 115 { "silverlight", "Silverlight", "Silverlight", kSilverlightVersionRange, |
| 112 arraysize(kSilverlightVersionRange), | 116 arraysize(kSilverlightVersionRange), |
| 113 "http://www.microsoft.com/getsilverlight/" }, | 117 "http://www.microsoft.com/getsilverlight/" }, |
| 114 { "shockwave", "Shockwave", "Shockwave for Director", kShockwaveVersionRange, | 118 { "shockwave", "Shockwave", "Shockwave for Director", kShockwaveVersionRange, |
| 115 arraysize(kShockwaveVersionRange), | 119 arraysize(kShockwaveVersionRange), |
| 116 "http://www.adobe.com/shockwave/download/" }, | 120 "http://www.adobe.com/shockwave/download/" }, |
| 117 { "divx-player", "DivX Player", "DivX Web Player", kDivXVersionRange, | 121 { "divx-player", "DivX Player", "DivX Web Player", kDivXVersionRange, |
| 118 arraysize(kDivXVersionRange), | 122 arraysize(kDivXVersionRange), |
| 119 "http://download.divx.com/divx/autoupdate/player/" | 123 "http://download.divx.com/divx/autoupdate/player/" |
| 120 "DivXWebPlayerInstaller.exe" }, | 124 "DivXWebPlayerInstaller.exe" }, |
| 121 // These are here for grouping, no vulnerabilities known. | 125 // These are here for grouping, no vulnerabilities known. |
| 122 { "windows-media-player", "Windows Media Player", "Windows Media Player", | 126 { "windows-media-player", "Windows Media Player", "Windows Media Player", |
| 123 NULL, 0, "" }, | 127 NULL, 0, "" }, |
| 124 { "microsoft-office", "Microsoft Office", "Microsoft Office", | 128 { "microsoft-office", "Microsoft Office", "Microsoft Office", |
| 125 NULL, 0, "" }, | 129 NULL, 0, "" }, |
| 126 // TODO(panayiotis): The vulnerable versions are | 130 // TODO(panayiotis): The vulnerable versions are |
| 127 // (v >= 6.0.12.1040 && v <= 6.0.12.1663) | 131 // (v >= 6.0.12.1040 && v <= 6.0.12.1663) |
| 128 // || v == 6.0.12.1698 || v == 6.0.12.1741 | 132 // || v == 6.0.12.1698 || v == 6.0.12.1741 |
| 129 { "realplayer", "RealPlayer", "RealPlayer", NULL, 0, | 133 { "realplayer", "RealPlayer", "RealPlayer", NULL, 0, |
| 130 "www.real.com/realplayer/downloads" }, | 134 "www.real.com/realplayer/downloads" }, |
| 131 }; | 135 }; |
| 132 | 136 |
| 133 #else | 137 #else |
| 134 static const PluginGroupDefinition kGroupDefinitions[] = {}; | 138 static const VersionRangeDefinition kJavaVersionRange[] = { |
| 139 { "0", "1.7", "1.6.0.22" } |
| 140 }; |
| 141 |
| 142 static const VersionRangeDefinition kRedhatIcedTeaVersionRange[] = { |
| 143 { "0", "1.9", "1.8.3" }, |
| 144 { "1.9", "1.10", "1.9.2" }, |
| 145 }; |
| 146 |
| 147 static const PluginGroupDefinition kGroupDefinitions[] = { |
| 148 // Flash on Linux is significant because there isn't yet a built-in Flash |
| 149 // plug-in on the Linux 64-bit version of Chrome. |
| 150 kFlashDefinition, |
| 151 { "java-runtime-environment", "Java 6", "Java", kJavaVersionRange, |
| 152 arraysize(kJavaVersionRange), |
| 153 "http://www.java.com/en/download/manual.jsp" }, |
| 154 { "redhat-icetea-java", "IcedTea", "IcedTea", kRedhatIcedTeaVersionRange, |
| 155 arraysize(kRedhatIcedTeaVersionRange), |
| 156 "http://www.linuxsecurity.com/content/section/3/170/" }, |
| 157 }; |
| 135 #endif | 158 #endif |
| 136 | 159 |
| 137 // static | 160 // static |
| 138 const PluginGroupDefinition* PluginList::GetPluginGroupDefinitions() { | 161 const PluginGroupDefinition* PluginList::GetPluginGroupDefinitions() { |
| 139 return kGroupDefinitions; | 162 return kGroupDefinitions; |
| 140 } | 163 } |
| 141 | 164 |
| 142 // static | 165 // static |
| 143 size_t PluginList::GetPluginGroupDefinitionsSize() { | 166 size_t PluginList::GetPluginGroupDefinitionsSize() { |
| 144 // TODO(viettrungluu): |arraysize()| doesn't work with zero-size arrays. | 167 // TODO(viettrungluu): |arraysize()| doesn't work with zero-size arrays. |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 Shutdown(); | 811 Shutdown(); |
| 789 } | 812 } |
| 790 | 813 |
| 791 void PluginList::Shutdown() { | 814 void PluginList::Shutdown() { |
| 792 STLDeleteContainerPairSecondPointers(plugin_groups_.begin(), | 815 STLDeleteContainerPairSecondPointers(plugin_groups_.begin(), |
| 793 plugin_groups_.end()); | 816 plugin_groups_.end()); |
| 794 } | 817 } |
| 795 | 818 |
| 796 } // namespace npapi | 819 } // namespace npapi |
| 797 } // namespace webkit | 820 } // namespace webkit |
| OLD | NEW |