#include <WebCore.h>
Public Member Functions | |
WebCore (const std::wstring &cachePath=L"", const std::wstring &cookiePath=L"", const std::wstring &pluginPath=L"", const std::wstring &logPath=L"", LogLevel level=LOG_NORMAL, bool enablePlugins=false, PixelFormat pixelFormat=PF_BGRA) | |
~WebCore () | |
void | setBaseDirectory (const std::string &baseDirectory) |
void | setBaseDirectory (const std::wstring &baseDirectory) |
WebView * | createWebView (int width, int height, bool isTransparent=false, bool enableAsyncRendering=false, int maxAsyncRenderPerSec=70) |
void | setCustomResponsePage (int statusCode, const std::string &filePath) |
void | update () |
const std::wstring & | getBaseDirectory () const |
PixelFormat | getPixelFormat () const |
bool | arePluginsEnabled () const |
void | pause () |
void | resume () |
Static Public Member Functions | |
static WebCore & | Get () |
static WebCore * | GetPointer () |
Protected Member Functions | |
void | queueEvent (WebViewEvent *event) |
void | removeWebView (WebView *view) |
void | purgePluginMessages () |
void | resolveJSValueFuture (WebView *view, int requestID, JSValue *result) |
void | getCustomResponsePage (int statusCode, std::string &filePathResult) |
Protected Attributes | |
base::Thread * | coreThread |
WebCoreProxy * | coreProxy |
base::AtExitManager * | atExitMgr |
std::vector< WebView * > | views |
std::queue< WebViewEvent * > | eventQueue |
std::map< int, std::string > | customResponsePageMap |
std::wstring | baseDirectory |
bool | logOpen |
bool | pluginsEnabled |
const PixelFormat | pixelFormat |
Lock * | eventQueueLock |
Lock * | baseDirLock |
Lock * | customResponsePageLock |
Static Protected Attributes | |
static WebCore * | instance = 0 |
Friends | |
class | WebView |
class | FutureJSValue |
class | ::WebCoreProxy |
class | ::WebViewProxy |
class | ::NamedCallback |
class | ::WindowlessPlugin |
std::string | GetDataResource (int id) |
Awesomium::WebCore::WebCore | ( | const std::wstring & | cachePath = L"" , |
|
const std::wstring & | cookiePath = L"" , |
|||
const std::wstring & | pluginPath = L"" , |
|||
const std::wstring & | logPath = L"" , |
|||
LogLevel | level = LOG_NORMAL , |
|||
bool | enablePlugins = false , |
|||
PixelFormat | pixelFormat = PF_BGRA | |||
) |
Instantiates the WebCore singleton (you can access it later with WebCore::Get or GetPointer).
cachePath | An absolute path to the directory that will be used to store the cache. If an empty string is specified, the cache will not persist between sessions. | |
cookiePath | An absolute path to the directory that will be used to store cookies. If an empty string is specified, cookies will not persist between sessions. | |
pluginPath | An absolute path that will be included in the search for plugins. This is useful if you wish to bundle certain plugins with your application. | |
logPath | The path to store the awesomium.log. If none is specified, the log will be stored in the working directory. | |
level | The logging level to use (default is LOG_NORMAL). | |
enablePlugins | Whether or not to enable embedded plugins. (default is FALSE) Note that the Flash and Silverlight plugins are only fully-supported on the Windows platform at this time. | |
pixelFormat | The pixel-format/byte-ordering to use when rendering WebViews. |
Awesomium::WebCore::~WebCore | ( | ) |
Destroys the WebCore singleton. (Also destroys any lingering WebViews)
bool Awesomium::WebCore::arePluginsEnabled | ( | ) | const |
Returns whether or not plugins are enabled.
Awesomium::WebView * Awesomium::WebCore::createWebView | ( | int | width, | |
int | height, | |||
bool | isTransparent = false , |
|||
bool | enableAsyncRendering = false , |
|||
int | maxAsyncRenderPerSec = 70 | |||
) |
Creates a new WebView.
width | The width of the WebView in pixels. | |
height | The height of the WebView in pixels. | |
isTransparent | Whether or not the background of a WebView should be rendered as transparent. | |
enableAsyncRendering | Enables fully-asynchronous rendering, see the note below. | |
maxAsyncRenderPerSec | The maximum times per second this WebView should asynchronously render. |
WebCore & Awesomium::WebCore::Get | ( | ) | [static] |
Retrieves the WebCore singleton.
const std::wstring & Awesomium::WebCore::getBaseDirectory | ( | ) | const |
Retrieves the base directory.
PixelFormat Awesomium::WebCore::getPixelFormat | ( | ) | const |
Retrieves the pixel format being used.
WebCore * Awesomium::WebCore::GetPointer | ( | ) | [static] |
void Awesomium::WebCore::pause | ( | ) |
Pauses the internal thread of the Awesomium WebCore.
void Awesomium::WebCore::resume | ( | ) |
void Awesomium::WebCore::setBaseDirectory | ( | const std::wstring & | baseDirectory | ) |
Sets the base directory.
baseDirectory | The absolute path to your base directory. The base directory is a location that holds all of your local assets. It will be used for WebView::loadFile and WebView::loadHTML (to resolve relative URLs). |
void Awesomium::WebCore::setBaseDirectory | ( | const std::string & | baseDirectory | ) |
Sets the base directory.
baseDirectory | The absolute path to your base directory. The base directory is a location that holds all of your local assets. It will be used for WebView::loadFile and WebView::loadHTML (to resolve relative URLs). |
void Awesomium::WebCore::setCustomResponsePage | ( | int | statusCode, | |
const std::string & | filePath | |||
) |
Sets a custom response page to use when a WebView encounters a certain HTML status code from the server (such as '404 - File not found').
statusCode | The status code this response page should be associated with. See <http://en.wikipedia.org/wiki/List_of_HTTP_status_codes> | |
filePath | The local page to load as a response, should be a path relative to the base directory. |
void Awesomium::WebCore::update | ( | ) |
Updates the WebCore and allows it to conduct various operations such as the propagation of bound JS callbacks and the invocation of any queued listener events.