mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Move cef_* header files that should not be directly included by the client to the "include/internal" folder.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@237 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
112
include/internal/cef_build.h
Normal file
112
include/internal/cef_build.h
Normal file
@@ -0,0 +1,112 @@
|
||||
// Copyright (c) 2011 Marshall A. Greenblatt. 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 Google Inc. nor the name Chromium Embedded
|
||||
// Framework 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 _CEF_BUILD_H
|
||||
#define _CEF_BUILD_H
|
||||
|
||||
#if defined(BUILDING_CEF_SHARED)
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
|
||||
#else // !BUILDING_CEF_SHARED
|
||||
|
||||
#if defined(_WIN32)
|
||||
#define OS_WIN 1
|
||||
#elif defined(__APPLE__)
|
||||
#define OS_MACOSX 1
|
||||
#elif defined(__linux__)
|
||||
#define OS_LINUX 1
|
||||
#else
|
||||
#error Please add support for your platform in cef_build.h
|
||||
#endif
|
||||
|
||||
// For access to standard POSIXish features, use OS_POSIX instead of a
|
||||
// more specific macro.
|
||||
#if defined(OS_MACOSX) || defined(OS_LINUX)
|
||||
#define OS_POSIX 1
|
||||
#endif
|
||||
|
||||
// Compiler detection.
|
||||
#if defined(__GNUC__)
|
||||
#define COMPILER_GCC 1
|
||||
#elif defined(_MSC_VER)
|
||||
#define COMPILER_MSVC 1
|
||||
#else
|
||||
#error Please add support for your compiler in cef_build.h
|
||||
#endif
|
||||
|
||||
// Annotate a virtual method indicating it must be overriding a virtual
|
||||
// method in the parent class.
|
||||
// Use like:
|
||||
// virtual void foo() OVERRIDE;
|
||||
#if defined(COMPILER_MSVC)
|
||||
#define OVERRIDE override
|
||||
#elif defined(__clang__)
|
||||
#define OVERRIDE override
|
||||
#else
|
||||
#define OVERRIDE
|
||||
#endif
|
||||
|
||||
#if defined(COMPILER_MSVC)
|
||||
|
||||
// MSVC_PUSH_DISABLE_WARNING pushes |n| onto a stack of warnings to be disabled.
|
||||
// The warning remains disabled until popped by MSVC_POP_WARNING.
|
||||
#define MSVC_PUSH_DISABLE_WARNING(n) __pragma(warning(push)) \
|
||||
__pragma(warning(disable:n))
|
||||
|
||||
// MSVC_PUSH_WARNING_LEVEL pushes |n| as the global warning level. The level
|
||||
// remains in effect until popped by MSVC_POP_WARNING(). Use 0 to disable all
|
||||
// warnings.
|
||||
#define MSVC_PUSH_WARNING_LEVEL(n) __pragma(warning(push, n))
|
||||
|
||||
// Pop effects of innermost MSVC_PUSH_* macro.
|
||||
#define MSVC_POP_WARNING() __pragma(warning(pop))
|
||||
|
||||
// Allows |this| to be passed as an argument in constructor initializer lists.
|
||||
// This uses push/pop instead of the seemingly simpler suppress feature to avoid
|
||||
// having the warning be disabled for more than just |code|.
|
||||
//
|
||||
// Example usage:
|
||||
// Foo::Foo() : x(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(y(this)), z(3) {}
|
||||
//
|
||||
// Compiler warning C4355: 'this': used in base member initializer list:
|
||||
// http://msdn.microsoft.com/en-us/library/3c594ae3(VS.80).aspx
|
||||
#define ALLOW_THIS_IN_INITIALIZER_LIST(code) MSVC_PUSH_DISABLE_WARNING(4355) \
|
||||
code \
|
||||
MSVC_POP_WARNING()
|
||||
#else // !COMPILER_MSVC
|
||||
|
||||
#define ALLOW_THIS_IN_INITIALIZER_LIST(code) code
|
||||
|
||||
#endif // !COMPILER_MSVC
|
||||
|
||||
#endif // !BUILDING_CEF_SHARED
|
||||
|
||||
#endif // _CEF_BUILD_H
|
49
include/internal/cef_export.h
Normal file
49
include/internal/cef_export.h
Normal file
@@ -0,0 +1,49 @@
|
||||
// Copyright (c) 2009 The Chromium Embedded Framework Authors. 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 Google Inc. nor the name Chromium Embedded
|
||||
// Framework 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.
|
||||
|
||||
#include "cef_build.h"
|
||||
|
||||
#if defined(COMPILER_MSVC)
|
||||
|
||||
#ifdef BUILDING_CEF_SHARED
|
||||
#define CEF_EXPORT __declspec(dllexport)
|
||||
#elif USING_CEF_SHARED
|
||||
#define CEF_EXPORT __declspec(dllimport)
|
||||
#else
|
||||
#define CEF_EXPORT
|
||||
#endif
|
||||
#define CEF_CALLBACK __stdcall
|
||||
|
||||
#elif defined(COMPILER_GCC)
|
||||
|
||||
#define CEF_EXPORT __attribute__ ((visibility("default")))
|
||||
#define CEF_CALLBACK
|
||||
|
||||
#endif // COMPILER_GCC
|
127
include/internal/cef_linux.h
Normal file
127
include/internal/cef_linux.h
Normal file
@@ -0,0 +1,127 @@
|
||||
// Copyright (c) 2010 Marshall A. Greenblatt. 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 Google Inc. nor the name Chromium Embedded
|
||||
// Framework 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 _CEF_LINUX_H
|
||||
#define _CEF_LINUX_H
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
#include <pthread.h>
|
||||
#include "cef_types_linux.h"
|
||||
#include "cef_types_wrappers.h"
|
||||
|
||||
// Atomic increment and decrement.
|
||||
inline long CefAtomicIncrement(long volatile *pDest)
|
||||
{
|
||||
return __sync_add_and_fetch(pDest, 1);
|
||||
}
|
||||
inline long CefAtomicDecrement(long volatile *pDest)
|
||||
{
|
||||
return __sync_sub_and_fetch(pDest, 1);
|
||||
}
|
||||
|
||||
// Critical section wrapper.
|
||||
class CefCriticalSection
|
||||
{
|
||||
public:
|
||||
CefCriticalSection()
|
||||
{
|
||||
pthread_mutexattr_init(&attr_);
|
||||
pthread_mutexattr_settype(&attr_, PTHREAD_MUTEX_RECURSIVE);
|
||||
pthread_mutex_init(&lock_, &attr_);
|
||||
}
|
||||
virtual ~CefCriticalSection()
|
||||
{
|
||||
pthread_mutex_destroy(&lock_);
|
||||
pthread_mutexattr_destroy(&attr_);
|
||||
}
|
||||
void Lock()
|
||||
{
|
||||
pthread_mutex_lock(&lock_);
|
||||
}
|
||||
void Unlock()
|
||||
{
|
||||
pthread_mutex_unlock(&lock_);
|
||||
}
|
||||
|
||||
pthread_mutex_t lock_;
|
||||
pthread_mutexattr_t attr_;
|
||||
};
|
||||
|
||||
// Handle types.
|
||||
#define CefWindowHandle cef_window_handle_t
|
||||
#define CefCursorHandle cef_cursor_handle_t
|
||||
|
||||
struct CefWindowInfoTraits {
|
||||
typedef cef_window_info_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s) {}
|
||||
static inline void clear(struct_type* s) {}
|
||||
|
||||
static inline void set(const struct_type* src, struct_type* target, bool copy)
|
||||
{
|
||||
target->m_Widget = src->m_Widget;
|
||||
target->m_ParentWidget = src->m_ParentWidget;
|
||||
}
|
||||
};
|
||||
|
||||
// Class representing window information.
|
||||
class CefWindowInfo : public CefStructBase<CefWindowInfoTraits>
|
||||
{
|
||||
public:
|
||||
typedef CefStructBase<CefWindowInfoTraits> parent;
|
||||
|
||||
CefWindowInfo() : parent() {}
|
||||
CefWindowInfo(const cef_window_info_t& r) : parent(r) {}
|
||||
CefWindowInfo(const CefWindowInfo& r) : parent(r) {}
|
||||
|
||||
void SetAsChild(CefWindowHandle ParentWidget)
|
||||
{
|
||||
m_ParentWidget = ParentWidget;
|
||||
}
|
||||
};
|
||||
|
||||
struct CefPrintInfoTraits {
|
||||
typedef cef_print_info_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s) {}
|
||||
static inline void clear(struct_type* s) {}
|
||||
|
||||
static inline void set(const struct_type* src, struct_type* target, bool copy)
|
||||
{
|
||||
target->m_Scale = src->m_Scale;
|
||||
}
|
||||
};
|
||||
|
||||
// Class representing print context information.
|
||||
typedef CefStructBase<CefPrintInfoTraits> CefPrintInfo;
|
||||
|
||||
#endif // OS_LINUX
|
||||
|
||||
#endif // _CEF_LINUX_H
|
144
include/internal/cef_mac.h
Normal file
144
include/internal/cef_mac.h
Normal file
@@ -0,0 +1,144 @@
|
||||
// Copyright (c) 2010 Marshall A. Greenblatt. 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 Google Inc. nor the name Chromium Embedded
|
||||
// Framework 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 _CEF_MAC_H
|
||||
#define _CEF_MAC_H
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#include <pthread.h>
|
||||
#include "cef_types_mac.h"
|
||||
#include "cef_types_wrappers.h"
|
||||
|
||||
// Atomic increment and decrement.
|
||||
inline long CefAtomicIncrement(long volatile *pDest)
|
||||
{
|
||||
return __sync_add_and_fetch(pDest, 1);
|
||||
}
|
||||
inline long CefAtomicDecrement(long volatile *pDest)
|
||||
{
|
||||
return __sync_sub_and_fetch(pDest, 1);
|
||||
}
|
||||
|
||||
// Handle types.
|
||||
#define CefWindowHandle cef_window_handle_t
|
||||
#define CefCursorHandle cef_cursor_handle_t
|
||||
|
||||
// Critical section wrapper.
|
||||
class CefCriticalSection
|
||||
{
|
||||
public:
|
||||
CefCriticalSection()
|
||||
{
|
||||
pthread_mutexattr_init(&attr_);
|
||||
pthread_mutexattr_settype(&attr_, PTHREAD_MUTEX_RECURSIVE);
|
||||
pthread_mutex_init(&lock_, &attr_);
|
||||
}
|
||||
virtual ~CefCriticalSection()
|
||||
{
|
||||
pthread_mutex_destroy(&lock_);
|
||||
pthread_mutexattr_destroy(&attr_);
|
||||
}
|
||||
void Lock()
|
||||
{
|
||||
pthread_mutex_lock(&lock_);
|
||||
}
|
||||
void Unlock()
|
||||
{
|
||||
pthread_mutex_unlock(&lock_);
|
||||
}
|
||||
|
||||
pthread_mutex_t lock_;
|
||||
pthread_mutexattr_t attr_;
|
||||
};
|
||||
|
||||
struct CefWindowInfoTraits {
|
||||
typedef cef_window_info_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s) {}
|
||||
|
||||
static inline void clear(struct_type* s)
|
||||
{
|
||||
cef_string_clear(&s->m_windowName);
|
||||
}
|
||||
|
||||
static inline void set(const struct_type* src, struct_type* target, bool copy)
|
||||
{
|
||||
target->m_View = src->m_View;
|
||||
target->m_ParentView = src->m_ParentView;
|
||||
cef_string_set(src->m_windowName.str, src->m_windowName.length,
|
||||
&target->m_windowName, copy);
|
||||
target->m_x = src->m_x;
|
||||
target->m_y = src->m_y;
|
||||
target->m_nWidth = src->m_nWidth;
|
||||
target->m_nHeight = src->m_nHeight;
|
||||
target->m_bHidden = src->m_bHidden;
|
||||
}
|
||||
};
|
||||
|
||||
// Class representing window information.
|
||||
class CefWindowInfo : public CefStructBase<CefWindowInfoTraits>
|
||||
{
|
||||
public:
|
||||
typedef CefStructBase<CefWindowInfoTraits> parent;
|
||||
|
||||
CefWindowInfo() : parent() {}
|
||||
CefWindowInfo(const cef_window_info_t& r) : parent(r) {}
|
||||
CefWindowInfo(const CefWindowInfo& r) : parent(r) {}
|
||||
|
||||
void SetAsChild(CefWindowHandle ParentView, int x, int y, int width,
|
||||
int height)
|
||||
{
|
||||
m_ParentView = ParentView;
|
||||
m_x = x;
|
||||
m_y = y;
|
||||
m_nWidth = width;
|
||||
m_nHeight = height;
|
||||
m_bHidden = false;
|
||||
}
|
||||
};
|
||||
|
||||
struct CefPrintInfoTraits {
|
||||
typedef cef_print_info_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s) {}
|
||||
static inline void clear(struct_type* s) {}
|
||||
|
||||
static inline void set(const struct_type* src, struct_type* target, bool copy)
|
||||
{
|
||||
target->m_Scale = src->m_Scale;
|
||||
}
|
||||
};
|
||||
|
||||
// Class representing print context information.
|
||||
typedef CefStructBase<CefPrintInfoTraits> CefPrintInfo;
|
||||
|
||||
#endif // OS_MACOSX
|
||||
|
||||
#endif // _CEF_MAC_H
|
77
include/internal/cef_nplugin_types.h
Normal file
77
include/internal/cef_nplugin_types.h
Normal file
@@ -0,0 +1,77 @@
|
||||
// Copyright (c) 2011 Marshall A. Greenblatt. 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 Google Inc. nor the name Chromium Embedded
|
||||
// Framework 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 _CEF_NPLUGIN_TYPES_H
|
||||
#define _CEF_NPLUGIN_TYPES_H
|
||||
|
||||
#include "cef_export.h"
|
||||
#include "cef_string.h"
|
||||
#include "third_party/npapi/bindings/npapi.h"
|
||||
#include "third_party/npapi/bindings/nphostapi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Netscape plugins are normally built at separate DLLs that are loaded by the
|
||||
// browser when needed. This interface supports the creation of plugins that
|
||||
// are an embedded component of the application. Embedded plugins built using
|
||||
// this interface use the same Netscape Plugin API as DLL-based plugins.
|
||||
// See https://developer.mozilla.org/En/Gecko_Plugin_API_Reference for complete
|
||||
// documentation on how to use the Netscape Plugin API.
|
||||
|
||||
// This structure provides attribute information and entry point functions for
|
||||
// a plugin.
|
||||
typedef struct _cef_plugin_info_t {
|
||||
// The unique name that identifies the plugin.
|
||||
cef_string_t unique_name;
|
||||
|
||||
// The friendly display name of the plugin.
|
||||
cef_string_t display_name;
|
||||
|
||||
// A description of the plugin.
|
||||
cef_string_t description;
|
||||
|
||||
// The mime type that the plugin supports.
|
||||
cef_string_t mime_type;
|
||||
|
||||
// Entry point function pointers.
|
||||
#if !defined(OS_POSIX) || defined(OS_MACOSX)
|
||||
NP_GetEntryPointsFunc np_getentrypoints;
|
||||
#endif
|
||||
NP_InitializeFunc np_initialize;
|
||||
NP_ShutdownFunc np_shutdown;
|
||||
} cef_plugin_info_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _CEF_NPLUGIN_TYPES_H
|
193
include/internal/cef_ptr.h
Normal file
193
include/internal/cef_ptr.h
Normal file
@@ -0,0 +1,193 @@
|
||||
// Copyright (c) 2008 Marshall A. Greenblatt. Portions Copyright (c)
|
||||
// 2006-2008 Google Inc. 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 Google Inc. nor the name Chromium Embedded
|
||||
// Framework 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 _CEF_PTR_H
|
||||
#define _CEF_PTR_H
|
||||
|
||||
// Smart pointer implementation borrowed from base/ref_counted.h
|
||||
//
|
||||
// A smart pointer class for reference counted objects. Use this class instead
|
||||
// of calling AddRef and Release manually on a reference counted object to
|
||||
// avoid common memory leaks caused by forgetting to Release an object
|
||||
// reference. Sample usage:
|
||||
//
|
||||
// class MyFoo : public CefBase {
|
||||
// ...
|
||||
// };
|
||||
//
|
||||
// void some_function() {
|
||||
// // The MyFoo object that |foo| represents starts with a single
|
||||
// // reference.
|
||||
// CefRefPtr<MyFoo> foo = new MyFoo();
|
||||
// foo->Method(param);
|
||||
// // |foo| is released when this function returns
|
||||
// }
|
||||
//
|
||||
// void some_other_function() {
|
||||
// CefRefPtr<MyFoo> foo = new MyFoo();
|
||||
// ...
|
||||
// foo = NULL; // explicitly releases |foo|
|
||||
// ...
|
||||
// if (foo)
|
||||
// foo->Method(param);
|
||||
// }
|
||||
//
|
||||
// The above examples show how CefRefPtr<T> acts like a pointer to T.
|
||||
// Given two CefRefPtr<T> classes, it is also possible to exchange
|
||||
// references between the two objects, like so:
|
||||
//
|
||||
// {
|
||||
// CefRefPtr<MyFoo> a = new MyFoo();
|
||||
// CefRefPtr<MyFoo> b;
|
||||
//
|
||||
// b.swap(a);
|
||||
// // now, |b| references the MyFoo object, and |a| references NULL.
|
||||
// }
|
||||
//
|
||||
// To make both |a| and |b| in the above example reference the same MyFoo
|
||||
// object, simply use the assignment operator:
|
||||
//
|
||||
// {
|
||||
// CefRefPtr<MyFoo> a = new MyFoo();
|
||||
// CefRefPtr<MyFoo> b;
|
||||
//
|
||||
// b = a;
|
||||
// // now, |a| and |b| each own a reference to the same MyFoo object.
|
||||
// // the reference count of the underlying MyFoo object will be 2.
|
||||
// }
|
||||
//
|
||||
// Reference counted objects can also be passed as function parameters and
|
||||
// used as function return values:
|
||||
//
|
||||
// void some_func_with_param(CefRefPtr<MyFoo> param) {
|
||||
// // A reference is added to the MyFoo object that |param| represents
|
||||
// // during the scope of some_func_with_param() and released when
|
||||
// // some_func_with_param() goes out of scope.
|
||||
// }
|
||||
//
|
||||
// CefRefPtr<MyFoo> some_func_with_retval() {
|
||||
// // The MyFoo object that |foox| represents starts with a single
|
||||
// // reference.
|
||||
// CefRefPtr<MyFoo> foox = new MyFoo();
|
||||
//
|
||||
// // Creating the return value adds an additional reference.
|
||||
// return foox;
|
||||
//
|
||||
// // When some_func_with_retval() goes out of scope the original |foox|
|
||||
// // reference is released.
|
||||
// }
|
||||
//
|
||||
// void and_another_function() {
|
||||
// CefRefPtr<MyFoo> foo = new MyFoo();
|
||||
//
|
||||
// // pass |foo| as a parameter.
|
||||
// some_function(foo);
|
||||
//
|
||||
// CefRefPtr<MyFoo> foo2 = some_func_with_retval();
|
||||
// // Now, since we kept a reference to the some_func_with_retval() return
|
||||
// // value, |foo2| is the only class pointing to the MyFoo object created
|
||||
// in some_func_with_retval(), and it has a reference count of 1.
|
||||
//
|
||||
// some_func_with_retval();
|
||||
// // Now, since we didn't keep a reference to the some_func_with_retval()
|
||||
// // return value, the MyFoo object created in some_func_with_retval()
|
||||
// // will automatically be released.
|
||||
// }
|
||||
//
|
||||
// And in standard containers:
|
||||
//
|
||||
// {
|
||||
// // Create a vector that holds MyFoo objects.
|
||||
// std::vector<CefRefPtr<MyFoo> > MyFooVec;
|
||||
//
|
||||
// // The MyFoo object that |foo| represents starts with a single
|
||||
// // reference.
|
||||
// CefRefPtr<MyFoo> foo = new MyFoo();
|
||||
//
|
||||
// // When the MyFoo object is added to |MyFooVec| the reference count
|
||||
// // is increased to 2.
|
||||
// MyFooVec.push_back(foo);
|
||||
// }
|
||||
//
|
||||
template <class T>
|
||||
class CefRefPtr {
|
||||
public:
|
||||
CefRefPtr() : ptr_(NULL) {
|
||||
}
|
||||
|
||||
CefRefPtr(T* p) : ptr_(p) {
|
||||
if (ptr_)
|
||||
ptr_->AddRef();
|
||||
}
|
||||
|
||||
CefRefPtr(const CefRefPtr<T>& r) : ptr_(r.ptr_) {
|
||||
if (ptr_)
|
||||
ptr_->AddRef();
|
||||
}
|
||||
|
||||
~CefRefPtr() {
|
||||
if (ptr_)
|
||||
ptr_->Release();
|
||||
}
|
||||
|
||||
T* get() const { return ptr_; }
|
||||
operator T*() const { return ptr_; }
|
||||
T* operator->() const { return ptr_; }
|
||||
|
||||
CefRefPtr<T>& operator=(T* p) {
|
||||
// AddRef first so that self assignment should work
|
||||
if (p)
|
||||
p->AddRef();
|
||||
if (ptr_ )
|
||||
ptr_ ->Release();
|
||||
ptr_ = p;
|
||||
return *this;
|
||||
}
|
||||
|
||||
CefRefPtr<T>& operator=(const CefRefPtr<T>& r) {
|
||||
return *this = r.ptr_;
|
||||
}
|
||||
|
||||
void swap(T** pp) {
|
||||
T* p = ptr_;
|
||||
ptr_ = *pp;
|
||||
*pp = p;
|
||||
}
|
||||
|
||||
void swap(CefRefPtr<T>& r) {
|
||||
swap(&r.ptr_);
|
||||
}
|
||||
|
||||
private:
|
||||
T* ptr_;
|
||||
};
|
||||
|
||||
#endif // _CEF_PTR_H
|
112
include/internal/cef_string.h
Normal file
112
include/internal/cef_string.h
Normal file
@@ -0,0 +1,112 @@
|
||||
// Copyright (c) 2010 Marshall A. Greenblatt. 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 Google Inc. nor the name Chromium Embedded
|
||||
// Framework 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 _CEF_STRING_H
|
||||
#define _CEF_STRING_H
|
||||
|
||||
// The CEF interface is built with one string type as the default. Comment out
|
||||
// all but one of the CEF_STRING_TYPE_* defines below to specify the default.
|
||||
// If you change the default you MUST recompile all of CEF.
|
||||
|
||||
// Build with the UTF8 string type as default.
|
||||
//#define CEF_STRING_TYPE_UTF8 1
|
||||
|
||||
// Build with the UTF16 string type as default.
|
||||
#define CEF_STRING_TYPE_UTF16 1
|
||||
|
||||
// Build with the wide string type as default.
|
||||
//#define CEF_STRING_TYPE_WIDE 1
|
||||
|
||||
|
||||
#include "cef_string_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "cef_string_wrappers.h"
|
||||
#if defined(CEF_STRING_TYPE_UTF8)
|
||||
typedef CefStringUTF8 CefString;
|
||||
#elif defined(CEF_STRING_TYPE_UTF16)
|
||||
typedef CefStringUTF16 CefString;
|
||||
#elif defined(CEF_STRING_TYPE_WIDE)
|
||||
typedef CefStringWide CefString;
|
||||
#endif
|
||||
#endif // __cplusplus
|
||||
|
||||
#if defined(CEF_STRING_TYPE_UTF8)
|
||||
typedef char cef_char_t;
|
||||
typedef cef_string_utf8_t cef_string_t;
|
||||
typedef cef_string_userfree_utf8_t cef_string_userfree_t;
|
||||
#define cef_string_set cef_string_utf8_set
|
||||
#define cef_string_copy cef_string_utf8_copy
|
||||
#define cef_string_clear cef_string_utf8_clear
|
||||
#define cef_string_userfree_alloc cef_string_userfree_utf8_alloc
|
||||
#define cef_string_userfree_free cef_string_userfree_utf8_free
|
||||
#define cef_string_from_ascii cef_string_utf8_copy
|
||||
#define cef_string_to_utf8 cef_string_utf8_copy
|
||||
#define cef_string_from_utf8 cef_string_utf8_copy
|
||||
#define cef_string_to_utf16 cef_string_utf8_to_utf16
|
||||
#define cef_string_from_utf16 cef_string_utf16_to_utf8
|
||||
#define cef_string_to_wide cef_string_utf8_to_wide
|
||||
#define cef_string_from_wide cef_string_wide_to_utf8
|
||||
#elif defined(CEF_STRING_TYPE_UTF16)
|
||||
typedef char16_t cef_char_t;
|
||||
typedef cef_string_userfree_utf16_t cef_string_userfree_t;
|
||||
typedef cef_string_utf16_t cef_string_t;
|
||||
#define cef_string_set cef_string_utf16_set
|
||||
#define cef_string_copy cef_string_utf16_copy
|
||||
#define cef_string_clear cef_string_utf16_clear
|
||||
#define cef_string_userfree_alloc cef_string_userfree_utf16_alloc
|
||||
#define cef_string_userfree_free cef_string_userfree_utf16_free
|
||||
#define cef_string_from_ascii cef_string_ascii_to_utf16
|
||||
#define cef_string_to_utf8 cef_string_utf16_to_utf8
|
||||
#define cef_string_from_utf8 cef_string_utf8_to_utf16
|
||||
#define cef_string_to_utf16 cef_string_utf16_copy
|
||||
#define cef_string_from_utf16 cef_string_utf16_copy
|
||||
#define cef_string_to_wide cef_string_utf16_to_wide
|
||||
#define cef_string_from_wide cef_string_wide_to_utf16
|
||||
#elif defined(CEF_STRING_TYPE_WIDE)
|
||||
typedef wchar_t cef_char_t;
|
||||
typedef cef_string_wide_t cef_string_t;
|
||||
typedef cef_string_userfree_wide_t cef_string_userfree_t;
|
||||
#define cef_string_set cef_string_wide_set
|
||||
#define cef_string_copy cef_string_wide_copy
|
||||
#define cef_string_clear cef_string_wide_clear
|
||||
#define cef_string_userfree_alloc cef_string_userfree_wide_alloc
|
||||
#define cef_string_userfree_free cef_string_userfree_wide_free
|
||||
#define cef_string_from_ascii cef_string_ascii_to_wide
|
||||
#define cef_string_to_utf8 cef_string_wide_to_utf8
|
||||
#define cef_string_from_utf8 cef_string_utf8_to_wide
|
||||
#define cef_string_to_utf16 cef_string_wide_to_utf16
|
||||
#define cef_string_from_utf16 cef_string_utf16_to_wide
|
||||
#define cef_string_to_wide cef_string_wide_copy
|
||||
#define cef_string_from_wide cef_string_wide_copy
|
||||
#else
|
||||
#error Please choose a string type.
|
||||
#endif
|
||||
|
||||
#endif // _CEF_STRING_H
|
71
include/internal/cef_string_list.h
Normal file
71
include/internal/cef_string_list.h
Normal file
@@ -0,0 +1,71 @@
|
||||
// Copyright (c) 2009 Marshall A. Greenblatt. 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 Google Inc. nor the name Chromium Embedded
|
||||
// Framework 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 _CEF_STRING_LIST_H
|
||||
#define _CEF_STRING_LIST_H
|
||||
|
||||
#include "cef_export.h"
|
||||
#include "cef_string.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// CEF string maps are a set of key/value string pairs.
|
||||
typedef void* cef_string_list_t;
|
||||
|
||||
// Allocate a new string map.
|
||||
CEF_EXPORT cef_string_list_t cef_string_list_alloc();
|
||||
|
||||
// Return the number of elements in the string list.
|
||||
CEF_EXPORT int cef_string_list_size(cef_string_list_t list);
|
||||
|
||||
// Retrieve the value at the specified zero-based string list index. Returns
|
||||
// true (1) if the value was successfully retrieved.
|
||||
CEF_EXPORT int cef_string_list_value(cef_string_list_t list,
|
||||
int index, cef_string_t* value);
|
||||
|
||||
// Append a new value at the end of the string list.
|
||||
CEF_EXPORT void cef_string_list_append(cef_string_list_t list,
|
||||
const cef_string_t* value);
|
||||
|
||||
// Clear the string list.
|
||||
CEF_EXPORT void cef_string_list_clear(cef_string_list_t list);
|
||||
|
||||
// Free the string list.
|
||||
CEF_EXPORT void cef_string_list_free(cef_string_list_t list);
|
||||
|
||||
// Creates a copy of an existing string list.
|
||||
CEF_EXPORT cef_string_list_t cef_string_list_copy(cef_string_list_t list);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _CEF_STRING_LIST_H
|
78
include/internal/cef_string_map.h
Normal file
78
include/internal/cef_string_map.h
Normal file
@@ -0,0 +1,78 @@
|
||||
// Copyright (c) 2009 Marshall A. Greenblatt. 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 Google Inc. nor the name Chromium Embedded
|
||||
// Framework 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 _CEF_STRING_MAP_H
|
||||
#define _CEF_STRING_MAP_H
|
||||
|
||||
#include "cef_export.h"
|
||||
#include "cef_string.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// CEF string maps are a set of key/value string pairs.
|
||||
typedef void* cef_string_map_t;
|
||||
|
||||
// Allocate a new string map.
|
||||
CEF_EXPORT cef_string_map_t cef_string_map_alloc();
|
||||
|
||||
// Return the number of elements in the string map.
|
||||
CEF_EXPORT int cef_string_map_size(cef_string_map_t map);
|
||||
|
||||
// Return the value assigned to the specified key.
|
||||
CEF_EXPORT int cef_string_map_find(cef_string_map_t map,
|
||||
const cef_string_t* key,
|
||||
cef_string_t* value);
|
||||
|
||||
// Return the key at the specified zero-based string map index.
|
||||
CEF_EXPORT int cef_string_map_key(cef_string_map_t map, int index,
|
||||
cef_string_t* key);
|
||||
|
||||
// Return the value at the specified zero-based string map index.
|
||||
CEF_EXPORT int cef_string_map_value(cef_string_map_t map, int index,
|
||||
cef_string_t* value);
|
||||
|
||||
// Append a new key/value pair at the end of the string map.
|
||||
CEF_EXPORT int cef_string_map_append(cef_string_map_t map,
|
||||
const cef_string_t* key,
|
||||
const cef_string_t* value);
|
||||
|
||||
// Clear the string map.
|
||||
CEF_EXPORT void cef_string_map_clear(cef_string_map_t map);
|
||||
|
||||
// Free the string map.
|
||||
CEF_EXPORT void cef_string_map_free(cef_string_map_t map);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _CEF_STRING_MAP_H
|
185
include/internal/cef_string_types.h
Normal file
185
include/internal/cef_string_types.h
Normal file
@@ -0,0 +1,185 @@
|
||||
// Copyright (c) 2010 Marshall A. Greenblatt. 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 Google Inc. nor the name Chromium Embedded
|
||||
// Framework 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 _CEF_STRING_TYPES_T
|
||||
#define _CEF_STRING_TYPES_T
|
||||
|
||||
// CEF provides functions for converting between UTF-8, -16 and -32 strings.
|
||||
// CEF string types are safe for reading from multiple threads but not for
|
||||
// modification. It is the user's responsibility to provide synchronization if
|
||||
// modifying CEF strings from multiple threads.
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "cef_build.h"
|
||||
#include "cef_export.h"
|
||||
#include <stddef.h>
|
||||
|
||||
// CEF character type definitions. wchat_t is 2 bytes on Windows and 4 bytes on
|
||||
// most other platforms.
|
||||
|
||||
#if defined(OS_WIN)
|
||||
typedef wchar_t char16_t;
|
||||
#else // !OS_WIN
|
||||
typedef unsigned short char16_t;
|
||||
#ifndef WCHAR_T_IS_UTF32
|
||||
#define WCHAR_T_IS_UTF32
|
||||
#endif // WCHAR_T_IS_UTF32
|
||||
#endif // !OS_WIN
|
||||
|
||||
|
||||
// CEF string type definitions. Whomever allocates |str| is responsible for
|
||||
// providing an appropriate |dtor| implementation that will free the string in
|
||||
// the same memory space. When reusing an existing string structure make sure
|
||||
// to call |dtor| for the old value before assigning new |str| and |dtor|
|
||||
// values. Static strings will have a NULL |dtor| value. Using the below
|
||||
// functions if you want this managed for you.
|
||||
|
||||
typedef struct _cef_string_wide_t {
|
||||
wchar_t* str;
|
||||
size_t length;
|
||||
void (*dtor)(wchar_t* str);
|
||||
} cef_string_wide_t;
|
||||
|
||||
typedef struct _cef_string_utf8_t {
|
||||
char* str;
|
||||
size_t length;
|
||||
void (*dtor)(char* str);
|
||||
} cef_string_utf8_t;
|
||||
|
||||
typedef struct _cef_string_utf16_t {
|
||||
char16_t* str;
|
||||
size_t length;
|
||||
void (*dtor)(char16_t* str);
|
||||
} cef_string_utf16_t;
|
||||
|
||||
|
||||
// These functions set string values. If |copy| is true (1) the value will be
|
||||
// copied instead of referenced. It is up to the user to properly manage
|
||||
// the lifespan of references.
|
||||
|
||||
CEF_EXPORT int cef_string_wide_set(const wchar_t* src, size_t src_len,
|
||||
cef_string_wide_t* output, int copy);
|
||||
CEF_EXPORT int cef_string_utf8_set(const char* src, size_t src_len,
|
||||
cef_string_utf8_t* output, int copy);
|
||||
CEF_EXPORT int cef_string_utf16_set(const char16_t* src, size_t src_len,
|
||||
cef_string_utf16_t* output, int copy);
|
||||
|
||||
|
||||
// Convenience macros for copying values.
|
||||
|
||||
#define cef_string_wide_copy(src, src_len, output) \
|
||||
cef_string_wide_set(src, src_len, output, true)
|
||||
#define cef_string_utf8_copy(src, src_len, output) \
|
||||
cef_string_utf8_set(src, src_len, output, true)
|
||||
#define cef_string_utf16_copy(src, src_len, output) \
|
||||
cef_string_utf16_set(src, src_len, output, true)
|
||||
|
||||
|
||||
// These functions clear string values. The structure itself is not freed.
|
||||
|
||||
CEF_EXPORT void cef_string_wide_clear(cef_string_wide_t* str);
|
||||
CEF_EXPORT void cef_string_utf8_clear(cef_string_utf8_t* str);
|
||||
CEF_EXPORT void cef_string_utf16_clear(cef_string_utf16_t* str);
|
||||
|
||||
|
||||
// These functions compare two string values with the same results as strcmp().
|
||||
|
||||
CEF_EXPORT int cef_string_wide_cmp(const cef_string_wide_t* str1,
|
||||
const cef_string_wide_t* str2);
|
||||
CEF_EXPORT int cef_string_utf8_cmp(const cef_string_utf8_t* str1,
|
||||
const cef_string_utf8_t* str2);
|
||||
CEF_EXPORT int cef_string_utf16_cmp(const cef_string_utf16_t* str1,
|
||||
const cef_string_utf16_t* str2);
|
||||
|
||||
|
||||
// These functions convert between UTF-8, -16, and -32 strings. They are
|
||||
// potentially slow so unnecessary conversions should be avoided. The best
|
||||
// possible result will always be written to |output| with the boolean return
|
||||
// value indicating whether the conversion is 100% valid.
|
||||
|
||||
CEF_EXPORT int cef_string_wide_to_utf8(const wchar_t* src, size_t src_len,
|
||||
cef_string_utf8_t* output);
|
||||
CEF_EXPORT int cef_string_utf8_to_wide(const char* src, size_t src_len,
|
||||
cef_string_wide_t* output);
|
||||
|
||||
CEF_EXPORT int cef_string_wide_to_utf16(const wchar_t* src, size_t src_len,
|
||||
cef_string_utf16_t* output);
|
||||
CEF_EXPORT int cef_string_utf16_to_wide(const char16_t* src, size_t src_len,
|
||||
cef_string_wide_t* output);
|
||||
|
||||
CEF_EXPORT int cef_string_utf8_to_utf16(const char* src, size_t src_len,
|
||||
cef_string_utf16_t* output);
|
||||
CEF_EXPORT int cef_string_utf16_to_utf8(const char16_t* src, size_t src_len,
|
||||
cef_string_utf8_t* output);
|
||||
|
||||
|
||||
// These functions convert an ASCII string, typically a hardcoded constant, to a
|
||||
// Wide/UTF16 string. Use instead of the UTF8 conversion routines if you know
|
||||
// the string is ASCII.
|
||||
|
||||
CEF_EXPORT int cef_string_ascii_to_wide(const char* src, size_t src_len,
|
||||
cef_string_wide_t* output);
|
||||
CEF_EXPORT int cef_string_ascii_to_utf16(const char* src, size_t src_len,
|
||||
cef_string_utf16_t* output);
|
||||
|
||||
|
||||
|
||||
// It is sometimes necessary for the system to allocate string structures with
|
||||
// the expectation that the user will free them. The userfree types act as a
|
||||
// hint that the user is responsible for freeing the structure.
|
||||
|
||||
typedef cef_string_wide_t* cef_string_userfree_wide_t;
|
||||
typedef cef_string_utf8_t* cef_string_userfree_utf8_t;
|
||||
typedef cef_string_utf16_t* cef_string_userfree_utf16_t;
|
||||
|
||||
|
||||
// These functions allocate a new string structure. They must be freed by
|
||||
// calling the associated free function.
|
||||
|
||||
CEF_EXPORT cef_string_userfree_wide_t cef_string_userfree_wide_alloc();
|
||||
CEF_EXPORT cef_string_userfree_utf8_t cef_string_userfree_utf8_alloc();
|
||||
CEF_EXPORT cef_string_userfree_utf16_t cef_string_userfree_utf16_alloc();
|
||||
|
||||
|
||||
// These functions free the string structure allocated by the associated
|
||||
// alloc function. Any string contents will first be cleared.
|
||||
|
||||
CEF_EXPORT void cef_string_userfree_wide_free(cef_string_userfree_wide_t str);
|
||||
CEF_EXPORT void cef_string_userfree_utf8_free(cef_string_userfree_utf8_t str);
|
||||
CEF_EXPORT void cef_string_userfree_utf16_free(cef_string_userfree_utf16_t str);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _CEF_STRING_TYPES_T
|
626
include/internal/cef_string_wrappers.h
Normal file
626
include/internal/cef_string_wrappers.h
Normal file
@@ -0,0 +1,626 @@
|
||||
// Copyright (c) 2010 Marshall A. Greenblatt. 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 Google Inc. nor the name Chromium Embedded
|
||||
// Framework 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 _CEF_STRING_WRAPPERS_H
|
||||
#define _CEF_STRING_WRAPPERS_H
|
||||
|
||||
#include "cef_string_types.h"
|
||||
#ifdef BUILDING_CEF_SHARED
|
||||
#include "base/string16.h"
|
||||
#endif
|
||||
#include <memory.h>
|
||||
#include <string>
|
||||
|
||||
// Traits implementation for wide character strings.
|
||||
struct CefStringTraitsWide {
|
||||
typedef wchar_t char_type;
|
||||
typedef cef_string_wide_t struct_type;
|
||||
typedef cef_string_userfree_wide_t userfree_struct_type;
|
||||
|
||||
static inline void clear(struct_type *s) { cef_string_wide_clear(s); }
|
||||
static inline int set(const char_type* src, size_t src_size,
|
||||
struct_type *output, int copy)
|
||||
{ return cef_string_wide_set(src, src_size, output, copy); }
|
||||
static inline int compare(const struct_type* s1, const struct_type* s2)
|
||||
{ return cef_string_wide_cmp(s1, s2); }
|
||||
static inline userfree_struct_type userfree_alloc()
|
||||
{ return cef_string_userfree_wide_alloc(); }
|
||||
static inline void userfree_free(userfree_struct_type ufs)
|
||||
{ return cef_string_userfree_wide_free(ufs); }
|
||||
|
||||
// Conversion methods.
|
||||
static inline bool from_ascii(const char* str, size_t len, struct_type *s)
|
||||
{
|
||||
return cef_string_ascii_to_wide(str, len, s) ? true : false;
|
||||
}
|
||||
static inline std::string to_string(const struct_type *s)
|
||||
{
|
||||
cef_string_utf8_t cstr;
|
||||
memset(&cstr, 0, sizeof(cstr));
|
||||
cef_string_wide_to_utf8(s->str, s->length, &cstr);
|
||||
std::string str;
|
||||
if (cstr.length > 0)
|
||||
str = std::string(cstr.str, cstr.length);
|
||||
cef_string_utf8_clear(&cstr);
|
||||
return str;
|
||||
}
|
||||
static inline bool from_string(const std::string& str, struct_type *s)
|
||||
{
|
||||
return cef_string_utf8_to_wide(str.c_str(), str.length(), s) ? true : false;
|
||||
}
|
||||
static inline std::wstring to_wstring(const struct_type *s)
|
||||
{
|
||||
return std::wstring(s->str, s->length);
|
||||
}
|
||||
static inline bool from_wstring(const std::wstring& str, struct_type *s)
|
||||
{
|
||||
return cef_string_wide_set(str.c_str(), str.length(), s, true) ?
|
||||
true : false;
|
||||
}
|
||||
#if defined(BUILDING_CEF_SHARED)
|
||||
#if defined(WCHAR_T_IS_UTF32)
|
||||
static inline string16 to_string16(const struct_type *s)
|
||||
{
|
||||
cef_string_utf16_t cstr;
|
||||
memset(&cstr, 0, sizeof(cstr));
|
||||
cef_string_wide_to_utf16(s->str, s->length, &cstr);
|
||||
string16 str;
|
||||
if (cstr.length > 0)
|
||||
str = string16(cstr.str, cstr.length);
|
||||
cef_string_utf16_clear(&cstr);
|
||||
return str;
|
||||
}
|
||||
static inline bool from_string16(const string16& str, struct_type *s)
|
||||
{
|
||||
return cef_string_utf16_to_wide(str.c_str(), str.length(), s) ?
|
||||
true : false;
|
||||
}
|
||||
#else // WCHAR_T_IS_UTF32
|
||||
static inline string16 to_string16(const struct_type *s)
|
||||
{
|
||||
return string16(s->str, s->length);
|
||||
}
|
||||
static inline bool from_string16(const string16& str, struct_type *s)
|
||||
{
|
||||
return cef_string_wide_set(str.c_str(), str.length(), s, true) ?
|
||||
true : false;
|
||||
}
|
||||
#endif // WCHAR_T_IS_UTF32
|
||||
#endif // BUILDING_CEF_SHARED
|
||||
};
|
||||
|
||||
// Traits implementation for utf8 character strings.
|
||||
struct CefStringTraitsUTF8 {
|
||||
typedef char char_type;
|
||||
typedef cef_string_utf8_t struct_type;
|
||||
typedef cef_string_userfree_utf8_t userfree_struct_type;
|
||||
|
||||
static inline void clear(struct_type *s) { cef_string_utf8_clear(s); }
|
||||
static inline int set(const char_type* src, size_t src_size,
|
||||
struct_type *output, int copy)
|
||||
{ return cef_string_utf8_set(src, src_size, output, copy); }
|
||||
static inline int compare(const struct_type* s1, const struct_type* s2)
|
||||
{ return cef_string_utf8_cmp(s1, s2); }
|
||||
static inline userfree_struct_type userfree_alloc()
|
||||
{ return cef_string_userfree_utf8_alloc(); }
|
||||
static inline void userfree_free(userfree_struct_type ufs)
|
||||
{ return cef_string_userfree_utf8_free(ufs); }
|
||||
|
||||
// Conversion methods.
|
||||
static inline bool from_ascii(const char* str, size_t len, struct_type* s)
|
||||
{
|
||||
return cef_string_utf8_copy(str, len, s) ? true : false;
|
||||
}
|
||||
static inline std::string to_string(const struct_type* s)
|
||||
{
|
||||
return std::string(s->str, s->length);
|
||||
}
|
||||
static inline bool from_string(const std::string& str, struct_type* s)
|
||||
{
|
||||
return cef_string_utf8_copy(str.c_str(), str.length(), s) ? true : false;
|
||||
}
|
||||
static inline std::wstring to_wstring(const struct_type* s)
|
||||
{
|
||||
cef_string_wide_t cstr;
|
||||
memset(&cstr, 0, sizeof(cstr));
|
||||
cef_string_utf8_to_wide(s->str, s->length, &cstr);
|
||||
std::wstring str;
|
||||
if (cstr.length > 0)
|
||||
str = std::wstring(cstr.str, cstr.length);
|
||||
cef_string_wide_clear(&cstr);
|
||||
return str;
|
||||
}
|
||||
static inline bool from_wstring(const std::wstring& str, struct_type* s)
|
||||
{
|
||||
return cef_string_wide_to_utf8(str.c_str(), str.length(), s) ? true : false;
|
||||
}
|
||||
#if defined(BUILDING_CEF_SHARED)
|
||||
static inline string16 to_string16(const struct_type* s)
|
||||
{
|
||||
cef_string_utf16_t cstr;
|
||||
memset(&cstr, 0, sizeof(cstr));
|
||||
cef_string_utf8_to_utf16(s->str, s->length, &cstr);
|
||||
string16 str;
|
||||
if (cstr.length > 0)
|
||||
str = string16(cstr.str, cstr.length);
|
||||
cef_string_utf16_clear(&cstr);
|
||||
return str;
|
||||
}
|
||||
static inline bool from_string16(const string16& str, struct_type* s)
|
||||
{
|
||||
return cef_string_utf16_to_utf8(str.c_str(), str.length(), s) ?
|
||||
true : false;
|
||||
}
|
||||
#endif // BUILDING_CEF_SHARED
|
||||
};
|
||||
|
||||
// Traits implementation for utf16 character strings.
|
||||
struct CefStringTraitsUTF16 {
|
||||
typedef char16_t char_type;
|
||||
typedef cef_string_utf16_t struct_type;
|
||||
typedef cef_string_userfree_utf16_t userfree_struct_type;
|
||||
|
||||
static inline void clear(struct_type *s) { cef_string_utf16_clear(s); }
|
||||
static inline int set(const char_type* src, size_t src_size,
|
||||
struct_type *output, int copy)
|
||||
{ return cef_string_utf16_set(src, src_size, output, copy); }
|
||||
static inline int compare(const struct_type* s1, const struct_type* s2)
|
||||
{ return cef_string_utf16_cmp(s1, s2); }
|
||||
static inline userfree_struct_type userfree_alloc()
|
||||
{ return cef_string_userfree_utf16_alloc(); }
|
||||
static inline void userfree_free(userfree_struct_type ufs)
|
||||
{ return cef_string_userfree_utf16_free(ufs); }
|
||||
|
||||
// Conversion methods.
|
||||
static inline bool from_ascii(const char* str, size_t len, struct_type* s)
|
||||
{
|
||||
return cef_string_ascii_to_utf16(str, len, s) ? true : false;
|
||||
}
|
||||
static inline std::string to_string(const struct_type* s)
|
||||
{
|
||||
cef_string_utf8_t cstr;
|
||||
memset(&cstr, 0, sizeof(cstr));
|
||||
cef_string_utf16_to_utf8(s->str, s->length, &cstr);
|
||||
std::string str;
|
||||
if (cstr.length > 0)
|
||||
str = std::string(cstr.str, cstr.length);
|
||||
cef_string_utf8_clear(&cstr);
|
||||
return str;
|
||||
}
|
||||
static inline bool from_string(const std::string& str, struct_type* s)
|
||||
{
|
||||
return cef_string_utf8_to_utf16(str.c_str(), str.length(), s) ?
|
||||
true : false;
|
||||
}
|
||||
#if defined(WCHAR_T_IS_UTF32)
|
||||
static inline std::wstring to_wstring(const struct_type* s)
|
||||
{
|
||||
cef_string_wide_t cstr;
|
||||
memset(&cstr, 0, sizeof(cstr));
|
||||
cef_string_utf16_to_wide(s->str, s->length, &cstr);
|
||||
std::wstring str;
|
||||
if (cstr.length > 0)
|
||||
str = std::wstring(cstr.str, cstr.length);
|
||||
cef_string_wide_clear(&cstr);
|
||||
return str;
|
||||
}
|
||||
static inline bool from_wstring(const std::wstring& str, struct_type* s)
|
||||
{
|
||||
return cef_string_wide_to_utf16(str.c_str(), str.length(), s) ?
|
||||
true : false;
|
||||
}
|
||||
#else // WCHAR_T_IS_UTF32
|
||||
static inline std::wstring to_wstring(const struct_type* s)
|
||||
{
|
||||
return std::wstring(s->str, s->length);
|
||||
}
|
||||
static inline bool from_wstring(const std::wstring& str, struct_type* s)
|
||||
{
|
||||
return cef_string_utf16_set(str.c_str(), str.length(), s, true) ?
|
||||
true : false;
|
||||
}
|
||||
#endif // WCHAR_T_IS_UTF32
|
||||
#if defined(BUILDING_CEF_SHARED)
|
||||
static inline string16 to_string16(const struct_type* s)
|
||||
{
|
||||
return string16(s->str, s->length);
|
||||
}
|
||||
static inline bool from_string16(const string16& str, struct_type* s)
|
||||
{
|
||||
return cef_string_utf16_set(str.c_str(), str.length(), s, true) ?
|
||||
true : false;
|
||||
}
|
||||
#endif // BUILDING_CEF_SHARED
|
||||
};
|
||||
|
||||
// String template.
|
||||
template <class traits>
|
||||
class CefStringBase {
|
||||
public:
|
||||
typedef typename traits::char_type char_type;
|
||||
typedef typename traits::struct_type struct_type;
|
||||
typedef typename traits::userfree_struct_type userfree_struct_type;
|
||||
|
||||
// Default constructor.
|
||||
CefStringBase() : string_(NULL), owner_(false) {}
|
||||
|
||||
// Create a new string from an existing string. Data will always be copied.
|
||||
CefStringBase(const CefStringBase& str) : string_(NULL), owner_(false)
|
||||
{ FromString(str.c_str(), str.length(), true); }
|
||||
|
||||
// Create a new string from an existing std::string. Data will be always
|
||||
// copied. Translation will occur if necessary based on the underlying string
|
||||
// type.
|
||||
CefStringBase(const std::string& src) : string_(NULL), owner_(false)
|
||||
{ FromString(src); }
|
||||
CefStringBase(const char* src) : string_(NULL), owner_(false)
|
||||
{ FromString(std::string(src)); }
|
||||
|
||||
// Create a new string from an existing std::wstring. Data will be always
|
||||
// copied. Translation will occur if necessary based on the underlying string
|
||||
// type.
|
||||
CefStringBase(const std::wstring& src) : string_(NULL), owner_(false)
|
||||
{ FromWString(src); }
|
||||
CefStringBase(const wchar_t* src) : string_(NULL), owner_(false)
|
||||
{ FromWString(std::wstring(src)); }
|
||||
|
||||
#if (defined(BUILDING_CEF_SHARED) && defined(WCHAR_T_IS_UTF32))
|
||||
// Create a new string from an existing string16. Data will be always
|
||||
// copied. Translation will occur if necessary based on the underlying string
|
||||
// type.
|
||||
CefStringBase(const string16& src) : string_(NULL), owner_(false)
|
||||
{ FromString16(src); }
|
||||
CefStringBase(const char16_t* src) : string_(NULL), owner_(false)
|
||||
{ FromString16(string16(src)); }
|
||||
#endif // BUILDING_CEF_SHARED && WCHAR_T_IS_UTF32
|
||||
|
||||
// Create a new string from an existing character array. If |copy| is true
|
||||
// this class will copy the data. Otherwise, this class will reference the
|
||||
// existing data. Referenced data must exist for the lifetime of this class
|
||||
// and will not be freed by this class.
|
||||
CefStringBase(const char_type* src, size_t src_len, bool copy)
|
||||
: string_(NULL), owner_(false)
|
||||
{ FromString(src, src_len, copy); }
|
||||
|
||||
// Create a new string referencing an existing string structure without taking
|
||||
// ownership. Referenced structures must exist for the lifetime of this class
|
||||
// and will not be freed by this class.
|
||||
CefStringBase(const struct_type* src) : string_(NULL), owner_(false)
|
||||
{
|
||||
if (!src)
|
||||
return;
|
||||
// Reference the existing structure without taking ownership.
|
||||
Attach(const_cast<struct_type*>(src), false);
|
||||
}
|
||||
|
||||
virtual ~CefStringBase() { ClearAndFree(); }
|
||||
|
||||
|
||||
// The following methods are named for compatibility with the standard library
|
||||
// string template types.
|
||||
|
||||
// Return a read-only pointer to the string data.
|
||||
const char_type* c_str() const { return (string_ ? string_->str : NULL); }
|
||||
|
||||
// Return the length of the string data.
|
||||
size_t length() const { return (string_ ? string_->length : 0); }
|
||||
|
||||
// Return the length of the string data.
|
||||
inline size_t size() const { return length(); }
|
||||
|
||||
// Returns true if the string is empty.
|
||||
bool empty() const { return (string_ == NULL || string_->length == 0); }
|
||||
|
||||
// Compare this string to the specified string.
|
||||
int compare(const CefStringBase& str) const
|
||||
{
|
||||
if (empty() && str.empty())
|
||||
return 0;
|
||||
if (empty())
|
||||
return -1;
|
||||
if (str.empty())
|
||||
return 1;
|
||||
return traits::compare(string_, str.GetStruct());
|
||||
}
|
||||
|
||||
// Clear the string data.
|
||||
void clear()
|
||||
{
|
||||
if (!empty())
|
||||
traits::clear(string_);
|
||||
}
|
||||
|
||||
|
||||
// The following methods are unique to CEF string template types.
|
||||
|
||||
// Returns true if this class owns the underlying string structure.
|
||||
bool IsOwner() const { return owner_; }
|
||||
|
||||
// Returns a read-only pointer to the underlying string structure. May return
|
||||
// NULL if no structure is currently allocated.
|
||||
const struct_type* GetStruct() const { return string_; }
|
||||
|
||||
// Returns a writable pointer to the underlying string structure. Will never
|
||||
// return NULL.
|
||||
struct_type* GetWritableStruct()
|
||||
{
|
||||
AllocIfNeeded();
|
||||
return string_;
|
||||
}
|
||||
|
||||
// Clear the state of this class. The underlying string structure and data
|
||||
// will be freed if this class owns the structure.
|
||||
void ClearAndFree()
|
||||
{
|
||||
if (!string_)
|
||||
return;
|
||||
if (owner_) {
|
||||
clear();
|
||||
delete string_;
|
||||
}
|
||||
string_ = NULL;
|
||||
owner_ = false;
|
||||
}
|
||||
|
||||
// Attach to the specified string structure. If |owner| is true this class
|
||||
// will take ownership of the structure.
|
||||
void Attach(struct_type* str, bool owner)
|
||||
{
|
||||
// Free the previous structure and data, if any.
|
||||
ClearAndFree();
|
||||
|
||||
string_ = str;
|
||||
owner_ = owner;
|
||||
}
|
||||
|
||||
// Take ownership of the specified userfree structure's string data. The
|
||||
// userfree structure itself will be freed. Only use this method with userfree
|
||||
// structures.
|
||||
void AttachToUserFree(userfree_struct_type str)
|
||||
{
|
||||
// Free the previous structure and data, if any.
|
||||
ClearAndFree();
|
||||
|
||||
if (!str)
|
||||
return;
|
||||
|
||||
AllocIfNeeded();
|
||||
owner_ = true;
|
||||
memcpy(string_, str, sizeof(struct_type));
|
||||
|
||||
// Free the |str| structure but not the data.
|
||||
memset(str, 0, sizeof(struct_type));
|
||||
traits::userfree_free(str);
|
||||
}
|
||||
|
||||
// Detach from the underlying string structure. To avoid memory leaks only use
|
||||
// this method if you already hold a pointer to the underlying string
|
||||
// structure.
|
||||
void Detach()
|
||||
{
|
||||
string_ = NULL;
|
||||
owner_ = false;
|
||||
}
|
||||
|
||||
// Create a userfree structure and give it ownership of this class' string
|
||||
// data. This class will be disassociated from the data. May return NULL if
|
||||
// this string class currently contains no data.
|
||||
userfree_struct_type DetachToUserFree()
|
||||
{
|
||||
if (empty())
|
||||
return NULL;
|
||||
|
||||
userfree_struct_type str = traits::userfree_alloc();
|
||||
memcpy(str, string_, sizeof(struct_type));
|
||||
|
||||
// Free this class' structure but not the data.
|
||||
memset(string_, 0, sizeof(struct_type));
|
||||
ClearAndFree();
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
// Set this string's data to the specified character array. If |copy| is true
|
||||
// this class will copy the data. Otherwise, this class will reference the
|
||||
// existing data. Referenced data must exist for the lifetime of this class
|
||||
// and will not be freed by this class.
|
||||
bool FromString(const char_type* src, size_t src_len, bool copy)
|
||||
{
|
||||
if (src == NULL || src_len == 0) {
|
||||
clear();
|
||||
return true;
|
||||
}
|
||||
AllocIfNeeded();
|
||||
return traits::set(src, src_len, string_, copy) ? true : false;
|
||||
}
|
||||
|
||||
// Set this string's data from an existing ASCII string. Data will be always
|
||||
// copied. Translation will occur if necessary based on the underlying string
|
||||
// type.
|
||||
bool FromASCII(const char* str)
|
||||
{
|
||||
size_t len = str ? strlen(str) : 0;
|
||||
if (len == 0) {
|
||||
clear();
|
||||
return true;
|
||||
}
|
||||
AllocIfNeeded();
|
||||
return traits::from_ascii(str, len, string_);
|
||||
}
|
||||
|
||||
// Return this string's data as a std::string. Translation will occur if
|
||||
// necessary based on the underlying string type.
|
||||
std::string ToString() const
|
||||
{
|
||||
if (empty())
|
||||
return std::string();
|
||||
return traits::to_string(string_);
|
||||
}
|
||||
|
||||
// Set this string's data from an existing std::string. Data will be always
|
||||
// copied. Translation will occur if necessary based on the underlying string
|
||||
// type.
|
||||
bool FromString(const std::string& str)
|
||||
{
|
||||
if (str.empty()) {
|
||||
clear();
|
||||
return true;
|
||||
}
|
||||
AllocIfNeeded();
|
||||
return traits::from_string(str, string_);
|
||||
}
|
||||
|
||||
// Return this string's data as a std::wstring. Translation will occur if
|
||||
// necessary based on the underlying string type.
|
||||
std::wstring ToWString() const
|
||||
{
|
||||
if (empty())
|
||||
return std::wstring();
|
||||
return traits::to_wstring(string_);
|
||||
}
|
||||
|
||||
// Set this string's data from an existing std::wstring. Data will be always
|
||||
// copied. Translation will occur if necessary based on the underlying string
|
||||
// type.
|
||||
bool FromWString(const std::wstring& str)
|
||||
{
|
||||
if (str.empty()) {
|
||||
clear();
|
||||
return true;
|
||||
}
|
||||
AllocIfNeeded();
|
||||
return traits::from_wstring(str, string_);
|
||||
}
|
||||
#if defined(BUILDING_CEF_SHARED)
|
||||
// Return this string's data as a string16. Translation will occur if
|
||||
// necessary based on the underlying string type.
|
||||
string16 ToString16() const
|
||||
{
|
||||
if (empty())
|
||||
return string16();
|
||||
return traits::to_string16(string_);
|
||||
}
|
||||
|
||||
// Set this string's data from an existing string16. Data will be always
|
||||
// copied. Translation will occur if necessary based on the underlying string
|
||||
// type.
|
||||
bool FromString16(const string16& str)
|
||||
{
|
||||
if (str.empty()) {
|
||||
clear();
|
||||
return true;
|
||||
}
|
||||
AllocIfNeeded();
|
||||
return traits::from_string16(str, string_);
|
||||
}
|
||||
#endif // BUILDING_CEF_SHARED
|
||||
|
||||
// Comparison operator overloads.
|
||||
bool operator<(const CefStringBase& str) const
|
||||
{ return (compare(str) < 0); }
|
||||
bool operator<=(const CefStringBase& str) const
|
||||
{ return (compare(str) <= 0); }
|
||||
bool operator>(const CefStringBase& str) const
|
||||
{ return (compare(str) > 0); }
|
||||
bool operator>=(const CefStringBase& str) const
|
||||
{ return (compare(str) >= 0); }
|
||||
bool operator==(const CefStringBase& str) const
|
||||
{ return (compare(str) == 0); }
|
||||
bool operator!=(const CefStringBase& str) const
|
||||
{ return (compare(str) != 0); }
|
||||
|
||||
// Assignment operator overloads.
|
||||
CefStringBase& operator=(const CefStringBase& str)
|
||||
{ FromString(str.c_str(), str.length(), true); return *this; }
|
||||
operator std::string() const { return ToString(); }
|
||||
CefStringBase& operator=(const std::string& str)
|
||||
{ FromString(str); return *this; }
|
||||
CefStringBase& operator=(const char* str)
|
||||
{ FromString(std::string(str)); return *this; }
|
||||
operator std::wstring() const { return ToWString(); }
|
||||
CefStringBase& operator=(const std::wstring& str)
|
||||
{ FromWString(str); return *this; }
|
||||
CefStringBase& operator=(const wchar_t* str)
|
||||
{ FromWString(std::wstring(str)); return *this; }
|
||||
#if (defined(BUILDING_CEF_SHARED) && defined(WCHAR_T_IS_UTF32))
|
||||
operator string16() const { return ToString16(); }
|
||||
CefStringBase& operator=(const string16& str)
|
||||
{ FromString16(str); return *this; }
|
||||
CefStringBase& operator=(const char16_t* str)
|
||||
{ FromString16(string16(str)); return *this; }
|
||||
#endif // BUILDING_CEF_SHARED && WCHAR_T_IS_UTF32
|
||||
|
||||
private:
|
||||
// Allocate the string structure if it doesn't already exist.
|
||||
void AllocIfNeeded()
|
||||
{
|
||||
if (string_ == NULL) {
|
||||
string_ = new struct_type;
|
||||
memset(string_, 0, sizeof(struct_type));
|
||||
owner_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
struct_type* string_;
|
||||
bool owner_;
|
||||
};
|
||||
|
||||
|
||||
// CEF string classes can convert between all supported string types. For
|
||||
// example, the CefStringWide class uses wchar_t as the underlying character
|
||||
// type and provides two approaches for converting data to/from a UTF8 string
|
||||
// (std::string).
|
||||
//
|
||||
// 1. Implicit conversion using the assignment operator overload.
|
||||
//
|
||||
// CefStringWide aCefString;
|
||||
// std::string aUTF8String;
|
||||
// aCefString = aUTF8String; // Assign std::string to CefStringWide
|
||||
// aUTF8String = aCefString; // Assign CefStringWide to std::string
|
||||
//
|
||||
// 2. Explicit conversion using the FromString/ToString methods.
|
||||
//
|
||||
// CefStringWide aCefString;
|
||||
// std::string aUTF8String;
|
||||
// aCefString.FromString(aUTF8String); // Assign std::string to CefStringWide
|
||||
// aUTF8String = aCefString.ToString(); // Assign CefStringWide to std::string
|
||||
//
|
||||
// Conversion will only occur if the assigned value is a different string type.
|
||||
// Assigning a std::string to a CefStringUTF8, for example, will copy the data
|
||||
// without performing a conversion.
|
||||
//
|
||||
// CEF string classes are safe for reading from multiple threads but not for
|
||||
// modification. It is the user's responsibility to provide synchronization if
|
||||
// modifying CEF strings from multiple threads.
|
||||
|
||||
typedef CefStringBase<CefStringTraitsWide> CefStringWide;
|
||||
typedef CefStringBase<CefStringTraitsUTF8> CefStringUTF8;
|
||||
typedef CefStringBase<CefStringTraitsUTF16> CefStringUTF16;
|
||||
|
||||
#endif // _CEF_STRING_WRAPPERS_H
|
1083
include/internal/cef_tuple.h
Normal file
1083
include/internal/cef_tuple.h
Normal file
File diff suppressed because it is too large
Load Diff
760
include/internal/cef_types.h
Normal file
760
include/internal/cef_types.h
Normal file
@@ -0,0 +1,760 @@
|
||||
// Copyright (c) 2010 Marshall A. Greenblatt. 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 Google Inc. nor the name Chromium Embedded
|
||||
// Framework 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 _CEF_TYPES_H
|
||||
#define _CEF_TYPES_H
|
||||
|
||||
#include "cef_build.h"
|
||||
#include "cef_string.h"
|
||||
#include "cef_string_list.h"
|
||||
|
||||
// Bring in platform-specific definitions.
|
||||
#if defined(OS_WIN)
|
||||
#include "cef_types_win.h"
|
||||
#elif defined(OS_MACOSX)
|
||||
#include "cef_types_mac.h"
|
||||
#elif defined(OS_LINUX)
|
||||
#include "cef_types_linux.h"
|
||||
#endif
|
||||
|
||||
// The NSPR system headers define 64-bit as |long| when possible. In order to
|
||||
// not have typedef mismatches, we do the same on LP64.
|
||||
#if __LP64__
|
||||
typedef long int64;
|
||||
typedef unsigned long uint64;
|
||||
#else
|
||||
typedef long long int64;
|
||||
typedef unsigned long long uint64;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Log severity levels.
|
||||
enum cef_log_severity_t
|
||||
{
|
||||
LOGSEVERITY_VERBOSE = -1,
|
||||
LOGSEVERITY_INFO,
|
||||
LOGSEVERITY_WARNING,
|
||||
LOGSEVERITY_ERROR,
|
||||
LOGSEVERITY_ERROR_REPORT,
|
||||
// Disables logging completely.
|
||||
LOGSEVERITY_DISABLE = 99
|
||||
};
|
||||
|
||||
// Initialization settings. Specify NULL or 0 to get the recommended default
|
||||
// values.
|
||||
typedef struct _cef_settings_t
|
||||
{
|
||||
// Size of this structure.
|
||||
size_t size;
|
||||
|
||||
// Set to true (1) to have the message loop run in a separate thread. If
|
||||
// false (0) than the CefDoMessageLoopWork() function must be called from
|
||||
// your application message loop.
|
||||
bool multi_threaded_message_loop;
|
||||
|
||||
// The location where cache data will be stored on disk. If empty an
|
||||
// in-memory cache will be used. HTML5 databases such as localStorage will
|
||||
// only persist across sessions if a cache path is specified.
|
||||
cef_string_t cache_path;
|
||||
|
||||
// Value that will be returned as the User-Agent HTTP header. If empty the
|
||||
// default User-Agent string will be used.
|
||||
cef_string_t user_agent;
|
||||
|
||||
// Value that will be inserted as the product portion of the default
|
||||
// User-Agent string. If empty the Chromium product version will be used. If
|
||||
// |userAgent| is specified this value will be ignored.
|
||||
cef_string_t product_version;
|
||||
|
||||
// The locale string that will be passed to WebKit. If empty the default
|
||||
// locale of "en-US" will be used.
|
||||
cef_string_t locale;
|
||||
|
||||
// List of file system paths that will be searched by the browser to locate
|
||||
// plugins. This is in addition to the default search paths.
|
||||
cef_string_list_t extra_plugin_paths;
|
||||
|
||||
// The directory and file name to use for the debug log. If empty, the
|
||||
// default name of "debug.log" will be used and the file will be written
|
||||
// to the application directory.
|
||||
cef_string_t log_file;
|
||||
|
||||
// The log severity. Only messages of this severity level or higher will be
|
||||
// logged.
|
||||
cef_log_severity_t log_severity;
|
||||
} cef_settings_t;
|
||||
|
||||
// Browser initialization settings. Specify NULL or 0 to get the recommended
|
||||
// default values. The consequences of using custom values may not be well
|
||||
// tested.
|
||||
typedef struct _cef_browser_settings_t
|
||||
{
|
||||
// Size of this structure.
|
||||
size_t size;
|
||||
|
||||
// Disable drag & drop of URLs from other windows.
|
||||
bool drag_drop_disabled;
|
||||
|
||||
// The below values map to WebPreferences settings.
|
||||
|
||||
// Font settings.
|
||||
cef_string_t standard_font_family;
|
||||
cef_string_t fixed_font_family;
|
||||
cef_string_t serif_font_family;
|
||||
cef_string_t sans_serif_font_family;
|
||||
cef_string_t cursive_font_family;
|
||||
cef_string_t fantasy_font_family;
|
||||
int default_font_size;
|
||||
int default_fixed_font_size;
|
||||
int minimum_font_size;
|
||||
int minimum_logical_font_size;
|
||||
|
||||
// Set to true (1) to disable loading of fonts from remote sources.
|
||||
bool remote_fonts_disabled;
|
||||
|
||||
// Default encoding for Web content. If empty "ISO-8859-1" will be used.
|
||||
cef_string_t default_encoding;
|
||||
|
||||
// Set to true (1) to attempt automatic detection of content encoding.
|
||||
bool encoding_detector_enabled;
|
||||
|
||||
// Set to true (1) to disable JavaScript.
|
||||
bool javascript_disabled;
|
||||
|
||||
// Set to true (1) to disallow JavaScript from opening windows.
|
||||
bool javascript_open_windows_disallowed;
|
||||
|
||||
// Set to true (1) to disallow JavaScript from closing windows.
|
||||
bool javascript_close_windows_disallowed;
|
||||
|
||||
// Set to true (1) to disallow JavaScript from accessing the clipboard.
|
||||
bool javascript_access_clipboard_disallowed;
|
||||
|
||||
// Set to true (1) to disable DOM pasting in the editor. DOM pasting also
|
||||
// depends on |javascript_cannot_access_clipboard| being false (0).
|
||||
bool dom_paste_disabled;
|
||||
|
||||
// Set to true (1) to enable drawing of the caret position.
|
||||
bool caret_browsing_enabled;
|
||||
|
||||
// Set to true (1) to disable Java.
|
||||
bool java_disabled;
|
||||
|
||||
// Set to true (1) to disable plugins.
|
||||
bool plugins_disabled;
|
||||
|
||||
// Set to true (1) to allow access to all URLs from file URLs.
|
||||
bool universal_access_from_file_urls_allowed;
|
||||
|
||||
// Set to true (1) to allow access to file URLs from other file URLs.
|
||||
bool file_access_from_file_urls_allowed;
|
||||
|
||||
// Set to true (1) to allow risky security behavior such as cross-site
|
||||
// scripting (XSS). Use with extreme care.
|
||||
bool web_security_disabled;
|
||||
|
||||
// Set to true (1) to enable console warnings about XSS attempts.
|
||||
bool xss_auditor_enabled;
|
||||
|
||||
// Set to true (1) to suppress the network load of image URLs. A cached
|
||||
// image will still be rendered if requested.
|
||||
bool image_load_disabled;
|
||||
|
||||
// Set to true (1) to shrink standalone images to fit the page.
|
||||
bool shrink_standalone_images_to_fit;
|
||||
|
||||
// Set to true (1) to disable browser backwards compatibility features.
|
||||
bool site_specific_quirks_disabled;
|
||||
|
||||
// Set to true (1) to disable resize of text areas.
|
||||
bool text_area_resize_disabled;
|
||||
|
||||
// Set to true (1) to disable use of the page cache.
|
||||
bool page_cache_disabled;
|
||||
|
||||
// Set to true (1) to not have the tab key advance focus to links.
|
||||
bool tab_to_links_disabled;
|
||||
|
||||
// Set to true (1) to disable hyperlink pings (<a ping> and window.sendPing).
|
||||
bool hyperlink_auditing_disabled;
|
||||
|
||||
// Set to true (1) to enable the user style sheet for all pages.
|
||||
// |user_style_sheet_location| must be set to the style sheet URL.
|
||||
bool user_style_sheet_enabled;
|
||||
cef_string_t user_style_sheet_location;
|
||||
|
||||
// Set to true (1) to disable style sheets.
|
||||
bool author_and_user_styles_disabled;
|
||||
|
||||
// Set to true (1) to disable local storage.
|
||||
bool local_storage_disabled;
|
||||
|
||||
// Set to true (1) to disable databases.
|
||||
bool databases_disabled;
|
||||
|
||||
// Set to true (1) to disable application cache.
|
||||
bool application_cache_disabled;
|
||||
|
||||
// Set to true (1) to disable WebGL.
|
||||
bool webgl_disabled;
|
||||
|
||||
// Set to true (1) to disable accelerated compositing.
|
||||
bool accelerated_compositing_disabled;
|
||||
|
||||
// Set to true (1) to disable accelerated layers. This affects features like
|
||||
// 3D CSS transforms.
|
||||
bool accelerated_layers_disabled;
|
||||
|
||||
// Set to true (1) to disable accelerated 2d canvas.
|
||||
bool accelerated_2d_canvas_disabled;
|
||||
|
||||
// Set to true (1) to disable developer tools (WebKit inspector).
|
||||
bool developer_tools_disabled;
|
||||
} cef_browser_settings_t;
|
||||
|
||||
// URL component parts.
|
||||
typedef struct _cef_urlparts_t
|
||||
{
|
||||
// The complete URL specification.
|
||||
cef_string_t spec;
|
||||
|
||||
// Scheme component not including the colon (e.g., "http").
|
||||
cef_string_t scheme;
|
||||
|
||||
// User name component.
|
||||
cef_string_t username;
|
||||
|
||||
// Password component.
|
||||
cef_string_t password;
|
||||
|
||||
// Host component. This may be a hostname, an IPv4 address or an IPv6 literal
|
||||
// surrounded by square brackets (e.g., "[2001:db8::1]").
|
||||
cef_string_t host;
|
||||
|
||||
// Port number component.
|
||||
cef_string_t port;
|
||||
|
||||
// Path component including the first slash following the host.
|
||||
cef_string_t path;
|
||||
|
||||
// Query string component (i.e., everything following the '?').
|
||||
cef_string_t query;
|
||||
} cef_urlparts_t;
|
||||
|
||||
// Time information. Values should always be in UTC.
|
||||
typedef struct _cef_time_t
|
||||
{
|
||||
int year; // Four digit year "2007"
|
||||
int month; // 1-based month (values 1 = January, etc.)
|
||||
int day_of_week; // 0-based day of week (0 = Sunday, etc.)
|
||||
int day_of_month; // 1-based day of month (1-31)
|
||||
int hour; // Hour within the current day (0-23)
|
||||
int minute; // Minute within the current hour (0-59)
|
||||
int second; // Second within the current minute (0-59 plus leap
|
||||
// seconds which may take it up to 60).
|
||||
int millisecond; // Milliseconds within the current second (0-999)
|
||||
} cef_time_t;
|
||||
|
||||
// Cookie information.
|
||||
typedef struct _cef_cookie_t
|
||||
{
|
||||
// The cookie name.
|
||||
cef_string_t name;
|
||||
|
||||
// The cookie value.
|
||||
cef_string_t value;
|
||||
|
||||
// If |domain| is empty a host cookie will be created instead of a domain
|
||||
// cookie. Domain cookies are stored with a leading "." and are visible to
|
||||
// sub-domains whereas host cookies are not.
|
||||
cef_string_t domain;
|
||||
|
||||
// If |path| is non-empty only URLs at or below the path will get the cookie
|
||||
// value.
|
||||
cef_string_t path;
|
||||
|
||||
// If |secure| is true the cookie will only be sent for HTTPS requests.
|
||||
bool secure;
|
||||
|
||||
// If |httponly| is true the cookie will only be sent for HTTP requests.
|
||||
bool httponly;
|
||||
|
||||
// The cookie creation date. This is automatically populated by the system on
|
||||
// cookie creation.
|
||||
cef_time_t creation;
|
||||
|
||||
// The cookie last access date. This is automatically populated by the system
|
||||
// on access.
|
||||
cef_time_t last_access;
|
||||
|
||||
// The cookie expiration date is only valid if |has_expires| is true.
|
||||
bool has_expires;
|
||||
cef_time_t expires;
|
||||
} cef_cookie_t;
|
||||
|
||||
// Mouse button types.
|
||||
enum cef_mouse_button_type_t
|
||||
{
|
||||
MBT_LEFT = 0,
|
||||
MBT_MIDDLE,
|
||||
MBT_RIGHT,
|
||||
};
|
||||
|
||||
// Key types.
|
||||
enum cef_key_type_t
|
||||
{
|
||||
KT_KEYUP = 0,
|
||||
KT_KEYDOWN,
|
||||
KT_CHAR,
|
||||
};
|
||||
|
||||
// Various browser navigation types supported by chrome.
|
||||
enum cef_handler_navtype_t
|
||||
{
|
||||
NAVTYPE_LINKCLICKED = 0,
|
||||
NAVTYPE_FORMSUBMITTED,
|
||||
NAVTYPE_BACKFORWARD,
|
||||
NAVTYPE_RELOAD,
|
||||
NAVTYPE_FORMRESUBMITTED,
|
||||
NAVTYPE_OTHER,
|
||||
};
|
||||
|
||||
// Supported error code values. See net\base\net_error_list.h for complete
|
||||
// descriptions of the error codes.
|
||||
enum cef_handler_errorcode_t
|
||||
{
|
||||
ERR_FAILED = -2,
|
||||
ERR_ABORTED = -3,
|
||||
ERR_INVALID_ARGUMENT = -4,
|
||||
ERR_INVALID_HANDLE = -5,
|
||||
ERR_FILE_NOT_FOUND = -6,
|
||||
ERR_TIMED_OUT = -7,
|
||||
ERR_FILE_TOO_BIG = -8,
|
||||
ERR_UNEXPECTED = -9,
|
||||
ERR_ACCESS_DENIED = -10,
|
||||
ERR_NOT_IMPLEMENTED = -11,
|
||||
ERR_CONNECTION_CLOSED = -100,
|
||||
ERR_CONNECTION_RESET = -101,
|
||||
ERR_CONNECTION_REFUSED = -102,
|
||||
ERR_CONNECTION_ABORTED = -103,
|
||||
ERR_CONNECTION_FAILED = -104,
|
||||
ERR_NAME_NOT_RESOLVED = -105,
|
||||
ERR_INTERNET_DISCONNECTED = -106,
|
||||
ERR_SSL_PROTOCOL_ERROR = -107,
|
||||
ERR_ADDRESS_INVALID = -108,
|
||||
ERR_ADDRESS_UNREACHABLE = -109,
|
||||
ERR_SSL_CLIENT_AUTH_CERT_NEEDED = -110,
|
||||
ERR_TUNNEL_CONNECTION_FAILED = -111,
|
||||
ERR_NO_SSL_VERSIONS_ENABLED = -112,
|
||||
ERR_SSL_VERSION_OR_CIPHER_MISMATCH = -113,
|
||||
ERR_SSL_RENEGOTIATION_REQUESTED = -114,
|
||||
ERR_CERT_COMMON_NAME_INVALID = -200,
|
||||
ERR_CERT_DATE_INVALID = -201,
|
||||
ERR_CERT_AUTHORITY_INVALID = -202,
|
||||
ERR_CERT_CONTAINS_ERRORS = -203,
|
||||
ERR_CERT_NO_REVOCATION_MECHANISM = -204,
|
||||
ERR_CERT_UNABLE_TO_CHECK_REVOCATION = -205,
|
||||
ERR_CERT_REVOKED = -206,
|
||||
ERR_CERT_INVALID = -207,
|
||||
ERR_CERT_END = -208,
|
||||
ERR_INVALID_URL = -300,
|
||||
ERR_DISALLOWED_URL_SCHEME = -301,
|
||||
ERR_UNKNOWN_URL_SCHEME = -302,
|
||||
ERR_TOO_MANY_REDIRECTS = -310,
|
||||
ERR_UNSAFE_REDIRECT = -311,
|
||||
ERR_UNSAFE_PORT = -312,
|
||||
ERR_INVALID_RESPONSE = -320,
|
||||
ERR_INVALID_CHUNKED_ENCODING = -321,
|
||||
ERR_METHOD_NOT_SUPPORTED = -322,
|
||||
ERR_UNEXPECTED_PROXY_AUTH = -323,
|
||||
ERR_EMPTY_RESPONSE = -324,
|
||||
ERR_RESPONSE_HEADERS_TOO_BIG = -325,
|
||||
ERR_CACHE_MISS = -400,
|
||||
ERR_INSECURE_RESPONSE = -501,
|
||||
};
|
||||
|
||||
// V8 access control values.
|
||||
enum cef_v8_accesscontrol_t
|
||||
{
|
||||
V8_ACCESS_CONTROL_DEFAULT = 0,
|
||||
V8_ACCESS_CONTROL_ALL_CAN_READ = 1,
|
||||
V8_ACCESS_CONTROL_ALL_CAN_WRITE = 1 << 1,
|
||||
V8_ACCESS_CONTROL_PROHIBITS_OVERWRITING = 1 << 2
|
||||
};
|
||||
|
||||
// V8 property attribute values.
|
||||
enum cef_v8_propertyattribute_t
|
||||
{
|
||||
V8_PROPERTY_ATTRIBUTE_NONE = 0, // Writeable, Enumerable,
|
||||
// Configurable
|
||||
V8_PROPERTY_ATTRIBUTE_READONLY = 1 << 0, // Not writeable
|
||||
V8_PROPERTY_ATTRIBUTE_DONTENUM = 1 << 1, // Not enumerable
|
||||
V8_PROPERTY_ATTRIBUTE_DONTDELETE = 1 << 2 // Not configurable
|
||||
};
|
||||
|
||||
// Structure representing menu information.
|
||||
typedef struct _cef_handler_menuinfo_t
|
||||
{
|
||||
// Values from the cef_handler_menutypebits_t enumeration.
|
||||
int typeFlags;
|
||||
|
||||
// If window rendering is enabled |x| and |y| will be in screen coordinates.
|
||||
// Otherwise, |x| and |y| will be in view coordinates.
|
||||
int x;
|
||||
int y;
|
||||
|
||||
cef_string_t linkUrl;
|
||||
cef_string_t imageUrl;
|
||||
cef_string_t pageUrl;
|
||||
cef_string_t frameUrl;
|
||||
cef_string_t selectionText;
|
||||
cef_string_t misspelledWord;
|
||||
|
||||
// Values from the cef_handler_menucapabilitybits_t enumeration.
|
||||
int editFlags;
|
||||
|
||||
cef_string_t securityInfo;
|
||||
} cef_handler_menuinfo_t;
|
||||
|
||||
// The cef_handler_menuinfo_t typeFlags value will be a combination of the
|
||||
// following values.
|
||||
enum cef_handler_menutypebits_t
|
||||
{
|
||||
// No node is selected
|
||||
MENUTYPE_NONE = 0x0,
|
||||
// The top page is selected
|
||||
MENUTYPE_PAGE = 0x1,
|
||||
// A subframe page is selected
|
||||
MENUTYPE_FRAME = 0x2,
|
||||
// A link is selected
|
||||
MENUTYPE_LINK = 0x4,
|
||||
// An image is selected
|
||||
MENUTYPE_IMAGE = 0x8,
|
||||
// There is a textual or mixed selection that is selected
|
||||
MENUTYPE_SELECTION = 0x10,
|
||||
// An editable element is selected
|
||||
MENUTYPE_EDITABLE = 0x20,
|
||||
// A misspelled word is selected
|
||||
MENUTYPE_MISSPELLED_WORD = 0x40,
|
||||
// A video node is selected
|
||||
MENUTYPE_VIDEO = 0x80,
|
||||
// A video node is selected
|
||||
MENUTYPE_AUDIO = 0x100,
|
||||
};
|
||||
|
||||
// The cef_handler_menuinfo_t editFlags value will be a combination of the
|
||||
// following values.
|
||||
enum cef_handler_menucapabilitybits_t
|
||||
{
|
||||
// Values from WebContextMenuData::EditFlags in WebContextMenuData.h
|
||||
MENU_CAN_DO_NONE = 0x0,
|
||||
MENU_CAN_UNDO = 0x1,
|
||||
MENU_CAN_REDO = 0x2,
|
||||
MENU_CAN_CUT = 0x4,
|
||||
MENU_CAN_COPY = 0x8,
|
||||
MENU_CAN_PASTE = 0x10,
|
||||
MENU_CAN_DELETE = 0x20,
|
||||
MENU_CAN_SELECT_ALL = 0x40,
|
||||
MENU_CAN_TRANSLATE = 0x80,
|
||||
// Values unique to CEF
|
||||
MENU_CAN_GO_FORWARD = 0x10000000,
|
||||
MENU_CAN_GO_BACK = 0x20000000,
|
||||
};
|
||||
|
||||
// Supported menu ID values.
|
||||
enum cef_handler_menuid_t
|
||||
{
|
||||
MENU_ID_NAV_BACK = 10,
|
||||
MENU_ID_NAV_FORWARD = 11,
|
||||
MENU_ID_NAV_RELOAD = 12,
|
||||
MENU_ID_NAV_RELOAD_NOCACHE = 13,
|
||||
MENU_ID_NAV_STOP = 14,
|
||||
MENU_ID_UNDO = 20,
|
||||
MENU_ID_REDO = 21,
|
||||
MENU_ID_CUT = 22,
|
||||
MENU_ID_COPY = 23,
|
||||
MENU_ID_PASTE = 24,
|
||||
MENU_ID_DELETE = 25,
|
||||
MENU_ID_SELECTALL = 26,
|
||||
MENU_ID_PRINT = 30,
|
||||
MENU_ID_VIEWSOURCE = 31,
|
||||
};
|
||||
|
||||
enum cef_paint_element_type_t
|
||||
{
|
||||
PET_VIEW = 0,
|
||||
PET_POPUP,
|
||||
};
|
||||
|
||||
// Post data elements may represent either bytes or files.
|
||||
enum cef_postdataelement_type_t
|
||||
{
|
||||
PDE_TYPE_EMPTY = 0,
|
||||
PDE_TYPE_BYTES,
|
||||
PDE_TYPE_FILE,
|
||||
};
|
||||
|
||||
enum cef_weburlrequest_flags_t
|
||||
{
|
||||
WUR_FLAG_NONE = 0,
|
||||
WUR_FLAG_SKIP_CACHE = 0x1,
|
||||
WUR_FLAG_ALLOW_CACHED_CREDENTIALS = 0x2,
|
||||
WUR_FLAG_ALLOW_COOKIES = 0x4,
|
||||
WUR_FLAG_REPORT_UPLOAD_PROGRESS = 0x8,
|
||||
WUR_FLAG_REPORT_LOAD_TIMING = 0x10,
|
||||
WUR_FLAG_REPORT_RAW_HEADERS = 0x20
|
||||
};
|
||||
|
||||
enum cef_weburlrequest_state_t
|
||||
{
|
||||
WUR_STATE_UNSENT = 0,
|
||||
WUR_STATE_STARTED = 1,
|
||||
WUR_STATE_HEADERS_RECEIVED = 2,
|
||||
WUR_STATE_LOADING = 3,
|
||||
WUR_STATE_DONE = 4,
|
||||
WUR_STATE_ERROR = 5,
|
||||
WUR_STATE_ABORT = 6,
|
||||
};
|
||||
|
||||
// Key event types.
|
||||
enum cef_handler_keyevent_type_t
|
||||
{
|
||||
KEYEVENT_RAWKEYDOWN = 0,
|
||||
KEYEVENT_KEYDOWN,
|
||||
KEYEVENT_KEYUP,
|
||||
KEYEVENT_CHAR
|
||||
};
|
||||
|
||||
// Key event modifiers.
|
||||
enum cef_handler_keyevent_modifiers_t
|
||||
{
|
||||
KEY_SHIFT = 1 << 0,
|
||||
KEY_CTRL = 1 << 1,
|
||||
KEY_ALT = 1 << 2,
|
||||
KEY_META = 1 << 3
|
||||
};
|
||||
|
||||
// Structure representing a rectangle.
|
||||
typedef struct _cef_rect_t
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
} cef_rect_t;
|
||||
|
||||
// Existing thread IDs.
|
||||
enum cef_thread_id_t
|
||||
{
|
||||
TID_UI = 0,
|
||||
TID_IO = 1,
|
||||
TID_FILE = 2,
|
||||
};
|
||||
|
||||
// Paper type for printing.
|
||||
enum cef_paper_type_t
|
||||
{
|
||||
PT_LETTER = 0,
|
||||
PT_LEGAL,
|
||||
PT_EXECUTIVE,
|
||||
PT_A3,
|
||||
PT_A4,
|
||||
PT_CUSTOM
|
||||
};
|
||||
|
||||
// Paper metric information for printing.
|
||||
struct cef_paper_metrics
|
||||
{
|
||||
enum cef_paper_type_t paper_type;
|
||||
//Length and width needed if paper_type is custom_size
|
||||
//Units are in inches.
|
||||
double length;
|
||||
double width;
|
||||
};
|
||||
|
||||
// Paper print margins.
|
||||
struct cef_print_margins
|
||||
{
|
||||
//Margin size in inches for left/right/top/bottom (this is content margins).
|
||||
double left;
|
||||
double right;
|
||||
double top;
|
||||
double bottom;
|
||||
//Margin size (top/bottom) in inches for header/footer.
|
||||
double header;
|
||||
double footer;
|
||||
};
|
||||
|
||||
// Page orientation for printing.
|
||||
enum cef_page_orientation
|
||||
{
|
||||
PORTRAIT = 0,
|
||||
LANDSCAPE
|
||||
};
|
||||
|
||||
// Printing options.
|
||||
typedef struct _cef_print_options_t
|
||||
{
|
||||
enum cef_page_orientation page_orientation;
|
||||
struct cef_paper_metrics paper_metrics;
|
||||
struct cef_print_margins paper_margins;
|
||||
} cef_print_options_t;
|
||||
|
||||
// Supported XML encoding types. The parser supports ASCII, ISO-8859-1, and
|
||||
// UTF16 (LE and BE) by default. All other types must be translated to UTF8
|
||||
// before being passed to the parser. If a BOM is detected and the correct
|
||||
// decoder is available then that decoder will be used automatically.
|
||||
enum cef_xml_encoding_type_t
|
||||
{
|
||||
XML_ENCODING_NONE = 0,
|
||||
XML_ENCODING_UTF8,
|
||||
XML_ENCODING_UTF16LE,
|
||||
XML_ENCODING_UTF16BE,
|
||||
XML_ENCODING_ASCII,
|
||||
};
|
||||
|
||||
// XML node types.
|
||||
enum cef_xml_node_type_t
|
||||
{
|
||||
XML_NODE_UNSUPPORTED = 0,
|
||||
XML_NODE_PROCESSING_INSTRUCTION,
|
||||
XML_NODE_DOCUMENT_TYPE,
|
||||
XML_NODE_ELEMENT_START,
|
||||
XML_NODE_ELEMENT_END,
|
||||
XML_NODE_ATTRIBUTE,
|
||||
XML_NODE_TEXT,
|
||||
XML_NODE_CDATA,
|
||||
XML_NODE_ENTITY_REFERENCE,
|
||||
XML_NODE_WHITESPACE,
|
||||
XML_NODE_COMMENT,
|
||||
};
|
||||
|
||||
// Status message types.
|
||||
enum cef_handler_statustype_t
|
||||
{
|
||||
STATUSTYPE_TEXT = 0,
|
||||
STATUSTYPE_MOUSEOVER_URL,
|
||||
STATUSTYPE_KEYBOARD_FOCUS_URL,
|
||||
};
|
||||
|
||||
// Popup window features.
|
||||
typedef struct _cef_popup_features_t
|
||||
{
|
||||
int x;
|
||||
bool xSet;
|
||||
int y;
|
||||
bool ySet;
|
||||
int width;
|
||||
bool widthSet;
|
||||
int height;
|
||||
bool heightSet;
|
||||
|
||||
bool menuBarVisible;
|
||||
bool statusBarVisible;
|
||||
bool toolBarVisible;
|
||||
bool locationBarVisible;
|
||||
bool scrollbarsVisible;
|
||||
bool resizable;
|
||||
|
||||
bool fullscreen;
|
||||
bool dialog;
|
||||
cef_string_list_t additionalFeatures;
|
||||
} cef_popup_features_t;
|
||||
|
||||
// DOM document types.
|
||||
enum cef_dom_document_type_t
|
||||
{
|
||||
DOM_DOCUMENT_TYPE_UNKNOWN = 0,
|
||||
DOM_DOCUMENT_TYPE_HTML,
|
||||
DOM_DOCUMENT_TYPE_XHTML,
|
||||
DOM_DOCUMENT_TYPE_PLUGIN,
|
||||
};
|
||||
|
||||
// DOM event category flags.
|
||||
enum cef_dom_event_category_t
|
||||
{
|
||||
DOM_EVENT_CATEGORY_UNKNOWN = 0x0,
|
||||
DOM_EVENT_CATEGORY_UI = 0x1,
|
||||
DOM_EVENT_CATEGORY_MOUSE = 0x2,
|
||||
DOM_EVENT_CATEGORY_MUTATION = 0x4,
|
||||
DOM_EVENT_CATEGORY_KEYBOARD = 0x8,
|
||||
DOM_EVENT_CATEGORY_TEXT = 0x10,
|
||||
DOM_EVENT_CATEGORY_COMPOSITION = 0x20,
|
||||
DOM_EVENT_CATEGORY_DRAG = 0x40,
|
||||
DOM_EVENT_CATEGORY_CLIPBOARD = 0x80,
|
||||
DOM_EVENT_CATEGORY_MESSAGE = 0x100,
|
||||
DOM_EVENT_CATEGORY_WHEEL = 0x200,
|
||||
DOM_EVENT_CATEGORY_BEFORE_TEXT_INSERTED = 0x400,
|
||||
DOM_EVENT_CATEGORY_OVERFLOW = 0x800,
|
||||
DOM_EVENT_CATEGORY_PAGE_TRANSITION = 0x1000,
|
||||
DOM_EVENT_CATEGORY_POPSTATE = 0x2000,
|
||||
DOM_EVENT_CATEGORY_PROGRESS = 0x4000,
|
||||
DOM_EVENT_CATEGORY_XMLHTTPREQUEST_PROGRESS = 0x8000,
|
||||
DOM_EVENT_CATEGORY_WEBKIT_ANIMATION = 0x10000,
|
||||
DOM_EVENT_CATEGORY_WEBKIT_TRANSITION = 0x20000,
|
||||
DOM_EVENT_CATEGORY_BEFORE_LOAD = 0x40000,
|
||||
};
|
||||
|
||||
// DOM event processing phases.
|
||||
enum cef_dom_event_phase_t
|
||||
{
|
||||
DOM_EVENT_PHASE_UNKNOWN = 0,
|
||||
DOM_EVENT_PHASE_CAPTURING,
|
||||
DOM_EVENT_PHASE_AT_TARGET,
|
||||
DOM_EVENT_PHASE_BUBBLING,
|
||||
};
|
||||
|
||||
// DOM node types.
|
||||
enum cef_dom_node_type_t
|
||||
{
|
||||
DOM_NODE_TYPE_UNSUPPORTED = 0,
|
||||
DOM_NODE_TYPE_ELEMENT,
|
||||
DOM_NODE_TYPE_ATTRIBUTE,
|
||||
DOM_NODE_TYPE_TEXT,
|
||||
DOM_NODE_TYPE_CDATA_SECTION,
|
||||
DOM_NODE_TYPE_ENTITY_REFERENCE,
|
||||
DOM_NODE_TYPE_ENTITY,
|
||||
DOM_NODE_TYPE_PROCESSING_INSTRUCTIONS,
|
||||
DOM_NODE_TYPE_COMMENT,
|
||||
DOM_NODE_TYPE_DOCUMENT,
|
||||
DOM_NODE_TYPE_DOCUMENT_TYPE,
|
||||
DOM_NODE_TYPE_DOCUMENT_FRAGMENT,
|
||||
DOM_NODE_TYPE_NOTATION,
|
||||
DOM_NODE_TYPE_XPATH_NAMESPACE,
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _CEF_TYPES_H
|
68
include/internal/cef_types_linux.h
Normal file
68
include/internal/cef_types_linux.h
Normal file
@@ -0,0 +1,68 @@
|
||||
// Copyright (c) 2010 Marshall A. Greenblatt. 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 Google Inc. nor the name Chromium Embedded
|
||||
// Framework 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 _CEF_TYPES_LINUX_H
|
||||
#define _CEF_TYPES_LINUX_H
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
#include <gtk/gtk.h>
|
||||
#include "cef_string.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Window handle.
|
||||
#define cef_window_handle_t GtkWidget*
|
||||
#define cef_cursor_handle_t void*
|
||||
|
||||
// Class representing window information.
|
||||
typedef struct _cef_window_info_t
|
||||
{
|
||||
// Pointer for the parent GtkBox widget.
|
||||
cef_window_handle_t m_ParentWidget;
|
||||
|
||||
// Pointer for the new browser widget.
|
||||
cef_window_handle_t m_Widget;
|
||||
} cef_window_info_t;
|
||||
|
||||
// Class representing print context information.
|
||||
typedef struct _cef_print_info_t
|
||||
{
|
||||
double m_Scale;
|
||||
} cef_print_info_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // OS_LINUX
|
||||
|
||||
#endif // _CEF_TYPES_LINUX_H
|
83
include/internal/cef_types_mac.h
Normal file
83
include/internal/cef_types_mac.h
Normal file
@@ -0,0 +1,83 @@
|
||||
// Copyright (c) 2010 Marshall A. Greenblatt. 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 Google Inc. nor the name Chromium Embedded
|
||||
// Framework 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 _CEF_TYPES_MAC_H
|
||||
#define _CEF_TYPES_MAC_H
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#include "cef_string.h"
|
||||
|
||||
// Window handle.
|
||||
#ifdef __cplusplus
|
||||
#ifdef __OBJC__
|
||||
@class NSView;
|
||||
#else
|
||||
class NSView;
|
||||
#endif
|
||||
#define cef_window_handle_t NSView*
|
||||
#else
|
||||
#define cef_window_handle_t void*
|
||||
#endif
|
||||
#define cef_cursor_handle_t void*
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Class representing window information.
|
||||
typedef struct _cef_window_info_t
|
||||
{
|
||||
cef_string_t m_windowName;
|
||||
int m_x;
|
||||
int m_y;
|
||||
int m_nWidth;
|
||||
int m_nHeight;
|
||||
int m_bHidden;
|
||||
|
||||
// NSView pointer for the parent view.
|
||||
cef_window_handle_t m_ParentView;
|
||||
|
||||
// NSView pointer for the new browser view.
|
||||
cef_window_handle_t m_View;
|
||||
} cef_window_info_t;
|
||||
|
||||
// Class representing print context information.
|
||||
typedef struct _cef_print_info_t
|
||||
{
|
||||
double m_Scale;
|
||||
} cef_print_info_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // OS_MACOSX
|
||||
|
||||
#endif // _CEF_TYPES_MAC_H
|
83
include/internal/cef_types_win.h
Normal file
83
include/internal/cef_types_win.h
Normal file
@@ -0,0 +1,83 @@
|
||||
// Copyright (c) 2009 Marshall A. Greenblatt. 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 Google Inc. nor the name Chromium Embedded
|
||||
// Framework 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 _CEF_TYPES_WIN_H
|
||||
#define _CEF_TYPES_WIN_H
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
#include "cef_string.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Window handle.
|
||||
#define cef_window_handle_t HWND
|
||||
#define cef_cursor_handle_t HCURSOR
|
||||
|
||||
// Class representing window information.
|
||||
typedef struct _cef_window_info_t
|
||||
{
|
||||
// Standard parameters required by CreateWindowEx()
|
||||
DWORD m_dwExStyle;
|
||||
cef_string_t m_windowName;
|
||||
DWORD m_dwStyle;
|
||||
int m_x;
|
||||
int m_y;
|
||||
int m_nWidth;
|
||||
int m_nHeight;
|
||||
cef_window_handle_t m_hWndParent;
|
||||
HMENU m_hMenu;
|
||||
|
||||
// If window rendering is disabled no browser window will be created. Set
|
||||
// |m_hWndParent| to the window that will act as the parent for popup menus,
|
||||
// dialog boxes, etc.
|
||||
BOOL m_bWindowRenderingDisabled;
|
||||
|
||||
// Handle for the new browser window.
|
||||
cef_window_handle_t m_hWnd;
|
||||
} cef_window_info_t;
|
||||
|
||||
// Class representing print context information.
|
||||
typedef struct _cef_print_info_t
|
||||
{
|
||||
HDC m_hDC;
|
||||
RECT m_Rect;
|
||||
double m_Scale;
|
||||
} cef_print_info_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // OS_WIN
|
||||
|
||||
#endif // _CEF_TYPES_WIN_H
|
444
include/internal/cef_types_wrappers.h
Normal file
444
include/internal/cef_types_wrappers.h
Normal file
@@ -0,0 +1,444 @@
|
||||
// Copyright (c) 2011 Marshall A. Greenblatt. 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 Google Inc. nor the name Chromium Embedded
|
||||
// Framework 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 _CEF_TYPES_WRAPPERS_H
|
||||
#define _CEF_TYPES_WRAPPERS_H
|
||||
|
||||
#include "cef_string.h"
|
||||
#include "cef_string_list.h"
|
||||
#include "cef_types.h"
|
||||
|
||||
// Template class that provides common functionality for CEF structure wrapping.
|
||||
template <class traits>
|
||||
class CefStructBase : public traits::struct_type {
|
||||
public:
|
||||
typedef typename traits::struct_type struct_type;
|
||||
|
||||
CefStructBase() : attached_to_(NULL)
|
||||
{
|
||||
Init();
|
||||
}
|
||||
virtual ~CefStructBase()
|
||||
{
|
||||
// Only clear this object's data if it isn't currently attached to a
|
||||
// structure.
|
||||
if (!attached_to_)
|
||||
Clear(this);
|
||||
}
|
||||
|
||||
CefStructBase(const CefStructBase& r)
|
||||
{
|
||||
Init();
|
||||
*this = r;
|
||||
}
|
||||
CefStructBase(const struct_type& r)
|
||||
{
|
||||
Init();
|
||||
*this = r;
|
||||
}
|
||||
|
||||
// Clear this object's values.
|
||||
void Reset()
|
||||
{
|
||||
Clear(this);
|
||||
Init();
|
||||
}
|
||||
|
||||
// Attach to the source structure's existing values. DetachTo() can be called
|
||||
// to insert the values back into the existing structure.
|
||||
void AttachTo(struct_type& source)
|
||||
{
|
||||
// Only clear this object's data if it isn't currently attached to a
|
||||
// structure.
|
||||
if (!attached_to_)
|
||||
Clear(this);
|
||||
|
||||
// This object is now attached to the new structure.
|
||||
attached_to_ = &source;
|
||||
|
||||
// Transfer ownership of the values from the source structure.
|
||||
memcpy(static_cast<struct_type*>(this), &source, sizeof(struct_type));
|
||||
}
|
||||
|
||||
// Relinquish ownership of values to the target structure.
|
||||
void DetachTo(struct_type& target)
|
||||
{
|
||||
if (attached_to_ != &target) {
|
||||
// Clear the target structure's values only if we are not currently
|
||||
// attached to that structure.
|
||||
Clear(&target);
|
||||
}
|
||||
|
||||
// Transfer ownership of the values to the target structure.
|
||||
memcpy(&target, static_cast<struct_type*>(this), sizeof(struct_type));
|
||||
|
||||
// Remove the references from this object.
|
||||
Init();
|
||||
}
|
||||
|
||||
// Set this object's values. If |copy| is true the source structure's values
|
||||
// will be copied instead of referenced.
|
||||
void Set(const struct_type& source, bool copy)
|
||||
{
|
||||
traits::set(&source, this, copy);
|
||||
}
|
||||
|
||||
CefStructBase& operator=(const CefStructBase& s)
|
||||
{
|
||||
return operator=(static_cast<const struct_type&>(s));
|
||||
}
|
||||
|
||||
CefStructBase& operator=(const struct_type& s)
|
||||
{
|
||||
Set(s, true);
|
||||
return *this;
|
||||
}
|
||||
|
||||
protected:
|
||||
void Init()
|
||||
{
|
||||
memset(static_cast<struct_type*>(this), 0, sizeof(struct_type));
|
||||
attached_to_ = NULL;
|
||||
traits::init(this);
|
||||
}
|
||||
|
||||
static void Clear(struct_type* s) { traits::clear(s); }
|
||||
|
||||
struct_type* attached_to_;
|
||||
};
|
||||
|
||||
|
||||
struct CefRectTraits {
|
||||
typedef cef_rect_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s) {}
|
||||
static inline void clear(struct_type* s) {}
|
||||
|
||||
static inline void set(const struct_type* src, struct_type* target, bool copy)
|
||||
{
|
||||
target->x = src->x;
|
||||
target->y = src->y;
|
||||
target->width = src->width;
|
||||
target->height = src->height;
|
||||
}
|
||||
};
|
||||
|
||||
// Class representing a rectangle.
|
||||
class CefRect : public CefStructBase<CefRectTraits>
|
||||
{
|
||||
public:
|
||||
typedef CefStructBase<CefRectTraits> parent;
|
||||
|
||||
CefRect() : parent() {}
|
||||
CefRect(const cef_rect_t& r) : parent(r) {}
|
||||
CefRect(const CefRect& r) : parent(r) {}
|
||||
CefRect(int x, int y, int width, int height) : parent()
|
||||
{
|
||||
Set(x, y, width, height);
|
||||
}
|
||||
|
||||
bool IsEmpty() const { return width <= 0 || height <= 0; }
|
||||
void Set(int x, int y, int width, int height)
|
||||
{
|
||||
this->x = x, this->y = y, this->width = width, this->height = height;
|
||||
}
|
||||
};
|
||||
|
||||
inline bool operator==(const CefRect& a, const CefRect& b)
|
||||
{
|
||||
return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height;
|
||||
}
|
||||
|
||||
inline bool operator!=(const CefRect& a, const CefRect& b)
|
||||
{
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
|
||||
struct CefPopupFeaturesTraits {
|
||||
typedef cef_popup_features_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s)
|
||||
{
|
||||
s->menuBarVisible = true;
|
||||
s->statusBarVisible = true;
|
||||
s->toolBarVisible = true;
|
||||
s->locationBarVisible = true;
|
||||
s->scrollbarsVisible = true;
|
||||
s->resizable = true;
|
||||
}
|
||||
|
||||
static inline void clear(struct_type* s)
|
||||
{
|
||||
if(s->additionalFeatures)
|
||||
cef_string_list_free(s->additionalFeatures);
|
||||
}
|
||||
|
||||
static inline void set(const struct_type* src, struct_type* target, bool copy)
|
||||
{
|
||||
if(target->additionalFeatures)
|
||||
cef_string_list_free(target->additionalFeatures);
|
||||
target->additionalFeatures = src->additionalFeatures ?
|
||||
cef_string_list_copy(src->additionalFeatures) : NULL;
|
||||
|
||||
target->x = src->x;
|
||||
target->xSet = src->xSet;
|
||||
target->y = src->y;
|
||||
target->ySet = src->ySet;
|
||||
target->width = src->width;
|
||||
target->widthSet = src->widthSet;
|
||||
target->height = src->height;
|
||||
target->heightSet = src->heightSet;
|
||||
target->menuBarVisible = src->menuBarVisible;
|
||||
target->statusBarVisible = src->statusBarVisible;
|
||||
target->toolBarVisible = src->toolBarVisible;
|
||||
target->locationBarVisible = src->locationBarVisible;
|
||||
target->scrollbarsVisible = src->scrollbarsVisible;
|
||||
target->resizable = src->resizable;
|
||||
target->fullscreen = src->fullscreen;
|
||||
target->dialog = src->dialog;
|
||||
}
|
||||
};
|
||||
|
||||
// Class representing popup window features.
|
||||
typedef CefStructBase<CefPopupFeaturesTraits> CefPopupFeatures;
|
||||
|
||||
|
||||
struct CefSettingsTraits {
|
||||
typedef cef_settings_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s)
|
||||
{
|
||||
s->size = sizeof(struct_type);
|
||||
}
|
||||
|
||||
static inline void clear(struct_type* s)
|
||||
{
|
||||
cef_string_clear(&s->cache_path);
|
||||
cef_string_clear(&s->user_agent);
|
||||
cef_string_clear(&s->product_version);
|
||||
cef_string_clear(&s->locale);
|
||||
if(s->extra_plugin_paths)
|
||||
cef_string_list_free(s->extra_plugin_paths);
|
||||
cef_string_clear(&s->log_file);
|
||||
}
|
||||
|
||||
static inline void set(const struct_type* src, struct_type* target, bool copy)
|
||||
{
|
||||
target->multi_threaded_message_loop = src->multi_threaded_message_loop;
|
||||
|
||||
cef_string_set(src->cache_path.str, src->cache_path.length,
|
||||
&target->cache_path, copy);
|
||||
cef_string_set(src->user_agent.str, src->user_agent.length,
|
||||
&target->user_agent, copy);
|
||||
cef_string_set(src->product_version.str, src->product_version.length,
|
||||
&target->product_version, copy);
|
||||
cef_string_set(src->locale.str, src->locale.length, &target->locale, copy);
|
||||
|
||||
if(target->extra_plugin_paths)
|
||||
cef_string_list_free(target->extra_plugin_paths);
|
||||
target->extra_plugin_paths = src->extra_plugin_paths ?
|
||||
cef_string_list_copy(src->extra_plugin_paths) : NULL;
|
||||
|
||||
cef_string_set(src->log_file.str, src->log_file.length, &target->log_file,
|
||||
copy);
|
||||
target->log_severity = src->log_severity;
|
||||
}
|
||||
};
|
||||
|
||||
// Class representing initialization settings.
|
||||
typedef CefStructBase<CefSettingsTraits> CefSettings;
|
||||
|
||||
|
||||
struct CefBrowserSettingsTraits {
|
||||
typedef cef_browser_settings_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s)
|
||||
{
|
||||
s->size = sizeof(struct_type);
|
||||
}
|
||||
|
||||
static inline void clear(struct_type* s)
|
||||
{
|
||||
cef_string_clear(&s->standard_font_family);
|
||||
cef_string_clear(&s->fixed_font_family);
|
||||
cef_string_clear(&s->serif_font_family);
|
||||
cef_string_clear(&s->sans_serif_font_family);
|
||||
cef_string_clear(&s->cursive_font_family);
|
||||
cef_string_clear(&s->fantasy_font_family);
|
||||
cef_string_clear(&s->default_encoding);
|
||||
cef_string_clear(&s->user_style_sheet_location);
|
||||
}
|
||||
|
||||
static inline void set(const struct_type* src, struct_type* target, bool copy)
|
||||
{
|
||||
target->drag_drop_disabled = src->drag_drop_disabled;
|
||||
|
||||
cef_string_set(src->standard_font_family.str,
|
||||
src->standard_font_family.length, &target->standard_font_family, copy);
|
||||
cef_string_set(src->fixed_font_family.str, src->fixed_font_family.length,
|
||||
&target->fixed_font_family, copy);
|
||||
cef_string_set(src->serif_font_family.str, src->serif_font_family.length,
|
||||
&target->serif_font_family, copy);
|
||||
cef_string_set(src->sans_serif_font_family.str,
|
||||
src->sans_serif_font_family.length, &target->sans_serif_font_family,
|
||||
copy);
|
||||
cef_string_set(src->cursive_font_family.str,
|
||||
src->cursive_font_family.length, &target->cursive_font_family, copy);
|
||||
cef_string_set(src->fantasy_font_family.str,
|
||||
src->fantasy_font_family.length, &target->fantasy_font_family, copy);
|
||||
|
||||
target->default_font_size = src->default_font_size;
|
||||
target->default_fixed_font_size = src->default_fixed_font_size;
|
||||
target->minimum_font_size = src->minimum_font_size;
|
||||
target->minimum_logical_font_size = src->minimum_logical_font_size;
|
||||
target->remote_fonts_disabled = src->remote_fonts_disabled;
|
||||
|
||||
cef_string_set(src->default_encoding.str, src->default_encoding.length,
|
||||
&target->default_encoding, copy);
|
||||
|
||||
target->encoding_detector_enabled = src->encoding_detector_enabled;
|
||||
target->javascript_disabled = src->javascript_disabled;
|
||||
target->javascript_open_windows_disallowed =
|
||||
src->javascript_open_windows_disallowed;
|
||||
target->javascript_close_windows_disallowed =
|
||||
src->javascript_close_windows_disallowed;
|
||||
target->javascript_access_clipboard_disallowed =
|
||||
src->javascript_access_clipboard_disallowed;
|
||||
target->dom_paste_disabled = src->dom_paste_disabled;
|
||||
target->caret_browsing_enabled = src->caret_browsing_enabled;
|
||||
target->java_disabled = src->java_disabled;
|
||||
target->plugins_disabled = src->plugins_disabled;
|
||||
target->universal_access_from_file_urls_allowed =
|
||||
src->universal_access_from_file_urls_allowed;
|
||||
target->file_access_from_file_urls_allowed =
|
||||
src->file_access_from_file_urls_allowed;
|
||||
target->web_security_disabled = src->web_security_disabled;
|
||||
target->xss_auditor_enabled = src->xss_auditor_enabled;
|
||||
target->image_load_disabled = src->image_load_disabled;
|
||||
target->shrink_standalone_images_to_fit =
|
||||
src->shrink_standalone_images_to_fit;
|
||||
target->site_specific_quirks_disabled = src->site_specific_quirks_disabled;
|
||||
target->text_area_resize_disabled = src->text_area_resize_disabled;
|
||||
target->page_cache_disabled = src->page_cache_disabled;
|
||||
target->tab_to_links_disabled = src->tab_to_links_disabled;
|
||||
target->hyperlink_auditing_disabled = src->hyperlink_auditing_disabled;
|
||||
target->user_style_sheet_enabled = src->user_style_sheet_enabled;
|
||||
|
||||
cef_string_set(src->user_style_sheet_location.str,
|
||||
src->user_style_sheet_location.length,
|
||||
&target->user_style_sheet_location, copy);
|
||||
|
||||
target->author_and_user_styles_disabled =
|
||||
src->author_and_user_styles_disabled;
|
||||
target->local_storage_disabled = src->local_storage_disabled;
|
||||
target->databases_disabled = src->databases_disabled;
|
||||
target->application_cache_disabled = src->application_cache_disabled;
|
||||
target->webgl_disabled = src->webgl_disabled;
|
||||
target->accelerated_compositing_disabled =
|
||||
src->accelerated_compositing_disabled;
|
||||
target->accelerated_layers_disabled = src->accelerated_layers_disabled;
|
||||
target->accelerated_2d_canvas_disabled =
|
||||
src->accelerated_2d_canvas_disabled;
|
||||
target->developer_tools_disabled = src->developer_tools_disabled;
|
||||
}
|
||||
};
|
||||
|
||||
// Class representing browser initialization settings.
|
||||
typedef CefStructBase<CefBrowserSettingsTraits> CefBrowserSettings;
|
||||
|
||||
|
||||
struct CefURLPartsTraits {
|
||||
typedef cef_urlparts_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s) {}
|
||||
|
||||
static inline void clear(struct_type* s)
|
||||
{
|
||||
cef_string_clear(&s->spec);
|
||||
cef_string_clear(&s->scheme);
|
||||
cef_string_clear(&s->username);
|
||||
cef_string_clear(&s->password);
|
||||
cef_string_clear(&s->host);
|
||||
cef_string_clear(&s->port);
|
||||
cef_string_clear(&s->path);
|
||||
cef_string_clear(&s->query);
|
||||
}
|
||||
|
||||
static inline void set(const struct_type* src, struct_type* target, bool copy)
|
||||
{
|
||||
cef_string_set(src->spec.str, src->spec.length, &target->spec, copy);
|
||||
cef_string_set(src->scheme.str, src->scheme.length, &target->scheme, copy);
|
||||
cef_string_set(src->username.str, src->username.length, &target->username,
|
||||
copy);
|
||||
cef_string_set(src->password.str, src->password.length, &target->password,
|
||||
copy);
|
||||
cef_string_set(src->host.str, src->host.length, &target->host, copy);
|
||||
cef_string_set(src->port.str, src->port.length, &target->port, copy);
|
||||
cef_string_set(src->path.str, src->path.length, &target->path, copy);
|
||||
cef_string_set(src->query.str, src->query.length, &target->query, copy);
|
||||
}
|
||||
};
|
||||
|
||||
// Class representing a URL's component parts.
|
||||
typedef CefStructBase<CefURLPartsTraits> CefURLParts;
|
||||
|
||||
|
||||
struct CefCookieTraits {
|
||||
typedef cef_cookie_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s) {}
|
||||
|
||||
static inline void clear(struct_type* s)
|
||||
{
|
||||
cef_string_clear(&s->name);
|
||||
cef_string_clear(&s->value);
|
||||
cef_string_clear(&s->domain);
|
||||
cef_string_clear(&s->path);
|
||||
}
|
||||
|
||||
static inline void set(const struct_type* src, struct_type* target, bool copy)
|
||||
{
|
||||
cef_string_set(src->name.str, src->name.length, &target->name, copy);
|
||||
cef_string_set(src->value.str, src->value.length, &target->value, copy);
|
||||
cef_string_set(src->domain.str, src->domain.length, &target->domain, copy);
|
||||
cef_string_set(src->path.str, src->path.length, &target->path, copy);
|
||||
target->secure = src->secure;
|
||||
target->httponly = src->httponly;
|
||||
target->creation = src->creation;
|
||||
target->last_access = src->last_access;
|
||||
target->has_expires = src->has_expires;
|
||||
target->expires = src->expires;
|
||||
}
|
||||
};
|
||||
|
||||
// Class representing a cookie.
|
||||
typedef CefStructBase<CefCookieTraits> CefCookie;
|
||||
|
||||
#endif // _CEF_TYPES_WRAPPERS_H
|
161
include/internal/cef_win.h
Normal file
161
include/internal/cef_win.h
Normal file
@@ -0,0 +1,161 @@
|
||||
// Copyright (c) 2008 Marshall A. Greenblatt. 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 Google Inc. nor the name Chromium Embedded
|
||||
// Framework 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 _CEF_WIN_H
|
||||
#define _CEF_WIN_H
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
#include "cef_types_win.h"
|
||||
#include "cef_types_wrappers.h"
|
||||
|
||||
// Atomic increment and decrement.
|
||||
#define CefAtomicIncrement(p) InterlockedIncrement(p)
|
||||
#define CefAtomicDecrement(p) InterlockedDecrement(p)
|
||||
|
||||
// Critical section wrapper.
|
||||
class CefCriticalSection
|
||||
{
|
||||
public:
|
||||
CefCriticalSection()
|
||||
{
|
||||
memset(&m_sec, 0, sizeof(CRITICAL_SECTION));
|
||||
InitializeCriticalSection(&m_sec);
|
||||
}
|
||||
virtual ~CefCriticalSection()
|
||||
{
|
||||
DeleteCriticalSection(&m_sec);
|
||||
}
|
||||
void Lock()
|
||||
{
|
||||
EnterCriticalSection(&m_sec);
|
||||
}
|
||||
void Unlock()
|
||||
{
|
||||
LeaveCriticalSection(&m_sec);
|
||||
}
|
||||
|
||||
CRITICAL_SECTION m_sec;
|
||||
};
|
||||
|
||||
// Handle types.
|
||||
#define CefWindowHandle cef_window_handle_t
|
||||
#define CefCursorHandle cef_cursor_handle_t
|
||||
|
||||
|
||||
struct CefWindowInfoTraits {
|
||||
typedef cef_window_info_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s) {}
|
||||
|
||||
static inline void clear(struct_type* s)
|
||||
{
|
||||
cef_string_clear(&s->m_windowName);
|
||||
}
|
||||
|
||||
static inline void set(const struct_type* src, struct_type* target, bool copy)
|
||||
{
|
||||
target->m_dwExStyle = src->m_dwExStyle;
|
||||
cef_string_set(src->m_windowName.str, src->m_windowName.length,
|
||||
&target->m_windowName, copy);
|
||||
target->m_dwStyle = src->m_dwStyle;
|
||||
target->m_x = src->m_x;
|
||||
target->m_y = src->m_y;
|
||||
target->m_nWidth = src->m_nWidth;
|
||||
target->m_nHeight = src->m_nHeight;
|
||||
target->m_hWndParent = src->m_hWndParent;
|
||||
target->m_hMenu = src->m_hMenu;
|
||||
target->m_bWindowRenderingDisabled = src->m_bWindowRenderingDisabled;
|
||||
target->m_hWnd = src->m_hWnd;
|
||||
}
|
||||
};
|
||||
|
||||
// Class representing window information.
|
||||
class CefWindowInfo : public CefStructBase<CefWindowInfoTraits>
|
||||
{
|
||||
public:
|
||||
typedef CefStructBase<CefWindowInfoTraits> parent;
|
||||
|
||||
CefWindowInfo() : parent() {}
|
||||
CefWindowInfo(const cef_window_info_t& r) : parent(r) {}
|
||||
CefWindowInfo(const CefWindowInfo& r) : parent(r) {}
|
||||
|
||||
void SetAsChild(HWND hWndParent, RECT windowRect)
|
||||
{
|
||||
m_dwStyle = WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_TABSTOP |
|
||||
WS_VISIBLE;
|
||||
m_hWndParent = hWndParent;
|
||||
m_x = windowRect.left;
|
||||
m_y = windowRect.top;
|
||||
m_nWidth = windowRect.right - windowRect.left;
|
||||
m_nHeight = windowRect.bottom - windowRect.top;
|
||||
}
|
||||
|
||||
void SetAsPopup(HWND hWndParent, const CefString& windowName)
|
||||
{
|
||||
m_dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS |
|
||||
WS_VISIBLE;
|
||||
m_hWndParent = hWndParent;
|
||||
m_x = CW_USEDEFAULT;
|
||||
m_y = CW_USEDEFAULT;
|
||||
m_nWidth = CW_USEDEFAULT;
|
||||
m_nHeight = CW_USEDEFAULT;
|
||||
|
||||
cef_string_copy(windowName.c_str(), windowName.length(), &m_windowName);
|
||||
}
|
||||
|
||||
void SetAsOffScreen(HWND hWndParent)
|
||||
{
|
||||
m_bWindowRenderingDisabled = TRUE;
|
||||
m_hWndParent = hWndParent;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
struct CefPrintInfoTraits {
|
||||
typedef cef_print_info_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s) {}
|
||||
static inline void clear(struct_type* s) {}
|
||||
|
||||
static inline void set(const struct_type* src, struct_type* target, bool copy)
|
||||
{
|
||||
target->m_hDC = src->m_hDC;
|
||||
target->m_Rect = src->m_Rect;
|
||||
target->m_Scale = src->m_Scale;
|
||||
}
|
||||
};
|
||||
|
||||
// Class representing print context information.
|
||||
typedef CefStructBase<CefPrintInfoTraits> CefPrintInfo;
|
||||
|
||||
#endif // OS_WIN
|
||||
|
||||
#endif // _CEF_WIN_H
|
Reference in New Issue
Block a user