Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: content/common/pepper_plugin_registry.cc

Issue 10917160: Add some logging to debug PPAPI permissions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/logging.h"
9 #include "base/native_library.h" 10 #include "base/native_library.h"
10 #include "base/string_split.h" 11 #include "base/string_split.h"
11 #include "base/string_util.h" 12 #include "base/string_util.h"
12 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
13 #include "content/public/common/content_client.h" 14 #include "content/public/common/content_client.h"
14 #include "content/public/common/content_switches.h" 15 #include "content/public/common/content_switches.h"
15 #include "ppapi/shared_impl/ppapi_permissions.h" 16 #include "ppapi/shared_impl/ppapi_permissions.h"
16 #include "webkit/plugins/npapi/plugin_list.h" 17 #include "webkit/plugins/npapi/plugin_list.h"
17 18
18 namespace { 19 namespace {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS; 92 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS;
92 93
93 info.name = name.empty() ? 94 info.name = name.empty() ?
94 path.BaseName().LossyDisplayName() : UTF8ToUTF16(name); 95 path.BaseName().LossyDisplayName() : UTF8ToUTF16(name);
95 info.path = path; 96 info.path = path;
96 info.version = ASCIIToUTF16(version); 97 info.version = ASCIIToUTF16(version);
97 info.desc = ASCIIToUTF16(description); 98 info.desc = ASCIIToUTF16(description);
98 info.mime_types = mime_types; 99 info.mime_types = mime_types;
99 info.pepper_permissions = permissions; 100 info.pepper_permissions = permissions;
100 101
102 // TODO(brettw) bug 147507: remove this logging.
103 LOG(INFO) << "PepperPluginInfo::ToWebPluginInfo \""
104 << UTF16ToUTF8(info.path.LossyDisplayName()) << "\" "
105 << "permissions = " << permissions;
106
101 return info; 107 return info;
102 } 108 }
103 109
104 bool MakePepperPluginInfo(const webkit::WebPluginInfo& webplugin_info, 110 bool MakePepperPluginInfo(const webkit::WebPluginInfo& webplugin_info,
105 content::PepperPluginInfo* pepper_info) { 111 content::PepperPluginInfo* pepper_info) {
106 if (!webkit::IsPepperPlugin(webplugin_info)) 112 if (!webkit::IsPepperPlugin(webplugin_info))
107 return false; 113 return false;
108 114
109 pepper_info->is_out_of_process = webkit::IsOutOfProcessPlugin(webplugin_info); 115 pepper_info->is_out_of_process = webkit::IsOutOfProcessPlugin(webplugin_info);
110 pepper_info->is_sandboxed = webplugin_info.type != 116 pepper_info->is_sandboxed = webplugin_info.type !=
111 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_UNSANDBOXED; 117 webkit::WebPluginInfo::PLUGIN_TYPE_PEPPER_UNSANDBOXED;
112 118
113 pepper_info->path = FilePath(webplugin_info.path); 119 pepper_info->path = FilePath(webplugin_info.path);
114 pepper_info->name = UTF16ToASCII(webplugin_info.name); 120 pepper_info->name = UTF16ToASCII(webplugin_info.name);
115 pepper_info->description = UTF16ToASCII(webplugin_info.desc); 121 pepper_info->description = UTF16ToASCII(webplugin_info.desc);
116 pepper_info->version = UTF16ToASCII(webplugin_info.version); 122 pepper_info->version = UTF16ToASCII(webplugin_info.version);
117 pepper_info->mime_types = webplugin_info.mime_types; 123 pepper_info->mime_types = webplugin_info.mime_types;
118 pepper_info->permissions = webplugin_info.pepper_permissions; 124 pepper_info->permissions = webplugin_info.pepper_permissions;
119 125
126 LOG(INFO) << "PepperPluginInfo::ToWebPluginInfo \""
127 << UTF16ToUTF8(pepper_info->path.LossyDisplayName()) << "\" "
128 << "permissions = " << pepper_info->permissions;
129
120 return true; 130 return true;
121 } 131 }
122 132
123 // static 133 // static
124 PepperPluginRegistry* PepperPluginRegistry::GetInstance() { 134 PepperPluginRegistry* PepperPluginRegistry::GetInstance() {
125 static PepperPluginRegistry* registry = NULL; 135 static PepperPluginRegistry* registry = NULL;
126 // This object leaks. It is a temporary hack to work around a crash. 136 // This object leaks. It is a temporary hack to work around a crash.
127 // http://code.google.com/p/chromium/issues/detail?id=63234 137 // http://code.google.com/p/chromium/issues/detail?id=63234
128 if (!registry) 138 if (!registry)
129 registry = new PepperPluginRegistry; 139 registry = new PepperPluginRegistry;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 228
219 // Note that in each case, AddLiveModule must be called before completing 229 // Note that in each case, AddLiveModule must be called before completing
220 // initialization. If we bail out (in the continue clauses) before saving 230 // initialization. If we bail out (in the continue clauses) before saving
221 // the initialized module, it will still try to unregister itself in its 231 // the initialized module, it will still try to unregister itself in its
222 // destructor. 232 // destructor.
223 for (size_t i = 0; i < plugin_list_.size(); i++) { 233 for (size_t i = 0; i < plugin_list_.size(); i++) {
224 const content::PepperPluginInfo& current = plugin_list_[i]; 234 const content::PepperPluginInfo& current = plugin_list_[i];
225 if (current.is_out_of_process) 235 if (current.is_out_of_process)
226 continue; // Out of process plugins need no special pre-initialization. 236 continue; // Out of process plugins need no special pre-initialization.
227 237
238 // TODO(brettw) bug 147507: Remove this logging.
239 LOG(INFO) << "PepperPluginRegistry::PepperPluginRegistry \""
240 << UTF16ToUTF8(current.path.LossyDisplayName()) << "\" "
241 << " permissions =" << current.permissions;
242
228 scoped_refptr<webkit::ppapi::PluginModule> module = 243 scoped_refptr<webkit::ppapi::PluginModule> module =
229 new webkit::ppapi::PluginModule(current.name, current.path, this, 244 new webkit::ppapi::PluginModule(current.name, current.path, this,
230 ppapi::PpapiPermissions(current.permissions)); 245 ppapi::PpapiPermissions(current.permissions));
231 AddLiveModule(current.path, module); 246 AddLiveModule(current.path, module);
232 if (current.is_internal) { 247 if (current.is_internal) {
233 if (!module->InitAsInternalPlugin(current.internal_entry_points)) { 248 if (!module->InitAsInternalPlugin(current.internal_entry_points)) {
234 DLOG(ERROR) << "Failed to load pepper module: " << current.path.value(); 249 DLOG(ERROR) << "Failed to load pepper module: " << current.path.value();
235 continue; 250 continue;
236 } 251 }
237 } else { 252 } else {
238 // Preload all external plugins we're not running out of process. 253 // Preload all external plugins we're not running out of process.
239 if (!module->InitAsLibrary(current.path)) { 254 if (!module->InitAsLibrary(current.path)) {
240 DLOG(ERROR) << "Failed to load pepper module: " << current.path.value(); 255 DLOG(ERROR) << "Failed to load pepper module: " << current.path.value();
241 continue; 256 continue;
242 } 257 }
243 } 258 }
244 preloaded_modules_[current.path] = module; 259 preloaded_modules_[current.path] = module;
245 } 260 }
246 } 261 }
247 262
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698