| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 bool PluginList::CreateWebPluginInfo(const PluginVersionInfo& pvi, | 101 bool PluginList::CreateWebPluginInfo(const PluginVersionInfo& pvi, |
| 102 WebPluginInfo* info) { | 102 WebPluginInfo* info) { |
| 103 std::vector<std::string> mime_types, file_extensions; | 103 std::vector<std::string> mime_types, file_extensions; |
| 104 std::vector<string16> descriptions; | 104 std::vector<string16> descriptions; |
| 105 SplitString(WideToUTF8(pvi.mime_types), '|', &mime_types); | 105 SplitString(WideToUTF8(pvi.mime_types), '|', &mime_types); |
| 106 SplitString(WideToUTF8(pvi.file_extensions), '|', &file_extensions); | 106 SplitString(WideToUTF8(pvi.file_extensions), '|', &file_extensions); |
| 107 SplitString(WideToUTF16(pvi.type_descriptions), '|', &descriptions); | 107 SplitString(WideToUTF16(pvi.type_descriptions), '|', &descriptions); |
| 108 | 108 |
| 109 info->mime_types.clear(); | 109 info->mime_types.clear(); |
| 110 | 110 |
| 111 if (mime_types.empty()) | 111 if (mime_types.empty()) { |
| 112 LOG_IF(ERROR, PluginList::DebugPluginLoading()) |
| 113 << "Plugin " << pvi.product_name << " has no MIME types, skipping"; |
| 112 return false; | 114 return false; |
| 115 } |
| 113 | 116 |
| 114 info->name = WideToUTF16(pvi.product_name); | 117 info->name = WideToUTF16(pvi.product_name); |
| 115 info->desc = WideToUTF16(pvi.file_description); | 118 info->desc = WideToUTF16(pvi.file_description); |
| 116 info->version = WideToUTF16(pvi.file_version); | 119 info->version = WideToUTF16(pvi.file_version); |
| 117 info->path = pvi.path; | 120 info->path = pvi.path; |
| 118 info->enabled = true; | 121 info->enabled = true; |
| 119 | 122 |
| 120 for (size_t i = 0; i < mime_types.size(); ++i) { | 123 for (size_t i = 0; i < mime_types.size(); ++i) { |
| 121 WebPluginMimeType mime_type; | 124 WebPluginMimeType mime_type; |
| 122 mime_type.mime_type = StringToLowerASCII(mime_types[i]); | 125 mime_type.mime_type = StringToLowerASCII(mime_types[i]); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 if (disabled_plugins_.find(it->path) != disabled_plugins_.end()) | 226 if (disabled_plugins_.find(it->path) != disabled_plugins_.end()) |
| 224 it->enabled = false; | 227 it->enabled = false; |
| 225 } | 228 } |
| 226 | 229 |
| 227 plugins_ = new_plugins; | 230 plugins_ = new_plugins; |
| 228 plugins_loaded_ = true; | 231 plugins_loaded_ = true; |
| 229 } | 232 } |
| 230 | 233 |
| 231 void PluginList::LoadPlugin(const FilePath& path, | 234 void PluginList::LoadPlugin(const FilePath& path, |
| 232 std::vector<WebPluginInfo>* plugins) { | 235 std::vector<WebPluginInfo>* plugins) { |
| 236 LOG_IF(ERROR, PluginList::DebugPluginLoading()) |
| 237 << "Loading plugin " << path.value(); |
| 238 |
| 233 WebPluginInfo plugin_info; | 239 WebPluginInfo plugin_info; |
| 234 const PluginEntryPoints* entry_points; | 240 const PluginEntryPoints* entry_points; |
| 235 | 241 |
| 236 if (!ReadPluginInfo(path, &plugin_info, &entry_points)) | 242 if (!ReadPluginInfo(path, &plugin_info, &entry_points)) |
| 237 return; | 243 return; |
| 238 | 244 |
| 239 if (!ShouldLoadPlugin(plugin_info, plugins)) | 245 if (!ShouldLoadPlugin(plugin_info, plugins)) |
| 240 return; | 246 return; |
| 241 | 247 |
| 242 if (path.value() != kDefaultPluginLibraryName | 248 if (path.value() != kDefaultPluginLibraryName |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 } | 457 } |
| 452 | 458 |
| 453 return did_disable; | 459 return did_disable; |
| 454 } | 460 } |
| 455 | 461 |
| 456 void PluginList::Shutdown() { | 462 void PluginList::Shutdown() { |
| 457 // TODO | 463 // TODO |
| 458 } | 464 } |
| 459 | 465 |
| 460 } // namespace NPAPI | 466 } // namespace NPAPI |
| OLD | NEW |