| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 *status = SECURITY_STATUS_REQUIRES_AUTHORIZATION; | 86 *status = SECURITY_STATUS_REQUIRES_AUTHORIZATION; |
| 87 else | 87 else |
| 88 return false; | 88 return false; |
| 89 | 89 |
| 90 return true; | 90 return true; |
| 91 } | 91 } |
| 92 | 92 |
| 93 PluginMetadata::SecurityStatus PluginMetadata::GetSecurityStatus( | 93 PluginMetadata::SecurityStatus PluginMetadata::GetSecurityStatus( |
| 94 const content::WebPluginInfo& plugin) const { | 94 const content::WebPluginInfo& plugin) const { |
| 95 if (versions_.empty()) { | 95 if (versions_.empty()) { |
| 96 #if defined(OS_LINUX) | 96 // Unknown plugins require authorization. |
| 97 // On Linux, unknown plugins require authorization. | |
| 98 return SECURITY_STATUS_REQUIRES_AUTHORIZATION; | 97 return SECURITY_STATUS_REQUIRES_AUTHORIZATION; |
| 99 #else | |
| 100 return SECURITY_STATUS_UP_TO_DATE; | |
| 101 #endif | |
| 102 } | 98 } |
| 103 | 99 |
| 104 Version version; | 100 Version version; |
| 105 content::WebPluginInfo::CreateVersionFromString(plugin.version, &version); | 101 content::WebPluginInfo::CreateVersionFromString(plugin.version, &version); |
| 106 if (!version.IsValid()) | 102 if (!version.IsValid()) |
| 107 version = Version("0"); | 103 version = Version("0"); |
| 108 | 104 |
| 109 // |lower_bound| returns the latest version that is not newer than |version|. | 105 // |lower_bound| returns the latest version that is not newer than |version|. |
| 110 std::map<Version, SecurityStatus, VersionComparator>::const_iterator it = | 106 std::map<Version, SecurityStatus, VersionComparator>::const_iterator it = |
| 111 versions_.lower_bound(version); | 107 versions_.lower_bound(version); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 127 PluginMetadata* copy = new PluginMetadata(identifier_, | 123 PluginMetadata* copy = new PluginMetadata(identifier_, |
| 128 name_, | 124 name_, |
| 129 url_for_display_, | 125 url_for_display_, |
| 130 plugin_url_, | 126 plugin_url_, |
| 131 help_url_, | 127 help_url_, |
| 132 group_name_matcher_, | 128 group_name_matcher_, |
| 133 language_); | 129 language_); |
| 134 copy->versions_ = versions_; | 130 copy->versions_ = versions_; |
| 135 return make_scoped_ptr(copy); | 131 return make_scoped_ptr(copy); |
| 136 } | 132 } |
| OLD | NEW |