/modules/newtek/newtek.vcxproj.user
/modules/newtek/bin
/modules/newtek/tmp
+/dependencies/cef
+++ /dev/null
-/* Berkelium - Embedded Chromium
- * Berkelium.hpp
- *
- * Copyright (c) 2009, Daniel Reiter Horn
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Sirikata nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _BERKELIUM_HPP_
-#define _BERKELIUM_HPP_
-#include "berkelium/Platform.hpp"
-#include "berkelium/WeakString.hpp"
-namespace sandbox {
-class BrokerServices;
-class TargetServices;
-#ifdef _WIN32
-enum DepEnforcement;
-#endif
-}
-namespace Berkelium {
-
-/** May be implemented to handle global errors gracefully.
- */
-class BERKELIUM_EXPORT ErrorDelegate {
-public:
- virtual ~ErrorDelegate() {}
-};
-
-/* TODO: Allow forkedProcessHook to be called without requiring the
- library to be initialized/in memory (unless this is a sub-process).
- i.e. an inline function that first searches for "--type=" in argv,
- then uses dlopen or GetProcAddress.
-*/
-
-/** Called by child processes.
- * Should only ever be called from subprocess.cpp (berkelium.exe).
- */
-#ifdef _WIN32
-void BERKELIUM_EXPORT forkedProcessHook(
- sandbox::BrokerServices* (*ptrGetBrokerServices)(),
- sandbox::TargetServices* (*ptrGetTargetServices)(),
- bool (*ptrSetCurrentProcessDEP)(enum sandbox::DepEnforcement));
-#else
-void BERKELIUM_EXPORT forkedProcessHook(int argc, char **argv);
-#endif
-
-/** Iniitialize berkelium's global object.
- * \param homeDirectory Just like Chrome's --user-data-dir command line flag.
- * If homeDirectory is null or empty, creates a temporary data directory.
- * \param subprocessDirectory Path to berkelium.exe.
- */
-bool BERKELIUM_EXPORT init(FileString homeDirectory, FileString subprocessDirectory);
-
-/** Iniitialize berkelium's global object.
- * \param homeDirectory Just like Chrome's --user-data-dir command line flag.
- * If homeDirectory is null or empty, creates a temporary data directory.
- */
-bool BERKELIUM_EXPORT init(FileString homeDirectory);
-
-/** Destroys Berkelium and attempts to free as much memory as possible.
- * Note: You must destroy all Window and Context objects before calling
- * Berkelium::destroy()!
- */
-void BERKELIUM_EXPORT destroy();
-
-void BERKELIUM_EXPORT setErrorHandler(ErrorDelegate * errorHandler);
-
-/** Runs the message loop until all pending messages are processed.
- * Must be called from the same thread as all other Berkelium functions,
- * usually your program's main (UI) thread.
- * For now, you have to poll to receive updates without blocking indefinitely.
- *
- * Your WindowDelegate's should only receive callbacks synchronously with
- * this call to update.
- */
-void BERKELIUM_EXPORT update();
-void BERKELIUM_EXPORT runUntilStopped();
-void BERKELIUM_EXPORT stopRunning();
-
-}
-
-#endif
+++ /dev/null
-/* Berkelium - Embedded Chromium
- * Context.hpp
- *
- * Copyright (c) 2009, Patrick Reiter Horn
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Sirikata nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _BERKELIUM_CONTEXT_HPP_
-#define _BERKELIUM_CONTEXT_HPP_
-
-class SiteInstance;
-class BrowsingInstance;
-
-namespace Berkelium {
-class ContextImpl;
-
-/** A context holds onto a reference counted profile object.
- * The Window class calls clone() on a context, so you can safely
- * destroy a Context after making all the Windows you want.
- *
- * No functions currently exist for this object.
- */
-class BERKELIUM_EXPORT Context {
- protected:
- Context();
-
-public:
- /** Creates an all-new context with no shared state and a refcount of 1.
- */
- static Context* create();
-
- /** Deletes this Context object, which decrements the refcount for the
- * underlying context data.
- */
- void destroy();
-
- /** Deprecated destructor
- * \deprecated destroy()
- */
- virtual ~Context();
-
- /** Returns a new Context object which increments the refcount of
- * the internal context information. Called by Window::create.
- */
- virtual Context* clone() const = 0;
-
-
- virtual ContextImpl* getImpl() = 0;
- virtual const ContextImpl* getImpl() const = 0;
-};
-
-}
-
-#endif
+++ /dev/null
-/* Berkelium - Embedded Chromium
- * Cursor.hpp
- *
- * Copyright (c) 2010, Ewen Cheslack-Postava
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Sirikata nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _BERKELIUM_CURSOR_HPP_
-#define _BERKELIUM_CURSOR_HPP_
-
-#include "berkelium/Platform.hpp"
-
-#if BERKELIUM_PLATFORM == PLATFORM_WINDOWS
-#include <windows.h>
-#elif BERKELIUM_PLATFORM == PLATFORM_LINUX
-// FIXME this really only works for toolkit == gtk
-// We use alternate definitions since we can't properly forward
-// declare these types
-typedef int GdkCursorEnum;
-#define GDK_CURSOR_TYPE_FROM_ENUM(X) ((GdkCursorType)X)
-typedef void* GdkCursorPtr;
-#define GDK_CURSOR_FROM_PTR(X) ((GdkCursor*)X)
-#elif BERKELIUM_PLATFORM == PLATFORM_MAC
-#ifdef __OBJC__
-@class NSCursor;
-#else
-class NSCursor;
-#endif
-#endif
-
-namespace Berkelium {
-
-class WindowImpl;
-
-/** A sort-of cross platform cursor class. Currently this is just a
- * thinner version of Chromium's WebCursor. Ideally we could figure
- * a way to hide these details and the application could perform any
- * necessary translation.
- */
-class BERKELIUM_EXPORT Cursor {
-public:
-#if BERKELIUM_PLATFORM == PLATFORM_WINDOWS
- HCURSOR GetCursor() const;
-#elif BERKELIUM_PLATFORM == PLATFORM_LINUX
- GdkCursorEnum GetCursorType() const;
- GdkCursorPtr GetCustomCursor() const;
-#elif BERKELIUM_PLATFORM == PLATFORM_MAC
- NSCursor* GetCursor() const;
-#endif
-
-private:
- friend class WindowImpl;
-
- Cursor(); // Non-copyable
-
-#if BERKELIUM_PLATFORM == PLATFORM_WINDOWS
- Cursor(const HCURSOR handle);
-
- HCURSOR mHandle;
-#elif BERKELIUM_PLATFORM == PLATFORM_LINUX
- Cursor(const GdkCursorEnum& _type, GdkCursorPtr _cursor);
-
- GdkCursorEnum mType;
- GdkCursorPtr mCursor;
-#elif BERKELIUM_PLATFORM == PLATFORM_MAC
- Cursor(NSCursor* _cursor);
-
- NSCursor* mCursor;
-#endif
-};
-
-} // namespace Berkelium
-
-#endif //_BERKELIUM_CURSOR_HPP_
+++ /dev/null
-#ifndef _BERKELIUM_PLATFORM_HPP_
-#define _BERKELIUM_PLATFORM_HPP_
-
-
-#define PLATFORM_WINDOWS 0
-#define PLATFORM_LINUX 1
-#define PLATFORM_MAC 2
-
-
-#if defined(__WIN32__) || defined(_WIN32)
-// disable type needs to have dll-interface to be used byu clients due to STL member variables which are not public
-#pragma warning (disable: 4251)
-//disable warning about no suitable definition provided for explicit template instantiation request which seems to have no resolution nor cause any problems
-#pragma warning (disable: 4661)
-//disable non dll-interface class used as base for dll-interface class when deriving from singleton
-#pragma warning (disable : 4275)
-# define BERKELIUM_PLATFORM PLATFORM_WINDOWS
-#elif defined(__APPLE_CC__) || defined(__APPLE__)
-# define BERKELIUM_PLATFORM PLATFORM_MAC
-# ifndef __MACOSX__
-# define __MACOSX__
-# endif
-#else
-# define BERKELIUM_PLATFORM PLATFORM_LINUX
-#endif
-
-#ifdef NDEBUG
-#define BERKELIUM_DEBUG 0
-#else
-#define BERKELIUM_DEBUG 1
-#endif
-
-#ifndef BERKELIUM_EXPORT
-# if BERKELIUM_PLATFORM == PLATFORM_WINDOWS
-# if defined(STATIC_LINKED)
-# define BERKELIUM_EXPORT
-# else
-# if defined(BERKELIUM_BUILD)
-# define BERKELIUM_EXPORT __declspec(dllexport)
-# else
-# define BERKELIUM_EXPORT __declspec(dllimport)
-# endif
-# endif
-# define BERKELIUM_PLUGIN_EXPORT __declspec(dllexport)
-# else
-# if defined(__GNUC__) && __GNUC__ >= 4
-# define BERKELIUM_EXPORT __attribute__ ((visibility("default")))
-# define BERKELIUM_PLUGIN_EXPORT __attribute__ ((visibility("default")))
-# else
-# define BERKELIUM_EXPORT
-# define BERKELIUM_PLUGIN_EXPORT
-# endif
-# endif
-#endif
-
-
-#ifndef BERKELIUM_FUNCTION_EXPORT
-# if BERKELIUM_PLATFORM == PLATFORM_WINDOWS
-# if defined(STATIC_LINKED)
-# define BERKELIUM_FUNCTION_EXPORT
-# else
-# if defined(BERKELIUM_BUILD)
-# define BERKELIUM_FUNCTION_EXPORT __declspec(dllexport)
-# else
-# define BERKELIUM_FUNCTION_EXPORT __declspec(dllimport)
-# endif
-# endif
-# else
-# define BERKELIUM_FUNCTION_EXPORT
-# endif
-#endif
-
-#endif
-
-#define UNIMPLEMENTED() (fprintf(stderr,"UNIMPLEMENTED %s:%d\n",__FILE__,__LINE__))
-
-
-#include <cstddef>
+++ /dev/null
-/* Berkelium - Embedded Chromium
- * Rect.hpp
- *
- * Copyright (c) 2009, Daniel Reiter Horn
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Sirikata nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _BERKELIUM_RECT_HPP_
-#define _BERKELIUM_RECT_HPP_
-
-namespace Berkelium {
-
-struct Rect {
- int mLeft;
- int mTop;
- int mWidth;
- int mHeight;
-
- inline int y() const { return mTop; }
- inline int x() const { return mLeft; }
- inline int top() const { return mTop; }
- inline int left() const { return mLeft; }
- inline int width() const { return mWidth; }
- inline int height() const { return mHeight; }
- inline int right() const { return mLeft + mWidth; }
- inline int bottom() const { return mTop + mHeight; }
-
- template <class T>
- inline void setFromRect(const T&sourceRect) {
- mLeft = sourceRect.x();
- mTop = sourceRect.y();
- mWidth = sourceRect.width();
- mHeight = sourceRect.height();
- }
-
- inline bool contains(int x, int y) const {
- return (x >= left() && x < right() &&
- y >= top() && y < bottom());
- }
- Rect intersect(const Rect &rect) const {
- int rx = rectmax(left(), rect.left());
- int ry = rectmax(top(), rect.top());
- int rr = rectmin(right(), rect.right());
- int rb = rectmin(bottom(), rect.bottom());
- if (rx >= rr || ry >= rb)
- rx = ry = rr = rb = 0; // non-intersecting
- Rect ret;
- ret.mLeft = rx;
- ret.mTop = ry;
- ret.mWidth = rr-rx;
- ret.mHeight = rb-ry;
- return ret;
- }
-
- /** Create a new Rect equivalent to this Rect translated by the specified
- * amounts in either direction.
- * \param dx amount to translate along the X axis
- * \param dy amount to translate along the Y axis
- * \returns a new translated Rect
- */
- Rect translate(int dx, int dy) const {
- Rect ret = *this;
- ret.mLeft += dx;
- ret.mTop += dy;
- return ret;
- }
-
-private:
- static int rectmax(int a, int b) {
- return a>b?a:b;
- }
- static int rectmin(int a, int b) {
- return a<b?a:b;
- }
-};
-
-}
-
-#endif
+++ /dev/null
-/* Berkelium - Embedded Chromium
- * ScriptUtil.hpp
- *
- * Copyright (c) 2010, Patrick Reiter Horn
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Sirikata nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _BERKELIUM_SCRIPT_URIL_HPP_
-#define _BERKELIUM_SCRIPT_URIL_HPP_
-
-#include "berkelium/WeakString.hpp"
-
-namespace Berkelium {
-namespace Script {
-class Variant;
-
-WideString BERKELIUM_EXPORT toJSON(const Variant &var);
-
-void BERKELIUM_EXPORT toJSON_free(WideString returnedValue);
-
-bool BERKELIUM_EXPORT fromJSON(WideString str, Variant &out);
-
-}
-}
-
-#endif
+++ /dev/null
-/* Berkelium - Embedded Chromium
- * ScriptVariant.hpp
- *
- * Copyright (c) 2010, Patrick Reiter Horn
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Sirikata nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _BERKELIUM_SCRIPT_VARIANT_HPP_
-#define _BERKELIUM_SCRIPT_VARIANT_HPP_
-#include "berkelium/WeakString.hpp"
-
-namespace Berkelium {
-namespace Script {
-
-class BERKELIUM_EXPORT Variant {
-public:
- enum Type {
- JSSTRING,
- JSDOUBLE,
- JSBOOLEAN,
- JSNULL,
- JSEMPTYOBJECT,
- JSEMPTYARRAY,
- JSBINDFUNC,
- JSBINDSYNCFUNC
- };
-private:
- union {
- WideString mStrPointer;
- double mDoubleValue;
- };
-
- Type mType;
- void initwc(const wchar_t* str, size_t length) ;
- void initmb(const char* str, size_t length);
- void initdbl(double dblval);
- void initbool(bool boolval);
- void initnull(Type typ);
- void initvariant(const Variant& other);
- void destroy();
- bool hasString() {
- return mType == JSSTRING || mType == JSBINDFUNC || mType == JSBINDSYNCFUNC;
- }
- Variant(Type type) {
- initnull(type);
- }
- Variant(WideString str, Type type);
-public:
- Variant(const char* str);
- Variant(const wchar_t* str);
- Variant(WideString str);
- Variant(double dblval) {
- initdbl(dblval);
- }
- Variant(int intval) {
- initdbl(intval);
- }
- Variant(bool boolval) {
- initbool(boolval);
- }
- Variant() {
- initnull(JSNULL);
- }
-
- static Variant emptyArray();
- static Variant emptyObject();
-
- static Variant bindFunction(WideString name, bool synchronous) {
- return Variant(name, synchronous ? JSBINDSYNCFUNC: JSBINDFUNC);
- }
-
- Variant(const Variant& other);
- Variant& operator=(const Variant& other);
-
- bool toBoolean() const {
- if (mType == JSDOUBLE || mType == JSBOOLEAN) {
- return mDoubleValue != 0;
- } else if (mType == JSSTRING) {
- return mStrPointer.length() ? true : false;
- } else {
- return false;
- }
- }
- int toInteger() const {
- if (mType == JSDOUBLE || mType == JSBOOLEAN) {
- return (int)mDoubleValue;
- } else {
- return 0;
- }
- }
- double toDouble() const {
- if (mType == JSDOUBLE || mType == JSBOOLEAN) {
- return mDoubleValue;
- } else {
- return 0;
- }
- }
-
- WideString toString() const {
- if (mType == JSSTRING) {
- return mStrPointer;
- } else {
- return WideString::empty();
- }
- }
-
- WideString toFunctionName() const {
- if (mType == JSBINDFUNC || mType == JSBINDSYNCFUNC) {
- return mStrPointer;
- } else {
- return WideString::empty();
- }
- }
-
- Type type() const {
- return mType;
- }
-
- ~Variant();
-};
-
-}
-}
-
-#endif
+++ /dev/null
-/* Berkelium Utilities -- Berkelium Utilities
- * Singleton.hpp
- *
- * Copyright (c) 2009, Daniel Reiter Horn
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Berkelium nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _BERKELIUM_SINGLETON_HPP_
-#define _BERKELIUM_SINGLETON_HPP_
-#include <memory>
-namespace Berkelium {
-
-template <class T> class AutoSingleton {
- static std::auto_ptr<T>sInstance;
-public:
- static T& getSingleton() {
- if (sInstance.get()==NULL) {
- throw std::exception();
- }
- return *static_cast<T*>(sInstance.get());
- }
- AutoSingleton() {
- if (sInstance.get()==NULL) {
- std::auto_ptr<T> tmp(static_cast<T*>(this));
- sInstance=tmp;
- }
- }
- virtual ~AutoSingleton() {
- if (sInstance.get()==this)
- sInstance.release();
- }
- static void destroy() {
- sInstance.reset();
- }
-};
-
-}
-#ifdef _WIN32
-#define AUTO_SINGLETON_INSTANCE(ClassName) template<>std::auto_ptr<ClassName>Berkelium::AutoSingleton<ClassName>::sInstance
-#else
-#define AUTO_SINGLETON_INSTANCE(ClassName) template std::auto_ptr<ClassName> Berkelium::AutoSingleton<ClassName>::sInstance; template<>std::auto_ptr<ClassName>Berkelium::AutoSingleton<ClassName>::sInstance
-#endif
-
-#endif
+++ /dev/null
-/* Berkelium - Embedded Chromium
- * StringUtil.hpp
- *
- * Copyright (c) 2010, Patrick Reiter Horn
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Sirikata nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _BERKELIUM_STRING_URIL_HPP_
-#define _BERKELIUM_STRING_URIL_HPP_
-
-#include "berkelium/WeakString.hpp"
-
-namespace Berkelium {
-
-typedef unsigned short char16;
-
-typedef WeakString<char> UTF8String;
-typedef WeakString<char16> UTF16String;
-
-WideString BERKELIUM_EXPORT UTF8ToWide(const UTF8String &in);
-UTF8String BERKELIUM_EXPORT WideToUTF8(const WideString &in);
-
-WideString BERKELIUM_EXPORT UTF16ToWide(const UTF16String &in);
-UTF16String BERKELIUM_EXPORT WideToUTF16(const WideString &in);
-
-UTF8String BERKELIUM_EXPORT UTF16ToUTF8(const UTF16String &in);
-UTF16String BERKELIUM_EXPORT UTF8ToUTF16(const UTF8String &in);
-
-void BERKELIUM_EXPORT stringUtil_free(WideString returnedValue);
-void BERKELIUM_EXPORT stringUtil_free(UTF8String returnedValue);
-void BERKELIUM_EXPORT stringUtil_free(UTF16String returnedValue);
-
-}
-
-#endif
-
+++ /dev/null
-/* Berkelium - Embedded Chromium
- * SafeString.hpp
- *
- * Copyright (c) 2009, Patrick Reiter Horn
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Sirikata nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _BERKELIUM_WEAK_STRING_HPP_
-#define _BERKELIUM_WEAK_STRING_HPP_
-
-#include "berkelium/Platform.hpp"
-
-namespace Berkelium {
-
-// Simple POD string class. Data must be owned by caller.
-template <class CharType>
-struct WeakString {
- const CharType* mData;
- size_t mLength;
-
- typedef CharType Type;
-
- inline const CharType* data() const {
- return mData;
- }
-
- inline size_t length() const {
- return mLength;
- }
-
- inline size_t size() const {
- return mLength;
- }
-
- template <class StrType>
- inline StrType& get(StrType& ret) const {
- if (!mData || !mLength) {
- ret = StrType();
- }
- ret = StrType(mData, mLength);
- return ret;
- }
-
- template <class StrType>
- inline StrType get() const {
- if (!mData || !mLength) {
- return StrType();
- }
- return StrType(mData, mLength);
- }
-
- template <class StrType>
- inline static WeakString<CharType> point_to(const StrType&input) {
- WeakString<CharType> ret;
- ret.mData = input.data();
- ret.mLength = input.length();
- return ret;
- }
-
- inline static WeakString<CharType> point_to(const CharType*input_data,
- size_t input_length) {
- WeakString<CharType> ret;
- ret.mData = input_data;
- ret.mLength = input_length;
- return ret;
- }
-
- inline static WeakString<CharType> point_to(const CharType *input_data) {
- WeakString<CharType> ret;
- ret.mData = input_data;
- for (ret.mLength = 0; input_data[ret.mLength]; ++ret.mLength) {
- }
- return ret;
- }
-
- inline static WeakString<CharType> empty() {
- WeakString<CharType> ret;
- ret.mData = NULL;
- ret.mLength = 0;
- return ret;
- }
-};
-
-template <class StrType, class CharType>
-inline StrType &operator+(const StrType&lhs, const WeakString<CharType>&rhs) {
- StrType temp;
- return lhs + rhs.get(temp);
-}
-
-template <class StrType, class CharType>
-inline StrType &operator+=(StrType&lhs, const WeakString<CharType>&rhs) {
- StrType temp;
- return lhs += rhs.get(temp);
-}
-
-template <class OstreamType, class CharType>
-inline OstreamType &operator<< (OstreamType&lhs, const WeakString<CharType>&rhs) {
- size_t length = rhs.length();
- const CharType *data = rhs.data();
- for (size_t i = 0; i < length; i++) {
- lhs << data[i];
- }
- return lhs;
-}
-
-typedef WeakString<char> URLString;
-typedef WeakString<wchar_t> WideString;
-
-#if BERKELIUM_PLATFORM == PLATFORM_WINDOWS
-typedef WeakString<wchar_t> FileString;
-#else
-typedef WeakString<char> FileString;
-#endif
-
-}
-
-#endif
+++ /dev/null
-/* Berkelium - Embedded Chromium
- * Widget.hpp
- *
- * Copyright (c) 2009, Daniel Reiter Horn
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Sirikata nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _BERKELIUM_WIDGET_HPP_
-#define _BERKELIUM_WIDGET_HPP_
-
-#include "berkelium/Rect.hpp"
-#include "berkelium/WeakString.hpp"
-
-namespace Berkelium {
-
-/** A widget is a rectangular canvas which can be painted to. A Widget
- * maintains its own focus state, and can accept input just like a Window.
- * Widgets have very limited use in practice--mostly just dropdowns.
- */
-class BERKELIUM_EXPORT Widget {
-public:
- /** Deprecated virtual destructor.
- * \deprecated Use the safer destroy() method instead.
- */
- virtual ~Widget() {}
-
- /** Safe destructor for widget. Should clean up all resources.
- * Note: WindowDelegate::onWidgetDestroyed will be called synchronously.
- */
- void destroy(); // defined in src/RenderWidget.cpp
-
- /** Gets a unique id for this widget.
- * \returns the widget's routing id
- */
- virtual int getId() const = 0;
-
- virtual void focus()=0;
- virtual void unfocus()=0;
- virtual bool hasFocus() const = 0;
-
- virtual void mouseMoved(int xPos, int yPos)=0;
- virtual void mouseButton(unsigned int buttonID, bool down)=0;
- virtual void mouseWheel(int xScroll, int yScroll)=0;
-
- virtual void textEvent(const wchar_t* evt, size_t evtLength)=0;
- virtual void keyEvent(bool pressed, int mods, int vk_code, int scancode)=0;
-
- virtual Rect getRect() const=0;
- virtual void setPos(int x, int y)=0;
-
- virtual void textEvent(WideString text)=0;
-};
-
-}
-
-#endif
+++ /dev/null
-/* Berkelium - Embedded Chromium
- * Window.hpp
- *
- * Copyright (c) 2009, Daniel Reiter Horn
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Sirikata nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _BERKELIUM_WINDOW_HPP_
-#define _BERKELIUM_WINDOW_HPP_
-
-#include <vector>
-
-#include "berkelium/WeakString.hpp"
-
-namespace Berkelium {
-
-class Widget;
-class WindowDelegate;
-class Context;
-
-namespace Script{
-class Variant;
-}
-
-enum KeyModifier {
- SHIFT_MOD = 1 << 0,
- CONTROL_MOD = 1 << 1,
- ALT_MOD = 1 << 2,
- META_MOD = 1 << 3,
- KEYPAD_KEY = 1 << 4, // If the key is on the keypad (use instead of keypad-specific keycodes)
- AUTOREPEAT_KEY = 1 << 5, // If this is not the first KeyPress event for this key
- SYSTEM_KEY = 1 << 6 // if the keypress is a system event (WM_SYS* messages in windows)
-};
-
-/** Windows are individual web pages, the equivalent of a single tab in a normal
- * browser. Windows mediate interaction between the user and the
- * renderer. They allow inspection of the page (access to UI widgets),
- * injection of input (keyboard, mouse), injection of Javascript code,
- * navigation controls (forward, back, loading URLs), and other utility methods
- * (cut, copy, paste, etc). Since the represent off-screen renderers, they
- * also allow manipulation such as resizting.
- */
-class BERKELIUM_EXPORT Window {
-protected:
- typedef std::vector<Widget*> WidgetList;
-
-public:
- typedef WidgetList::const_iterator BackToFrontIter;
- typedef WidgetList::const_reverse_iterator FrontToBackIter;
-
-protected:
- /** Construct a completely uninitialized Window -- it will have no backing
- * renderer or delegate and use a new Context.
- */
- Window ();
- /** Construct a Window which uses the specified Context for rendering.
- * \param otherContext an existing rendering Context to use
- */
- Window (const Context*otherContext);
-
-public:
- /** Create a new Window with all default properties which uses an existing
- * Context for rendering. It will be zero sized and use a default local
- * web page.
- * \param context an existing context to use for rendering
- * \returns a new Window or NULL on failure
- */
- static Window* create (const Context * context);
-
- /** Deletes this window object.
- */
- void destroy();
-
- /** Deprecated virtual destructor.
- * \deprecated Use destroy() to avoid interference from custom allocators.
- */
- virtual ~Window();
-
- /** A Window should have a root widget object, unless the window crashed
- * or has never been navigated.
- * If such a widget exists, returns non-null.
- */
- virtual Widget* getWidget() const=0;
-
- /** Get the rendering context for this Window. */
- inline Context *getContext() const {
- return mContext;
- }
-
- /** Set the delegate for receiving events, such as paint events and alerts,
- * from this Window.
- * \param delegate the WindowDelegate that should receive events, or NULL
- * to disable delegation of events
- */
- void setDelegate(WindowDelegate *delegate) {
- mDelegate = delegate;
- }
-
- /** loop from the backmost (usually obscured) widget to the
- * frontmost (focused) widget.
- */
- BackToFrontIter backIter() const {
- return mWidgets.begin();
- }
-
- /** Corresponding end() to compare against the backIter. */
- BackToFrontIter backEnd() const {
- return mWidgets.end();
- }
-
- /** loop from the frontmost (focused) widget to the
- * backmost (usually obscured) widget.
- */
- FrontToBackIter frontIter() const {
- return mWidgets.rbegin();
- }
-
- /** Corresponding end() to compare against the frontIter. */
- FrontToBackIter frontEnd() const {
- return mWidgets.rend();
- }
-
- /** Look up which widget is at the specified point in the Window.
- * \param xPos the position on the x-axis of the point to look up
- * \param yPos the position on the y-axis of the point to look up
- * \param returnRootIfOutside if true and the specified point lies outside
- * the Window, returns the root Widget instead of NULL
- * \returns the Widget at the specified location or NULL if no widgets are
- * at that point
- */
- Widget *getWidgetAtPoint(int xPos, int yPos, bool returnRootIfOutside=false) const;
-
- /** Gets an id for this window.
- * \returns the RenderView's unique routing id.
- */
- virtual int getId() const = 0;
-
- /** Sets the transparency flag for this Window. Note that the buffer will
- * be BGRA regardless of transparency, but if the window is not set as
- * transparent, the alpha channel should always be 1.
- * Transparency defaults to false and must be enabled on each Window.
- * \param istrans Whether to enable a transparent background.
- */
- virtual void setTransparent(bool istrans)=0;
-
- /** Set the topmost Widget for this Window as focused.
- */
- virtual void focus()=0;
-
- /** Blurs all widgets on this Window.
- */
- virtual void unfocus()=0;
-
- /** Inject a mouse movement event into the Window at the specified position.
- * \param xPos the position along the x-axis of the mouse movement
- * \param yPos the position along the y-axis of the mouse movement
- */
- virtual void mouseMoved(int xPos, int yPos)=0;
- /** Inject a mouse button event into the Window.
- * \param buttonID index of the button that caused the event
- * \param down if true, indicates the mouse button was pressed, if false
- * indicates it was released
- */
- virtual void mouseButton(unsigned int buttonID, bool down)=0;
- /** Inject a mouse wheel scroll event into the Window.
- * \param xScroll amount scrolled horizontally
- * \param yScroll amount scrolled vertically
- */
- virtual void mouseWheel(int xScroll, int yScroll)=0;
-
- /** Inject a text event into the Window.
- * \param evt pointer to text string to inject
- * \param evtLength length of string
- */
- virtual void textEvent(const wchar_t *evt, size_t evtLength)=0;
-
- /** Inject an individual key event into the Window.
- * \param pressed if true indicates the key was pressed, if false indicates
- * it was released
- * \param mods a modifier code created by a logical or of KeyModifiers
- * \param vk_code the virtual key code received from the OS
- * \param scancode the original scancode that generated the event
- */
- virtual void keyEvent(bool pressed, int mods, int vk_code, int scancode)=0;
-
-
- /** Resize the Window. You should receive an onPaint message as an
- * acknowledgement.
- * \param width the new width
- * \param height the new height
- */
- virtual void resize(int width, int height)=0;
-
- /** Changes the zoom level of the page in fixed increments (same as
- * Ctrl--, Ctrl-0, and Ctrl-+ in most browsers.
- * \param mode -1 to zoom out, 0 to reset zoom, 1 to zoom in
- */
- virtual void adjustZoom (int mode)=0;
-
- /** Execute Javascript in the context of the Window. This is equivalent to
- * executing Javascript in the address bar of a regular browser. The
- * javascript is copied so the caller retains ownership of the string.
- * \param javascript pointer to a string containing Javascript code
- */
- virtual void executeJavascript (WideString javascript) = 0;
-
- /** Insert the given text as a STYLE element at the beginning of the
- * document.
- * \param css Stylesheet content to insert.
- * \param elementId Can be empty, but if specified then it is used
- * as the id for the newly inserted element (replacing an existing one
- * with the same id, if any).
- */
- virtual void insertCSS (WideString css, WideString elementId) = 0;
-
- /** Request navigation to a URL. Depending on the url, this might not
- * cause an actual navigation.
- * \param url URLString pointer to an ASCII URL.
- */
- virtual bool navigateTo(URLString url)=0;
-
- /**
- * Request navigation to a URL. The URL string is copied so the caller
- * retains ownership of the string.
- * \deprecated Use navigateTo(URLString) instead
- * \param url pointer to an ASCII string containing a URL
- * \param url_length the length of the URL string
- */
- inline bool navigateTo(const char *url, size_t url_length) {
- return navigateTo(URLString::point_to(url,url_length));
- }
-
- /** Request that the page be reloaded. */
- virtual void refresh() = 0;
-
- /** Stop ongoing navigations. */
- virtual void stop() = 0;
-
- /** Goes back by one history item. */
- virtual void goBack() = 0;
-
- /** Goes forward by one history item. */
- virtual void goForward() = 0;
-
- /** True if you can go back at all (if back button should be enabled). */
- virtual bool canGoBack() const = 0;
-
- /** True if you can go forward (if forwrad button should be enabled). */
- virtual bool canGoForward() const = 0;
-
- /** Cut the currently selected data to the clipboard. */
- virtual void cut()=0;
-
- /** Copy the currently selected data to the clipboard. */
- virtual void copy()=0;
-
- /** Paste the current clipboard contents to the current cursoor position in
- * the Window.
- */
- virtual void paste()=0;
-
- /** Request the last action be undone. */
- virtual void undo()=0;
-
- /** Request the last undone action be reperformed. */
- virtual void redo()=0;
-
- /** Request deletion action. */
- virtual void del()=0;
-
- /** Request all data be selected. */
- virtual void selectAll()=0;
-
- /** Call after the file chooser has finished. Cancels if |files| is NULL or empty.
- * \param files List of FileString's terminated with empty FileString.
- */
- virtual void filesSelected(FileString *files)=0;
-
- /** Call after the file chooser has finished. Cancels if |files| is NULL or empty.
- * Note: This *MUST* be called after onJavascriptCallback is called with synchronous.
- * If not called, the owning RenderViewHost will no longer run scripts.
- *
- * \param handle Opaque |replyMsg| passed in WindowDelegate::onJavascriptCallback
- * \param result Javascript value to return.
- */
- virtual void synchronousScriptReturn(void *handle, const Script::Variant &result)=0;
-
- /** Binds a proxy function in Javascript to call */
- virtual void bind(WideString lvalue, const Script::Variant &rvalue)=0;
-
- /** Binds a proxy function in Javascript at the beginning of each page load */
- virtual void addBindOnStartLoading(WideString lvalue, const Script::Variant &rvalue)=0;
-
- /** Runs code in Javascript at the beginning of each page load */
- virtual void addEvalOnStartLoading(WideString script)=0;
-
- /** Removes all bindings in Javascript */
- virtual void clearStartLoading()=0;
-
-protected:
- void appendWidget(Widget *wid) {
- mWidgets.push_back(wid);
- }
- void removeWidget(Widget *wid) {
- for (WidgetList::iterator it = mWidgets.begin();
- it != backEnd();
- ++it)
- {
- if (*it == wid) {
- mWidgets.erase(it);
- return;
- }
- }
- }
-
-protected:
- Context *mContext;
- WindowDelegate *mDelegate;
-
- WidgetList mWidgets;
-};
-
-}
-
-#endif
+++ /dev/null
-/* Berkelium - Embedded Chromium
- * WindowDelegate.hpp
- *
- * Copyright (c) 2009, Patrick Reiter Horn
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Sirikata nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
- * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _BERKELIUM_WINDOW_DELEGATE_HPP_
-#define _BERKELIUM_WINDOW_DELEGATE_HPP_
-
-#include "berkelium/WeakString.hpp"
-#include "berkelium/Rect.hpp"
-#include "berkelium/ScriptVariant.hpp"
-#include "berkelium/Window.hpp"
-
-namespace Berkelium {
-
-class WindowImpl;
-class Widget;
-class Window;
-class Cursor;
-
-/**
- * Holds parameters for the onContextMenu delegate method.
- */
-struct ContextMenuEventArgs {
- enum MediaType {
- MediaTypeNone,
- MediaTypeImage,
- MediaTypeVideo,
- MediaTypeAudio,
- };
- enum EditFlags {
- CanDoNone = 0x0,
- CanUndo = 0x1,
- CanRedo = 0x2,
- CanCut = 0x4,
- CanCopy = 0x8,
- CanPaste = 0x10,
- CanDelete = 0x20,
- CanSelectAll = 0x40,
- };
-
- MediaType mediaType;
-
- int mouseX, mouseY;
-
- URLString linkUrl, srcUrl, pageUrl, frameUrl;
- WideString selectedText;
-
- bool isEditable;
-
- int editFlags;
-};
-
-enum ScriptAlertType {
- JavascriptAlert = 0,
- JavascriptConfirm = 1,
- JavascriptPrompt = 2
-};
-
-enum FileChooserType {
- FileOpen = 0,
- FileOpenMultiple = 1,
- FileOpenFolder = 2,
- FileSaveAs = 3
-};
-
-/**
- * Override WindowDelegate methods to intercept events from a render view.
- */
-class BERKELIUM_EXPORT WindowDelegate {
-public:
- /**
- * Virtual destructor is not necessary--Berkelium will not delete a
- * WindowDelegate.
- */
- virtual ~WindowDelegate() {}
-
- /**
- * The URL associated with this page has changed. This is similar to
- * onStartLoading, but may also be called if the hash part of the url
- * changes.
- *
- * \param win Window instance that fired this event.
- * \param newURL URL to display or store.
- */
- virtual void onAddressBarChanged(Window *win, URLString newURL) {}
- /**
- * Indicates whether the main page has started navigating to a new URL.
- * \note See onLoadingStateChanged for deciding to show a loading message.
- *
- * \param win Window instance that fired this event.
- * \param newURL URL of the currently-loading page for the main frame.
- */
- virtual void onStartLoading(Window *win, URLString newURL) {}
- /**
- * A page has loaded without error.
- *
- * \param win Window instance that fired this event.
- */
- virtual void onLoad(Window *win) {}
- /**
- * A worker has crashed. No info is provided yet to the callback.
- *
- * \param win Window instance that fired this event.
- */
- virtual void onCrashedWorker(Window *win) {}
- /**
- * Plugin with a given name has crashed. There's currently no way to
- * restart it, aside from maybe reloading the page that uses it.
- *
- * \param win Window instance that fired this event.
- * \param pluginName Name reported by the plugin..
- */
- virtual void onCrashedPlugin(Window *win, WideString pluginName) {}
- /**
- * Encountered an error while loading a page, and might not finish loading.
- *
- * \param win Window instance that fired this event.
- * \param url URL that encountered the error.
- * \param errorCode Some enumeration? errno? net error code?
- * \param isMainFrame True if the error happened for the main page,
- * If false, it may have happened in an iframe (or XHR?).
- */
- virtual void onProvisionalLoadError(Window *win, URLString url,
- int errorCode, bool isMainFrame) {}
- /**
- * Display a javascript message (Maybe an error?) or console.log.
- *
- * \param win Window instance that fired this event.
- * \param message String contents of the log message.
- * \param sourceId Javascript file or other source sending the message.
- * \param line_no Line number, useful for debugging.
- */
- virtual void onConsoleMessage(Window *win, WideString message,
- WideString sourceId, int line_no) {}
- /**
- * Synchronously display an alert box (OK), confirm (OK, CANCEL), or a
- * prompt (Input). If prompt, optionally return a string in value.
- *
- * \param win Window instance that fired this event.
- * \param message Alert message
- * \param defaultValue What to display in a text field if this is prompt.
- * \param url Originator (script? or page?) of the alert box.
- * \param flags What type of alert/confirm/prompt. See ScriptAlertType.
- * \param success True if the OK button, false if CANCEL.
- * \param value Allocated (strdup is easiest) return, default empty/null.
- */
- virtual void onScriptAlert(Window *win, WideString message,
- WideString defaultValue, URLString url,
- int flags, bool &success, WideString &value) {}
- /**
- * Frees resources from the most recent onScriptAlert call, if necessary.
- * Guaranteed to be called within the span of the same update() call, so
- * the WindowDelegate can safely use a variable to hold the string instance
- * while waiting to free it.
- *
- * \param lastValue A value to pass to the appropriate free method.
- */
- virtual void freeLastScriptAlert(WideString lastValue) {}
- /**
- * A navigation has been requested but not yet started.
- * I'm not sure yet if this gets called for frames.
- *
- * \param win Window instance that fired this event.
- * \param newUrl URL which wants to load.
- * \param referrer Page which initiated the request.
- * \param isNewWindow The request will result in a popup if not cancelled.
- If true and not cancelled, expect a onCreatedWindow callback soon.
- * \param cancelDefaultAction Put true into this value to cancel.
- * For example, if you don't want a new window, call win->navigate.
- */
- virtual void onNavigationRequested(Window *win, URLString newUrl,
- URLString referrer, bool isNewWindow,
- bool &cancelDefaultAction) {
- // Override to permit popup windows only if you support onCreatedWindow.
- if (isNewWindow) cancelDefaultAction = true;
- }
- /**
- * Notifies if a page is loading.
- * This callback is only useful for deciding whether to show a loading
- * indicator, for example a spinning widget or maybe a capital letter
- * being bombarded by meteors.
- * \note This may happen at different times from onStartLoading.
- *
- * \param win Window instance that fired this event.
- * \param isLoading true if loading has started, false if stopped.
- */
- virtual void onLoadingStateChanged(Window *win, bool isLoading) {}
- /**
- * Window's title has changed. This is usually the contents of title,
- * however some pages may dynamically change document.title.
- * Additionally, may be a default title (e.g. a URL) if the page has none.
- *
- * \param win Window instance that fired this event.
- * \param title Page title, should be the same as document.title.
- */
- virtual void onTitleChanged(Window *win, WideString title) {}
- /**
- * Display a tooltip at the mouse cursor position.
- * There's no notification for destroying the tooltip afaik
- *
- * \param win Window instance that fired this event.
- * \param text Text on the tooltip.
- */
- virtual void onTooltipChanged(Window *win, WideString text) {}
-
- /**
- * A renderer instance crashed. Applications can't currently do anything
- * to handle this aside from recreating the Window object.
- *
- * \param win Window instance that fired this event.
- */
- virtual void onCrashed(Window *win) {}
- /**
- * A renderer instance is hung. You can use this to display the Window in
- * a greyed out state, and offer the user a choice to kill the Window.
- *
- * \param win Window instance that fired this event.
- */
- virtual void onUnresponsive(Window *win) {}
- /**
- * Renderer instance is back to normal. Reset the color and close dialogs.
- *
- * \param win Window instance that fired this event.
- */
- virtual void onResponsive(Window *win) {}
-
- /**
- * Javascript has sent an externalHost message to this WindowDelegate.
- * To send a message from javascript call, for example: <code>
- * window.externalHost.postMessage("message", "urn:uuid:0000-...")
- * </code>
- * \param win Window instance that fired this event.
- * \param message Full contents of message sent by javascript.
- * \param origin Origin header of page sending the request. Use this
- * if you want to restrict messages to trusted pages.
- * \param target A URI Specified by the page. Can be in a custum or urn
- * format if that is useful.
- */
- virtual void onExternalHost(
- Window *win,
- WideString message,
- URLString origin,
- URLString target) {}
-
- /**
- * A new window has already been created. You are now expected to hold
- * onto the instance and be responsible for deleting it.
- *
- * \param win Window instance that fired this event.
- * \param newWindow New Berkelium window object to keep track of.
- * You may optionally destroy the window if you don't want it.
- * \param initialRect Coordinates and size that the window is requesting.
- * Use them as a recommendataion, but it's fine to call resize(),
- * and x/y coords should be ignored if doing off-screen rendering.
- */
- virtual void onCreatedWindow(Window *win, Window *newWindow,
- const Rect &initialRect) {}
-
- /**
- * The window is being painted. You need to synchronously copy the buffer
- * into application (video) memory before returning.
- *
- * \param win Window instance that fired this event.
- * \param sourceBuffer BGRA buffer with width/height of sourceBufferRect.
- * \param sourceBufferRect Rect containing the buffer.
- * \param numCopyRects Length of copyRects.
- * \param copyRects Array of valid+changed rectangles of sourceBuffer.
- * Anything not in copyRects is usually garbage data.
- * While these must lie within sourceBufferRect to make sense,
- * they are not relative to sourceBufferRect.
- * \param dx If non-zero, the area of the page specified by scrollRect has
- * been scrolled horizontally.
- * \param dy If non-zero, the area of the page specified by scrollRect has
- * been scrolled vertically.
- * \param scrollRect Area of the page to scroll. Only valid if dx&&dy.
- */
- virtual void onPaint(
- Window *win,
- const unsigned char *sourceBuffer,
- const Rect &sourceBufferRect,
- size_t numCopyRects,
- const Rect *copyRects,
- int dx, int dy,
- const Rect &scrollRect) {}
-
- /**
- * A widget is a rectangle to display on top of the page, e.g. a context
- * menu or a dropdown.
- *
- * \param win Window which is gaining a new widget object
- * \param newWidget Widget object to optionally hold onto.
- * \param zIndex Sorting value to compare to other Widget's.
- */
- virtual void onWidgetCreated(Window *win, Widget *newWidget, int zIndex) {}
- /**
- * Called by Widget::destroy(), in its destructor. This widget will be
- * removed from the Window's list of widgets when this function returns.
- *
- * \param win Window which is losing this widget object.
- * \param wid Widget this event is for.
- */
- virtual void onWidgetDestroyed(Window *win, Widget *wid) {}
-
- /**
- * Widget has changed size, Usually only happens once after creating.
- *
- * \param win Window which is losing this widget object.
- * \param wid Widget this event is for.
- * \param newWidth Width of widget texture.
- * \param newHeight Height of widget texture.
- */
- virtual void onWidgetResize(
- Window *win,
- Widget *wid,
- int newWidth,
- int newHeight) {}
-
- /**
- * Widget has moved, Usually only happens once after creating.
- * While these coordinates may be ignored, the position usually corresponds
- * to some click event or the mouse coordinates.
- *
- * \param win Window which is losing this widget object.
- * \param wid Widget this event is for.
- * \param newX Left coordinate relative to Window.
- * \param newY Top coordinate relative to Window.
- */
- virtual void onWidgetMove(
- Window *win,
- Widget *wid,
- int newX,
- int newY) {}
-
- /**
- * A widget overlay has been painted.
- *
- * \see onPaint
- * \param win Window instance that fired this event.
- * \param wid Widget this event is for
- * \param sourceBuffer raw buffer.
- * \param sourceBufferRect Rect containing the buffer.
- * \param numCopyRects Length of copyRects.
- * \param copyRects Array of valid+changed rectangles of sourceBuffer.
- * \param dx delta-x scroll
- * \param dy delta-y scroll
- * \param scrollRect Area of the page to scroll. Only valid if dx&&dy.
- */
- virtual void onWidgetPaint(
- Window *win,
- Widget *wid,
- const unsigned char *sourceBuffer,
- const Rect &sourceBufferRect,
- size_t numCopyRects,
- const Rect *copyRects,
- int dx, int dy,
- const Rect &scrollRect) {}
-
- /**
- * Invoked when the Window requests that the mouse cursor be updated.
- * \param win Window instance that fired this event.
- * \param newCursor Platform-specific cursor handle to pass to the
- * appropriate system API.
- * \see Berkelium::Cursor
- */
- virtual void onCursorUpdated(Window *win, const Cursor& newCursor) {}
-
- /**
- * Notification that the user has brought up a context menu. Chrome doesn't
- * specify the exact set of context menu items--implementors are free to
- * choose other menu items to display.
- * \param win Window instance that fired this event.
- * \param args Guidelines on what menu items to include or not include.
- */
- virtual void onShowContextMenu(Window *win,
- const ContextMenuEventArgs& args) {}
-
- /** Javascript has called a bound function on this Window.
- * Make sure to h
- *
- * \param win Window instance that fired this event.
- * \param replyMsg If non-NULL, opaque reply identifier to be passed to synchronousScriptReturn.
- * \param url Origin of the sending script.
- * \param funcName name of function to call.
- * \param args list of variants passed into function.
- * \param numArgs number of arguments.
- */
- virtual void onJavascriptCallback(Window *win, void* replyMsg, URLString origin, WideString funcName, Script::Variant *args, size_t numArgs) {
- if (replyMsg) {
- win->synchronousScriptReturn(replyMsg, Script::Variant());
- }
- }
-
- /** Display a file chooser dialog, if necessary. The value to be returned should go ______.
- * \param win Window instance that fired this event.
- * \param mode Type of file chooser expected. See FileChooserType.
- * \param title Title for dialog. "Open" or "Save" should be used if empty.
- * \param defaultFile Default file to select in dialog.
- */
- virtual void onRunFileChooser(Window *win, int mode, WideString title, FileString defaultFile) {
- win->filesSelected(NULL);
- }
-
-/**************************
- Might want messages for:
-- StartDragging(const WebDropData& drop_data,
- WebKit::WebDragOperationsMask allowed_ops);
-- UpdateDragCursor(WebKit::WebDragOperation operation);
-- TakeFocus(bool reverse)
-- Close
-- UpdateTargetURL
-- UpdateEncoding
-**************************/
-
-};
-
-}
-
-#endif
#include <common/concurrency/executor.h>
-#include <berkelium/Berkelium.hpp>
-
#include <boost/thread.hpp>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
-namespace caspar { namespace html {
-
-std::unique_ptr<executor> g_berkelium_executor;
-std::unique_ptr<executor> g_berkelium_timer_executor;
+#include <cef_app.h>
-void tick()
-{
- g_berkelium_timer_executor->begin_invoke([&]
- {
- static boost::asio::io_service io;
+#include <tbb/atomic.h>
- boost::asio::deadline_timer t(io, boost::posix_time::milliseconds(10));
+#pragma comment(lib, "libcef.lib")
+#pragma comment(lib, "libcef_dll_wrapper.lib")
- g_berkelium_executor->invoke(std::bind(&Berkelium::update));
+namespace caspar { namespace html {
- t.wait();
+tbb::atomic<bool> g_cef_running;
+std::unique_ptr<executor> g_cef_executor;
- tick();
- });
+void tick()
+{
+ if (!g_cef_running)
+ return;
+
+ CefDoMessageLoopWork();
+ g_cef_executor->begin_invoke([&]{ tick(); });
}
-void init()
+bool init()
{
- core::register_producer_factory(html::create_producer);
+ CefMainArgs main_args;
+
+ if (CefExecuteProcess(main_args, nullptr, nullptr) >= 0)
+ return false;
- g_berkelium_executor.reset(new executor(L"berkelium"));
- g_berkelium_timer_executor.reset(new executor(L"g_berkelium_timer"));
+ core::register_producer_factory(html::create_producer);
- g_berkelium_executor->invoke([&]
+ g_cef_executor.reset(new executor(L"cef"));
+ g_cef_running = true;
+
+ g_cef_executor->invoke([&]
{
- if (!Berkelium::init(Berkelium::FileString::empty()))
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info("Failed to initialize Berkelium"));
+ CefSettings settings;
+ //settings.windowless_rendering_enabled = true;
+ CefInitialize(main_args, settings, nullptr, nullptr);
});
-
- g_berkelium_timer_executor->begin_invoke([&]
+
+ g_cef_executor->begin_invoke([&]
{
tick();
});
-}
-void invoke(const std::function<void()>& func)
-{
- g_berkelium_executor->invoke(func);
+ return true;
}
void uninit()
{
- g_berkelium_timer_executor.reset();
-
- g_berkelium_executor->invoke([&]
+ g_cef_executor->invoke([=]
{
- Berkelium::destroy();
+ g_cef_running = false;
+ g_cef_executor->wait();
+ CefShutdown();
});
+}
+
- g_berkelium_executor.reset();
+void invoke(const std::function<void()>& func)
+{
+ g_cef_executor->invoke(func);
}
+
+void begin_invoke(const std::function<void()>& func)
+{
+ g_cef_executor->begin_invoke(func);
+}
}}
namespace caspar { namespace html {
-void init();
+bool init();
void uninit();
void invoke(const std::function<void()>& func);
-
+void begin_invoke(const std::function<void()>& func);
}}
\ No newline at end of file
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)tmp\$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">$(ProjectDir)tmp\$(Configuration)\</IntDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">$(ProjectDir)tmp\$(Configuration)\</IntDir>
- <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\;..\..\dependencies\boost\;..\..\dependencies\ffmpeg\include\;..\..\dependencies\tbb\include\;..\..\dependencies\zlib\include\;..\..\dependencies\berkelium\include\;..\;.;$(IncludePath)</IncludePath>
- <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\;..\..\dependencies\boost\;..\..\dependencies\ffmpeg\include\;..\..\dependencies\tbb\include\;..\..\dependencies\zlib\include\;..\..\dependencies\berkelium\include\;..\;.;$(IncludePath)</IncludePath>
+ <IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\;..\..\dependencies\boost\;..\..\dependencies\ffmpeg\include\;..\..\dependencies\tbb\include\;..\..\dependencies\zlib\include\;..\..\dependencies\cef\include\;..\;.;..\..\dependencies\cef\;$(IncludePath)</IncludePath>
+ <IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\;..\..\dependencies\boost\;..\..\dependencies\ffmpeg\include\;..\..\dependencies\tbb\include\;..\..\dependencies\zlib\include\;..\..\dependencies\cef\include\;..\;.;..\..\dependencies\cef\;$(IncludePath)</IncludePath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">..\..\;..\..\dependencies\boost\;..\..\dependencies\ffmpeg\include\;..\..\dependencies\tbb\include\;..\..\dependencies\zlib\include\;..\..\dependencies\cef\include\;..\..\dependencies\cef;..\;.;$(IncludePath)</IncludePath>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">..\..\;..\..\dependencies\boost\;..\..\dependencies\ffmpeg\include\;..\..\dependencies\tbb\include\;..\..\dependencies\zlib\include\;..\..\dependencies\cef\include\;..\..\dependencies\cef;..\;.;$(IncludePath)</IncludePath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\dependencies\boost\stage\lib\;..\..\dependencies\ffmpeg\lib\;..\..\dependencies\tbb\lib\ia32\vc10\;..\..\dependencies\cef\lib;$(LibraryPath)</LibraryPath>
- <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\dependencies\boost\stage\lib\;..\..\dependencies\ffmpeg\lib\;..\..\dependencies\tbb\lib\ia32\vc10\;$(LibraryPath)</LibraryPath>
+ <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\dependencies\boost\stage\lib\;..\..\dependencies\ffmpeg\lib\;..\..\dependencies\tbb\lib\ia32\vc10\;..\..\dependencies\cef\lib\;$(LibraryPath)</LibraryPath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">..\..\dependencies\boost\stage\lib\;..\..\dependencies\ffmpeg\lib\;..\..\dependencies\tbb\lib\ia32\vc10\;$(LibraryPath)</LibraryPath>
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">..\..\dependencies\boost\stage\lib\;..\..\dependencies\ffmpeg\lib\;..\..\dependencies\tbb\lib\ia32\vc10\;$(LibraryPath)</LibraryPath>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)bin\$(Configuration)\</OutDir>
#include <core/producer/frame_producer.h>
#include <core/mixer/write_frame.h>
+#include <common/utility/assert.h>
#include <common/env.h>
#include <common/concurrency/executor.h>
#include <common/concurrency/lock.h>
#include <common/diagnostics/graph.h>
#include <common/utility/timer.h>
-
-#include <berkelium/Berkelium.hpp>
-#include <berkelium/Context.hpp>
-#include <berkelium/Window.hpp>
-#include <berkelium/WindowDelegate.hpp>
-#include <berkelium/Rect.hpp>
+#include <common/memory/memcpy.h>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <tbb/atomic.h>
#include <tbb/parallel_for.h>
+#include <cef_task.h>
+#include <cef_app.h>
+#include <cef_client.h>
+#include <cef_render_handler.h>
+
#include "html.h"
-namespace caspar { namespace html {
+#pragma comment (lib, "libcef.lib")
+#pragma comment (lib, "libcef_dll_wrapper.lib")
+
+namespace caspar {
+ namespace html {
-class html_producer
- : public core::frame_producer
- , public Berkelium::WindowDelegate
-{
- core::monitor::subject monitor_subject_;
- const std::wstring url_;
- safe_ptr<diagnostics::graph> graph_;
-
- const safe_ptr<core::frame_factory> frame_factory_;
+ class html_client
+ : public CefClient
+ , public CefRenderHandler
+ , public CefLifeSpanHandler
+ {
- safe_ptr<core::basic_frame> last_frame_;
- mutable boost::mutex last_frame_mutex_;
-
- std::vector<unsigned char> frame_;
- mutable boost::mutex frame_mutex_;
+ safe_ptr<core::frame_factory> frame_factory_;
+ tbb::atomic<bool> invalidated_;
+ std::vector<unsigned char> frame_;
+ mutable boost::mutex frame_mutex_;
- tbb::atomic<bool> invalidated_;
+ safe_ptr<core::basic_frame> last_frame_;
+ mutable boost::mutex last_frame_mutex_;
- std::unique_ptr<Berkelium::Window> window_;
+ CefRefPtr<CefBrowser> browser_;
- executor executor_;
-
-public:
- html_producer(
- const safe_ptr<core::frame_factory>& frame_factory,
- const std::wstring& url)
- : url_(url)
- , frame_factory_(frame_factory)
- , last_frame_(core::basic_frame::empty())
- , frame_(frame_factory->get_video_format_desc().width * frame_factory->get_video_format_desc().height * 4, 0)
- , executor_(L"html_producer")
- {
- invalidated_ = true;
-
- graph_->set_text(print());
- diagnostics::register_graph(graph_);
-
- html::invoke([&]
- {
+ executor executor_;
+
+ public:
+
+ html_client(safe_ptr<core::frame_factory> frame_factory)
+ : frame_factory_(frame_factory)
+ , frame_(frame_factory->get_video_format_desc().width * frame_factory->get_video_format_desc().height * 4, 0)
+ , last_frame_(core::basic_frame::empty())
+ , executor_(L"html_producer")
{
- std::unique_ptr<Berkelium::Context> context(Berkelium::Context::create());
- window_.reset(Berkelium::Window::create(context.get()));
+ invalidated_ = true;
+ executor_.begin_invoke([&]{ update(); });
}
- window_->resize(
- frame_factory->get_video_format_desc().width,
- frame_factory->get_video_format_desc().height);
- window_->setDelegate(this);
- window_->setTransparent(true);
-
- const auto narrow_url = narrow(url);
-
- if(!window_->navigateTo(
- Berkelium::URLString::point_to(
- narrow_url.data(),
- narrow_url.length())))
+ safe_ptr<core::basic_frame> receive(int)
{
- BOOST_THROW_EXCEPTION(caspar_exception() << msg_info("Failed to navigate."));
+ auto frame = last_frame();
+ executor_.begin_invoke([&]{ update(); });
+ return frame;
}
- });
- tick();
- }
+ safe_ptr<core::basic_frame> last_frame() const
+ {
+ return lock(last_frame_mutex_, [&]
+ {
+ return last_frame_;
+ });
+ }
- ~html_producer()
- {
- html::invoke([=]
- {
- window_.reset();
- });
- }
-
- // frame_producer
-
- safe_ptr<core::basic_frame> receive(int) override
- {
- executor_.begin_invoke([this]{ tick(); });
+ void execute_javascript(const std::wstring& javascript)
+ {
+ html::begin_invoke([=]
+ {
+ if (browser_ != nullptr)
+ browser_->GetMainFrame()->ExecuteJavaScript(narrow(javascript).c_str(), browser_->GetMainFrame()->GetURL(), 0);
+ });
+ }
- return last_frame();
- }
+ void close()
+ {
+ html::invoke([=]
+ {
+ if (browser_ != nullptr)
+ {
+ browser_->GetHost()->CloseBrowser(true);
+ }
+ });
+ }
- safe_ptr<core::basic_frame> last_frame() const override
- {
- return lock(last_frame_mutex_, [&]
- {
- return last_frame_;
- });
- }
-
- boost::unique_future<std::wstring> call(const std::wstring& param) override
- {
- static const boost::wregex play_exp(L"PLAY\\s*(\\d+)?", boost::regex::icase);
- static const boost::wregex stop_exp(L"STOP\\s*(\\d+)?", boost::regex::icase);
- static const boost::wregex next_exp(L"NEXT\\s*(\\d+)?", boost::regex::icase);
- static const boost::wregex remove_exp(L"REMOVE\\s*(\\d+)?", boost::regex::icase);
- static const boost::wregex update_exp(L"UPDATE\\s+(\\d+)?\"?(?<VALUE>.*)\"?", boost::regex::icase);
- static const boost::wregex invoke_exp(L"INVOKE\\s+(\\d+)?\"?(?<VALUE>.*)\"?", boost::regex::icase);
-
- auto command = [=]
- {
- auto javascript = param;
+ private:
- boost::wsmatch what;
+ bool GetViewRect(CefRefPtr<CefBrowser> browser, CefRect &rect)
+ {
+ CASPAR_ASSERT(CefCurrentlyOn(TID_UI));
- if (boost::regex_match(param, what, play_exp))
+ rect = CefRect(0, 0, frame_factory_->get_video_format_desc().width, frame_factory_->get_video_format_desc().height);
+ return true;
+ }
+
+ void OnPaint(CefRefPtr<CefBrowser> browser, PaintElementType type, const RectList &dirtyRects, const void *buffer, int width, int height)
{
- javascript = (boost::wformat(L"play()")).str();
+ CASPAR_ASSERT(CefCurrentlyOn(TID_UI));
+
+ lock(frame_mutex_, [&]
+ {
+ invalidated_ = true;
+ fast_memcpy(frame_.data(), buffer, width * height * 4);
+ });
}
- else if (boost::regex_match(param, what, stop_exp))
+
+ void OnAfterCreated(CefRefPtr<CefBrowser> browser) override
{
- javascript = (boost::wformat(L"stop()")).str();
+ CASPAR_ASSERT(CefCurrentlyOn(TID_UI));
+
+ browser_ = browser;
}
- else if (boost::regex_match(param, what, next_exp))
+
+ void OnBeforeClose(CefRefPtr<CefBrowser> browser) override
{
- javascript = (boost::wformat(L"next()")).str();
+ CASPAR_ASSERT(CefCurrentlyOn(TID_UI));
+
+ browser_ = nullptr;
}
- else if (boost::regex_match(param, what, remove_exp))
+
+ bool DoClose(CefRefPtr<CefBrowser> browser) override
{
- javascript = (boost::wformat(L"remove()")).str();
+ CASPAR_ASSERT(CefCurrentlyOn(TID_UI));
+
+ return false;
}
- else if (boost::regex_match(param, what, update_exp))
+
+ CefRefPtr<CefRenderHandler> GetRenderHandler() override
{
- javascript = (boost::wformat(L"update(\"%1%\")") % boost::algorithm::trim_copy_if(what["VALUE"].str(), boost::is_any_of(" \""))).str();
+ return this;
}
- else if (boost::regex_match(param, what, invoke_exp))
+
+ CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() override
{
- javascript = (boost::wformat(L"invoke(\"%1%\")") % boost::algorithm::trim_copy_if(what["VALUE"].str(), boost::is_any_of(" \""))).str();
+ return this;
}
-
- window_->executeJavascript(Berkelium::WideString::point_to(javascript.data(), javascript.length()));
+
+ void invoke_on_enter_frame()
+ {
+ //html::invoke([this]
+ //{
+ // static const std::wstring javascript = L"onEnterFrame()";
+ // execute_javascript(javascript);
+ //});
+ }
+
+ safe_ptr<core::basic_frame> draw(safe_ptr<core::write_frame> frame, core::field_mode::type field_mode)
+ {
+ const auto& pixel_desc = frame->get_pixel_format_desc();
+
+ CASPAR_ASSERT(pixel_desc.pix_fmt == core::pixel_format::bgra);
+
+ const auto& height = pixel_desc.planes[0].height;
+ const auto& linesize = pixel_desc.planes[0].linesize;
+
+ lock(frame_mutex_, [&]
+ {
+ tbb::parallel_for<int>(
+ field_mode == core::field_mode::upper ? 0 : 1,
+ height,
+ field_mode == core::field_mode::progressive ? 1 : 2,
+ [&](int y)
+ {
+ fast_memcpy(
+ frame->image_data().begin() + y * linesize,
+ frame_.data() + y * linesize,
+ linesize);
+ });
+ });
+
+ return frame;
+ }
+
+ void update()
+ {
+ invoke_on_enter_frame();
+
+ if (invalidated_.fetch_and_store(false))
+ {
+ high_prec_timer timer;
+ timer.tick(0.0);
+
+ core::pixel_format_desc pixel_desc;
+ pixel_desc.pix_fmt = core::pixel_format::bgra;
+ pixel_desc.planes.push_back(
+ core::pixel_format_desc::plane(
+ frame_factory_->get_video_format_desc().width,
+ frame_factory_->get_video_format_desc().height,
+ 4));
+
+ auto frame = frame_factory_->create_frame(this, pixel_desc);
+
+ const auto& format_desc = frame_factory_->get_video_format_desc();
+
+ if (format_desc.field_mode != core::field_mode::progressive)
+ {
+ draw(frame, format_desc.field_mode);
+
+ executor_.yield();
+ timer.tick(1.0 / (format_desc.fps * format_desc.field_count));
+
+ draw(frame, static_cast<core::field_mode::type>(format_desc.field_mode ^ core::field_mode::progressive));
+ }
+ else
+ {
+ draw(frame, format_desc.field_mode);
+ }
+
+ frame->commit();
+
+ lock(last_frame_mutex_, [&]
+ {
+ last_frame_ = frame;
+ });
+ }
+ }
+
+ IMPLEMENT_REFCOUNTING(html_client);
};
-
- boost::packaged_task<std::wstring> task([=]() -> std::wstring
+
+ class html_producer
+ : public core::frame_producer
{
- html::invoke(command);
+ core::monitor::subject monitor_subject_;
+ const std::wstring url_;
+ safe_ptr<diagnostics::graph> graph_;
- return L"";
- });
+ CefRefPtr<html_client> client_;
- task();
+ public:
+ html_producer(
+ const safe_ptr<core::frame_factory>& frame_factory,
+ const std::wstring& url)
+ : url_(url)
+ {
+ graph_->set_text(print());
+ diagnostics::register_graph(graph_);
- return task.get_future();
- }
-
- std::wstring print() const override
- {
- return L"html[" + url_ + L"]";
- }
-
- boost::property_tree::wptree info() const override
- {
- boost::property_tree::wptree info;
- info.add(L"type", L"html-producer");
- return info;
- }
-
- core::monitor::subject& monitor_output()
- {
- return monitor_subject_;
- }
-
- // Berkelium::WindowDelegate
-
- void onPaint(
- Berkelium::Window* wini,
- const unsigned char* bitmap_in,
- const Berkelium::Rect& bitmap_rect,
- size_t num_copy_rects,
- const Berkelium::Rect* copy_rects,
- int dx,
- int dy,
- const Berkelium::Rect& scroll_rect) override
- {
- lock(frame_mutex_, [&]
- {
- invalidated_ = true;
-
- tbb::parallel_for<int>(0, num_copy_rects, 1, [&](int i)
- {
- tbb::parallel_for<int>(0, copy_rects[i].height(), 1, [&](int y)
+ html::invoke([&]
{
- memcpy(
- frame_.data() + ((y + copy_rects[i].top()) * frame_factory_->get_video_format_desc().width + copy_rects[i].left()) * 4,
- bitmap_in + ((y + copy_rects[i].top() - bitmap_rect.top()) * bitmap_rect.width() + copy_rects[i].left() - bitmap_rect.left()) * 4,
- copy_rects[i].width() * 4);
+ client_ = new html_client(frame_factory);
+
+ CefWindowInfo window_info;
+
+ window_info.SetTransparentPainting(TRUE);
+ window_info.SetAsOffScreen(nullptr);
+ //window_info.SetAsWindowless(nullptr, true);
+
+ CefBrowserSettings browser_settings;
+ CefBrowserHost::CreateBrowser(window_info, client_.get(), url, browser_settings, nullptr);
});
- });
- });
- }
+ }
- void onExternalHost(
- Berkelium::Window *win,
- Berkelium::WideString message,
- Berkelium::URLString origin,
- Berkelium::URLString target) override
- {
- }
+ ~html_producer()
+ {
+ client_->close();
+ }
- // html_producer
+ // frame_producer
- void invoke_on_enter_frame()
- {
- html::invoke([this]
- {
- static const std::wstring javascript = L"onEnterFrame()";
- window_->executeJavascript(Berkelium::WideString::point_to(javascript.data(), javascript.length()));
- });
- }
-
- safe_ptr<core::basic_frame> draw(
- safe_ptr<core::write_frame> frame,
- core::field_mode::type field_mode)
- {
- const auto& pixel_desc = frame->get_pixel_format_desc();
+ safe_ptr<core::basic_frame> receive(int) override
+ {
+ return client_->receive(0);
+ }
- CASPAR_ASSERT(pixel_desc.pix_fmt == core::pixel_format::bgra);
-
- const auto& height = pixel_desc.planes[0].height;
- const auto& linesize = pixel_desc.planes[0].linesize;
-
- invoke_on_enter_frame();
-
- lock(frame_mutex_, [&]
- {
- tbb::parallel_for<int>(
- field_mode == core::field_mode::upper ? 0 : 1,
- height,
- field_mode == core::field_mode::progressive ? 1 : 2,
- [&](int y)
+ safe_ptr<core::basic_frame> last_frame() const override
{
- memcpy(
- frame->image_data().begin() + y * linesize,
- frame_.data() + y * linesize,
- linesize);
- });
- });
-
- return frame;
- }
-
- void tick()
- {
- if(invalidated_.fetch_and_store(false))
- {
- high_prec_timer timer;
- timer.tick(0.0);
+ return client_->last_frame();
+ }
- core::pixel_format_desc pixel_desc;
- pixel_desc.pix_fmt = core::pixel_format::bgra;
- pixel_desc.planes.push_back(
- core::pixel_format_desc::plane(
- frame_factory_->get_video_format_desc().width,
- frame_factory_->get_video_format_desc().height,
- 4));
+ boost::unique_future<std::wstring> call(const std::wstring& param) override
+ {
+ static const boost::wregex play_exp(L"PLAY\\s*(\\d+)?", boost::regex::icase);
+ static const boost::wregex stop_exp(L"STOP\\s*(\\d+)?", boost::regex::icase);
+ static const boost::wregex next_exp(L"NEXT\\s*(\\d+)?", boost::regex::icase);
+ static const boost::wregex remove_exp(L"REMOVE\\s*(\\d+)?", boost::regex::icase);
+ static const boost::wregex update_exp(L"UPDATE\\s+(\\d+)?\"?(?<VALUE>.*)\"?", boost::regex::icase);
+ static const boost::wregex invoke_exp(L"INVOKE\\s+(\\d+)?\"?(?<VALUE>.*)\"?", boost::regex::icase);
+
+ auto command = [=]
+ {
+ auto javascript = param;
+
+ boost::wsmatch what;
+
+ if (boost::regex_match(param, what, play_exp))
+ {
+ javascript = (boost::wformat(L"play()")).str();
+ }
+ else if (boost::regex_match(param, what, stop_exp))
+ {
+ javascript = (boost::wformat(L"stop()")).str();
+ }
+ else if (boost::regex_match(param, what, next_exp))
+ {
+ javascript = (boost::wformat(L"next()")).str();
+ }
+ else if (boost::regex_match(param, what, remove_exp))
+ {
+ javascript = (boost::wformat(L"remove()")).str();
+ }
+ else if (boost::regex_match(param, what, update_exp))
+ {
+ javascript = (boost::wformat(L"update(\"%1%\")") % boost::algorithm::trim_copy_if(what["VALUE"].str(), boost::is_any_of(" \""))).str();
+ }
+ else if (boost::regex_match(param, what, invoke_exp))
+ {
+ javascript = (boost::wformat(L"invoke(\"%1%\")") % boost::algorithm::trim_copy_if(what["VALUE"].str(), boost::is_any_of(" \""))).str();
+ }
+
+ client_->execute_javascript(javascript);
+ };
+
+ boost::packaged_task<std::wstring> task([=]() -> std::wstring
+ {
+ html::invoke(command);
+ return L"";
+ });
- auto frame = frame_factory_->create_frame(this, pixel_desc);
+ task();
- const auto& format_desc = frame_factory_->get_video_format_desc();
+ return task.get_future();
+ }
- if (format_desc.field_mode != core::field_mode::progressive)
+ std::wstring print() const override
{
- draw(frame, format_desc.field_mode);
-
- executor_.yield();
- timer.tick(1.0 / (format_desc.fps * format_desc.field_count));
-
- draw(frame, static_cast<core::field_mode::type>(format_desc.field_mode ^ core::field_mode::progressive));
+ return L"html[" + url_ + L"]";
}
- else
- {
- draw(frame, format_desc.field_mode);
- }
-
- frame->commit();
- lock(last_frame_mutex_, [&]
- {
- last_frame_ = frame;
- });
- }
- }
-};
+ boost::property_tree::wptree info() const override
+ {
+ boost::property_tree::wptree info;
+ info.add(L"type", L"html-producer");
+ return info;
+ }
-safe_ptr<core::frame_producer> create_producer(
- const safe_ptr<core::frame_factory>& frame_factory,
- const core::parameters& params)
-{
- const auto filename = env::template_folder() + L"\\" + params.at_original(0) + L".html";
+ core::monitor::subject& monitor_output()
+ {
+ return monitor_subject_;
+ }
+ };
+
+ safe_ptr<core::frame_producer> create_producer(
+ const safe_ptr<core::frame_factory>& frame_factory,
+ const core::parameters& params)
+ {
+ const auto filename = env::template_folder() + L"\\" + params.at_original(0) + L".html";
- if (!boost::filesystem::exists(filename) && params.at(0) != L"[HTML]")
- return core::frame_producer::empty();
+ if (!boost::filesystem::exists(filename) && params.at(0) != L"[HTML]")
+ return core::frame_producer::empty();
- const auto url = boost::filesystem::exists(filename)
- ? filename
- : params.at_original(1);
+ const auto url = boost::filesystem::exists(filename)
+ ? filename
+ : params.at_original(1);
- if(!boost::algorithm::contains(url, ".") || boost::algorithm::ends_with(url, "_A") || boost::algorithm::ends_with(url, "_ALPHA"))
- return core::frame_producer::empty();
-
- return core::create_producer_destroy_proxy(
- core::create_producer_print_proxy(
- make_safe<html_producer>(
- frame_factory,
- url)));
-}
+ if(!boost::algorithm::contains(url, ".") || boost::algorithm::ends_with(url, "_A") || boost::algorithm::ends_with(url, "_ALPHA"))
+ return core::frame_producer::empty();
+
+ return core::create_producer_destroy_proxy(
+ core::create_producer_print_proxy(
+ make_safe<html_producer>(
+ frame_factory,
+ url)));
+ }
-}}
\ No newline at end of file
+ }
+}
\ No newline at end of file
#include <modules/ffmpeg/ffmpeg.h>\r
#include <modules/image/image.h>\r
#include <modules/newtek/util/air_send.h>\r
+#include <modules/html/html.h>\r
\r
#include <common/env.h>\r
#include <common/exception/win32_exception.h>\r
#include <boost/locale.hpp>\r
#include <boost/algorithm/string/case_conv.hpp>\r
\r
+#include <functional>\r
+\r
// NOTE: This is needed in order to make CComObject work since this is not a real ATL project.\r
CComModule _AtlModule;\r
extern __declspec(selectany) CAtlModule* _pAtlModule = &_AtlModule;\r
return boost::to_upper_copy(str);\r
}\r
\r
+struct init_t\r
+{\r
+ std::wstring name;\r
+ std::function<void()> uninit;\r
+\r
+ init_t(std::wstring name, std::function<void()> init, std::function<void()> uninit)\r
+ : name(name)\r
+ , uninit(uninit)\r
+ {\r
+ if (init)\r
+ init();\r
+ CASPAR_LOG(info) << L"Initialized " << name << L" module.";\r
+ }\r
+\r
+ ~init_t()\r
+ {\r
+ if (uninit)\r
+ uninit();\r
+ CASPAR_LOG(info) << L"Uninitialized " << name << L" module.";\r
+ }\r
+};\r
+\r
int main(int argc, char* argv[])\r
-{ \r
+{\r
+ if (!caspar::html::init())\r
+ return 0;\r
+\r
static_assert(sizeof(void*) == 4, "64-bit code generation is not supported.");\r
\r
SetUnhandledExceptionFilter(UserUnhandledExceptionFilter);\r
wait_for_keypress = false;\r
\r
{\r
+ init_t html_init(L"html", nullptr, caspar::html::uninit);\r
+\r
boost::promise<bool> shutdown_server_now;\r
boost::unique_future<bool> shutdown_server = shutdown_server_now.get_future();\r
\r
#include <modules/decklink/decklink.h>\r
#include <modules/ffmpeg/ffmpeg.h>\r
#include <modules/flash/flash.h>\r
-#include <modules/html/html.h>\r
#include <modules/oal/oal.h>\r
#include <modules/ogl/ogl.h>\r
#include <modules/newtek/newtek.h>\r
running_ = true;\r
setup_audio(env::properties());\r
\r
- html::init();\r
- CASPAR_LOG(info) << L"Initialized html module.";\r
-\r
ffmpeg::init(media_info_repo_);\r
CASPAR_LOG(info) << L"Initialized ffmpeg module.";\r
\r
destroy_producers_synchronously();\r
channels_.clear();\r
\r
- html::uninit();\r
ffmpeg::uninit();\r
}\r
\r
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\dependencies\BluefishSDK_V5_10_0_42\Inc\;..\dependencies\boost\;..\dependencies\ffmpeg\include\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\include;..\dependencies\SFML-1.6\include\;..\dependencies\tbb\include\;$(IncludePath)</IncludePath>\r
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">..\dependencies\BluefishSDK_V5_10_0_42\Inc\;..\dependencies\boost\;..\dependencies\ffmpeg\include\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\include;..\dependencies\SFML-1.6\include\;..\dependencies\tbb\include\;$(IncludePath)</IncludePath>\r
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">..\dependencies\BluefishSDK_V5_10_0_42\Inc\;..\dependencies\boost\;..\dependencies\ffmpeg\include\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\include;..\dependencies\SFML-1.6\include\;..\dependencies\tbb\include\;$(IncludePath)</IncludePath>\r
- <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Program\Microsoft DirectX SDK (June 2010)\Lib\x86;..\dependencies\BluefishSDK_V5_10_0_42\Lib\;..\dependencies\boost\stage\lib\;..\dependencies\ffmpeg\lib\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\lib;..\dependencies\SFML-1.6\lib\;..\dependencies\tbb\lib\ia32\vc10\;..\dependencies\zlib\lib;..\dependencies\berkelium\lib;$(LibraryPath)</LibraryPath>\r
- <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\Program\Microsoft DirectX SDK (June 2010)\Lib\x86;..\dependencies\BluefishSDK_V5_10_0_42\Lib\;..\dependencies\boost\stage\lib\;..\dependencies\ffmpeg\lib\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\lib;..\dependencies\SFML-1.6\lib\;..\dependencies\tbb\lib\ia32\vc10\;..\dependencies\zlib\lib;..\dependencies\berkelium\lib;$(LibraryPath)</LibraryPath>\r
- <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">C:\Program\Microsoft DirectX SDK (June 2010)\Lib\x86;..\dependencies\BluefishSDK_V5_10_0_42\Lib\;..\dependencies\boost\stage\lib\;..\dependencies\ffmpeg\lib\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\lib;..\dependencies\SFML-1.6\lib\;..\dependencies\tbb\lib\ia32\vc10\;..\dependencies\zlib\lib;..\dependencies\berkelium\lib;$(LibraryPath)</LibraryPath>\r
- <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">C:\Program\Microsoft DirectX SDK (June 2010)\Lib\x86;..\dependencies\BluefishSDK_V5_10_0_42\Lib\;..\dependencies\boost\stage\lib\;..\dependencies\ffmpeg\lib\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\lib;..\dependencies\SFML-1.6\lib\;..\dependencies\tbb\lib\ia32\vc10\;..\dependencies\zlib\lib;..\dependencies\berkelium\lib;$(LibraryPath)</LibraryPath>\r
+ <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Program\Microsoft DirectX SDK (June 2010)\Lib\x86;..\dependencies\BluefishSDK_V5_10_0_42\Lib\;..\dependencies\boost\stage\lib\;..\dependencies\ffmpeg\lib\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\lib;..\dependencies\SFML-1.6\lib\;..\dependencies\tbb\lib\ia32\vc10\;..\dependencies\zlib\lib;..\dependencies\cef\lib\debug;$(LibraryPath)</LibraryPath>\r
+ <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\Program\Microsoft DirectX SDK (June 2010)\Lib\x86;..\dependencies\BluefishSDK_V5_10_0_42\Lib\;..\dependencies\boost\stage\lib\;..\dependencies\ffmpeg\lib\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\lib;..\dependencies\SFML-1.6\lib\;..\dependencies\tbb\lib\ia32\vc10\;..\dependencies\zlib\lib;..\dependencies\cef\lib\release;$(LibraryPath)</LibraryPath>\r
+ <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">C:\Program\Microsoft DirectX SDK (June 2010)\Lib\x86;..\dependencies\BluefishSDK_V5_10_0_42\Lib\;..\dependencies\boost\stage\lib\;..\dependencies\ffmpeg\lib\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\lib;..\dependencies\SFML-1.6\lib\;..\dependencies\tbb\lib\ia32\vc10\;..\dependencies\zlib\lib;..\dependencies\cef\lib\release;$(LibraryPath)</LibraryPath>\r
+ <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">C:\Program\Microsoft DirectX SDK (June 2010)\Lib\x86;..\dependencies\BluefishSDK_V5_10_0_42\Lib\;..\dependencies\boost\stage\lib\;..\dependencies\ffmpeg\lib\;..\dependencies\FreeImage\Dist\;..\dependencies\glew-1.6.0\lib;..\dependencies\SFML-1.6\lib\;..\dependencies\tbb\lib\ia32\vc10\;..\dependencies\zlib\lib;..\dependencies\cef\lib\release;$(LibraryPath)</LibraryPath>\r
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)bin\$(Configuration)\</OutDir>\r
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)bin\$(Configuration)\</OutDir>\r
<OutDir Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">$(SolutionDir)bin\$(Configuration)\</OutDir>\r
<ForcedIncludeFiles>common/compiler/vs/disable_silly_warnings.h</ForcedIncludeFiles>\r
</ClCompile>\r
<Link>\r
- <AdditionalDependencies>sfml-system-s-d.lib;sfml-audio-s-d.lib;sfml-window-s-d.lib;sfml-graphics-s-d.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avdevice.lib;avutil.lib;avfilter.lib;swscale.lib;swresample.lib;tbb.lib;glew32.lib;zdll.lib;berkelium.lib</AdditionalDependencies>\r
+ <AdditionalDependencies>sfml-system-s-d.lib;sfml-audio-s-d.lib;sfml-window-s-d.lib;sfml-graphics-s-d.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avdevice.lib;avutil.lib;avfilter.lib;swscale.lib;swresample.lib;tbb.lib;glew32.lib;zdll.lib</AdditionalDependencies>\r
<Version>\r
</Version>\r
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
</Link>\r
<PostBuildEvent>\r
<Command>copy "$(SolutionDir)dependencies\ffmpeg\bin\*.dll" "$(OutDir)"\r
-copy "$(SolutionDir)dependencies\berkelium\bin\*.dll" "$(OutDir)"\r
-copy "$(SolutionDir)dependencies\berkelium\bin\berkelium.exe" "$(OutDir)"\r
+copy "$(SolutionDir)dependencies\cef\bin\debug\*.*" "$(OutDir)"\r
+copy "$(SolutionDir)dependencies\cef\bin\debug\locales\*.*" "$(OutDir)\locales"\r
copy "$(SolutionDir)dependencies\FreeImage\Dist\*.dll" "$(OutDir)"\r
copy "$(SolutionDir)dependencies\glew-1.6.0\bin\*.dll" "$(OutDir)"\r
copy "$(SolutionDir)dependencies\tbb\bin\ia32\vc10\*.dll" "$(OutDir)"\r
</Command>\r
</PreLinkEvent>\r
<Link>\r
- <AdditionalDependencies>sfml-system-s.lib;sfml-audio-s.lib;sfml-window-s.lib;sfml-graphics-s.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avdevice.lib;avutil.lib;avfilter.lib;swscale.lib;swresample.lib;tbb.lib;glew32.lib;zdll.lib;berkelium.lib</AdditionalDependencies>\r
+ <AdditionalDependencies>sfml-system-s.lib;sfml-audio-s.lib;sfml-window-s.lib;sfml-graphics-s.lib;OpenGL32.lib;FreeImage.lib;Winmm.lib;Ws2_32.lib;avformat.lib;avcodec.lib;avdevice.lib;avutil.lib;avfilter.lib;swscale.lib;swresample.lib;tbb.lib;glew32.lib;zdll.lib</AdditionalDependencies>\r
<Version>\r
</Version>\r
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>\r
</Link>\r
<PostBuildEvent>\r
<Command>copy "$(SolutionDir)dependencies\ffmpeg\bin\*.dll" "$(OutDir)"\r
-copy "$(SolutionDir)dependencies\berkelium\bin\*.dll" "$(OutDir)"\r
-copy "$(SolutionDir)dependencies\berkelium\bin\berkelium.exe" "$(OutDir)"\r
+copy "$(SolutionDir)dependencies\cef\bin\release\*.*" "$(OutDir)"\r
+copy "$(SolutionDir)dependencies\cef\bin\release\locales\*.*" "$(OutDir)\locales"\r
copy "$(SolutionDir)dependencies\FreeImage\Dist\*.dll" "$(OutDir)"\r
copy "$(SolutionDir)dependencies\glew-1.6.0\bin\*.dll" "$(OutDir)"\r
copy "$(SolutionDir)dependencies\tbb\bin\ia32\vc10\*.dll" "$(OutDir)"\r
</Link>\r
<PostBuildEvent>\r
<Command>copy "$(SolutionDir)dependencies\ffmpeg\bin\*.dll" "$(OutDir)"\r
-copy "$(SolutionDir)dependencies\berkelium\bin\*.dll" "$(OutDir)"\r
-copy "$(SolutionDir)dependencies\berkelium\bin\berkelium.exe" "$(OutDir)"\r
+copy "$(SolutionDir)dependencies\cef\bin\release\*.*" "$(OutDir)"\r
+copy "$(SolutionDir)dependencies\cef\bin\release\locales\*.*" "$(OutDir)\locales"\r
copy "$(SolutionDir)dependencies\FreeImage\Dist\*.dll" "$(OutDir)"\r
copy "$(SolutionDir)dependencies\glew-1.6.0\bin\*.dll" "$(OutDir)"\r
copy "$(SolutionDir)dependencies\tbb\bin\ia32\vc10\*.dll" "$(OutDir)"\r
</Link>\r
<PostBuildEvent>\r
<Command>copy "$(SolutionDir)dependencies\ffmpeg\bin\*.dll" "$(OutDir)"\r
-copy "$(SolutionDir)dependencies\berkelium\bin\*.dll" "$(OutDir)"\r
-copy "$(SolutionDir)dependencies\berkelium\bin\berkelium.exe" "$(OutDir)"\r
+copy "$(SolutionDir)dependencies\cef\bin\release\*.*" "$(OutDir)"\r
+copy "$(SolutionDir)dependencies\cef\bin\release\locales\*.*" "$(OutDir)\locales"\r
copy "$(SolutionDir)dependencies\FreeImage\Dist\*.dll" "$(OutDir)"\r
copy "$(SolutionDir)dependencies\glew-1.6.0\bin\*.dll" "$(OutDir)"\r
copy "$(SolutionDir)dependencies\tbb\bin\ia32\vc10\*.dll" "$(OutDir)"\r