Home | History | Annotate | Download | only in common
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CONTENT_PUBLIC_COMMON_PEPPER_PLUGIN_INFO_H_
      6 #define CONTENT_PUBLIC_COMMON_PEPPER_PLUGIN_INFO_H_
      7 
      8 #include <string>
      9 #include <vector>
     10 
     11 #include "base/files/file_path.h"
     12 #include "content/common/content_export.h"
     13 #include "content/public/common/webplugininfo.h"
     14 #include "ppapi/c/pp_module.h"
     15 #include "ppapi/c/ppb.h"
     16 
     17 #if !defined(ENABLE_PLUGINS)
     18 #error "Plugins should be enabled"
     19 #endif
     20 
     21 namespace content {
     22 
     23 struct CONTENT_EXPORT PepperPluginInfo {
     24   typedef const void* (*GetInterfaceFunc)(const char*);
     25   typedef int (*PPP_InitializeModuleFunc)(PP_Module, PPB_GetInterface);
     26   typedef void (*PPP_ShutdownModuleFunc)();
     27 
     28   struct EntryPoints {
     29     // This structure is POD, with the constructor initializing to NULL.
     30     CONTENT_EXPORT EntryPoints();
     31 
     32     GetInterfaceFunc get_interface;
     33     PPP_InitializeModuleFunc initialize_module;
     34     PPP_ShutdownModuleFunc shutdown_module;  // Optional, may be NULL.
     35   };
     36 
     37   PepperPluginInfo();
     38   ~PepperPluginInfo();
     39 
     40   WebPluginInfo ToWebPluginInfo() const;
     41 
     42   // Indicates internal plugins for which there's not actually a library.
     43   // These plugins are implemented in the Chrome binary using a separate set
     44   // of entry points (see internal_entry_points below).
     45   // Defaults to false.
     46   bool is_internal;
     47 
     48   // True when this plugin should be run out of process. Defaults to false.
     49   bool is_out_of_process;
     50 
     51   // True when an out-of-process plugin should also be run within sandbox.
     52   // Defaults to true.
     53   bool is_sandboxed;
     54 
     55   base::FilePath path;  // Internal plugins have "internal-[name]" as path.
     56   std::string name;
     57   std::string description;
     58   std::string version;
     59   std::vector<WebPluginMimeType> mime_types;
     60 
     61   // When is_internal is set, this contains the function pointers to the
     62   // entry points for the internal plugins.
     63   EntryPoints internal_entry_points;
     64 
     65   // Permission bits from ppapi::Permission.
     66   uint32 permissions;
     67 };
     68 
     69 }  // namespace content
     70 
     71 #endif  // CONTENT_PUBLIC_COMMON_PEPPER_PLUGIN_INFO_H_
     72