OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/lazy_instance.h" | 6 #include "base/lazy_instance.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/plugin_manager.h" | 10 #include "chrome/browser/extensions/plugin_manager.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 content::WebPluginInfo info; | 90 content::WebPluginInfo info; |
91 info.type = content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN; | 91 info.type = content::WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN; |
92 info.name = base::UTF8ToUTF16(handler->extension_id()); | 92 info.name = base::UTF8ToUTF16(handler->extension_id()); |
93 info.path = base::FilePath::FromUTF8Unsafe(handler->extension_id()); | 93 info.path = base::FilePath::FromUTF8Unsafe(handler->extension_id()); |
94 | 94 |
95 for (std::set<std::string>::const_iterator mime_type = | 95 for (std::set<std::string>::const_iterator mime_type = |
96 handler->mime_type_set().begin(); | 96 handler->mime_type_set().begin(); |
97 mime_type != handler->mime_type_set().end(); ++mime_type) { | 97 mime_type != handler->mime_type_set().end(); ++mime_type) { |
98 content::WebPluginMimeType mime_type_info; | 98 content::WebPluginMimeType mime_type_info; |
99 mime_type_info.mime_type = *mime_type; | 99 mime_type_info.mime_type = *mime_type; |
| 100 base::FilePath::StringType file_extension; |
| 101 if (net::GetPreferredExtensionForMimeType(*mime_type, &file_extension)) { |
| 102 mime_type_info.file_extensions.push_back( |
| 103 base::FilePath(file_extension).AsUTF8Unsafe()); |
| 104 } |
100 info.mime_types.push_back(mime_type_info); | 105 info.mime_types.push_back(mime_type_info); |
101 } | 106 } |
102 | 107 |
103 PluginService::GetInstance()->RefreshPlugins(); | 108 PluginService::GetInstance()->RefreshPlugins(); |
104 PluginService::GetInstance()->RegisterInternalPlugin(info, true); | 109 PluginService::GetInstance()->RegisterInternalPlugin(info, true); |
105 } | 110 } |
106 | 111 |
107 if (plugins_or_nacl_changed) | 112 if (plugins_or_nacl_changed) |
108 PluginService::GetInstance()->PurgePluginListCache(profile_, false); | 113 PluginService::GetInstance()->PurgePluginListCache(profile_, false); |
109 } | 114 } |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 iter != nacl_module_list_.end(); ++iter) { | 225 iter != nacl_module_list_.end(); ++iter) { |
221 if (iter->url == url) | 226 if (iter->url == url) |
222 return iter; | 227 return iter; |
223 } | 228 } |
224 return nacl_module_list_.end(); | 229 return nacl_module_list_.end(); |
225 } | 230 } |
226 | 231 |
227 #endif // !defined(DISABLE_NACL) | 232 #endif // !defined(DISABLE_NACL) |
228 | 233 |
229 } // namespace extensions | 234 } // namespace extensions |
OLD | NEW |