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

Side by Side Diff: webkit/plugins/npapi/plugin_lib_mac.mm

Issue 8071013: Finish moving plugin probing out of process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 2 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
« no previous file with comments | « content/browser/utility_process_host.cc ('k') | webkit/plugins/npapi/plugin_list.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #import <Carbon/Carbon.h> 5 #import <Carbon/Carbon.h>
6 #import <CoreFoundation/CoreFoundation.h>
6 7
7 #include "webkit/plugins/npapi/plugin_lib.h" 8 #include "webkit/plugins/npapi/plugin_lib.h"
8 9
9 #include "base/mac/scoped_cftyperef.h" 10 #include "base/mac/scoped_cftyperef.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "base/native_library.h" 12 #include "base/native_library.h"
12 #include "base/string_split.h" 13 #include "base/string_split.h"
13 #include "base/string_util.h" 14 #include "base/string_util.h"
14 #include "base/sys_string_conversions.h" 15 #include "base/sys_string_conversions.h"
15 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // Alternatively (and this is undocumented), rather than a WebPluginMIMETypes 170 // Alternatively (and this is undocumented), rather than a WebPluginMIMETypes
170 // key, there may be a WebPluginMIMETypesFilename key. If it is present, then 171 // key, there may be a WebPluginMIMETypesFilename key. If it is present, then
171 // it is the name of a file in the user's preferences folder in which to find 172 // it is the name of a file in the user's preferences folder in which to find
172 // the WebPluginMIMETypes key. If the key is present but the file doesn't 173 // the WebPluginMIMETypes key. If the key is present but the file doesn't
173 // exist, we must load the plugin and call a specific function to have the 174 // exist, we must load the plugin and call a specific function to have the
174 // plugin create the file. 175 // plugin create the file.
175 176
176 ScopedCFTypeRef<CFURLRef> bundle_url(CFURLCreateFromFileSystemRepresentation( 177 ScopedCFTypeRef<CFURLRef> bundle_url(CFURLCreateFromFileSystemRepresentation(
177 kCFAllocatorDefault, (const UInt8*)filename.value().c_str(), 178 kCFAllocatorDefault, (const UInt8*)filename.value().c_str(),
178 filename.value().length(), true)); 179 filename.value().length(), true));
179 if (!bundle_url) 180 if (!bundle_url) {
181 LOG_IF(ERROR, PluginList::DebugPluginLoading())
182 << "PluginLib::ReadWebPluginInfo could not create bundle URL";
180 return false; 183 return false;
184 }
181 ScopedCFTypeRef<CFBundleRef> bundle(CFBundleCreate(kCFAllocatorDefault, 185 ScopedCFTypeRef<CFBundleRef> bundle(CFBundleCreate(kCFAllocatorDefault,
182 bundle_url.get())); 186 bundle_url.get()));
183 if (!bundle) 187 if (!bundle) {
188 LOG_IF(ERROR, PluginList::DebugPluginLoading())
189 << "PluginLib::ReadWebPluginInfo could not create CFBundleRef";
184 return false; 190 return false;
191 }
185 192
186 // preflight 193 // preflight
187 194
188 OSType type = 0; 195 OSType type = 0;
189 CFBundleGetPackageInfo(bundle.get(), &type, NULL); 196 CFBundleGetPackageInfo(bundle.get(), &type, NULL);
190 if (type != FOUR_CHAR_CODE('BRPL')) 197 if (type != FOUR_CHAR_CODE('BRPL')) {
198 LOG_IF(ERROR, PluginList::DebugPluginLoading())
199 << "PluginLib::ReadWebPluginInfo bundle is not BRPL, is " << type;
191 return false; 200 return false;
201 }
192 202
193 CFErrorRef error; 203 CFErrorRef error;
194 Boolean would_load = CFBundlePreflightExecutable(bundle.get(), &error); 204 Boolean would_load = CFBundlePreflightExecutable(bundle.get(), &error);
195 if (!would_load) 205 if (!would_load) {
206 ScopedCFTypeRef<CFStringRef> error_string(CFErrorCopyDescription(error));
207 LOG_IF(ERROR, PluginList::DebugPluginLoading())
208 << "PluginLib::ReadWebPluginInfo bundle failed preflight: "
209 << base::SysCFStringRefToUTF8(error_string);
196 return false; 210 return false;
211 }
197 212
198 // get the info 213 // get the info
199 214
200 if (ReadPlistPluginInfo(filename, bundle.get(), info)) 215 if (ReadPlistPluginInfo(filename, bundle.get(), info))
201 return true; 216 return true;
202 217
203 // ... or not 218 // ... or not
204 219
205 return false; 220 return false;
206 } 221 }
207 222
208 } // namespace npapi 223 } // namespace npapi
209 } // namespace webkit 224 } // namespace webkit
OLDNEW
« no previous file with comments | « content/browser/utility_process_host.cc ('k') | webkit/plugins/npapi/plugin_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698