FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
FactoryBase.h
1 /**********************************************************\
2  Original Author: Georg Fritzsche
3 
4  Created: Oct 23, 2010
5  License: Dual license model; choose one of two:
6  New BSD License
7  http://www.opensource.org/licenses/bsd-license.php
8  - or -
9  GNU Lesser General Public License, version 2.1
10  http://www.gnu.org/licenses/lgpl-2.1.html
11 
12  Copyright 2010 Georg Fritzsche, Firebreath development team
13  \**********************************************************/
14 
15 #pragma once
16 #ifndef H_FB_FACTORYBASE
17 #define H_FB_FACTORYBASE
18 
19 #include <string>
20 #include <boost/shared_ptr.hpp>
21 #include <boost/utility.hpp>
22 #include "APITypes.h"
23 #include "FBPointers.h"
24 #include "logging.h"
25 
26 #include "PluginWindowForwardDecl.h"
27 
28 #ifdef FB_MACOSX
29 #include <Carbon/Carbon.h>
30 #if !defined(__QUICKDRAWAPI__) && !defined(NP_NO_QUICKDRAW)
31 #define NP_NO_QUICKDRAW 1
32 #endif
33 #endif
34 
35 
36 namespace FB
37 {
38  FB_FORWARD_PTR(FactoryBase);
39  FB_FORWARD_PTR(PluginCore);
40  FB_FORWARD_PTR(BrowserHost);
41  FB_FORWARD_PTR(JSAPI);
43  typedef boost::shared_ptr<FactoryBase> FactoryBasePtr;
44 
46  typedef boost::shared_ptr<PluginCore> PluginCorePtr;
47 
48  FB_FORWARD_PTR(D3d10DeviceContext);
49 
50  namespace Npapi {
51  FB_FORWARD_PTR(NpapiPlugin);
52  FB_FORWARD_PTR(NpapiBrowserHost);
53  }
54 }
55 
57 FB::FactoryBasePtr getFactoryInstance();
58 struct IDispatchEx;
59 typedef long HRESULT;
60 
61 namespace FB
62 {
100  class FactoryBase : public boost::noncopyable
101  {
102  public:
103  FactoryBase();
104  virtual ~FactoryBase();
105 
126  virtual FB::PluginCorePtr createPlugin(const std::string& mimetype) = 0;
127 
143  virtual void globalPluginInitialize();
144 
160  virtual void globalPluginDeinitialize();
161 
170  std::string getPluginName();
172  std::string getPluginName(const std::string& mimetype);
181  std::string getPluginDescription();
183  std::string getPluginDescription(const std::string& mimetype);
184 
197  virtual FB::Npapi::NpapiPluginPtr createNpapiPlugin(const FB::Npapi::NpapiBrowserHostPtr& host, const std::string& mimetype);
198 
207  virtual void getLoggingMethods(FB::Log::LogMethodList& outMethods);
208 
216  virtual FB::Log::LogLevel getLogLevel();
217 
218 #ifdef FB_WIN
219  virtual PluginWindowWin* createPluginWindowWin(const WindowContextWin& ctx);
229 
239  virtual PluginWindowlessWin* createPluginWindowless(const WindowContextWindowless& ctx);
240 
241  virtual IDispatchEx* createCOMJSObject(const FB::BrowserHostPtr& host, const FB::JSAPIWeakPtr& api, bool autoRelease = false);
242  virtual HRESULT UpdateWindowsRegistry( bool install );
243 #endif
244 
245 #ifdef FBWIN_ASYNCSURFACE
246  virtual D3d10DeviceContextPtr createD3d10DeviceContext();
247 #endif
248 
249 #ifdef FB_MACOSX
250  virtual PluginWindowMacICA* createPluginWindowMacICA();
265  virtual PluginWindowMacCA* createPluginWindowMacCA();
273  virtual PluginWindowMacCG* createPluginWindowMacCG();
274 #ifndef NP_NO_QUICKDRAW
275  virtual PluginWindowMacQD* createPluginWindowMacQD();
285 #endif
286 
287  virtual PluginEventMacCocoa* createPluginEventMacCocoa();
288 #ifndef NP_NO_CARBON
289  virtual PluginEventMacCarbon* createPluginEventMacCarbon();
290 #endif
291 
292 #endif
293 
294 #ifdef FB_X11
295  virtual PluginWindowX11* createPluginWindowX11(const WindowContextX11& ctx);
305 #endif
306  };
307 }
308 
309 #endif
310 
std::string getPluginDescription()
Returns the description of the plugin. To change the description of your plugin edit PluginConfig...
Definition: FactoryBase.cpp:59
virtual FB::Npapi::NpapiPluginPtr createNpapiPlugin(const FB::Npapi::NpapiBrowserHostPtr &host, const std::string &mimetype)
Creates a npapi plugin. The default implementation creates a NpapiPluginWin, NpapiPluginX11, or NpapiPluginMac depending on the platform. Only in very very rare cases will you need to override this method.
Definition: FactoryBase.cpp:69
virtual void globalPluginDeinitialize()
Global plugin deinitialization.
Definition: FactoryBase.cpp:44
virtual void getLoggingMethods(FB::Log::LogMethodList &outMethods)
Called by the logger to discover which log methods should be used.
Definition: FactoryBase.cpp:74
virtual PluginWindowMacCG * createPluginWindowMacCG()
Creates a PluginWindow derived plugin window object for CoreGraphics.
Mac OS X Cocoa specific implementation of PluginEventMac.
Windows specific implementation of PluginWindow.
boost::weak_ptr< FB::JSAPI > JSAPIWeakPtr
Defines an alias for a JSAPI weak_ptr (you should never use a JSAPI* directly)
Definition: APITypes.h:88
Mac OS X Carbon specific implementation of PluginEventMac.
X11 specific implementation of PluginWindow.
This is the base factory for a plugin. Every plugin must implement this class and override at least t...
Definition: FactoryBase.h:100
boost::shared_ptr< FactoryBase > FactoryBasePtr
Defines an alias representing a boost::shared_ptr<FactoryBase>
Definition: FactoryBase.h:43
virtual PluginWindowMacCA * createPluginWindowMacCA()
Creates a PluginWindow derived plugin window object for CoreAnimation.
boost::shared_ptr< FB::BrowserHost > BrowserHostPtr
Defines an alias representing a BrowserHost shared_ptr (you should never use a BrowserHost* directly)...
Definition: APITypes.h:117
virtual PluginWindowX11 * createPluginWindowX11(const WindowContextX11 &ctx)
Creates a PluginWindowX11 derived plugin window object for X11.
virtual PluginWindowWin * createPluginWindowWin(const WindowContextWin &ctx)
Creates a PluginWindowWin derived plugin window object.
Definition: FactoryBase.cpp:88
virtual FB::PluginCorePtr createPlugin(const std::string &mimetype)=0
Creates a FB::PluginCore derived user plugin object. This must be implemented for all plugin projects...
boost::shared_ptr< PluginCore > PluginCorePtr
Defines an alias representing a boost::shared_ptr<PluginCore>
Definition: FactoryBase.h:46
virtual PluginWindowMacICA * createPluginWindowMacICA()
Creates a PluginWindow derived plugin window object for Invalidating CoreAnimation.
Windows specific implementation of PluginWindow.
virtual void globalPluginInitialize()
Global plugin initialization.
Definition: FactoryBase.cpp:39
std::string getPluginName()
Returns the name of the plugin. To change the name of your plugin edit PluginConfig.cmake.
Definition: FactoryBase.cpp:49
virtual FB::Log::LogLevel getLogLevel()
Called by the logger to discover what loglevel to use.
Definition: FactoryBase.cpp:81
virtual PluginWindowlessWin * createPluginWindowless(const WindowContextWindowless &ctx)
Creates a PluginWindowlessWin derived plugin window object.
Definition: FactoryBase.cpp:93