-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththorium.cpp
81 lines (69 loc) · 2.91 KB
/
thorium.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/**********************************************************\
Auto-generated thorium.cpp
This file contains the auto-generated main plugin object
implementation for the thorium project
\**********************************************************/
#include "NpapiTypes.h"
#include "thoriumAPI.h"
#include "thorium.h"
///////////////////////////////////////////////////////////////////////////////
/// @fn thorium::StaticInitialize()
///
/// @brief Called from PluginFactory::globalPluginInitialize()
///
/// @see FB::FactoryBase::globalPluginInitialize
///////////////////////////////////////////////////////////////////////////////
void thorium::StaticInitialize()
{
// Place one-time initialization stuff here; note that there isn't an absolute guarantee that
// this will only execute once per process, just a guarantee that it won't execute again until
// after StaticDeinitialize is called
}
///////////////////////////////////////////////////////////////////////////////
/// @fn thorium::StaticInitialize()
///
/// @brief Called from PluginFactory::globalPluginDeinitialize()
///
/// @see FB::FactoryBase::globalPluginDeinitialize
///////////////////////////////////////////////////////////////////////////////
void thorium::StaticDeinitialize()
{
// Place one-time deinitialization stuff here
}
///////////////////////////////////////////////////////////////////////////////
/// @brief thorium constructor. Note that your API is not available
/// at this point, nor the window. For best results wait to use
/// the JSAPI object until the onPluginReady method is called
///////////////////////////////////////////////////////////////////////////////
thorium::thorium()
{
}
///////////////////////////////////////////////////////////////////////////////
/// @brief thorium destructor.
///////////////////////////////////////////////////////////////////////////////
thorium::~thorium()
{
}
void thorium::onPluginReady()
{
// When this is called, the BrowserHost is attached, the JSAPI object is
// created, and we are ready to interact with the page and such. The
// PluginWindow may or may not have already fire the AttachedEvent at
// this point.
}
///////////////////////////////////////////////////////////////////////////////
/// @brief Creates an instance of the JSAPI object that provides your main
/// Javascript interface.
///
/// Note that m_host is your BrowserHost and shared_ptr returns a
/// FB::PluginCorePtr, which can be used to provide a
/// boost::weak_ptr<thorium> for your JSAPI class.
///
/// Be very careful where you hold a shared_ptr to your plugin class from,
/// as it could prevent your plugin class from getting destroyed properly.
///////////////////////////////////////////////////////////////////////////////
FB::JSAPIPtr thorium::createJSAPI()
{
// m_host is the BrowserHost
return FB::JSAPIPtr(new thoriumAPI(FB::ptr_cast<thorium>(shared_ptr()), m_host));
}