OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS : | 81 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS : |
82 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS; | 82 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS; |
83 | 83 |
84 info.name = name.empty() ? | 84 info.name = name.empty() ? |
85 path.BaseName().LossyDisplayName() : UTF8ToUTF16(name); | 85 path.BaseName().LossyDisplayName() : UTF8ToUTF16(name); |
86 info.path = path; | 86 info.path = path; |
87 info.version = ASCIIToUTF16(version); | 87 info.version = ASCIIToUTF16(version); |
88 info.desc = ASCIIToUTF16(description); | 88 info.desc = ASCIIToUTF16(description); |
89 info.mime_types = mime_types; | 89 info.mime_types = mime_types; |
90 | 90 |
91 webkit::WebPluginInfo::EnabledStates enabled_state = | |
92 webkit::WebPluginInfo::USER_ENABLED_POLICY_UNMANAGED; | |
93 | |
94 if (!enabled) { | |
95 enabled_state = | |
96 webkit::WebPluginInfo::USER_DISABLED_POLICY_UNMANAGED; | |
97 } | |
98 | |
99 info.enabled = enabled_state; | |
100 return info; | 91 return info; |
101 } | 92 } |
102 | 93 |
103 PepperPluginInfo::PepperPluginInfo() | 94 PepperPluginInfo::PepperPluginInfo() |
104 : is_internal(false), | 95 : is_internal(false), |
105 is_out_of_process(false), | 96 is_out_of_process(false) { |
106 enabled(true) { | |
107 } | 97 } |
108 | 98 |
109 PepperPluginInfo::~PepperPluginInfo() { | 99 PepperPluginInfo::~PepperPluginInfo() { |
110 } | 100 } |
111 | 101 |
112 bool MakePepperPluginInfo(const webkit::WebPluginInfo& webplugin_info, | 102 bool MakePepperPluginInfo(const webkit::WebPluginInfo& webplugin_info, |
113 PepperPluginInfo* pepper_info) { | 103 PepperPluginInfo* pepper_info) { |
114 if (!webkit::IsPepperPlugin(webplugin_info)) | 104 if (!webkit::IsPepperPlugin(webplugin_info)) |
115 return false; | 105 return false; |
116 | 106 |
117 pepper_info->is_out_of_process = | 107 pepper_info->is_out_of_process = |
118 webplugin_info.type == | 108 webplugin_info.type == |
119 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS; | 109 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS; |
120 | 110 |
121 pepper_info->enabled = webkit::IsPluginEnabled(webplugin_info); | |
122 pepper_info->path = FilePath(webplugin_info.path); | 111 pepper_info->path = FilePath(webplugin_info.path); |
123 pepper_info->name = UTF16ToASCII(webplugin_info.name); | 112 pepper_info->name = UTF16ToASCII(webplugin_info.name); |
124 pepper_info->description = UTF16ToASCII(webplugin_info.desc); | 113 pepper_info->description = UTF16ToASCII(webplugin_info.desc); |
125 pepper_info->version = UTF16ToASCII(webplugin_info.version); | 114 pepper_info->version = UTF16ToASCII(webplugin_info.version); |
126 pepper_info->mime_types = webplugin_info.mime_types; | 115 pepper_info->mime_types = webplugin_info.mime_types; |
127 return true; | 116 return true; |
128 } | 117 } |
129 | 118 |
130 // static | 119 // static |
131 PepperPluginRegistry* PepperPluginRegistry::GetInstance() { | 120 PepperPluginRegistry* PepperPluginRegistry::GetInstance() { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 // Preload all external plugins we're not running out of process. | 231 // Preload all external plugins we're not running out of process. |
243 if (!module->InitAsLibrary(current.path)) { | 232 if (!module->InitAsLibrary(current.path)) { |
244 DLOG(ERROR) << "Failed to load pepper module: " << current.path.value(); | 233 DLOG(ERROR) << "Failed to load pepper module: " << current.path.value(); |
245 continue; | 234 continue; |
246 } | 235 } |
247 } | 236 } |
248 preloaded_modules_[current.path] = module; | 237 preloaded_modules_[current.path] = module; |
249 } | 238 } |
250 } | 239 } |
251 | 240 |
OLD | NEW |