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