OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "webkit/plugins/ppapi/ppapi_plugin_info.h" |
| 6 |
| 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" |
| 9 |
| 10 namespace webkit { |
| 11 namespace ppapi { |
| 12 |
| 13 PluginInfo::PluginInfo() |
| 14 : is_internal(false), |
| 15 is_out_of_process(false) { |
| 16 } |
| 17 |
| 18 PluginInfo::~PluginInfo() { |
| 19 } |
| 20 |
| 21 void PepperToWebPluginInfo(const PluginInfo& pepper_info, |
| 22 webkit::WebPluginInfo* web_info) { |
| 23 web_info->type = pepper_info.is_out_of_process ? |
| 24 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS : |
| 25 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS; |
| 26 |
| 27 web_info->name = pepper_info.name.empty() ? |
| 28 pepper_info.path.BaseName().LossyDisplayName() : |
| 29 UTF8ToUTF16(pepper_info.name); |
| 30 web_info->path = pepper_info.path; |
| 31 web_info->version = ASCIIToUTF16(pepper_info.version); |
| 32 web_info->desc = ASCIIToUTF16(pepper_info.description); |
| 33 web_info->mime_types = pepper_info.mime_types; |
| 34 } |
| 35 |
| 36 bool WebToPepperPluginInfo(const webkit::WebPluginInfo& web_info, |
| 37 PluginInfo* pepper_info) { |
| 38 if (!webkit::IsPepperPlugin(web_info)) |
| 39 return false; |
| 40 |
| 41 pepper_info->is_out_of_process = |
| 42 web_info.type == webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS; |
| 43 |
| 44 pepper_info->path = FilePath(web_info.path); |
| 45 pepper_info->name = UTF16ToASCII(web_info.name); |
| 46 pepper_info->description = UTF16ToASCII(web_info.desc); |
| 47 pepper_info->version = UTF16ToASCII(web_info.version); |
| 48 pepper_info->mime_types = web_info.mime_types; |
| 49 return true; |
| 50 } |
| 51 |
| 52 } // namespace ppapi |
| 53 } // namespace webkit |
OLD | NEW |