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 "chrome/browser/plugins/plugin_metadata.h" | 5 #include "chrome/browser/plugins/plugin_metadata.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/string_util.h" |
10 #include "webkit/plugins/npapi/plugin_list.h" | 11 #include "webkit/plugins/npapi/plugin_list.h" |
11 #include "webkit/plugins/npapi/plugin_utils.h" | 12 #include "webkit/plugins/npapi/plugin_utils.h" |
12 #include "webkit/plugins/webplugininfo.h" | 13 #include "webkit/plugins/webplugininfo.h" |
13 | 14 |
14 // static | 15 // static |
15 const char PluginMetadata::kAdobeReaderGroupName[] = "Adobe Reader"; | 16 const char PluginMetadata::kAdobeReaderGroupName[] = "Adobe Reader"; |
16 const char PluginMetadata::kJavaGroupName[] = "Java(TM)"; | 17 const char PluginMetadata::kJavaGroupName[] = "Java(TM)"; |
17 const char PluginMetadata::kQuickTimeGroupName[] = "QuickTime Player"; | 18 const char PluginMetadata::kQuickTimeGroupName[] = "QuickTime Player"; |
18 const char PluginMetadata::kShockwaveGroupName[] = "Adobe Shockwave Player"; | 19 const char PluginMetadata::kShockwaveGroupName[] = "Adobe Shockwave Player"; |
19 const char PluginMetadata::kRealPlayerGroupName[] = "RealPlayer"; | 20 const char PluginMetadata::kRealPlayerGroupName[] = "RealPlayer"; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 bool PluginMetadata::MatchesPlugin(const webkit::WebPluginInfo& plugin) { | 63 bool PluginMetadata::MatchesPlugin(const webkit::WebPluginInfo& plugin) { |
63 using webkit::npapi::PluginList; | 64 using webkit::npapi::PluginList; |
64 | 65 |
65 for (size_t i = 0; i < matching_mime_types_.size(); ++i) { | 66 for (size_t i = 0; i < matching_mime_types_.size(); ++i) { |
66 // To have a match, every one of the |matching_mime_types_| | 67 // To have a match, every one of the |matching_mime_types_| |
67 // must be handled by the plug-in. | 68 // must be handled by the plug-in. |
68 if (!PluginList::SupportsType(plugin, matching_mime_types_[i], false)) | 69 if (!PluginList::SupportsType(plugin, matching_mime_types_[i], false)) |
69 return false; | 70 return false; |
70 } | 71 } |
71 | 72 |
72 return plugin.name.find(group_name_matcher_) != string16::npos; | 73 return MatchPattern(plugin.name, group_name_matcher_); |
73 } | 74 } |
74 | 75 |
75 // static | 76 // static |
76 bool PluginMetadata::ParseSecurityStatus( | 77 bool PluginMetadata::ParseSecurityStatus( |
77 const std::string& status_str, | 78 const std::string& status_str, |
78 PluginMetadata::SecurityStatus* status) { | 79 PluginMetadata::SecurityStatus* status) { |
79 if (status_str == "up_to_date") | 80 if (status_str == "up_to_date") |
80 *status = SECURITY_STATUS_UP_TO_DATE; | 81 *status = SECURITY_STATUS_UP_TO_DATE; |
81 else if (status_str == "out_of_date") | 82 else if (status_str == "out_of_date") |
82 *status = SECURITY_STATUS_OUT_OF_DATE; | 83 *status = SECURITY_STATUS_OUT_OF_DATE; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 PluginMetadata* copy = new PluginMetadata(identifier_, | 126 PluginMetadata* copy = new PluginMetadata(identifier_, |
126 name_, | 127 name_, |
127 url_for_display_, | 128 url_for_display_, |
128 plugin_url_, | 129 plugin_url_, |
129 help_url_, | 130 help_url_, |
130 group_name_matcher_, | 131 group_name_matcher_, |
131 language_); | 132 language_); |
132 copy->versions_ = versions_; | 133 copy->versions_ = versions_; |
133 return make_scoped_ptr(copy); | 134 return make_scoped_ptr(copy); |
134 } | 135 } |
OLD | NEW |