| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. Use of this | |
| 2 // source code is governed by a BSD-style license that can be found in the | |
| 3 // LICENSE file. | |
| 4 | |
| 5 #include "config.h" | |
| 6 #include "PluginData.h" | |
| 7 | |
| 8 #undef LOG | |
| 9 #include "webkit/glue/glue_util.h" | |
| 10 #include "webkit/glue/webkit_glue.h" | |
| 11 | |
| 12 namespace WebCore { | |
| 13 | |
| 14 static bool refreshData = false; | |
| 15 | |
| 16 void PluginData::initPlugins() | |
| 17 { | |
| 18 std::vector<WebPluginInfo> plugins; | |
| 19 if (!webkit_glue::GetPlugins(refreshData, &plugins)) | |
| 20 return; | |
| 21 refreshData = false; | |
| 22 | |
| 23 for (size_t i = 0; i < plugins.size(); ++i) { | |
| 24 const WebPluginInfo& sourceInfo = plugins[i]; | |
| 25 | |
| 26 PluginInfo* info = new PluginInfo; | |
| 27 info->name = webkit_glue::StdWStringToString(sourceInfo.name); | |
| 28 info->file = webkit_glue::StdWStringToString(sourceInfo.file); | |
| 29 info->desc = webkit_glue::StdWStringToString(sourceInfo.desc); | |
| 30 | |
| 31 for (size_t j = 0; j < sourceInfo.mime_types.size(); ++j) { | |
| 32 const WebPluginMimeType& mimeType = sourceInfo.mime_types[j]; | |
| 33 | |
| 34 MimeClassInfo* mime = new MimeClassInfo; | |
| 35 mime->type = webkit_glue::StdStringToString(mimeType.mime_type); | |
| 36 mime->desc = webkit_glue::StdWStringToString(mimeType.description); | |
| 37 | |
| 38 for (size_t k = 0; k < mimeType.file_extensions.size(); ++k) { | |
| 39 if (k > 0) | |
| 40 mime->suffixes += ","; | |
| 41 mime->suffixes += webkit_glue::StdStringToString(mimeType.file_e
xtensions[k]); | |
| 42 } | |
| 43 info->mimes.append(mime); | |
| 44 } | |
| 45 m_plugins.append(info); | |
| 46 } | |
| 47 } | |
| 48 | |
| 49 void PluginData::refresh() | |
| 50 { | |
| 51 // When next we initialize a PluginData, it'll be fresh. | |
| 52 refreshData = true; | |
| 53 } | |
| 54 | |
| 55 } | |
| OLD | NEW |