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

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

Issue 492012: [Mac] Puts a NULL check in case a native plugin library cannot be loaded (.dl... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years 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 | « no previous file | no next file » | 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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 6
7 #include "webkit/glue/plugins/plugin_lib.h" 7 #include "webkit/glue/plugins/plugin_lib.h"
8 8
9 #include "base/native_library.h" 9 #include "base/native_library.h"
10 #include "base/scoped_cftyperef.h" 10 #include "base/scoped_cftyperef.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 // (1) <<plugindescription>> 304 // (1) <<plugindescription>>
305 // (2) <<pluginname>> 305 // (2) <<pluginname>>
306 // 306 //
307 // Strictly speaking, only STR# 128 is required. 307 // Strictly speaking, only STR# 128 is required.
308 308
309 // We are accessing the bundle contained in the NativeLibrary but not 309 // We are accessing the bundle contained in the NativeLibrary but not
310 // unloading it. We use a scoped_ptr to make sure the NativeLibraryStruct is 310 // unloading it. We use a scoped_ptr to make sure the NativeLibraryStruct is
311 // not leaked. 311 // not leaked.
312 scoped_ptr<base::NativeLibraryStruct> native_library( 312 scoped_ptr<base::NativeLibraryStruct> native_library(
313 base::LoadNativeLibrary(filename)); 313 base::LoadNativeLibrary(filename));
314 if (native_library->type != base::BUNDLE) 314 if (!native_library.get() || native_library->type != base::BUNDLE)
315 return false; 315 return false;
316 scoped_cftyperef<CFBundleRef> bundle(native_library->bundle); 316 scoped_cftyperef<CFBundleRef> bundle(native_library->bundle);
317 if (!bundle) 317 if (!bundle)
318 return false; 318 return false;
319 319
320 // preflight 320 // preflight
321 321
322 OSType type = 0; 322 OSType type = 0;
323 CFBundleGetPackageInfo(bundle.get(), &type, NULL); 323 CFBundleGetPackageInfo(bundle.get(), &type, NULL);
324 if (type != FOUR_CHAR_CODE('BRPL')) 324 if (type != FOUR_CHAR_CODE('BRPL'))
(...skipping 11 matching lines...) Expand all
336 336
337 if (ReadSTRPluginInfo(filename, bundle.get(), info)) 337 if (ReadSTRPluginInfo(filename, bundle.get(), info))
338 return true; 338 return true;
339 339
340 // ... or not 340 // ... or not
341 341
342 return false; 342 return false;
343 } 343 }
344 344
345 } // namespace NPAPI 345 } // namespace NPAPI
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698