| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // the filename without extension if the name is empty. | 47 // the filename without extension if the name is empty. |
| 48 static string16 GetGroupName(const webkit::WebPluginInfo& plugin) { | 48 static string16 GetGroupName(const webkit::WebPluginInfo& plugin) { |
| 49 if (!plugin.name.empty()) | 49 if (!plugin.name.empty()) |
| 50 return plugin.name; | 50 return plugin.name; |
| 51 | 51 |
| 52 base::FilePath::StringType path = | 52 base::FilePath::StringType path = |
| 53 plugin.path.BaseName().RemoveExtension().value(); | 53 plugin.path.BaseName().RemoveExtension().value(); |
| 54 #if defined(OS_POSIX) | 54 #if defined(OS_POSIX) |
| 55 return UTF8ToUTF16(path); | 55 return UTF8ToUTF16(path); |
| 56 #elif defined(OS_WIN) | 56 #elif defined(OS_WIN) |
| 57 return WideToUTF16(path); | 57 return base::WideToUTF16(path); |
| 58 #endif | 58 #endif |
| 59 } | 59 } |
| 60 | 60 |
| 61 void LoadMimeTypes(bool matching_mime_types, | 61 void LoadMimeTypes(bool matching_mime_types, |
| 62 const DictionaryValue* plugin_dict, | 62 const DictionaryValue* plugin_dict, |
| 63 PluginMetadata* plugin) { | 63 PluginMetadata* plugin) { |
| 64 const ListValue* mime_types = NULL; | 64 const ListValue* mime_types = NULL; |
| 65 std::string list_key = | 65 std::string list_key = |
| 66 matching_mime_types ? "matching_mime_types" : "mime_types"; | 66 matching_mime_types ? "matching_mime_types" : "mime_types"; |
| 67 if (!plugin_dict->GetList(list_key, &mime_types)) | 67 if (!plugin_dict->GetList(list_key, &mime_types)) |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 metadata->AddMatchingMimeType(plugin.mime_types[i].mime_type); | 299 metadata->AddMatchingMimeType(plugin.mime_types[i].mime_type); |
| 300 | 300 |
| 301 DCHECK(metadata->MatchesPlugin(plugin)); | 301 DCHECK(metadata->MatchesPlugin(plugin)); |
| 302 if (identifier_plugin_.find(identifier) != identifier_plugin_.end()) | 302 if (identifier_plugin_.find(identifier) != identifier_plugin_.end()) |
| 303 identifier = GetLongIdentifier(plugin); | 303 identifier = GetLongIdentifier(plugin); |
| 304 | 304 |
| 305 DCHECK(identifier_plugin_.find(identifier) == identifier_plugin_.end()); | 305 DCHECK(identifier_plugin_.find(identifier) == identifier_plugin_.end()); |
| 306 identifier_plugin_[identifier] = metadata; | 306 identifier_plugin_[identifier] = metadata; |
| 307 return metadata->Clone(); | 307 return metadata->Clone(); |
| 308 } | 308 } |
| OLD | NEW |