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_finder.h" | 5 #include "chrome/browser/plugins/plugin_finder.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 continue; | 285 continue; |
286 | 286 |
287 return it->second->Clone(); | 287 return it->second->Clone(); |
288 } | 288 } |
289 | 289 |
290 // The plug-in metadata was not found, create a dummy one holding | 290 // The plug-in metadata was not found, create a dummy one holding |
291 // the name, identifier and group name only. | 291 // the name, identifier and group name only. |
292 std::string identifier = GetIdentifier(plugin); | 292 std::string identifier = GetIdentifier(plugin); |
293 PluginMetadata* metadata = new PluginMetadata(identifier, | 293 PluginMetadata* metadata = new PluginMetadata(identifier, |
294 GetGroupName(plugin), | 294 GetGroupName(plugin), |
295 false, GURL(), GURL(), | 295 false, |
| 296 GURL(), |
| 297 GURL(), |
296 plugin.name, | 298 plugin.name, |
297 ""); | 299 std::string()); |
298 for (size_t i = 0; i < plugin.mime_types.size(); ++i) | 300 for (size_t i = 0; i < plugin.mime_types.size(); ++i) |
299 metadata->AddMatchingMimeType(plugin.mime_types[i].mime_type); | 301 metadata->AddMatchingMimeType(plugin.mime_types[i].mime_type); |
300 | 302 |
301 DCHECK(metadata->MatchesPlugin(plugin)); | 303 DCHECK(metadata->MatchesPlugin(plugin)); |
302 if (identifier_plugin_.find(identifier) != identifier_plugin_.end()) | 304 if (identifier_plugin_.find(identifier) != identifier_plugin_.end()) |
303 identifier = GetLongIdentifier(plugin); | 305 identifier = GetLongIdentifier(plugin); |
304 | 306 |
305 DCHECK(identifier_plugin_.find(identifier) == identifier_plugin_.end()); | 307 DCHECK(identifier_plugin_.find(identifier) == identifier_plugin_.end()); |
306 identifier_plugin_[identifier] = metadata; | 308 identifier_plugin_[identifier] = metadata; |
307 return metadata->Clone(); | 309 return metadata->Clone(); |
308 } | 310 } |
OLD | NEW |