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/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 } | 54 } |
55 | 55 |
56 bool PluginMetadata::HasMimeType(const std::string& mime_type) const { | 56 bool PluginMetadata::HasMimeType(const std::string& mime_type) const { |
57 return std::find(all_mime_types_.begin(), all_mime_types_.end(), mime_type) != | 57 return std::find(all_mime_types_.begin(), all_mime_types_.end(), mime_type) != |
58 all_mime_types_.end(); | 58 all_mime_types_.end(); |
59 } | 59 } |
60 | 60 |
61 bool PluginMetadata::MatchesPlugin(const content::WebPluginInfo& plugin) { | 61 bool PluginMetadata::MatchesPlugin(const content::WebPluginInfo& plugin) { |
62 for (size_t i = 0; i < matching_mime_types_.size(); ++i) { | 62 for (size_t i = 0; i < matching_mime_types_.size(); ++i) { |
63 // To have a match, every one of the |matching_mime_types_| | 63 // To have a match, every one of the |matching_mime_types_| |
64 // must be handled by the plug-in. | 64 // must be handled by the plugin. |
65 size_t j = 0; | 65 size_t j = 0; |
66 for (; j < plugin.mime_types.size(); ++j) { | 66 for (; j < plugin.mime_types.size(); ++j) { |
67 if (plugin.mime_types[j].mime_type == matching_mime_types_[i]) | 67 if (plugin.mime_types[j].mime_type == matching_mime_types_[i]) |
68 break; | 68 break; |
69 } | 69 } |
70 if (j == plugin.mime_types.size()) | 70 if (j == plugin.mime_types.size()) |
71 return false; | 71 return false; |
72 } | 72 } |
73 | 73 |
74 return MatchPattern(plugin.name, group_name_matcher_); | 74 return MatchPattern(plugin.name, group_name_matcher_); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 PluginMetadata* copy = new PluginMetadata(identifier_, | 123 PluginMetadata* copy = new PluginMetadata(identifier_, |
124 name_, | 124 name_, |
125 url_for_display_, | 125 url_for_display_, |
126 plugin_url_, | 126 plugin_url_, |
127 help_url_, | 127 help_url_, |
128 group_name_matcher_, | 128 group_name_matcher_, |
129 language_); | 129 language_); |
130 copy->versions_ = versions_; | 130 copy->versions_ = versions_; |
131 return make_scoped_ptr(copy); | 131 return make_scoped_ptr(copy); |
132 } | 132 } |
OLD | NEW |