| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS : | 82 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS : |
| 83 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS; | 83 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS; |
| 84 | 84 |
| 85 info.name = name.empty() ? | 85 info.name = name.empty() ? |
| 86 path.BaseName().LossyDisplayName() : UTF8ToUTF16(name); | 86 path.BaseName().LossyDisplayName() : UTF8ToUTF16(name); |
| 87 info.path = path; | 87 info.path = path; |
| 88 info.version = ASCIIToUTF16(version); | 88 info.version = ASCIIToUTF16(version); |
| 89 info.desc = ASCIIToUTF16(description); | 89 info.desc = ASCIIToUTF16(description); |
| 90 info.mime_types = mime_types; | 90 info.mime_types = mime_types; |
| 91 | 91 |
| 92 webkit::WebPluginInfo::EnabledStates enabled_state = |
| 93 webkit::WebPluginInfo::USER_ENABLED_POLICY_UNMANAGED; |
| 94 |
| 95 if (!enabled) { |
| 96 enabled_state = |
| 97 webkit::WebPluginInfo::USER_DISABLED_POLICY_UNMANAGED; |
| 98 } |
| 99 |
| 100 info.enabled = enabled_state; |
| 92 return info; | 101 return info; |
| 93 } | 102 } |
| 94 | 103 |
| 95 PepperPluginInfo::PepperPluginInfo() | 104 PepperPluginInfo::PepperPluginInfo() |
| 96 : is_internal(false), | 105 : is_internal(false), |
| 97 is_out_of_process(false) { | 106 is_out_of_process(false), |
| 107 enabled(true) { |
| 98 } | 108 } |
| 99 | 109 |
| 100 PepperPluginInfo::~PepperPluginInfo() { | 110 PepperPluginInfo::~PepperPluginInfo() { |
| 101 } | 111 } |
| 102 | 112 |
| 103 bool MakePepperPluginInfo(const webkit::WebPluginInfo& webplugin_info, | 113 bool MakePepperPluginInfo(const webkit::WebPluginInfo& webplugin_info, |
| 104 PepperPluginInfo* pepper_info) { | 114 PepperPluginInfo* pepper_info) { |
| 105 if (!webkit::IsPepperPlugin(webplugin_info)) | 115 if (!webkit::IsPepperPlugin(webplugin_info)) |
| 106 return false; | 116 return false; |
| 107 | 117 |
| 108 pepper_info->is_out_of_process = | 118 pepper_info->is_out_of_process = |
| 109 webplugin_info.type == | 119 webplugin_info.type == |
| 110 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS; | 120 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS; |
| 111 | 121 |
| 122 pepper_info->enabled = webkit::IsPluginEnabled(webplugin_info); |
| 112 pepper_info->path = FilePath(webplugin_info.path); | 123 pepper_info->path = FilePath(webplugin_info.path); |
| 113 pepper_info->name = UTF16ToASCII(webplugin_info.name); | 124 pepper_info->name = UTF16ToASCII(webplugin_info.name); |
| 114 pepper_info->description = UTF16ToASCII(webplugin_info.desc); | 125 pepper_info->description = UTF16ToASCII(webplugin_info.desc); |
| 115 pepper_info->version = UTF16ToASCII(webplugin_info.version); | 126 pepper_info->version = UTF16ToASCII(webplugin_info.version); |
| 116 pepper_info->mime_types = webplugin_info.mime_types; | 127 pepper_info->mime_types = webplugin_info.mime_types; |
| 117 return true; | 128 return true; |
| 118 } | 129 } |
| 119 | 130 |
| 120 // static | 131 // static |
| 121 PepperPluginRegistry* PepperPluginRegistry::GetInstance() { | 132 PepperPluginRegistry* PepperPluginRegistry::GetInstance() { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 base::MessageLoopProxy* PepperPluginRegistry::GetIPCMessageLoop() { | 253 base::MessageLoopProxy* PepperPluginRegistry::GetIPCMessageLoop() { |
| 243 // This is called only in the renderer so we know we have a child process. | 254 // This is called only in the renderer so we know we have a child process. |
| 244 DCHECK(ChildProcess::current()) << "Must be in the renderer."; | 255 DCHECK(ChildProcess::current()) << "Must be in the renderer."; |
| 245 return ChildProcess::current()->io_message_loop_proxy(); | 256 return ChildProcess::current()->io_message_loop_proxy(); |
| 246 } | 257 } |
| 247 | 258 |
| 248 base::WaitableEvent* PepperPluginRegistry::GetShutdownEvent() { | 259 base::WaitableEvent* PepperPluginRegistry::GetShutdownEvent() { |
| 249 DCHECK(ChildProcess::current()) << "Must be in the renderer."; | 260 DCHECK(ChildProcess::current()) << "Must be in the renderer."; |
| 250 return ChildProcess::current()->GetShutDownEvent(); | 261 return ChildProcess::current()->GetShutDownEvent(); |
| 251 } | 262 } |
| OLD | NEW |