| OLD | NEW | 
|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "webkit/glue/plugins/plugin_lib.h" | 7 #include "webkit/glue/plugins/plugin_lib.h" | 
| 8 | 8 | 
| 9 #include <dlfcn.h> | 9 #include <dlfcn.h> | 
| 10 | 10 | 
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" | 
| 12 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" | 
| 13 #include "webkit/glue/plugins/plugin_list.h" | 13 #include "webkit/glue/plugins/plugin_list.h" | 
| 14 | 14 | 
| 15 // These headers must be included in this order to make the declaration gods | 15 // These headers must be included in this order to make the declaration gods | 
| 16 // happy. | 16 // happy. | 
| 17 #include "base/third_party/nspr/prcpucfg_linux.h" | 17 #include "base/third_party/nspr/prcpucfg_linux.h" | 
| 18 #include "third_party/mozilla/include/nsplugindefs.h" | 18 #include "third_party/mozilla/include/nsplugindefs.h" | 
| 19 | 19 | 
| 20 namespace NPAPI { | 20 namespace NPAPI { | 
| 21 | 21 | 
| 22 // static |  | 
| 23 PluginLib::NativeLibrary PluginLib::LoadNativeLibrary( |  | 
| 24     const FilePath& library_path) { |  | 
| 25   void* dl = dlopen(library_path.value().c_str(), RTLD_LAZY); |  | 
| 26   if (!dl) |  | 
| 27     NOTREACHED() << "dlopen failed: " << dlerror(); |  | 
| 28 |  | 
| 29   return dl; |  | 
| 30 } |  | 
| 31 |  | 
| 32 // static |  | 
| 33 void PluginLib::UnloadNativeLibrary(NativeLibrary library) { |  | 
| 34   int ret = dlclose(library); |  | 
| 35   if (ret < 0) |  | 
| 36     NOTREACHED() << "dlclose failed: " << dlerror(); |  | 
| 37 } |  | 
| 38 |  | 
| 39 // static |  | 
| 40 void* PluginLib::GetFunctionPointerFromNativeLibrary( |  | 
| 41     NativeLibrary library, |  | 
| 42     NativeLibraryFunctionNameType name) { |  | 
| 43   return dlsym(library, name); |  | 
| 44 } |  | 
| 45 |  | 
| 46 bool PluginLib::ReadWebPluginInfo(const FilePath& filename, | 22 bool PluginLib::ReadWebPluginInfo(const FilePath& filename, | 
| 47                                   WebPluginInfo* info) { | 23                                   WebPluginInfo* info) { | 
| 48   // The file to reference is: | 24   // The file to reference is: | 
| 49   // http://mxr.mozilla.org/firefox/source/modules/plugin/base/src/nsPluginsDirU
     nix.cpp | 25   // http://mxr.mozilla.org/firefox/source/modules/plugin/base/src/nsPluginsDirU
     nix.cpp | 
| 50 | 26 | 
| 51   void* dl = LoadNativeLibrary(filename); | 27   void* dl = base::LoadNativeLibrary(filename); | 
| 52   if (!dl) | 28   if (!dl) | 
| 53     return false; | 29     return false; | 
| 54 | 30 | 
| 55   info->path = filename; | 31   info->path = filename; | 
| 56 | 32 | 
| 57   // See comments in plugin_lib_mac regarding this symbol. | 33   // See comments in plugin_lib_mac regarding this symbol. | 
| 58   typedef const char* (*NP_GetMimeDescriptionType)(); | 34   typedef const char* (*NP_GetMimeDescriptionType)(); | 
| 59   NP_GetMimeDescriptionType NP_GetMIMEDescription = | 35   NP_GetMimeDescriptionType NP_GetMIMEDescription = | 
| 60       reinterpret_cast<NP_GetMimeDescriptionType>( | 36       reinterpret_cast<NP_GetMimeDescriptionType>( | 
| 61           dlsym(dl, "NP_GetMIMEDescription")); | 37           dlsym(dl, "NP_GetMIMEDescription")); | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 101     const char* description = NULL; | 77     const char* description = NULL; | 
| 102     NP_GetValue(NULL, nsPluginVariable_DescriptionString, &description); | 78     NP_GetValue(NULL, nsPluginVariable_DescriptionString, &description); | 
| 103     if (description) | 79     if (description) | 
| 104       info->desc = ASCIIToWide(description); | 80       info->desc = ASCIIToWide(description); | 
| 105   } | 81   } | 
| 106 | 82 | 
| 107   return true; | 83   return true; | 
| 108 } | 84 } | 
| 109 | 85 | 
| 110 }  // namespace NPAPI | 86 }  // namespace NPAPI | 
| OLD | NEW | 
|---|