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

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

Issue 115896: Making the browser tests work on Unix (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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
« chrome/chrome.gyp ('K') | « webkit/glue/plugins/plugin_lib.cc ('k') | 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 #include "config.h" 5 #include "config.h"
6 6
7 #import <Carbon/Carbon.h> 7 #import <Carbon/Carbon.h>
8 8
9 #include "webkit/glue/plugins/plugin_lib.h" 9 #include "webkit/glue/plugins/plugin_lib.h"
10 10
11 #include "base/native_library.h"
11 #include "base/scoped_cftyperef.h" 12 #include "base/scoped_cftyperef.h"
13 #include "base/scoped_ptr.h"
12 #include "base/string_util.h" 14 #include "base/string_util.h"
13 #include "base/sys_string_conversions.h" 15 #include "base/sys_string_conversions.h"
14 #include "webkit/glue/plugins/plugin_list.h" 16 #include "webkit/glue/plugins/plugin_list.h"
15 17
16 static const short kSTRTypeDefinitionResourceID = 128; 18 static const short kSTRTypeDefinitionResourceID = 128;
17 static const short kSTRTypeDescriptionResourceID = 127; 19 static const short kSTRTypeDescriptionResourceID = 127;
18 static const short kSTRPluginDescriptionResourceID = 126; 20 static const short kSTRPluginDescriptionResourceID = 126;
19 21
20 namespace NPAPI 22 namespace NPAPI
21 { 23 {
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 // (1) <<type0description>> 291 // (1) <<type0description>>
290 // (2) <<type1description>> 292 // (2) <<type1description>>
291 // (...) 293 // (...)
292 // (n+1) <<typendescription>> 294 // (n+1) <<typendescription>>
293 // STR# 126 295 // STR# 126
294 // (1) <<plugindescription>> 296 // (1) <<plugindescription>>
295 // (2) <<pluginname>> 297 // (2) <<pluginname>>
296 // 298 //
297 // Strictly speaking, only STR# 128 is required. 299 // Strictly speaking, only STR# 128 is required.
298 300
299 scoped_cftyperef<CFBundleRef> bundle(base::LoadNativeLibrary(filename)); 301 // We are accessing the bundle contained in the NativeLibrary but not
302 // unloading it. We use a scoped_ptr to make sure the NativeLibraryStruct is
303 // not leaked.
304 scoped_ptr<base::NativeLibraryStruct> native_library(
305 base::LoadNativeLibrary(filename));
306 if (native_library->type != base::BUNDLE)
307 return false;
308 scoped_cftyperef<CFBundleRef> bundle(native_library->bundle);
300 if (!bundle) 309 if (!bundle)
301 return false; 310 return false;
302 311
303 // preflight 312 // preflight
304 313
305 OSType type = 0; 314 OSType type = 0;
306 CFBundleGetPackageInfo(bundle.get(), &type, NULL); 315 CFBundleGetPackageInfo(bundle.get(), &type, NULL);
307 if (type != FOUR_CHAR_CODE('BRPL')) 316 if (type != FOUR_CHAR_CODE('BRPL'))
308 return false; 317 return false;
309 318
310 CFErrorRef error; 319 CFErrorRef error;
311 Boolean would_load = CFBundlePreflightExecutable(bundle.get(), &error); 320 Boolean would_load = CFBundlePreflightExecutable(bundle.get(), &error);
312 if (!would_load) 321 if (!would_load)
313 return false; 322 return false;
314 323
315 // get the info 324 // get the info
316 325
317 if (ReadPlistPluginInfo(filename, bundle.get(), info)) 326 if (ReadPlistPluginInfo(filename, bundle.get(), info))
318 return true; 327 return true;
319 328
320 if (ReadSTRPluginInfo(filename, bundle.get(), info)) 329 if (ReadSTRPluginInfo(filename, bundle.get(), info))
321 return true; 330 return true;
322 331
323 // ... or not 332 // ... or not
324 333
325 return false; 334 return false;
326 } 335 }
327 336
328 } // namespace NPAPI 337 } // namespace NPAPI
OLDNEW
« chrome/chrome.gyp ('K') | « webkit/glue/plugins/plugin_lib.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698