Chromium Code Reviews| 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/glue/plugins/plugin_list.h" | 5 #include "webkit/glue/plugins/plugin_list.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/sha1.h" | 9 #include "base/sha1.h" |
| 10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info, | 240 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info, |
| 241 std::vector<WebPluginInfo>* plugins) { | 241 std::vector<WebPluginInfo>* plugins) { |
| 242 LOG_IF(ERROR, PluginList::DebugPluginLoading()) | 242 LOG_IF(ERROR, PluginList::DebugPluginLoading()) |
| 243 << "Considering " << info.path.value() << " (" << info.name << ")"; | 243 << "Considering " << info.path.value() << " (" << info.name << ")"; |
| 244 | 244 |
| 245 if (IsUndesirablePlugin(info)) { | 245 if (IsUndesirablePlugin(info)) { |
| 246 LOG_IF(ERROR, PluginList::DebugPluginLoading()) | 246 LOG_IF(ERROR, PluginList::DebugPluginLoading()) |
| 247 << info.path.value() << " is undesirable."; | 247 << info.path.value() << " is undesirable."; |
| 248 | 248 |
| 249 // See if we have a better version of this plugin. | 249 // See if we have a better version of this plugin. |
| 250 for (size_t i = 0; i < plugins->size(); ++i) { | 250 for (std::vector<WebPluginInfo>::iterator it = plugins->begin(); |
|
jam
2010/12/17 19:14:45
please leave as before
pastarmovj
2010/12/20 19:57:37
Done.
| |
| 251 if (plugins->at(i).name == info.name && | 251 it != plugins->end(); |
| 252 !IsUndesirablePlugin(plugins->at(i))) { | 252 ++it) { |
| 253 if (it->name == info.name && | |
| 254 !IsUndesirablePlugin(*it)) { | |
| 253 // Skip the current undesirable one so we can use the better one | 255 // Skip the current undesirable one so we can use the better one |
| 254 // we just found. | 256 // we just found. |
| 255 LOG_IF(ERROR, PluginList::DebugPluginLoading()) | 257 LOG_IF(ERROR, PluginList::DebugPluginLoading()) |
| 256 << "Skipping " << info.path.value() << ", preferring " | 258 << "Skipping " << info.path.value() << ", preferring " |
| 257 << plugins->at(i).path.value(); | 259 << it->path.value(); |
| 258 return false; | 260 return false; |
| 259 } | 261 } |
| 260 } | 262 } |
| 261 } | 263 } |
| 262 | 264 |
| 263 // TODO(evanm): prefer the newest version of flash, etc. here? | 265 // TODO(evanm): prefer the newest version of flash, etc. here? |
| 264 | 266 |
| 265 VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value(); | 267 VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value(); |
| 266 | 268 |
| 267 return true; | 269 return true; |
| 268 } | 270 } |
| 269 | 271 |
| 270 } // namespace NPAPI | 272 } // namespace NPAPI |
| OLD | NEW |