Change comment format to support automatic document generation using the CppDoc application.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@249 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2011-05-31 17:12:37 +00:00
parent 3a6ddf782a
commit 2779179489
19 changed files with 2336 additions and 149 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -33,15 +33,17 @@
#include "internal/cef_nplugin_types.h" #include "internal/cef_nplugin_types.h"
///
// Netscape plugins are normally built at separate DLLs that are loaded by the // Netscape plugins are normally built at separate DLLs that are loaded by the
// browser when needed. This interface supports the creation of plugins that // browser when needed. This interface supports the creation of plugins that
// are an embedded component of the application. Embedded plugins built using // are an embedded component of the application. Embedded plugins built using
// this interface use the same Netscape Plugin API as DLL-based plugins. // this interface use the same Netscape Plugin API as DLL-based plugins.
// See https://developer.mozilla.org/En/Gecko_Plugin_API_Reference for complete // See https://developer.mozilla.org/En/Gecko_Plugin_API_Reference for complete
// documentation on how to use the Netscape Plugin API. // documentation on how to use the Netscape Plugin API.
//
// This class provides attribute information and entry point functions for a // This class provides attribute information and entry point functions for a
// plugin. // plugin.
///
class CefPluginInfo : public cef_plugin_info_t class CefPluginInfo : public cef_plugin_info_t
{ {
public: public:
@ -111,7 +113,9 @@ protected:
} }
}; };
///
// Register a plugin with the system. // Register a plugin with the system.
///
bool CefRegisterPlugin(const CefPluginInfo& plugin_info); bool CefRegisterPlugin(const CefPluginInfo& plugin_info);
#endif // _CEF_NPLUGIN_H #endif // _CEF_NPLUGIN_H

View File

@ -37,7 +37,9 @@ extern "C" {
#include "internal/cef_nplugin_types.h" #include "internal/cef_nplugin_types.h"
///
// Register a plugin with the system. Returns true (1) on success. // Register a plugin with the system. Returns true (1) on success.
///
CEF_EXPORT int cef_register_plugin(const cef_plugin_info_t* plugin_info); CEF_EXPORT int cef_register_plugin(const cef_plugin_info_t* plugin_info);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -40,11 +40,12 @@
#include <map> #include <map>
#include <vector> #include <vector>
///
// Thread safe class for representing XML data as a structured object. This // Thread safe class for representing XML data as a structured object. This
// class should not be used with large XML documents because all data will be // class should not be used with large XML documents because all data will be
// resident in memory at the same time. This implementation supports a // resident in memory at the same time. This implementation supports a
// restricted set of XML features: // restricted set of XML features:
// <pre>
// (1) Processing instructions, whitespace and comments are ignored. // (1) Processing instructions, whitespace and comments are ignored.
// (2) Elements and attributes must always be referenced using the fully // (2) Elements and attributes must always be referenced using the fully
// qualified name (ie, namespace:localname). // qualified name (ie, namespace:localname).
@ -60,59 +61,81 @@
// (b) Entity reference nodes are resolved to the corresponding entity // (b) Entity reference nodes are resolved to the corresponding entity
// value. // value.
// (c) Element nodes are represented by their outer XML string. // (c) Element nodes are represented by their outer XML string.
// </pre>
///
class CefXmlObject : public CefBase class CefXmlObject : public CefBase
{ {
public: public:
typedef std::vector<CefRefPtr<CefXmlObject> > ObjectVector; typedef std::vector<CefRefPtr<CefXmlObject> > ObjectVector;
typedef std::map<CefString, CefString > AttributeMap; typedef std::map<CefString, CefString > AttributeMap;
///
// Create a new object with the specified name. An object name must always be // Create a new object with the specified name. An object name must always be
// at least one character long. // at least one character long.
///
CefXmlObject(const CefString& name); CefXmlObject(const CefString& name);
virtual ~CefXmlObject(); virtual ~CefXmlObject();
///
// Load the contents of the specified XML stream into this object. The // Load the contents of the specified XML stream into this object. The
// existing children and attributes, if any, will first be cleared. // existing children and attributes, if any, will first be cleared.
///
bool Load(CefRefPtr<CefStreamReader> stream, bool Load(CefRefPtr<CefStreamReader> stream,
CefXmlReader::EncodingType encodingType, CefXmlReader::EncodingType encodingType,
const CefString& URI, CefString* loadError); const CefString& URI, CefString* loadError);
///
// Set the name, children and attributes of this object to a duplicate of the // Set the name, children and attributes of this object to a duplicate of the
// specified object's contents. The existing children and attributes, if any, // specified object's contents. The existing children and attributes, if any,
// will first be cleared. // will first be cleared.
///
void Set(CefRefPtr<CefXmlObject> object); void Set(CefRefPtr<CefXmlObject> object);
///
// Append a duplicate of the children and attributes of the specified object // Append a duplicate of the children and attributes of the specified object
// to this object. If |overwriteAttributes| is true then any attributes in // to this object. If |overwriteAttributes| is true then any attributes in
// this object that also exist in the specified object will be overwritten // this object that also exist in the specified object will be overwritten
// with the new values. The name of this object is not changed. // with the new values. The name of this object is not changed.
///
void Append(CefRefPtr<CefXmlObject> object, bool overwriteAttributes); void Append(CefRefPtr<CefXmlObject> object, bool overwriteAttributes);
///
// Return a new object with the same name, children and attributes as this // Return a new object with the same name, children and attributes as this
// object. The parent of the new object will be NULL. // object. The parent of the new object will be NULL.
///
CefRefPtr<CefXmlObject> Duplicate(); CefRefPtr<CefXmlObject> Duplicate();
///
// Clears this object's children and attributes. The name and parenting of // Clears this object's children and attributes. The name and parenting of
// this object are not changed. // this object are not changed.
///
void Clear(); void Clear();
///
// Access the object's name. An object name must always be at least one // Access the object's name. An object name must always be at least one
// character long. // character long.
///
CefString GetName(); CefString GetName();
bool SetName(const CefString& name); bool SetName(const CefString& name);
///
// Access the object's parent. The parent can be NULL if this object has not // Access the object's parent. The parent can be NULL if this object has not
// been added as the child on another object. // been added as the child on another object.
///
bool HasParent(); bool HasParent();
CefRefPtr<CefXmlObject> GetParent(); CefRefPtr<CefXmlObject> GetParent();
///
// Access the object's value. An object cannot have a value if it also has // Access the object's value. An object cannot have a value if it also has
// children. Attempting to set the value while children exist will fail. // children. Attempting to set the value while children exist will fail.
///
bool HasValue(); bool HasValue();
CefString GetValue(); CefString GetValue();
bool SetValue(const CefString& value); bool SetValue(const CefString& value);
///
// Access the object's attributes. Attributes must have unique names. // Access the object's attributes. Attributes must have unique names.
///
bool HasAttributes(); bool HasAttributes();
size_t GetAttributeCount(); size_t GetAttributeCount();
bool HasAttribute(const CefString& name); bool HasAttribute(const CefString& name);
@ -121,11 +144,13 @@ public:
size_t GetAttributes(AttributeMap& attributes); size_t GetAttributes(AttributeMap& attributes);
void ClearAttributes(); void ClearAttributes();
///
// Access the object's children. Each object can only have one parent so // Access the object's children. Each object can only have one parent so
// attempting to add an object that already has a parent will fail. Removing a // attempting to add an object that already has a parent will fail. Removing a
// child will set the child's parent to NULL. Adding a child will set the // child will set the child's parent to NULL. Adding a child will set the
// child's parent to this object. This object's value, if any, will be cleared // child's parent to this object. This object's value, if any, will be cleared
// if a child is added. // if a child is added.
///
bool HasChildren(); bool HasChildren();
size_t GetChildCount(); size_t GetChildCount();
bool HasChild(CefRefPtr<CefXmlObject> child); bool HasChild(CefRefPtr<CefXmlObject> child);
@ -134,10 +159,14 @@ public:
size_t GetChildren(ObjectVector& children); size_t GetChildren(ObjectVector& children);
void ClearChildren(); void ClearChildren();
///
// Find the first child with the specified name. // Find the first child with the specified name.
///
CefRefPtr<CefXmlObject> FindChild(const CefString& name); CefRefPtr<CefXmlObject> FindChild(const CefString& name);
///
// Find all children with the specified name. // Find all children with the specified name.
///
size_t FindChildren(const CefString& name, ObjectVector& children); size_t FindChildren(const CefString& name, ObjectVector& children);
private: private:
@ -154,28 +183,40 @@ private:
}; };
///
// Thread safe implementation of the CefReadHandler class for reading an // Thread safe implementation of the CefReadHandler class for reading an
// in-memory array of bytes. // in-memory array of bytes.
///
class CefByteReadHandler : public CefReadHandler class CefByteReadHandler : public CefReadHandler
{ {
public: public:
///
// Create a new object for reading an array of bytes. An optional |source| // Create a new object for reading an array of bytes. An optional |source|
// reference can be kept to keep the underlying data source from being // reference can be kept to keep the underlying data source from being
// released while the reader exists. // released while the reader exists.
///
CefByteReadHandler(const unsigned char* bytes, size_t size, CefByteReadHandler(const unsigned char* bytes, size_t size,
CefRefPtr<CefBase> source); CefRefPtr<CefBase> source);
///
// Read raw binary data. // Read raw binary data.
///
virtual size_t Read(void* ptr, size_t size, size_t n); virtual size_t Read(void* ptr, size_t size, size_t n);
///
// Seek to the specified offset position. |whence| may be any one of // Seek to the specified offset position. |whence| may be any one of
// SEEK_CUR, SEEK_END or SEEK_SET. // SEEK_CUR, SEEK_END or SEEK_SET.
///
virtual int Seek(long offset, int whence); virtual int Seek(long offset, int whence);
///
// Return the current offset position. // Return the current offset position.
///
virtual long Tell(); virtual long Tell();
///
// Return non-zero if at end of file. // Return non-zero if at end of file.
///
virtual int Eof(); virtual int Eof();
private: private:
@ -189,6 +230,7 @@ private:
}; };
///
// Thread-safe class for accessing zip archive file contents. This class should // Thread-safe class for accessing zip archive file contents. This class should
// not be used with large archive files because all data will be resident in // not be used with large archive files because all data will be resident in
// memory at the same time. This implementation supports a restricted set of zip // memory at the same time. This implementation supports a restricted set of zip
@ -198,51 +240,76 @@ private:
// (3) File ordering from the original zip archive is not maintained. This // (3) File ordering from the original zip archive is not maintained. This
// means that files from the same folder may not be located together in the // means that files from the same folder may not be located together in the
// file content map. // file content map.
///
class CefZipArchive : public CefBase class CefZipArchive : public CefBase
{ {
public: public:
///
// Class representing a file in the archive. Accessing the file data from // Class representing a file in the archive. Accessing the file data from
// multiple threads is safe provided a reference to the File object is kept. // multiple threads is safe provided a reference to the File object is kept.
///
class File : public CefBase class File : public CefBase
{ {
public: public:
///
// Returns the read-only data contained in the file. // Returns the read-only data contained in the file.
///
virtual const unsigned char* GetData() =0; virtual const unsigned char* GetData() =0;
///
// Returns the size of the data in the file. // Returns the size of the data in the file.
///
virtual size_t GetDataSize() =0; virtual size_t GetDataSize() =0;
///
// Returns a CefStreamReader object for streaming the contents of the file. // Returns a CefStreamReader object for streaming the contents of the file.
///
virtual CefRefPtr<CefStreamReader> GetStreamReader() =0; virtual CefRefPtr<CefStreamReader> GetStreamReader() =0;
}; };
typedef std::map<CefString, CefRefPtr<File> > FileMap; typedef std::map<CefString, CefRefPtr<File> > FileMap;
///
// Create a new object. // Create a new object.
///
CefZipArchive(); CefZipArchive();
virtual ~CefZipArchive(); virtual ~CefZipArchive();
///
// Load the contents of the specified zip archive stream into this object. // Load the contents of the specified zip archive stream into this object.
// If |overwriteExisting| is true then any files in this object that also // If |overwriteExisting| is true then any files in this object that also
// exist in the specified archive will be replaced with the new files. // exist in the specified archive will be replaced with the new files.
// Returns the number of files successfully loaded. // Returns the number of files successfully loaded.
///
size_t Load(CefRefPtr<CefStreamReader> stream, bool overwriteExisting); size_t Load(CefRefPtr<CefStreamReader> stream, bool overwriteExisting);
///
// Clears the contents of this object. // Clears the contents of this object.
///
void Clear(); void Clear();
///
// Returns the number of files in the archive. // Returns the number of files in the archive.
///
size_t GetFileCount(); size_t GetFileCount();
///
// Returns true if the specified file exists and has contents. // Returns true if the specified file exists and has contents.
///
bool HasFile(const CefString& fileName); bool HasFile(const CefString& fileName);
///
// Returns the specified file. // Returns the specified file.
///
CefRefPtr<File> GetFile(const CefString& fileName); CefRefPtr<File> GetFile(const CefString& fileName);
///
// Removes the specified file. // Removes the specified file.
///
bool RemoveFile(const CefString& fileName); bool RemoveFile(const CefString& fileName);
///
// Returns the map of all files. // Returns the map of all files.
///
size_t GetFiles(FileMap& map); size_t GetFiles(FileMap& map);
private: private:

View File

@ -32,13 +32,14 @@
#ifndef _CEF_PTR_H #ifndef _CEF_PTR_H
#define _CEF_PTR_H #define _CEF_PTR_H
///
// Smart pointer implementation borrowed from base/ref_counted.h // Smart pointer implementation borrowed from base/ref_counted.h
// // <p>
// A smart pointer class for reference counted objects. Use this class instead // A smart pointer class for reference counted objects. Use this class instead
// of calling AddRef and Release manually on a reference counted object to // of calling AddRef and Release manually on a reference counted object to
// avoid common memory leaks caused by forgetting to Release an object // avoid common memory leaks caused by forgetting to Release an object
// reference. Sample usage: // reference. Sample usage:
// // <pre>
// class MyFoo : public CefBase { // class MyFoo : public CefBase {
// ... // ...
// }; // };
@ -59,11 +60,11 @@
// if (foo) // if (foo)
// foo->Method(param); // foo->Method(param);
// } // }
// // </pre>
// The above examples show how CefRefPtr<T> acts like a pointer to T. // The above examples show how CefRefPtr<T> acts like a pointer to T.
// Given two CefRefPtr<T> classes, it is also possible to exchange // Given two CefRefPtr<T> classes, it is also possible to exchange
// references between the two objects, like so: // references between the two objects, like so:
// // <pre>
// { // {
// CefRefPtr<MyFoo> a = new MyFoo(); // CefRefPtr<MyFoo> a = new MyFoo();
// CefRefPtr<MyFoo> b; // CefRefPtr<MyFoo> b;
@ -71,10 +72,10 @@
// b.swap(a); // b.swap(a);
// // now, |b| references the MyFoo object, and |a| references NULL. // // now, |b| references the MyFoo object, and |a| references NULL.
// } // }
// // </pre>
// To make both |a| and |b| in the above example reference the same MyFoo // To make both |a| and |b| in the above example reference the same MyFoo
// object, simply use the assignment operator: // object, simply use the assignment operator:
// // <pre>
// { // {
// CefRefPtr<MyFoo> a = new MyFoo(); // CefRefPtr<MyFoo> a = new MyFoo();
// CefRefPtr<MyFoo> b; // CefRefPtr<MyFoo> b;
@ -83,10 +84,10 @@
// // now, |a| and |b| each own a reference to the same MyFoo object. // // now, |a| and |b| each own a reference to the same MyFoo object.
// // the reference count of the underlying MyFoo object will be 2. // // the reference count of the underlying MyFoo object will be 2.
// } // }
// // </pre>
// Reference counted objects can also be passed as function parameters and // Reference counted objects can also be passed as function parameters and
// used as function return values: // used as function return values:
// // <pre>
// void some_func_with_param(CefRefPtr<MyFoo> param) { // void some_func_with_param(CefRefPtr<MyFoo> param) {
// // A reference is added to the MyFoo object that |param| represents // // A reference is added to the MyFoo object that |param| represents
// // during the scope of some_func_with_param() and released when // // during the scope of some_func_with_param() and released when
@ -121,9 +122,9 @@
// // return value, the MyFoo object created in some_func_with_retval() // // return value, the MyFoo object created in some_func_with_retval()
// // will automatically be released. // // will automatically be released.
// } // }
// // </pre>
// And in standard containers: // And in standard containers:
// // <pre>
// { // {
// // Create a vector that holds MyFoo objects. // // Create a vector that holds MyFoo objects.
// std::vector<CefRefPtr<MyFoo> > MyFooVec; // std::vector<CefRefPtr<MyFoo> > MyFooVec;
@ -136,7 +137,9 @@
// // is increased to 2. // // is increased to 2.
// MyFooVec.push_back(foo); // MyFooVec.push_back(foo);
// } // }
// // </pre>
// </p>
///
template <class T> template <class T>
class CefRefPtr { class CefRefPtr {
public: public:

View File

@ -48,10 +48,10 @@
#ifdef __cplusplus #ifdef __cplusplus
#include "cef_string_wrappers.h" #include "cef_string_wrappers.h"
#if defined(CEF_STRING_TYPE_UTF8) #if defined(CEF_STRING_TYPE_UTF16)
typedef CefStringUTF8 CefString;
#elif defined(CEF_STRING_TYPE_UTF16)
typedef CefStringUTF16 CefString; typedef CefStringUTF16 CefString;
#elif defined(CEF_STRING_TYPE_UTF8)
typedef CefStringUTF8 CefString;
#elif defined(CEF_STRING_TYPE_WIDE) #elif defined(CEF_STRING_TYPE_WIDE)
typedef CefStringWide CefString; typedef CefStringWide CefString;
#endif #endif

View File

@ -37,31 +37,47 @@
extern "C" { extern "C" {
#endif #endif
///
// CEF string maps are a set of key/value string pairs. // CEF string maps are a set of key/value string pairs.
///
typedef void* cef_string_list_t; typedef void* cef_string_list_t;
///
// Allocate a new string map. // Allocate a new string map.
///
CEF_EXPORT cef_string_list_t cef_string_list_alloc(); CEF_EXPORT cef_string_list_t cef_string_list_alloc();
///
// Return the number of elements in the string list. // Return the number of elements in the string list.
///
CEF_EXPORT int cef_string_list_size(cef_string_list_t 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 // Retrieve the value at the specified zero-based string list index. Returns
// true (1) if the value was successfully retrieved. // true (1) if the value was successfully retrieved.
///
CEF_EXPORT int cef_string_list_value(cef_string_list_t list, CEF_EXPORT int cef_string_list_value(cef_string_list_t list,
int index, cef_string_t* value); int index, cef_string_t* value);
///
// Append a new value at the end of the string list. // Append a new value at the end of the string list.
///
CEF_EXPORT void cef_string_list_append(cef_string_list_t list, CEF_EXPORT void cef_string_list_append(cef_string_list_t list,
const cef_string_t* value); const cef_string_t* value);
///
// Clear the string list. // Clear the string list.
///
CEF_EXPORT void cef_string_list_clear(cef_string_list_t list); CEF_EXPORT void cef_string_list_clear(cef_string_list_t list);
///
// Free the string list. // Free the string list.
///
CEF_EXPORT void cef_string_list_free(cef_string_list_t list); CEF_EXPORT void cef_string_list_free(cef_string_list_t list);
///
// Creates a copy of an existing string list. // Creates a copy of an existing string list.
///
CEF_EXPORT cef_string_list_t cef_string_list_copy(cef_string_list_t list); CEF_EXPORT cef_string_list_t cef_string_list_copy(cef_string_list_t list);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -37,37 +37,55 @@
extern "C" { extern "C" {
#endif #endif
///
// CEF string maps are a set of key/value string pairs. // CEF string maps are a set of key/value string pairs.
///
typedef void* cef_string_map_t; typedef void* cef_string_map_t;
///
// Allocate a new string map. // Allocate a new string map.
///
CEF_EXPORT cef_string_map_t cef_string_map_alloc(); CEF_EXPORT cef_string_map_t cef_string_map_alloc();
///
// Return the number of elements in the string map. // Return the number of elements in the string map.
///
CEF_EXPORT int cef_string_map_size(cef_string_map_t map); CEF_EXPORT int cef_string_map_size(cef_string_map_t map);
///
// Return the value assigned to the specified key. // Return the value assigned to the specified key.
///
CEF_EXPORT int cef_string_map_find(cef_string_map_t map, CEF_EXPORT int cef_string_map_find(cef_string_map_t map,
const cef_string_t* key, const cef_string_t* key,
cef_string_t* value); cef_string_t* value);
///
// Return the key at the specified zero-based string map index. // 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_EXPORT int cef_string_map_key(cef_string_map_t map, int index,
cef_string_t* key); cef_string_t* key);
///
// Return the value at the specified zero-based string map index. // 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_EXPORT int cef_string_map_value(cef_string_map_t map, int index,
cef_string_t* value); cef_string_t* value);
///
// Append a new key/value pair at the end of the string map. // 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, CEF_EXPORT int cef_string_map_append(cef_string_map_t map,
const cef_string_t* key, const cef_string_t* key,
const cef_string_t* value); const cef_string_t* value);
///
// Clear the string map. // Clear the string map.
///
CEF_EXPORT void cef_string_map_clear(cef_string_map_t map); CEF_EXPORT void cef_string_map_clear(cef_string_map_t map);
///
// Free the string map. // Free the string map.
///
CEF_EXPORT void cef_string_map_free(cef_string_map_t map); CEF_EXPORT void cef_string_map_free(cef_string_map_t map);

View File

@ -82,9 +82,11 @@ typedef struct _cef_string_utf16_t {
} cef_string_utf16_t; } cef_string_utf16_t;
///
// These functions set string values. If |copy| is true (1) the value will be // 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 // copied instead of referenced. It is up to the user to properly manage
// the lifespan of references. // the lifespan of references.
///
CEF_EXPORT int cef_string_wide_set(const wchar_t* src, size_t src_len, CEF_EXPORT int cef_string_wide_set(const wchar_t* src, size_t src_len,
cef_string_wide_t* output, int copy); cef_string_wide_t* output, int copy);
@ -94,7 +96,9 @@ CEF_EXPORT int cef_string_utf16_set(const char16_t* src, size_t src_len,
cef_string_utf16_t* output, int copy); cef_string_utf16_t* output, int copy);
///
// Convenience macros for copying values. // Convenience macros for copying values.
///
#define cef_string_wide_copy(src, src_len, output) \ #define cef_string_wide_copy(src, src_len, output) \
cef_string_wide_set(src, src_len, output, true) cef_string_wide_set(src, src_len, output, true)
@ -104,14 +108,18 @@ CEF_EXPORT int cef_string_utf16_set(const char16_t* src, size_t src_len,
cef_string_utf16_set(src, src_len, output, true) cef_string_utf16_set(src, src_len, output, true)
///
// These functions clear string values. The structure itself is not freed. // 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_wide_clear(cef_string_wide_t* str);
CEF_EXPORT void cef_string_utf8_clear(cef_string_utf8_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); CEF_EXPORT void cef_string_utf16_clear(cef_string_utf16_t* str);
///
// These functions compare two string values with the same results as strcmp(). // 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, CEF_EXPORT int cef_string_wide_cmp(const cef_string_wide_t* str1,
const cef_string_wide_t* str2); const cef_string_wide_t* str2);
@ -121,10 +129,12 @@ CEF_EXPORT int cef_string_utf16_cmp(const cef_string_utf16_t* str1,
const cef_string_utf16_t* str2); const cef_string_utf16_t* str2);
///
// These functions convert between UTF-8, -16, and -32 strings. They are // These functions convert between UTF-8, -16, and -32 strings. They are
// potentially slow so unnecessary conversions should be avoided. The best // potentially slow so unnecessary conversions should be avoided. The best
// possible result will always be written to |output| with the boolean return // possible result will always be written to |output| with the boolean return
// value indicating whether the conversion is 100% valid. // 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_EXPORT int cef_string_wide_to_utf8(const wchar_t* src, size_t src_len,
cef_string_utf8_t* output); cef_string_utf8_t* output);
@ -142,9 +152,11 @@ CEF_EXPORT int cef_string_utf16_to_utf8(const char16_t* src, size_t src_len,
cef_string_utf8_t* output); cef_string_utf8_t* output);
///
// These functions convert an ASCII string, typically a hardcoded constant, to a // 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 // Wide/UTF16 string. Use instead of the UTF8 conversion routines if you know
// the string is ASCII. // the string is ASCII.
///
CEF_EXPORT int cef_string_ascii_to_wide(const char* src, size_t src_len, CEF_EXPORT int cef_string_ascii_to_wide(const char* src, size_t src_len,
cef_string_wide_t* output); cef_string_wide_t* output);
@ -153,25 +165,31 @@ CEF_EXPORT int cef_string_ascii_to_utf16(const char* src, size_t src_len,
///
// It is sometimes necessary for the system to allocate string structures with // 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 // the expectation that the user will free them. The userfree types act as a
// hint that the user is responsible for freeing the structure. // hint that the user is responsible for freeing the structure.
///
typedef cef_string_wide_t* cef_string_userfree_wide_t; typedef cef_string_wide_t* cef_string_userfree_wide_t;
typedef cef_string_utf8_t* cef_string_userfree_utf8_t; typedef cef_string_utf8_t* cef_string_userfree_utf8_t;
typedef cef_string_utf16_t* cef_string_userfree_utf16_t; typedef cef_string_utf16_t* cef_string_userfree_utf16_t;
///
// These functions allocate a new string structure. They must be freed by // These functions allocate a new string structure. They must be freed by
// calling the associated free function. // calling the associated free function.
///
CEF_EXPORT cef_string_userfree_wide_t cef_string_userfree_wide_alloc(); 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_utf8_t cef_string_userfree_utf8_alloc();
CEF_EXPORT cef_string_userfree_utf16_t cef_string_userfree_utf16_alloc(); CEF_EXPORT cef_string_userfree_utf16_t cef_string_userfree_utf16_alloc();
///
// These functions free the string structure allocated by the associated // These functions free the string structure allocated by the associated
// alloc function. Any string contents will first be cleared. // 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_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_utf8_free(cef_string_userfree_utf8_t str);

View File

@ -37,7 +37,9 @@
#include <memory.h> #include <memory.h>
#include <string> #include <string>
///
// Traits implementation for wide character strings. // Traits implementation for wide character strings.
///
struct CefStringTraitsWide { struct CefStringTraitsWide {
typedef wchar_t char_type; typedef wchar_t char_type;
typedef cef_string_wide_t struct_type; typedef cef_string_wide_t struct_type;
@ -115,7 +117,9 @@ struct CefStringTraitsWide {
#endif // BUILDING_CEF_SHARED #endif // BUILDING_CEF_SHARED
}; };
///
// Traits implementation for utf8 character strings. // Traits implementation for utf8 character strings.
///
struct CefStringTraitsUTF8 { struct CefStringTraitsUTF8 {
typedef char char_type; typedef char char_type;
typedef cef_string_utf8_t struct_type; typedef cef_string_utf8_t struct_type;
@ -180,7 +184,9 @@ struct CefStringTraitsUTF8 {
#endif // BUILDING_CEF_SHARED #endif // BUILDING_CEF_SHARED
}; };
///
// Traits implementation for utf16 character strings. // Traits implementation for utf16 character strings.
///
struct CefStringTraitsUTF16 { struct CefStringTraitsUTF16 {
typedef char16_t char_type; typedef char16_t char_type;
typedef cef_string_utf16_t struct_type; typedef cef_string_utf16_t struct_type;
@ -259,7 +265,34 @@ struct CefStringTraitsUTF16 {
#endif // BUILDING_CEF_SHARED #endif // BUILDING_CEF_SHARED
}; };
// String template. ///
// 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).
// <p>
// 1. Implicit conversion using the assignment operator overload.
// <pre>
// CefStringWide aCefString;
// std::string aUTF8String;
// aCefString = aUTF8String; // Assign std::string to CefStringWide
// aUTF8String = aCefString; // Assign CefStringWide to std::string
// </pre>
// 2. Explicit conversion using the FromString/ToString methods.
// <pre>
// CefStringWide aCefString;
// std::string aUTF8String;
// aCefString.FromString(aUTF8String); // Assign std::string to CefStringWide
// aUTF8String = aCefString.ToString(); // Assign CefStringWide to std::string
// </pre>
// 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.
// </p>
// 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.
///
template <class traits> template <class traits>
class CefStringBase { class CefStringBase {
public: public:
@ -267,50 +300,64 @@ public:
typedef typename traits::struct_type struct_type; typedef typename traits::struct_type struct_type;
typedef typename traits::userfree_struct_type userfree_struct_type; typedef typename traits::userfree_struct_type userfree_struct_type;
///
// Default constructor. // Default constructor.
///
CefStringBase() : string_(NULL), owner_(false) {} CefStringBase() : string_(NULL), owner_(false) {}
///
// Create a new string from an existing string. Data will always be copied. // Create a new string from an existing string. Data will always be copied.
///
CefStringBase(const CefStringBase& str) : string_(NULL), owner_(false) CefStringBase(const CefStringBase& str) : string_(NULL), owner_(false)
{ FromString(str.c_str(), str.length(), true); } { FromString(str.c_str(), str.length(), true); }
///
// Create a new string from an existing std::string. Data will be always // Create a new string from an existing std::string. Data will be always
// copied. Translation will occur if necessary based on the underlying string // copied. Translation will occur if necessary based on the underlying string
// type. // type.
///
CefStringBase(const std::string& src) : string_(NULL), owner_(false) CefStringBase(const std::string& src) : string_(NULL), owner_(false)
{ FromString(src); } { FromString(src); }
CefStringBase(const char* src) : string_(NULL), owner_(false) CefStringBase(const char* src) : string_(NULL), owner_(false)
{ FromString(std::string(src)); } { FromString(std::string(src)); }
///
// Create a new string from an existing std::wstring. Data will be always // Create a new string from an existing std::wstring. Data will be always
// copied. Translation will occur if necessary based on the underlying string // copied. Translation will occur if necessary based on the underlying string
// type. // type.
///
CefStringBase(const std::wstring& src) : string_(NULL), owner_(false) CefStringBase(const std::wstring& src) : string_(NULL), owner_(false)
{ FromWString(src); } { FromWString(src); }
CefStringBase(const wchar_t* src) : string_(NULL), owner_(false) CefStringBase(const wchar_t* src) : string_(NULL), owner_(false)
{ FromWString(std::wstring(src)); } { FromWString(std::wstring(src)); }
#if (defined(BUILDING_CEF_SHARED) && defined(WCHAR_T_IS_UTF32)) #if (defined(BUILDING_CEF_SHARED) && defined(WCHAR_T_IS_UTF32))
///
// Create a new string from an existing string16. Data will be always // Create a new string from an existing string16. Data will be always
// copied. Translation will occur if necessary based on the underlying string // copied. Translation will occur if necessary based on the underlying string
// type. // type.
///
CefStringBase(const string16& src) : string_(NULL), owner_(false) CefStringBase(const string16& src) : string_(NULL), owner_(false)
{ FromString16(src); } { FromString16(src); }
CefStringBase(const char16_t* src) : string_(NULL), owner_(false) CefStringBase(const char16_t* src) : string_(NULL), owner_(false)
{ FromString16(string16(src)); } { FromString16(string16(src)); }
#endif // BUILDING_CEF_SHARED && WCHAR_T_IS_UTF32 #endif // BUILDING_CEF_SHARED && WCHAR_T_IS_UTF32
///
// Create a new string from an existing character array. If |copy| is true // 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 // this class will copy the data. Otherwise, this class will reference the
// existing data. Referenced data must exist for the lifetime of this class // existing data. Referenced data must exist for the lifetime of this class
// and will not be freed by this class. // and will not be freed by this class.
///
CefStringBase(const char_type* src, size_t src_len, bool copy) CefStringBase(const char_type* src, size_t src_len, bool copy)
: string_(NULL), owner_(false) : string_(NULL), owner_(false)
{ FromString(src, src_len, copy); } { FromString(src, src_len, copy); }
///
// Create a new string referencing an existing string structure without taking // Create a new string referencing an existing string structure without taking
// ownership. Referenced structures must exist for the lifetime of this class // ownership. Referenced structures must exist for the lifetime of this class
// and will not be freed by this class. // and will not be freed by this class.
///
CefStringBase(const struct_type* src) : string_(NULL), owner_(false) CefStringBase(const struct_type* src) : string_(NULL), owner_(false)
{ {
if (!src) if (!src)
@ -325,19 +372,29 @@ public:
// The following methods are named for compatibility with the standard library // The following methods are named for compatibility with the standard library
// string template types. // string template types.
///
// Return a read-only pointer to the string data. // Return a read-only pointer to the string data.
///
const char_type* c_str() const { return (string_ ? string_->str : NULL); } const char_type* c_str() const { return (string_ ? string_->str : NULL); }
///
// Return the length of the string data. // Return the length of the string data.
///
size_t length() const { return (string_ ? string_->length : 0); } size_t length() const { return (string_ ? string_->length : 0); }
///
// Return the length of the string data. // Return the length of the string data.
///
inline size_t size() const { return length(); } inline size_t size() const { return length(); }
///
// Returns true if the string is empty. // Returns true if the string is empty.
///
bool empty() const { return (string_ == NULL || string_->length == 0); } bool empty() const { return (string_ == NULL || string_->length == 0); }
///
// Compare this string to the specified string. // Compare this string to the specified string.
///
int compare(const CefStringBase& str) const int compare(const CefStringBase& str) const
{ {
if (empty() && str.empty()) if (empty() && str.empty())
@ -349,7 +406,9 @@ public:
return traits::compare(string_, str.GetStruct()); return traits::compare(string_, str.GetStruct());
} }
///
// Clear the string data. // Clear the string data.
///
void clear() void clear()
{ {
if (!empty()) if (!empty())
@ -359,23 +418,31 @@ public:
// The following methods are unique to CEF string template types. // The following methods are unique to CEF string template types.
///
// Returns true if this class owns the underlying string structure. // Returns true if this class owns the underlying string structure.
///
bool IsOwner() const { return owner_; } bool IsOwner() const { return owner_; }
///
// Returns a read-only pointer to the underlying string structure. May return // Returns a read-only pointer to the underlying string structure. May return
// NULL if no structure is currently allocated. // NULL if no structure is currently allocated.
///
const struct_type* GetStruct() const { return string_; } const struct_type* GetStruct() const { return string_; }
///
// Returns a writable pointer to the underlying string structure. Will never // Returns a writable pointer to the underlying string structure. Will never
// return NULL. // return NULL.
///
struct_type* GetWritableStruct() struct_type* GetWritableStruct()
{ {
AllocIfNeeded(); AllocIfNeeded();
return string_; return string_;
} }
///
// Clear the state of this class. The underlying string structure and data // Clear the state of this class. The underlying string structure and data
// will be freed if this class owns the structure. // will be freed if this class owns the structure.
///
void ClearAndFree() void ClearAndFree()
{ {
if (!string_) if (!string_)
@ -388,8 +455,10 @@ public:
owner_ = false; owner_ = false;
} }
///
// Attach to the specified string structure. If |owner| is true this class // Attach to the specified string structure. If |owner| is true this class
// will take ownership of the structure. // will take ownership of the structure.
///
void Attach(struct_type* str, bool owner) void Attach(struct_type* str, bool owner)
{ {
// Free the previous structure and data, if any. // Free the previous structure and data, if any.
@ -399,9 +468,11 @@ public:
owner_ = owner; owner_ = owner;
} }
///
// Take ownership of the specified userfree structure's string data. The // Take ownership of the specified userfree structure's string data. The
// userfree structure itself will be freed. Only use this method with userfree // userfree structure itself will be freed. Only use this method with userfree
// structures. // structures.
///
void AttachToUserFree(userfree_struct_type str) void AttachToUserFree(userfree_struct_type str)
{ {
// Free the previous structure and data, if any. // Free the previous structure and data, if any.
@ -419,18 +490,22 @@ public:
traits::userfree_free(str); traits::userfree_free(str);
} }
///
// Detach from the underlying string structure. To avoid memory leaks only use // Detach from the underlying string structure. To avoid memory leaks only use
// this method if you already hold a pointer to the underlying string // this method if you already hold a pointer to the underlying string
// structure. // structure.
///
void Detach() void Detach()
{ {
string_ = NULL; string_ = NULL;
owner_ = false; owner_ = false;
} }
///
// Create a userfree structure and give it ownership of this class' string // 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 // data. This class will be disassociated from the data. May return NULL if
// this string class currently contains no data. // this string class currently contains no data.
///
userfree_struct_type DetachToUserFree() userfree_struct_type DetachToUserFree()
{ {
if (empty()) if (empty())
@ -446,10 +521,12 @@ public:
return str; return str;
} }
///
// Set this string's data to the specified character array. If |copy| is true // 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 // this class will copy the data. Otherwise, this class will reference the
// existing data. Referenced data must exist for the lifetime of this class // existing data. Referenced data must exist for the lifetime of this class
// and will not be freed by this class. // and will not be freed by this class.
///
bool FromString(const char_type* src, size_t src_len, bool copy) bool FromString(const char_type* src, size_t src_len, bool copy)
{ {
if (src == NULL || src_len == 0) { if (src == NULL || src_len == 0) {
@ -460,9 +537,11 @@ public:
return traits::set(src, src_len, string_, copy) ? true : false; return traits::set(src, src_len, string_, copy) ? true : false;
} }
///
// Set this string's data from an existing ASCII string. Data will be always // 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 // copied. Translation will occur if necessary based on the underlying string
// type. // type.
///
bool FromASCII(const char* str) bool FromASCII(const char* str)
{ {
size_t len = str ? strlen(str) : 0; size_t len = str ? strlen(str) : 0;
@ -474,8 +553,10 @@ public:
return traits::from_ascii(str, len, string_); return traits::from_ascii(str, len, string_);
} }
///
// Return this string's data as a std::string. Translation will occur if // Return this string's data as a std::string. Translation will occur if
// necessary based on the underlying string type. // necessary based on the underlying string type.
///
std::string ToString() const std::string ToString() const
{ {
if (empty()) if (empty())
@ -483,9 +564,11 @@ public:
return traits::to_string(string_); return traits::to_string(string_);
} }
///
// Set this string's data from an existing std::string. Data will be always // 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 // copied. Translation will occur if necessary based on the underlying string
// type. // type.
///
bool FromString(const std::string& str) bool FromString(const std::string& str)
{ {
if (str.empty()) { if (str.empty()) {
@ -496,8 +579,10 @@ public:
return traits::from_string(str, string_); return traits::from_string(str, string_);
} }
///
// Return this string's data as a std::wstring. Translation will occur if // Return this string's data as a std::wstring. Translation will occur if
// necessary based on the underlying string type. // necessary based on the underlying string type.
///
std::wstring ToWString() const std::wstring ToWString() const
{ {
if (empty()) if (empty())
@ -505,9 +590,11 @@ public:
return traits::to_wstring(string_); return traits::to_wstring(string_);
} }
///
// Set this string's data from an existing std::wstring. Data will be always // 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 // copied. Translation will occur if necessary based on the underlying string
// type. // type.
///
bool FromWString(const std::wstring& str) bool FromWString(const std::wstring& str)
{ {
if (str.empty()) { if (str.empty()) {
@ -518,8 +605,10 @@ public:
return traits::from_wstring(str, string_); return traits::from_wstring(str, string_);
} }
#if defined(BUILDING_CEF_SHARED) #if defined(BUILDING_CEF_SHARED)
///
// Return this string's data as a string16. Translation will occur if // Return this string's data as a string16. Translation will occur if
// necessary based on the underlying string type. // necessary based on the underlying string type.
///
string16 ToString16() const string16 ToString16() const
{ {
if (empty()) if (empty())
@ -527,9 +616,11 @@ public:
return traits::to_string16(string_); return traits::to_string16(string_);
} }
///
// Set this string's data from an existing string16. Data will be always // Set this string's data from an existing string16. Data will be always
// copied. Translation will occur if necessary based on the underlying string // copied. Translation will occur if necessary based on the underlying string
// type. // type.
///
bool FromString16(const string16& str) bool FromString16(const string16& str)
{ {
if (str.empty()) { if (str.empty()) {
@ -541,7 +632,9 @@ public:
} }
#endif // BUILDING_CEF_SHARED #endif // BUILDING_CEF_SHARED
///
// Comparison operator overloads. // Comparison operator overloads.
///
bool operator<(const CefStringBase& str) const bool operator<(const CefStringBase& str) const
{ return (compare(str) < 0); } { return (compare(str) < 0); }
bool operator<=(const CefStringBase& str) const bool operator<=(const CefStringBase& str) const
@ -555,7 +648,9 @@ public:
bool operator!=(const CefStringBase& str) const bool operator!=(const CefStringBase& str) const
{ return (compare(str) != 0); } { return (compare(str) != 0); }
///
// Assignment operator overloads. // Assignment operator overloads.
///
CefStringBase& operator=(const CefStringBase& str) CefStringBase& operator=(const CefStringBase& str)
{ FromString(str.c_str(), str.length(), true); return *this; } { FromString(str.c_str(), str.length(), true); return *this; }
operator std::string() const { return ToString(); } operator std::string() const { return ToString(); }
@ -592,33 +687,6 @@ private:
}; };
// 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<CefStringTraitsWide> CefStringWide;
typedef CefStringBase<CefStringTraitsUTF8> CefStringUTF8; typedef CefStringBase<CefStringTraitsUTF8> CefStringUTF8;
typedef CefStringBase<CefStringTraitsUTF16> CefStringUTF16; typedef CefStringBase<CefStringTraitsUTF16> CefStringUTF16;

View File

@ -37,7 +37,9 @@ extern "C" {
#include "cef_export.h" #include "cef_export.h"
#include <time.h> #include <time.h>
///
// Time information. Values should always be in UTC. // Time information. Values should always be in UTC.
///
typedef struct _cef_time_t typedef struct _cef_time_t
{ {
int year; // Four digit year "2007" int year; // Four digit year "2007"
@ -51,15 +53,19 @@ typedef struct _cef_time_t
int millisecond; // Milliseconds within the current second (0-999) int millisecond; // Milliseconds within the current second (0-999)
} cef_time_t; } cef_time_t;
///
// Converts cef_time_t to/from time_t. Returns true (1) on success and false (0) // Converts cef_time_t to/from time_t. Returns true (1) on success and false (0)
// on failure. // on failure.
///
CEF_EXPORT int cef_time_to_timet(const cef_time_t* cef_time, time_t* time); CEF_EXPORT int cef_time_to_timet(const cef_time_t* cef_time, time_t* time);
CEF_EXPORT int cef_time_from_timet(time_t time, cef_time_t* cef_time); CEF_EXPORT int cef_time_from_timet(time_t time, cef_time_t* cef_time);
///
// Converts cef_time_t to/from a double which is the number of seconds since // Converts cef_time_t to/from a double which is the number of seconds since
// epoch (Jan 1, 1970). Webkit uses this format to represent time. A value of 0 // epoch (Jan 1, 1970). Webkit uses this format to represent time. A value of 0
// means "not initialized". Returns true (1) on success and false (0) on // means "not initialized". Returns true (1) on success and false (0) on
// failure. // failure.
///
CEF_EXPORT int cef_time_to_doublet(const cef_time_t* cef_time, double* time); CEF_EXPORT int cef_time_to_doublet(const cef_time_t* cef_time, double* time);
CEF_EXPORT int cef_time_from_doublet(double time, cef_time_t* cef_time); CEF_EXPORT int cef_time_from_doublet(double time, cef_time_t* cef_time);

View File

@ -59,7 +59,9 @@ typedef unsigned long long uint64;
extern "C" { extern "C" {
#endif #endif
///
// Log severity levels. // Log severity levels.
///
enum cef_log_severity_t enum cef_log_severity_t
{ {
LOGSEVERITY_VERBOSE = -1, LOGSEVERITY_VERBOSE = -1,
@ -71,64 +73,92 @@ enum cef_log_severity_t
LOGSEVERITY_DISABLE = 99 LOGSEVERITY_DISABLE = 99
}; };
///
// Initialization settings. Specify NULL or 0 to get the recommended default // Initialization settings. Specify NULL or 0 to get the recommended default
// values. // values.
///
typedef struct _cef_settings_t typedef struct _cef_settings_t
{ {
///
// Size of this structure. // Size of this structure.
///
size_t size; size_t size;
///
// Set to true (1) to have the message loop run in a separate thread. If // 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 // false (0) than the CefDoMessageLoopWork() function must be called from
// your application message loop. // your application message loop.
///
bool multi_threaded_message_loop; bool multi_threaded_message_loop;
///
// The location where cache data will be stored on disk. If empty an // 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 // in-memory cache will be used. HTML5 databases such as localStorage will
// only persist across sessions if a cache path is specified. // only persist across sessions if a cache path is specified.
///
cef_string_t cache_path; cef_string_t cache_path;
///
// Value that will be returned as the User-Agent HTTP header. If empty the // Value that will be returned as the User-Agent HTTP header. If empty the
// default User-Agent string will be used. // default User-Agent string will be used.
///
cef_string_t user_agent; cef_string_t user_agent;
///
// Value that will be inserted as the product portion of the default // 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 // User-Agent string. If empty the Chromium product version will be used. If
// |userAgent| is specified this value will be ignored. // |userAgent| is specified this value will be ignored.
///
cef_string_t product_version; cef_string_t product_version;
///
// The locale string that will be passed to WebKit. If empty the default // The locale string that will be passed to WebKit. If empty the default
// locale of "en-US" will be used. // locale of "en-US" will be used.
///
cef_string_t locale; cef_string_t locale;
///
// List of fully qualified paths to plugins (including plugin name) that will // List of fully qualified paths to plugins (including plugin name) that will
// be loaded in addition to any plugins found in the default search paths. // be loaded in addition to any plugins found in the default search paths.
///
cef_string_list_t extra_plugin_paths; cef_string_list_t extra_plugin_paths;
///
// The directory and file name to use for the debug log. If empty, the // 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 // default name of "debug.log" will be used and the file will be written
// to the application directory. // to the application directory.
///
cef_string_t log_file; cef_string_t log_file;
///
// The log severity. Only messages of this severity level or higher will be // The log severity. Only messages of this severity level or higher will be
// logged. // logged.
///
cef_log_severity_t log_severity; cef_log_severity_t log_severity;
} cef_settings_t; } cef_settings_t;
///
// Browser initialization settings. Specify NULL or 0 to get the recommended // Browser initialization settings. Specify NULL or 0 to get the recommended
// default values. The consequences of using custom values may not be well // default values. The consequences of using custom values may not be well
// tested. // tested.
///
typedef struct _cef_browser_settings_t typedef struct _cef_browser_settings_t
{ {
///
// Size of this structure. // Size of this structure.
///
size_t size; size_t size;
///
// Disable drag & drop of URLs from other windows. // Disable drag & drop of URLs from other windows.
///
bool drag_drop_disabled; bool drag_drop_disabled;
// The below values map to WebPreferences settings. // The below values map to WebPreferences settings.
///
// Font settings. // Font settings.
///
cef_string_t standard_font_family; cef_string_t standard_font_family;
cef_string_t fixed_font_family; cef_string_t fixed_font_family;
cef_string_t serif_font_family; cef_string_t serif_font_family;
@ -140,176 +170,280 @@ typedef struct _cef_browser_settings_t
int minimum_font_size; int minimum_font_size;
int minimum_logical_font_size; int minimum_logical_font_size;
///
// Set to true (1) to disable loading of fonts from remote sources. // Set to true (1) to disable loading of fonts from remote sources.
///
bool remote_fonts_disabled; bool remote_fonts_disabled;
///
// Default encoding for Web content. If empty "ISO-8859-1" will be used. // Default encoding for Web content. If empty "ISO-8859-1" will be used.
///
cef_string_t default_encoding; cef_string_t default_encoding;
///
// Set to true (1) to attempt automatic detection of content encoding. // Set to true (1) to attempt automatic detection of content encoding.
///
bool encoding_detector_enabled; bool encoding_detector_enabled;
///
// Set to true (1) to disable JavaScript. // Set to true (1) to disable JavaScript.
///
bool javascript_disabled; bool javascript_disabled;
///
// Set to true (1) to disallow JavaScript from opening windows. // Set to true (1) to disallow JavaScript from opening windows.
///
bool javascript_open_windows_disallowed; bool javascript_open_windows_disallowed;
///
// Set to true (1) to disallow JavaScript from closing windows. // Set to true (1) to disallow JavaScript from closing windows.
///
bool javascript_close_windows_disallowed; bool javascript_close_windows_disallowed;
///
// Set to true (1) to disallow JavaScript from accessing the clipboard. // Set to true (1) to disallow JavaScript from accessing the clipboard.
///
bool javascript_access_clipboard_disallowed; bool javascript_access_clipboard_disallowed;
///
// Set to true (1) to disable DOM pasting in the editor. DOM pasting also // Set to true (1) to disable DOM pasting in the editor. DOM pasting also
// depends on |javascript_cannot_access_clipboard| being false (0). // depends on |javascript_cannot_access_clipboard| being false (0).
///
bool dom_paste_disabled; bool dom_paste_disabled;
///
// Set to true (1) to enable drawing of the caret position. // Set to true (1) to enable drawing of the caret position.
///
bool caret_browsing_enabled; bool caret_browsing_enabled;
///
// Set to true (1) to disable Java. // Set to true (1) to disable Java.
///
bool java_disabled; bool java_disabled;
///
// Set to true (1) to disable plugins. // Set to true (1) to disable plugins.
///
bool plugins_disabled; bool plugins_disabled;
///
// Set to true (1) to allow access to all URLs from file URLs. // Set to true (1) to allow access to all URLs from file URLs.
///
bool universal_access_from_file_urls_allowed; bool universal_access_from_file_urls_allowed;
///
// Set to true (1) to allow access to file URLs from other file URLs. // Set to true (1) to allow access to file URLs from other file URLs.
///
bool file_access_from_file_urls_allowed; bool file_access_from_file_urls_allowed;
///
// Set to true (1) to allow risky security behavior such as cross-site // Set to true (1) to allow risky security behavior such as cross-site
// scripting (XSS). Use with extreme care. // scripting (XSS). Use with extreme care.
///
bool web_security_disabled; bool web_security_disabled;
///
// Set to true (1) to enable console warnings about XSS attempts. // Set to true (1) to enable console warnings about XSS attempts.
///
bool xss_auditor_enabled; bool xss_auditor_enabled;
///
// Set to true (1) to suppress the network load of image URLs. A cached // Set to true (1) to suppress the network load of image URLs. A cached
// image will still be rendered if requested. // image will still be rendered if requested.
///
bool image_load_disabled; bool image_load_disabled;
///
// Set to true (1) to shrink standalone images to fit the page. // Set to true (1) to shrink standalone images to fit the page.
///
bool shrink_standalone_images_to_fit; bool shrink_standalone_images_to_fit;
///
// Set to true (1) to disable browser backwards compatibility features. // Set to true (1) to disable browser backwards compatibility features.
///
bool site_specific_quirks_disabled; bool site_specific_quirks_disabled;
///
// Set to true (1) to disable resize of text areas. // Set to true (1) to disable resize of text areas.
///
bool text_area_resize_disabled; bool text_area_resize_disabled;
///
// Set to true (1) to disable use of the page cache. // Set to true (1) to disable use of the page cache.
///
bool page_cache_disabled; bool page_cache_disabled;
///
// Set to true (1) to not have the tab key advance focus to links. // Set to true (1) to not have the tab key advance focus to links.
///
bool tab_to_links_disabled; bool tab_to_links_disabled;
///
// Set to true (1) to disable hyperlink pings (<a ping> and window.sendPing). // Set to true (1) to disable hyperlink pings (<a ping> and window.sendPing).
///
bool hyperlink_auditing_disabled; bool hyperlink_auditing_disabled;
///
// Set to true (1) to enable the user style sheet for all pages. // 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. // |user_style_sheet_location| must be set to the style sheet URL.
///
bool user_style_sheet_enabled; bool user_style_sheet_enabled;
cef_string_t user_style_sheet_location; cef_string_t user_style_sheet_location;
///
// Set to true (1) to disable style sheets. // Set to true (1) to disable style sheets.
///
bool author_and_user_styles_disabled; bool author_and_user_styles_disabled;
///
// Set to true (1) to disable local storage. // Set to true (1) to disable local storage.
///
bool local_storage_disabled; bool local_storage_disabled;
///
// Set to true (1) to disable databases. // Set to true (1) to disable databases.
///
bool databases_disabled; bool databases_disabled;
///
// Set to true (1) to disable application cache. // Set to true (1) to disable application cache.
///
bool application_cache_disabled; bool application_cache_disabled;
///
// Set to true (1) to disable WebGL. // Set to true (1) to disable WebGL.
///
bool webgl_disabled; bool webgl_disabled;
///
// Set to true (1) to disable accelerated compositing. // Set to true (1) to disable accelerated compositing.
///
bool accelerated_compositing_disabled; bool accelerated_compositing_disabled;
///
// Set to true (1) to disable accelerated layers. This affects features like // Set to true (1) to disable accelerated layers. This affects features like
// 3D CSS transforms. // 3D CSS transforms.
///
bool accelerated_layers_disabled; bool accelerated_layers_disabled;
///
// Set to true (1) to disable accelerated 2d canvas. // Set to true (1) to disable accelerated 2d canvas.
///
bool accelerated_2d_canvas_disabled; bool accelerated_2d_canvas_disabled;
///
// Set to true (1) to disable developer tools (WebKit inspector). // Set to true (1) to disable developer tools (WebKit inspector).
///
bool developer_tools_disabled; bool developer_tools_disabled;
} cef_browser_settings_t; } cef_browser_settings_t;
///
// URL component parts. // URL component parts.
///
typedef struct _cef_urlparts_t typedef struct _cef_urlparts_t
{ {
///
// The complete URL specification. // The complete URL specification.
///
cef_string_t spec; cef_string_t spec;
///
// Scheme component not including the colon (e.g., "http"). // Scheme component not including the colon (e.g., "http").
///
cef_string_t scheme; cef_string_t scheme;
///
// User name component. // User name component.
///
cef_string_t username; cef_string_t username;
///
// Password component. // Password component.
///
cef_string_t password; cef_string_t password;
///
// Host component. This may be a hostname, an IPv4 address or an IPv6 literal // Host component. This may be a hostname, an IPv4 address or an IPv6 literal
// surrounded by square brackets (e.g., "[2001:db8::1]"). // surrounded by square brackets (e.g., "[2001:db8::1]").
///
cef_string_t host; cef_string_t host;
///
// Port number component. // Port number component.
///
cef_string_t port; cef_string_t port;
///
// Path component including the first slash following the host. // Path component including the first slash following the host.
///
cef_string_t path; cef_string_t path;
///
// Query string component (i.e., everything following the '?'). // Query string component (i.e., everything following the '?').
///
cef_string_t query; cef_string_t query;
} cef_urlparts_t; } cef_urlparts_t;
///
// Cookie information. // Cookie information.
///
typedef struct _cef_cookie_t typedef struct _cef_cookie_t
{ {
///
// The cookie name. // The cookie name.
///
cef_string_t name; cef_string_t name;
///
// The cookie value. // The cookie value.
///
cef_string_t value; cef_string_t value;
///
// If |domain| is empty a host cookie will be created instead of a domain // 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 // cookie. Domain cookies are stored with a leading "." and are visible to
// sub-domains whereas host cookies are not. // sub-domains whereas host cookies are not.
///
cef_string_t domain; cef_string_t domain;
///
// If |path| is non-empty only URLs at or below the path will get the cookie // If |path| is non-empty only URLs at or below the path will get the cookie
// value. // value.
///
cef_string_t path; cef_string_t path;
///
// If |secure| is true the cookie will only be sent for HTTPS requests. // If |secure| is true the cookie will only be sent for HTTPS requests.
///
bool secure; bool secure;
///
// If |httponly| is true the cookie will only be sent for HTTP requests. // If |httponly| is true the cookie will only be sent for HTTP requests.
///
bool httponly; bool httponly;
///
// The cookie creation date. This is automatically populated by the system on // The cookie creation date. This is automatically populated by the system on
// cookie creation. // cookie creation.
///
cef_time_t creation; cef_time_t creation;
///
// The cookie last access date. This is automatically populated by the system // The cookie last access date. This is automatically populated by the system
// on access. // on access.
///
cef_time_t last_access; cef_time_t last_access;
///
// The cookie expiration date is only valid if |has_expires| is true. // The cookie expiration date is only valid if |has_expires| is true.
///
bool has_expires; bool has_expires;
cef_time_t expires; cef_time_t expires;
} cef_cookie_t; } cef_cookie_t;
///
// Mouse button types. // Mouse button types.
///
enum cef_mouse_button_type_t enum cef_mouse_button_type_t
{ {
MBT_LEFT = 0, MBT_LEFT = 0,
@ -317,7 +451,9 @@ enum cef_mouse_button_type_t
MBT_RIGHT, MBT_RIGHT,
}; };
///
// Key types. // Key types.
///
enum cef_key_type_t enum cef_key_type_t
{ {
KT_KEYUP = 0, KT_KEYUP = 0,
@ -325,7 +461,9 @@ enum cef_key_type_t
KT_CHAR, KT_CHAR,
}; };
///
// Various browser navigation types supported by chrome. // Various browser navigation types supported by chrome.
///
enum cef_handler_navtype_t enum cef_handler_navtype_t
{ {
NAVTYPE_LINKCLICKED = 0, NAVTYPE_LINKCLICKED = 0,
@ -336,8 +474,10 @@ enum cef_handler_navtype_t
NAVTYPE_OTHER, NAVTYPE_OTHER,
}; };
///
// Supported error code values. See net\base\net_error_list.h for complete // Supported error code values. See net\base\net_error_list.h for complete
// descriptions of the error codes. // descriptions of the error codes.
///
enum cef_handler_errorcode_t enum cef_handler_errorcode_t
{ {
ERR_FAILED = -2, ERR_FAILED = -2,
@ -390,7 +530,9 @@ enum cef_handler_errorcode_t
ERR_INSECURE_RESPONSE = -501, ERR_INSECURE_RESPONSE = -501,
}; };
///
// V8 access control values. // V8 access control values.
///
enum cef_v8_accesscontrol_t enum cef_v8_accesscontrol_t
{ {
V8_ACCESS_CONTROL_DEFAULT = 0, V8_ACCESS_CONTROL_DEFAULT = 0,
@ -399,7 +541,9 @@ enum cef_v8_accesscontrol_t
V8_ACCESS_CONTROL_PROHIBITS_OVERWRITING = 1 << 2 V8_ACCESS_CONTROL_PROHIBITS_OVERWRITING = 1 << 2
}; };
///
// V8 property attribute values. // V8 property attribute values.
///
enum cef_v8_propertyattribute_t enum cef_v8_propertyattribute_t
{ {
V8_PROPERTY_ATTRIBUTE_NONE = 0, // Writeable, Enumerable, V8_PROPERTY_ATTRIBUTE_NONE = 0, // Writeable, Enumerable,
@ -409,14 +553,20 @@ enum cef_v8_propertyattribute_t
V8_PROPERTY_ATTRIBUTE_DONTDELETE = 1 << 2 // Not configurable V8_PROPERTY_ATTRIBUTE_DONTDELETE = 1 << 2 // Not configurable
}; };
///
// Structure representing menu information. // Structure representing menu information.
///
typedef struct _cef_handler_menuinfo_t typedef struct _cef_handler_menuinfo_t
{ {
///
// Values from the cef_handler_menutypebits_t enumeration. // Values from the cef_handler_menutypebits_t enumeration.
///
int typeFlags; int typeFlags;
///
// If window rendering is enabled |x| and |y| will be in screen coordinates. // If window rendering is enabled |x| and |y| will be in screen coordinates.
// Otherwise, |x| and |y| will be in view coordinates. // Otherwise, |x| and |y| will be in view coordinates.
///
int x; int x;
int y; int y;
@ -427,40 +577,66 @@ typedef struct _cef_handler_menuinfo_t
cef_string_t selectionText; cef_string_t selectionText;
cef_string_t misspelledWord; cef_string_t misspelledWord;
///
// Values from the cef_handler_menucapabilitybits_t enumeration. // Values from the cef_handler_menucapabilitybits_t enumeration.
///
int editFlags; int editFlags;
cef_string_t securityInfo; cef_string_t securityInfo;
} cef_handler_menuinfo_t; } cef_handler_menuinfo_t;
///
// The cef_handler_menuinfo_t typeFlags value will be a combination of the // The cef_handler_menuinfo_t typeFlags value will be a combination of the
// following values. // following values.
///
enum cef_handler_menutypebits_t enum cef_handler_menutypebits_t
{ {
///
// No node is selected // No node is selected
///
MENUTYPE_NONE = 0x0, MENUTYPE_NONE = 0x0,
///
// The top page is selected // The top page is selected
///
MENUTYPE_PAGE = 0x1, MENUTYPE_PAGE = 0x1,
///
// A subframe page is selected // A subframe page is selected
///
MENUTYPE_FRAME = 0x2, MENUTYPE_FRAME = 0x2,
///
// A link is selected // A link is selected
///
MENUTYPE_LINK = 0x4, MENUTYPE_LINK = 0x4,
///
// An image is selected // An image is selected
///
MENUTYPE_IMAGE = 0x8, MENUTYPE_IMAGE = 0x8,
///
// There is a textual or mixed selection that is selected // There is a textual or mixed selection that is selected
///
MENUTYPE_SELECTION = 0x10, MENUTYPE_SELECTION = 0x10,
///
// An editable element is selected // An editable element is selected
///
MENUTYPE_EDITABLE = 0x20, MENUTYPE_EDITABLE = 0x20,
///
// A misspelled word is selected // A misspelled word is selected
///
MENUTYPE_MISSPELLED_WORD = 0x40, MENUTYPE_MISSPELLED_WORD = 0x40,
///
// A video node is selected // A video node is selected
///
MENUTYPE_VIDEO = 0x80, MENUTYPE_VIDEO = 0x80,
///
// A video node is selected // A video node is selected
///
MENUTYPE_AUDIO = 0x100, MENUTYPE_AUDIO = 0x100,
}; };
///
// The cef_handler_menuinfo_t editFlags value will be a combination of the // The cef_handler_menuinfo_t editFlags value will be a combination of the
// following values. // following values.
///
enum cef_handler_menucapabilitybits_t enum cef_handler_menucapabilitybits_t
{ {
// Values from WebContextMenuData::EditFlags in WebContextMenuData.h // Values from WebContextMenuData::EditFlags in WebContextMenuData.h
@ -478,7 +654,9 @@ enum cef_handler_menucapabilitybits_t
MENU_CAN_GO_BACK = 0x20000000, MENU_CAN_GO_BACK = 0x20000000,
}; };
///
// Supported menu ID values. // Supported menu ID values.
///
enum cef_handler_menuid_t enum cef_handler_menuid_t
{ {
MENU_ID_NAV_BACK = 10, MENU_ID_NAV_BACK = 10,
@ -503,7 +681,9 @@ enum cef_paint_element_type_t
PET_POPUP, PET_POPUP,
}; };
///
// Post data elements may represent either bytes or files. // Post data elements may represent either bytes or files.
///
enum cef_postdataelement_type_t enum cef_postdataelement_type_t
{ {
PDE_TYPE_EMPTY = 0, PDE_TYPE_EMPTY = 0,
@ -533,7 +713,9 @@ enum cef_weburlrequest_state_t
WUR_STATE_ABORT = 6, WUR_STATE_ABORT = 6,
}; };
///
// Key event types. // Key event types.
///
enum cef_handler_keyevent_type_t enum cef_handler_keyevent_type_t
{ {
KEYEVENT_RAWKEYDOWN = 0, KEYEVENT_RAWKEYDOWN = 0,
@ -542,7 +724,9 @@ enum cef_handler_keyevent_type_t
KEYEVENT_CHAR KEYEVENT_CHAR
}; };
///
// Key event modifiers. // Key event modifiers.
///
enum cef_handler_keyevent_modifiers_t enum cef_handler_keyevent_modifiers_t
{ {
KEY_SHIFT = 1 << 0, KEY_SHIFT = 1 << 0,
@ -551,7 +735,9 @@ enum cef_handler_keyevent_modifiers_t
KEY_META = 1 << 3 KEY_META = 1 << 3
}; };
///
// Structure representing a rectangle. // Structure representing a rectangle.
///
typedef struct _cef_rect_t typedef struct _cef_rect_t
{ {
int x; int x;
@ -560,7 +746,9 @@ typedef struct _cef_rect_t
int height; int height;
} cef_rect_t; } cef_rect_t;
///
// Existing thread IDs. // Existing thread IDs.
///
enum cef_thread_id_t enum cef_thread_id_t
{ {
TID_UI = 0, TID_UI = 0,
@ -568,7 +756,9 @@ enum cef_thread_id_t
TID_FILE = 2, TID_FILE = 2,
}; };
///
// Paper type for printing. // Paper type for printing.
///
enum cef_paper_type_t enum cef_paper_type_t
{ {
PT_LETTER = 0, PT_LETTER = 0,
@ -579,7 +769,9 @@ enum cef_paper_type_t
PT_CUSTOM PT_CUSTOM
}; };
///
// Paper metric information for printing. // Paper metric information for printing.
///
struct cef_paper_metrics struct cef_paper_metrics
{ {
enum cef_paper_type_t paper_type; enum cef_paper_type_t paper_type;
@ -589,7 +781,9 @@ struct cef_paper_metrics
double width; double width;
}; };
///
// Paper print margins. // Paper print margins.
///
struct cef_print_margins struct cef_print_margins
{ {
//Margin size in inches for left/right/top/bottom (this is content margins). //Margin size in inches for left/right/top/bottom (this is content margins).
@ -602,14 +796,18 @@ struct cef_print_margins
double footer; double footer;
}; };
///
// Page orientation for printing. // Page orientation for printing.
///
enum cef_page_orientation enum cef_page_orientation
{ {
PORTRAIT = 0, PORTRAIT = 0,
LANDSCAPE LANDSCAPE
}; };
///
// Printing options. // Printing options.
///
typedef struct _cef_print_options_t typedef struct _cef_print_options_t
{ {
enum cef_page_orientation page_orientation; enum cef_page_orientation page_orientation;
@ -617,10 +815,12 @@ typedef struct _cef_print_options_t
struct cef_print_margins paper_margins; struct cef_print_margins paper_margins;
} cef_print_options_t; } cef_print_options_t;
///
// Supported XML encoding types. The parser supports ASCII, ISO-8859-1, and // 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 // 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 // before being passed to the parser. If a BOM is detected and the correct
// decoder is available then that decoder will be used automatically. // decoder is available then that decoder will be used automatically.
///
enum cef_xml_encoding_type_t enum cef_xml_encoding_type_t
{ {
XML_ENCODING_NONE = 0, XML_ENCODING_NONE = 0,
@ -630,7 +830,9 @@ enum cef_xml_encoding_type_t
XML_ENCODING_ASCII, XML_ENCODING_ASCII,
}; };
///
// XML node types. // XML node types.
///
enum cef_xml_node_type_t enum cef_xml_node_type_t
{ {
XML_NODE_UNSUPPORTED = 0, XML_NODE_UNSUPPORTED = 0,
@ -646,7 +848,9 @@ enum cef_xml_node_type_t
XML_NODE_COMMENT, XML_NODE_COMMENT,
}; };
///
// Status message types. // Status message types.
///
enum cef_handler_statustype_t enum cef_handler_statustype_t
{ {
STATUSTYPE_TEXT = 0, STATUSTYPE_TEXT = 0,
@ -654,7 +858,9 @@ enum cef_handler_statustype_t
STATUSTYPE_KEYBOARD_FOCUS_URL, STATUSTYPE_KEYBOARD_FOCUS_URL,
}; };
///
// Popup window features. // Popup window features.
///
typedef struct _cef_popup_features_t typedef struct _cef_popup_features_t
{ {
int x; int x;
@ -678,7 +884,9 @@ typedef struct _cef_popup_features_t
cef_string_list_t additionalFeatures; cef_string_list_t additionalFeatures;
} cef_popup_features_t; } cef_popup_features_t;
///
// DOM document types. // DOM document types.
///
enum cef_dom_document_type_t enum cef_dom_document_type_t
{ {
DOM_DOCUMENT_TYPE_UNKNOWN = 0, DOM_DOCUMENT_TYPE_UNKNOWN = 0,
@ -687,7 +895,9 @@ enum cef_dom_document_type_t
DOM_DOCUMENT_TYPE_PLUGIN, DOM_DOCUMENT_TYPE_PLUGIN,
}; };
///
// DOM event category flags. // DOM event category flags.
///
enum cef_dom_event_category_t enum cef_dom_event_category_t
{ {
DOM_EVENT_CATEGORY_UNKNOWN = 0x0, DOM_EVENT_CATEGORY_UNKNOWN = 0x0,
@ -712,7 +922,9 @@ enum cef_dom_event_category_t
DOM_EVENT_CATEGORY_BEFORE_LOAD = 0x40000, DOM_EVENT_CATEGORY_BEFORE_LOAD = 0x40000,
}; };
///
// DOM event processing phases. // DOM event processing phases.
///
enum cef_dom_event_phase_t enum cef_dom_event_phase_t
{ {
DOM_EVENT_PHASE_UNKNOWN = 0, DOM_EVENT_PHASE_UNKNOWN = 0,
@ -721,7 +933,9 @@ enum cef_dom_event_phase_t
DOM_EVENT_PHASE_BUBBLING, DOM_EVENT_PHASE_BUBBLING,
}; };
///
// DOM node types. // DOM node types.
///
enum cef_dom_node_type_t enum cef_dom_node_type_t
{ {
DOM_NODE_TYPE_UNSUPPORTED = 0, DOM_NODE_TYPE_UNSUPPORTED = 0,

View File

@ -43,7 +43,9 @@ extern "C" {
#define cef_window_handle_t GtkWidget* #define cef_window_handle_t GtkWidget*
#define cef_cursor_handle_t void* #define cef_cursor_handle_t void*
///
// Class representing window information. // Class representing window information.
///
typedef struct _cef_window_info_t typedef struct _cef_window_info_t
{ {
// Pointer for the parent GtkBox widget. // Pointer for the parent GtkBox widget.
@ -53,7 +55,9 @@ typedef struct _cef_window_info_t
cef_window_handle_t m_Widget; cef_window_handle_t m_Widget;
} cef_window_info_t; } cef_window_info_t;
///
// Class representing print context information. // Class representing print context information.
///
typedef struct _cef_print_info_t typedef struct _cef_print_info_t
{ {
double m_Scale; double m_Scale;

View File

@ -51,7 +51,9 @@ class NSView;
extern "C" { extern "C" {
#endif #endif
///
// Class representing window information. // Class representing window information.
///
typedef struct _cef_window_info_t typedef struct _cef_window_info_t
{ {
cef_string_t m_windowName; cef_string_t m_windowName;
@ -68,7 +70,9 @@ typedef struct _cef_window_info_t
cef_window_handle_t m_View; cef_window_handle_t m_View;
} cef_window_info_t; } cef_window_info_t;
///
// Class representing print context information. // Class representing print context information.
///
typedef struct _cef_print_info_t typedef struct _cef_print_info_t
{ {
double m_Scale; double m_Scale;

View File

@ -43,7 +43,9 @@ extern "C" {
#define cef_window_handle_t HWND #define cef_window_handle_t HWND
#define cef_cursor_handle_t HCURSOR #define cef_cursor_handle_t HCURSOR
///
// Class representing window information. // Class representing window information.
///
typedef struct _cef_window_info_t typedef struct _cef_window_info_t
{ {
// Standard parameters required by CreateWindowEx() // Standard parameters required by CreateWindowEx()
@ -66,7 +68,9 @@ typedef struct _cef_window_info_t
cef_window_handle_t m_hWnd; cef_window_handle_t m_hWnd;
} cef_window_info_t; } cef_window_info_t;
///
// Class representing print context information. // Class representing print context information.
///
typedef struct _cef_print_info_t typedef struct _cef_print_info_t
{ {
HDC m_hDC; HDC m_hDC;

View File

@ -34,7 +34,9 @@
#include "cef_string_list.h" #include "cef_string_list.h"
#include "cef_types.h" #include "cef_types.h"
///
// Template class that provides common functionality for CEF structure wrapping. // Template class that provides common functionality for CEF structure wrapping.
///
template <class traits> template <class traits>
class CefStructBase : public traits::struct_type { class CefStructBase : public traits::struct_type {
public: public:
@ -63,15 +65,19 @@ public:
*this = r; *this = r;
} }
///
// Clear this object's values. // Clear this object's values.
///
void Reset() void Reset()
{ {
Clear(this); Clear(this);
Init(); Init();
} }
///
// Attach to the source structure's existing values. DetachTo() can be called // Attach to the source structure's existing values. DetachTo() can be called
// to insert the values back into the existing structure. // to insert the values back into the existing structure.
///
void AttachTo(struct_type& source) void AttachTo(struct_type& source)
{ {
// Only clear this object's data if it isn't currently attached to a // Only clear this object's data if it isn't currently attached to a
@ -86,7 +92,9 @@ public:
memcpy(static_cast<struct_type*>(this), &source, sizeof(struct_type)); memcpy(static_cast<struct_type*>(this), &source, sizeof(struct_type));
} }
///
// Relinquish ownership of values to the target structure. // Relinquish ownership of values to the target structure.
///
void DetachTo(struct_type& target) void DetachTo(struct_type& target)
{ {
if (attached_to_ != &target) { if (attached_to_ != &target) {
@ -102,8 +110,10 @@ public:
Init(); Init();
} }
///
// Set this object's values. If |copy| is true the source structure's values // Set this object's values. If |copy| is true the source structure's values
// will be copied instead of referenced. // will be copied instead of referenced.
///
void Set(const struct_type& source, bool copy) void Set(const struct_type& source, bool copy)
{ {
traits::set(&source, this, copy); traits::set(&source, this, copy);
@ -146,7 +156,9 @@ struct CefRectTraits {
} }
}; };
///
// Class representing a rectangle. // Class representing a rectangle.
///
class CefRect : public CefStructBase<CefRectTraits> class CefRect : public CefStructBase<CefRectTraits>
{ {
public: public:
@ -223,7 +235,9 @@ struct CefPopupFeaturesTraits {
} }
}; };
///
// Class representing popup window features. // Class representing popup window features.
///
typedef CefStructBase<CefPopupFeaturesTraits> CefPopupFeatures; typedef CefStructBase<CefPopupFeaturesTraits> CefPopupFeatures;
@ -269,7 +283,9 @@ struct CefSettingsTraits {
} }
}; };
///
// Class representing initialization settings. // Class representing initialization settings.
///
typedef CefStructBase<CefSettingsTraits> CefSettings; typedef CefStructBase<CefSettingsTraits> CefSettings;
@ -367,7 +383,9 @@ struct CefBrowserSettingsTraits {
} }
}; };
///
// Class representing browser initialization settings. // Class representing browser initialization settings.
///
typedef CefStructBase<CefBrowserSettingsTraits> CefBrowserSettings; typedef CefStructBase<CefBrowserSettingsTraits> CefBrowserSettings;
@ -403,7 +421,9 @@ struct CefURLPartsTraits {
} }
}; };
///
// Class representing a URL's component parts. // Class representing a URL's component parts.
///
typedef CefStructBase<CefURLPartsTraits> CefURLParts; typedef CefStructBase<CefURLPartsTraits> CefURLParts;
@ -420,7 +440,9 @@ struct CefTimeTraits {
} }
}; };
///
// Class representing a time. // Class representing a time.
///
class CefTime : public CefStructBase<CefTimeTraits> class CefTime : public CefStructBase<CefTimeTraits>
{ {
public: public:
@ -483,7 +505,9 @@ struct CefCookieTraits {
} }
}; };
///
// Class representing a cookie. // Class representing a cookie.
///
typedef CefStructBase<CefCookieTraits> CefCookie; typedef CefStructBase<CefCookieTraits> CefCookie;
#endif // _CEF_TYPES_WRAPPERS_H #endif // _CEF_TYPES_WRAPPERS_H

View File

@ -36,11 +36,15 @@
#include "cef_types_win.h" #include "cef_types_win.h"
#include "cef_types_wrappers.h" #include "cef_types_wrappers.h"
///
// Atomic increment and decrement. // Atomic increment and decrement.
///
#define CefAtomicIncrement(p) InterlockedIncrement(p) #define CefAtomicIncrement(p) InterlockedIncrement(p)
#define CefAtomicDecrement(p) InterlockedDecrement(p) #define CefAtomicDecrement(p) InterlockedDecrement(p)
///
// Critical section wrapper. // Critical section wrapper.
///
class CefCriticalSection class CefCriticalSection
{ {
public: public:
@ -65,7 +69,9 @@ public:
CRITICAL_SECTION m_sec; CRITICAL_SECTION m_sec;
}; };
///
// Handle types. // Handle types.
///
#define CefWindowHandle cef_window_handle_t #define CefWindowHandle cef_window_handle_t
#define CefCursorHandle cef_cursor_handle_t #define CefCursorHandle cef_cursor_handle_t
@ -97,7 +103,9 @@ struct CefWindowInfoTraits {
} }
}; };
///
// Class representing window information. // Class representing window information.
///
class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> class CefWindowInfo : public CefStructBase<CefWindowInfoTraits>
{ {
public: public:
@ -153,7 +161,9 @@ struct CefPrintInfoTraits {
} }
}; };
///
// Class representing print context information. // Class representing print context information.
///
typedef CefStructBase<CefPrintInfoTraits> CefPrintInfo; typedef CefStructBase<CefPrintInfoTraits> CefPrintInfo;
#endif // OS_WIN #endif // OS_WIN

View File

@ -189,7 +189,8 @@ def get_comment(body, name):
elif line[0:2] == '/*': elif line[0:2] == '/*':
continue continue
elif line[0:2] == '//': elif line[0:2] == '//':
result.append(line[3:]) # keep the comment line including any leading spaces
result.append(line[2:])
else: else:
break break
@ -202,7 +203,15 @@ def format_comment(comment, indent, translate_map = None, maxchars = 80):
wrapme = '' wrapme = ''
hasemptyline = False hasemptyline = False
for line in comment: for line in comment:
if line is None or len(line) == 0 or line[0:1] == ' ': # if the line starts with a leading space, remove that space
if not line is None and len(line) > 0 and line[0:1] == ' ':
line = line[1:]
didremovespace = True
else:
didremovespace = False
if line is None or len(line) == 0 or line[0:1] == ' ' \
or line[0:1] == '/':
# the previous paragraph, if any, has ended # the previous paragraph, if any, has ended
if len(wrapme) > 0: if len(wrapme) > 0:
if not translate_map is None: if not translate_map is None:
@ -214,12 +223,15 @@ def format_comment(comment, indent, translate_map = None, maxchars = 80):
wrapme = '' wrapme = ''
if not line is None: if not line is None:
if len(line) == 0 or line[0:1] == ' ': if len(line) == 0 or line[0:1] == ' ' or line[0:1] == '/':
# blank lines or anything that's further indented should be # blank lines or anything that's further indented should be
# output as-is # output as-is
result += indent+'//' result += indent+'//'
if len(line) > 0: if len(line) > 0:
result += ' '+line if didremovespace:
result += ' '+line
else:
result += line;
result += '\n' result += '\n'
else: else:
# add to the current paragraph # add to the current paragraph