FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
FactoryBase.cpp
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 #include "FactoryBase.h"
16 #include "ConstructDefaultPluginWindows.h"
17 #include "NpapiPluginFactory.h"
18 
19 #ifdef FB_WIN
20 #include "ActiveXFactoryDefinitions.h"
21 #endif
22 #ifdef FBWIN_ASYNCSURFACE
23 #include "Win/D3d10DeviceContextImpl.h"
24 #endif
25 
26 #include "PluginInfo.h"
27 #include "precompiled_headers.h" // On windows, everything above this line in PCH
28 
29 FB::FactoryBase::FactoryBase()
30 {
31 
32 }
33 
34 FB::FactoryBase::~FactoryBase()
35 {
36 
37 }
38 
40 {
41 
42 }
43 
45 {
46 
47 }
48 
50 {
51  return FB::getPluginName("");
52 }
53 
54 std::string FB::FactoryBase::getPluginName( const std::string& mimetype )
55 {
56  return FB::getPluginName(mimetype);
57 }
58 
60 {
61  return FB::getPluginDescription("");
62 }
63 
64 std::string FB::FactoryBase::getPluginDescription( const std::string& mimetype )
65 {
66  return FB::getPluginDescription(mimetype);
67 }
68 
69 FB::Npapi::NpapiPluginPtr FB::FactoryBase::createNpapiPlugin(const FB::Npapi::NpapiBrowserHostPtr& host, const std::string& mimetype)
70 {
71  return FB::Npapi::createNpapiPlugin(host, mimetype);
72 }
73 
74 void FB::FactoryBase::getLoggingMethods( FB::Log::LogMethodList& outMethods )
75 {
76 #ifndef NDEBUG
77  outMethods.push_back(std::make_pair(FB::Log::LogMethod_Console, std::string()));
78 #endif
79 }
80 
81 FB::Log::LogLevel FB::FactoryBase::getLogLevel()
82 {
83  return FB::Log::LogLevel_Info;
84 }
85 
86 
87 #ifdef FB_WIN
89 {
90  return FB::createPluginWindowWin(ctx);
91 }
92 
94 {
95  return FB::createPluginWindowless(ctx);
96 }
97 IDispatchEx* FB::FactoryBase::createCOMJSObject(const FB::BrowserHostPtr& host, const FB::JSAPIWeakPtr& api, bool autoRelease/* = false*/)
98 {
99  return _getCOMJSWrapper(host, api, autoRelease);
100 }
101 
102 HRESULT FB::FactoryBase::UpdateWindowsRegistry( bool install )
103 {
104  return _updateRegistry(install);
105 }
106 #endif
107 
108 #ifdef FBWIN_ASYNCSURFACE
109 FB::D3d10DeviceContextPtr FB::FactoryBase::createD3d10DeviceContext()
110 {
111  return boost::make_shared<D3d10DeviceContextImpl>();
112 }
113 #endif
114 
115 #ifdef FB_MACOSX
117 {
118  return FB::createPluginWindowMacICA();
119 }
121 {
122  return FB::createPluginWindowMacCA();
123 }
125 {
126  return FB::createPluginWindowMacCG();
127 }
128 #ifndef NP_NO_QUICKDRAW
129 FB::PluginWindowMacQD* FB::FactoryBase::createPluginWindowMacQD()
130 {
131  return FB::createPluginWindowMacQD();
132 }
133 #endif
134 FB::PluginEventMacCocoa* FB::FactoryBase::createPluginEventMacCocoa()
135 {
136  return FB::createPluginEventMacCocoa();
137 }
138 #ifndef NP_NO_CARBON
139 FB::PluginEventMacCarbon* FB::FactoryBase::createPluginEventMacCarbon()
140 {
141  return FB::createPluginEventMacCarbon();
142 }
143 #endif
144 
145 #endif
146 
147 #ifdef FB_X11
149 {
150  return FB::createPluginWindowX11(ctx);
151 }
152 
153 #endif
154 
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.
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 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