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 "content/common/pepper_plugin_registry.h" | 5 #include "content/common/pepper_plugin_registry.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/native_library.h" | 9 #include "base/native_library.h" |
10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS : | 89 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS : |
90 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_UNSANDBOXED) : | 90 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_UNSANDBOXED) : |
91 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS; | 91 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS; |
92 | 92 |
93 info.name = name.empty() ? | 93 info.name = name.empty() ? |
94 path.BaseName().LossyDisplayName() : UTF8ToUTF16(name); | 94 path.BaseName().LossyDisplayName() : UTF8ToUTF16(name); |
95 info.path = path; | 95 info.path = path; |
96 info.version = ASCIIToUTF16(version); | 96 info.version = ASCIIToUTF16(version); |
97 info.desc = ASCIIToUTF16(description); | 97 info.desc = ASCIIToUTF16(description); |
98 info.mime_types = mime_types; | 98 info.mime_types = mime_types; |
| 99 info.pepper_permissions = permissions; |
99 | 100 |
100 return info; | 101 return info; |
101 } | 102 } |
102 | 103 |
103 bool MakePepperPluginInfo(const webkit::WebPluginInfo& webplugin_info, | 104 bool MakePepperPluginInfo(const webkit::WebPluginInfo& webplugin_info, |
104 content::PepperPluginInfo* pepper_info) { | 105 content::PepperPluginInfo* pepper_info) { |
105 if (!webkit::IsPepperPlugin(webplugin_info)) | 106 if (!webkit::IsPepperPlugin(webplugin_info)) |
106 return false; | 107 return false; |
107 | 108 |
108 pepper_info->is_out_of_process = webkit::IsOutOfProcessPlugin(webplugin_info); | 109 pepper_info->is_out_of_process = webkit::IsOutOfProcessPlugin(webplugin_info); |
109 pepper_info->is_sandboxed = webplugin_info.type != | 110 pepper_info->is_sandboxed = webplugin_info.type != |
110 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_UNSANDBOXED; | 111 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_UNSANDBOXED; |
111 | 112 |
112 pepper_info->path = FilePath(webplugin_info.path); | 113 pepper_info->path = FilePath(webplugin_info.path); |
113 pepper_info->name = UTF16ToASCII(webplugin_info.name); | 114 pepper_info->name = UTF16ToASCII(webplugin_info.name); |
114 pepper_info->description = UTF16ToASCII(webplugin_info.desc); | 115 pepper_info->description = UTF16ToASCII(webplugin_info.desc); |
115 pepper_info->version = UTF16ToASCII(webplugin_info.version); | 116 pepper_info->version = UTF16ToASCII(webplugin_info.version); |
116 pepper_info->mime_types = webplugin_info.mime_types; | 117 pepper_info->mime_types = webplugin_info.mime_types; |
| 118 pepper_info->permissions = webplugin_info.pepper_permissions; |
| 119 |
117 return true; | 120 return true; |
118 } | 121 } |
119 | 122 |
120 // static | 123 // static |
121 PepperPluginRegistry* PepperPluginRegistry::GetInstance() { | 124 PepperPluginRegistry* PepperPluginRegistry::GetInstance() { |
122 static PepperPluginRegistry* registry = NULL; | 125 static PepperPluginRegistry* registry = NULL; |
123 // This object leaks. It is a temporary hack to work around a crash. | 126 // This object leaks. It is a temporary hack to work around a crash. |
124 // http://code.google.com/p/chromium/issues/detail?id=63234 | 127 // http://code.google.com/p/chromium/issues/detail?id=63234 |
125 if (!registry) | 128 if (!registry) |
126 registry = new PepperPluginRegistry; | 129 registry = new PepperPluginRegistry; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 // Preload all external plugins we're not running out of process. | 238 // Preload all external plugins we're not running out of process. |
236 if (!module->InitAsLibrary(current.path)) { | 239 if (!module->InitAsLibrary(current.path)) { |
237 DLOG(ERROR) << "Failed to load pepper module: " << current.path.value(); | 240 DLOG(ERROR) << "Failed to load pepper module: " << current.path.value(); |
238 continue; | 241 continue; |
239 } | 242 } |
240 } | 243 } |
241 preloaded_modules_[current.path] = module; | 244 preloaded_modules_[current.path] = module; |
242 } | 245 } |
243 } | 246 } |
244 | 247 |
OLD | NEW |