Introduce CefString and cef_string_t implementations that support string type conversions and customization of the API string type (issue #146).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@145 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2010-11-22 17:49:46 +00:00
parent 1e1c2ad8d7
commit 7d60642638
121 changed files with 2598 additions and 3209 deletions

View File

@ -137,8 +137,8 @@ void CefDoMessageLoopWork();
// example.test.increment();
//
/*--cef()--*/
bool CefRegisterExtension(const std::wstring& extension_name,
const std::wstring& javascript_code,
bool CefRegisterExtension(const CefString& extension_name,
const CefString& javascript_code,
CefRefPtr<CefV8Handler> handler);
@ -147,8 +147,8 @@ bool CefRegisterExtension(const std::wstring& extension_name,
// by CefSchemeHandler instances returned by the factory. Specify an empty
// |host_name| value to match all host names.
/*--cef()--*/
bool CefRegisterScheme(const std::wstring& scheme_name,
const std::wstring& host_name,
bool CefRegisterScheme(const CefString& scheme_name,
const CefString& host_name,
CefRefPtr<CefSchemeHandlerFactory> factory);
@ -215,9 +215,9 @@ public:
//
// class MyHandler : public CefThreadSafeBase<CefHandler>
// {
// std::wstring m_title;
// CefString m_title;
//
// virtual RetVal HandleTitleChange(const std::wstring& title)
// virtual RetVal HandleTitleChange(const CefString& title)
// {
// Lock(); // Begin protecting code
// m_title = title;
@ -354,7 +354,7 @@ public:
/*--cef()--*/
static bool CreateBrowser(CefWindowInfo& windowInfo, bool popup,
CefRefPtr<CefHandler> handler,
const std::wstring& url);
const CefString& url);
// Create a new browser window using the window parameters specified
// by |windowInfo|. The |popup| parameter should be true if the new window is
@ -364,7 +364,7 @@ public:
static CefRefPtr<CefBrowser> CreateBrowserSync(CefWindowInfo& windowInfo,
bool popup,
CefRefPtr<CefHandler> handler,
const std::wstring& url);
const CefString& url);
// Returns true if the browser can navigate backwards.
/*--cef()--*/
@ -415,11 +415,11 @@ public:
// Returns the frame with the specified name, or NULL if not found.
/*--cef()--*/
virtual CefRefPtr<CefFrame> GetFrame(const std::wstring& name) =0;
virtual CefRefPtr<CefFrame> GetFrame(const CefString& name) =0;
// Returns the names of all existing frames.
/*--cef()--*/
virtual void GetFrameNames(std::vector<std::wstring>& names) =0;
virtual void GetFrameNames(std::vector<CefString>& names) =0;
// Search for |searchText|. |identifier| can be used to have multiple searches
// running simultaniously. |forward| indicates whether to search forward or
@ -427,7 +427,7 @@ public:
// be case-sensitive. |findNext| indicates whether this is the first request
// or a follow-up.
/*--cef()--*/
virtual void Find(int identifier, const std::wstring& searchText,
virtual void Find(int identifier, const CefString& searchText,
bool forward, bool matchCase, bool findNext) =0;
// Cancel all searches that are currently going on.
@ -476,11 +476,11 @@ public:
// Returns this frame's HTML source as a string.
/*--cef()--*/
virtual std::wstring GetSource() =0;
virtual CefString GetSource() =0;
// Returns this frame's display text as a string.
/*--cef()--*/
virtual std::wstring GetText() =0;
virtual CefString GetText() =0;
// Load the request represented by the |request| object.
/*--cef()--*/
@ -488,17 +488,17 @@ public:
// Load the specified |url|.
/*--cef()--*/
virtual void LoadURL(const std::wstring& url) =0;
virtual void LoadURL(const CefString& url) =0;
// Load the contents of |string| with the optional dummy target |url|.
/*--cef()--*/
virtual void LoadString(const std::wstring& string,
const std::wstring& url) =0;
virtual void LoadString(const CefString& string,
const CefString& url) =0;
// Load the contents of |stream| with the optional dummy target |url|.
/*--cef()--*/
virtual void LoadStream(CefRefPtr<CefStreamReader> stream,
const std::wstring& url) =0;
const CefString& url) =0;
// Execute a string of JavaScript code in this frame. The |script_url|
// parameter is the URL where the script in question can be found, if any.
@ -506,8 +506,8 @@ public:
// error. The |start_line| parameter is the base line number to use for error
// reporting.
/*--cef()--*/
virtual void ExecuteJavaScript(const std::wstring& jsCode,
const std::wstring& scriptUrl,
virtual void ExecuteJavaScript(const CefString& jsCode,
const CefString& scriptUrl,
int startLine) =0;
// Returns true if this is the main frame.
@ -520,11 +520,11 @@ public:
// Returns this frame's name.
/*--cef()--*/
virtual std::wstring GetName() =0;
virtual CefString GetName() =0;
// Return the URL currently loaded in this frame.
/*--cef()--*/
virtual std::wstring GetURL() =0;
virtual CefString GetURL() =0;
};
@ -557,7 +557,7 @@ public:
CefWindowInfo& windowInfo, bool popup,
const CefPopupFeatures& popupFeatures,
CefRefPtr<CefHandler>& handler,
std::wstring& url,
CefString& url,
CefBrowserSettings& settings) =0;
// Event called after a new window is created. The return value is currently
@ -570,13 +570,13 @@ public:
/*--cef()--*/
virtual RetVal HandleAddressChange(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const std::wstring& url) =0;
const CefString& url) =0;
// Event called when the page title changes. The return value is currently
// ignored.
/*--cef()--*/
virtual RetVal HandleTitleChange(CefRefPtr<CefBrowser> browser,
const std::wstring& title) =0;
const CefString& title) =0;
// Various browser navigation types supported by chrome.
typedef cef_handler_navtype_t NavType;
@ -618,8 +618,8 @@ public:
virtual RetVal HandleLoadError(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
ErrorCode errorCode,
const std::wstring& failedUrl,
std::wstring& errorText) =0;
const CefString& failedUrl,
CefString& errorText) =0;
// Event called before a resource is loaded. To allow the resource to load
// normally return RV_CONTINUE. To redirect the resource to a new url
@ -631,11 +631,11 @@ public:
// |redirectUrl| is also set, the URL in |request| will be used.
/*--cef()--*/
virtual RetVal HandleBeforeResourceLoad(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefRequest> request,
std::wstring& redirectUrl,
CefRefPtr<CefStreamReader>& resourceStream,
std::wstring& mimeType,
int loadFlags) =0;
CefRefPtr<CefRequest> request,
CefString& redirectUrl,
CefRefPtr<CefStreamReader>& resourceStream,
CefString& mimeType,
int loadFlags) =0;
// Called when a server indicates via the 'Content-Disposition' header that a
// response represents a file to download. |mimeType| is the mime type for
@ -646,8 +646,8 @@ public:
// or RV_HANDLED to cancel the file download.
/*--cef()--*/
virtual RetVal HandleDownloadResponse(CefRefPtr<CefBrowser> browser,
const std::wstring& mimeType,
const std::wstring& fileName,
const CefString& mimeType,
const CefString& fileName,
int64 contentLength,
CefRefPtr<CefDownloadHandler>& handler) =0;
@ -668,7 +668,7 @@ public:
// alternate text. The return value is currently ignored.
/*--cef()--*/
virtual RetVal HandleGetMenuLabel(CefRefPtr<CefBrowser> browser,
MenuId menuId, std::wstring& label) =0;
MenuId menuId, CefString& label) =0;
// Event called when an option is selected from the default context menu.
// Return RV_HANDLED to cancel default handling of the action.
@ -703,22 +703,22 @@ public:
virtual RetVal HandlePrintHeaderFooter(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefPrintInfo& printInfo,
const std::wstring& url,
const std::wstring& title,
const CefString& url,
const CefString& title,
int currentPage, int maxPages,
std::wstring& topLeft,
std::wstring& topCenter,
std::wstring& topRight,
std::wstring& bottomLeft,
std::wstring& bottomCenter,
std::wstring& bottomRight) =0;
CefString& topLeft,
CefString& topCenter,
CefString& topRight,
CefString& bottomLeft,
CefString& bottomCenter,
CefString& bottomRight) =0;
// Run a JS alert message. Return RV_CONTINUE to display the default alert
// or RV_HANDLED if you displayed a custom alert.
/*--cef()--*/
virtual RetVal HandleJSAlert(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const std::wstring& message) =0;
const CefString& message) =0;
// Run a JS confirm request. Return RV_CONTINUE to display the default alert
// or RV_HANDLED if you displayed a custom alert. If you handled the alert
@ -726,7 +726,7 @@ public:
/*--cef()--*/
virtual RetVal HandleJSConfirm(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const std::wstring& message, bool& retval) =0;
const CefString& message, bool& retval) =0;
// Run a JS prompt request. Return RV_CONTINUE to display the default prompt
// or RV_HANDLED if you displayed a custom prompt. If you handled the prompt
@ -735,10 +735,10 @@ public:
/*--cef()--*/
virtual RetVal HandleJSPrompt(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const std::wstring& message,
const std::wstring& defaultValue,
const CefString& message,
const CefString& defaultValue,
bool& retval,
std::wstring& result) =0;
CefString& result) =0;
// Event called for adding values to a frame's JavaScript 'window' object. The
// return value is currently ignored.
@ -792,14 +792,14 @@ public:
// the browser to display the tooltip.
/*--cef()--*/
virtual RetVal HandleTooltip(CefRefPtr<CefBrowser> browser,
std::wstring& text) =0;
CefString& text) =0;
// Called to display a console message. Return RV_HANDLED to stop the message
// from being output to the console.
/*--cef()--*/
virtual RetVal HandleConsoleMessage(CefRefPtr<CefBrowser> browser,
const std::wstring& message,
const std::wstring& source, int line) =0;
const CefString& message,
const CefString& source, int line) =0;
// Called to report find results returned by CefBrowser::Find(). |identifer|
// is the identifier passed to CefBrowser::Find(), |count| is the number of
@ -820,7 +820,7 @@ public:
class CefRequest : public CefBase
{
public:
typedef std::map<std::wstring,std::wstring> HeaderMap;
typedef std::map<CefString,CefString> HeaderMap;
// Create a new CefRequest object.
/*--cef()--*/
@ -828,16 +828,16 @@ public:
// Fully qualified URL to load.
/*--cef()--*/
virtual std::wstring GetURL() =0;
virtual CefString GetURL() =0;
/*--cef()--*/
virtual void SetURL(const std::wstring& url) =0;
virtual void SetURL(const CefString& url) =0;
// Optional request method type, defaulting to POST if post data is provided
// and GET otherwise.
/*--cef()--*/
virtual std::wstring GetMethod() =0;
virtual CefString GetMethod() =0;
/*--cef()--*/
virtual void SetMethod(const std::wstring& method) =0;
virtual void SetMethod(const CefString& method) =0;
// Optional post data.
/*--cef()--*/
@ -853,8 +853,8 @@ public:
// Set all values at one time.
/*--cef()--*/
virtual void Set(const std::wstring& url,
const std::wstring& method,
virtual void Set(const CefString& url,
const CefString& method,
CefRefPtr<CefPostData> postData,
const HeaderMap& headerMap) =0;
};
@ -912,7 +912,7 @@ public:
// The post data element will represent a file.
/*--cef()--*/
virtual void SetToFile(const std::wstring& fileName) =0;
virtual void SetToFile(const CefString& fileName) =0;
// The post data element will represent bytes. The bytes passed
// in will be copied.
@ -925,7 +925,7 @@ public:
// Return the file name.
/*--cef()--*/
virtual std::wstring GetFile() =0;
virtual CefString GetFile() =0;
// Return the number of bytes.
/*--cef()--*/
@ -969,7 +969,7 @@ class CefStreamReader : public CefBase
public:
// Create a new CefStreamReader object.
/*--cef()--*/
static CefRefPtr<CefStreamReader> CreateForFile(const std::wstring& fileName);
static CefRefPtr<CefStreamReader> CreateForFile(const CefString& fileName);
/*--cef()--*/
static CefRefPtr<CefStreamReader> CreateForData(void* data, size_t size);
/*--cef()--*/
@ -1026,7 +1026,7 @@ class CefStreamWriter : public CefBase
public:
// Create a new CefStreamWriter object.
/*--cef()--*/
static CefRefPtr<CefStreamWriter> CreateForFile(const std::wstring& fileName);
static CefRefPtr<CefStreamWriter> CreateForFile(const CefString& fileName);
/*--cef()--*/
static CefRefPtr<CefStreamWriter> CreateForHandler(CefRefPtr<CefWriteHandler> handler);
@ -1059,11 +1059,11 @@ public:
// Execute with the specified argument list and return value. Return true if
// the method was handled.
/*--cef()--*/
virtual bool Execute(const std::wstring& name,
virtual bool Execute(const CefString& name,
CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments,
CefRefPtr<CefV8Value>& retval,
std::wstring& exception) =0;
CefString& exception) =0;
};
@ -1087,13 +1087,13 @@ public:
/*--cef()--*/
static CefRefPtr<CefV8Value> CreateDouble(double value);
/*--cef()--*/
static CefRefPtr<CefV8Value> CreateString(const std::wstring& value);
static CefRefPtr<CefV8Value> CreateString(const CefString& value);
/*--cef()--*/
static CefRefPtr<CefV8Value> CreateObject(CefRefPtr<CefBase> user_data);
/*--cef()--*/
static CefRefPtr<CefV8Value> CreateArray();
/*--cef()--*/
static CefRefPtr<CefV8Value> CreateFunction(const std::wstring& name,
static CefRefPtr<CefV8Value> CreateFunction(const CefString& name,
CefRefPtr<CefV8Handler> handler);
// Check the value type.
@ -1125,7 +1125,7 @@ public:
/*--cef()--*/
virtual double GetDoubleValue() =0;
/*--cef()--*/
virtual std::wstring GetStringValue() =0;
virtual CefString GetStringValue() =0;
// OBJECT METHODS - These methods are only available on objects. Arrays and
@ -1135,32 +1135,32 @@ public:
// Returns true if the object has a value with the specified identifier.
/*--cef(capi_name=has_value_bykey)--*/
virtual bool HasValue(const std::wstring& key) =0;
virtual bool HasValue(const CefString& key) =0;
/*--cef(capi_name=has_value_byindex)--*/
virtual bool HasValue(int index) =0;
// Delete the value with the specified identifier.
/*--cef(capi_name=delete_value_bykey)--*/
virtual bool DeleteValue(const std::wstring& key) =0;
virtual bool DeleteValue(const CefString& key) =0;
/*--cef(capi_name=delete_value_byindex)--*/
virtual bool DeleteValue(int index) =0;
// Returns the value with the specified identifier.
/*--cef(capi_name=get_value_bykey)--*/
virtual CefRefPtr<CefV8Value> GetValue(const std::wstring& key) =0;
virtual CefRefPtr<CefV8Value> GetValue(const CefString& key) =0;
/*--cef(capi_name=get_value_byindex)--*/
virtual CefRefPtr<CefV8Value> GetValue(int index) =0;
// Associate value with the specified identifier.
/*--cef(capi_name=set_value_bykey)--*/
virtual bool SetValue(const std::wstring& key, CefRefPtr<CefV8Value> value) =0;
virtual bool SetValue(const CefString& key, CefRefPtr<CefV8Value> value) =0;
/*--cef(capi_name=set_value_byindex)--*/
virtual bool SetValue(int index, CefRefPtr<CefV8Value> value) =0;
// Read the keys for the object's values into the specified vector. Integer-
// based keys will also be returned as strings.
/*--cef()--*/
virtual bool GetKeys(std::vector<std::wstring>& keys) =0;
virtual bool GetKeys(std::vector<CefString>& keys) =0;
// Returns the user data, if any, specified when the object was created.
/*--cef()--*/
@ -1178,7 +1178,7 @@ public:
// Returns the function name.
/*--cef()--*/
virtual std::wstring GetFunctionName() =0;
virtual CefString GetFunctionName() =0;
// Returns the function handler or NULL if not a CEF-created function.
/*--cef()--*/
@ -1189,7 +1189,7 @@ public:
virtual bool ExecuteFunction(CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments,
CefRefPtr<CefV8Value>& retval,
std::wstring& exception) =0;
CefString& exception) =0;
};
@ -1220,7 +1220,7 @@ public:
// |mime_type| to the mime type for the response.
/*--cef()--*/
virtual bool ProcessRequest(CefRefPtr<CefRequest> request,
std::wstring& mime_type, int* response_length) =0;
CefString& mime_type, int* response_length) =0;
// Cancel processing of the request.
/*--cef()--*/
@ -1265,7 +1265,7 @@ public:
/*--cef()--*/
static CefRefPtr<CefXmlReader> Create(CefRefPtr<CefStreamReader> stream,
EncodingType encodingType,
const std::wstring& URI);
const CefString& URI);
// Moves the cursor to the next node in the document. This method must be
// called at least once to set the current cursor position. Returns true if
@ -1284,7 +1284,7 @@ public:
// Returns the error string.
/*--cef()--*/
virtual std::wstring GetError() =0;
virtual CefString GetError() =0;
// The below methods retrieve data for the node at the current cursor
@ -1301,32 +1301,32 @@ public:
// Returns the local name. See
// http://www.w3.org/TR/REC-xml-names/#NT-LocalPart for additional details.
/*--cef()--*/
virtual std::wstring GetLocalName() =0;
virtual CefString GetLocalName() =0;
// Returns the namespace prefix. See http://www.w3.org/TR/REC-xml-names/ for
// additional details.
/*--cef()--*/
virtual std::wstring GetPrefix() =0;
virtual CefString GetPrefix() =0;
// Returns the qualified name, equal to (Prefix:)LocalName. See
// http://www.w3.org/TR/REC-xml-names/#ns-qualnames for additional details.
/*--cef()--*/
virtual std::wstring GetQualifiedName() =0;
virtual CefString GetQualifiedName() =0;
// Returns the URI defining the namespace associated with the node. See
// http://www.w3.org/TR/REC-xml-names/ for additional details.
/*--cef()--*/
virtual std::wstring GetNamespaceURI() =0;
virtual CefString GetNamespaceURI() =0;
// Returns the base URI of the node. See http://www.w3.org/TR/xmlbase/ for
// additional details.
/*--cef()--*/
virtual std::wstring GetBaseURI() =0;
virtual CefString GetBaseURI() =0;
// Returns the xml:lang scope within which the node resides. See
// http://www.w3.org/TR/REC-xml/#sec-lang-tag for additional details.
/*--cef()--*/
virtual std::wstring GetXmlLang() =0;
virtual CefString GetXmlLang() =0;
// Returns true if the node represents an empty element. <a/> is considered
// empty but <a></a> is not.
@ -1339,7 +1339,7 @@ public:
// Returns the text value.
/*--cef()--*/
virtual std::wstring GetValue() =0;
virtual CefString GetValue() =0;
// Returns true if the node has attributes.
/*--cef()--*/
@ -1351,25 +1351,25 @@ public:
// Returns the value of the attribute at the specified 0-based index.
/*--cef(capi_name=get_attribute_byindex)--*/
virtual std::wstring GetAttribute(int index) =0;
virtual CefString GetAttribute(int index) =0;
// Returns the value of the attribute with the specified qualified name.
/*--cef(capi_name=get_attribute_byqname)--*/
virtual std::wstring GetAttribute(const std::wstring& qualifiedName) =0;
virtual CefString GetAttribute(const CefString& qualifiedName) =0;
// Returns the value of the attribute with the specified local name and
// namespace URI.
/*--cef(capi_name=get_attribute_bylname)--*/
virtual std::wstring GetAttribute(const std::wstring& localName,
const std::wstring& namespaceURI) =0;
virtual CefString GetAttribute(const CefString& localName,
const CefString& namespaceURI) =0;
// Returns an XML representation of the current node's children.
/*--cef()--*/
virtual std::wstring GetInnerXml() =0;
virtual CefString GetInnerXml() =0;
// Returns an XML representation of the current node including its children.
/*--cef()--*/
virtual std::wstring GetOuterXml() =0;
virtual CefString GetOuterXml() =0;
// Returns the line number for the current node.
/*--cef()--*/
@ -1389,13 +1389,13 @@ public:
// Moves the cursor to the attribute with the specified qualified name.
// Returns true if the cursor position was set successfully.
/*--cef(capi_name=move_to_attribute_byqname)--*/
virtual bool MoveToAttribute(const std::wstring& qualifiedName) =0;
virtual bool MoveToAttribute(const CefString& qualifiedName) =0;
// Moves the cursor to the attribute with the specified local name and
// namespace URI. Returns true if the cursor position was set successfully.
/*--cef(capi_name=move_to_attribute_bylname)--*/
virtual bool MoveToAttribute(const std::wstring& localName,
const std::wstring& namespaceURI) =0;
virtual bool MoveToAttribute(const CefString& localName,
const CefString& namespaceURI) =0;
// Moves the cursor to the first attribute in the current element. Returns
// true if the cursor position was set successfully.
@ -1438,7 +1438,7 @@ public:
// is true then the search will be case sensitive. Returns true if the cursor
// position was set successfully.
/*--cef()--*/
virtual bool MoveToFile(const std::wstring& fileName, bool caseSensitive) =0;
virtual bool MoveToFile(const CefString& fileName, bool caseSensitive) =0;
// Closes the archive. This should be called directly to ensure that cleanup
// occurs on the correct thread.
@ -1450,7 +1450,7 @@ public:
// Returns the name of the file.
/*--cef()--*/
virtual std::wstring GetFileName() =0;
virtual CefString GetFileName() =0;
// Returns the uncompressed size of the file.
/*--cef()--*/
@ -1463,7 +1463,7 @@ public:
// Opens the file for reading of uncompressed data. A read password may
// optionally be specified.
/*--cef()--*/
virtual bool OpenFile(const std::wstring& password) =0;
virtual bool OpenFile(const CefString& password) =0;
// Closes the file.
/*--cef()--*/
@ -1608,14 +1608,10 @@ public:
void Reset()
{
if(cache_path)
cef_string_free(cache_path);
if(user_agent)
cef_string_free(user_agent);
if(product_version)
cef_string_free(product_version);
if(locale)
cef_string_free(locale);
cef_string_clear(&cache_path);
cef_string_clear(&user_agent);
cef_string_clear(&product_version);
cef_string_clear(&locale);
if(extra_plugin_paths)
cef_string_list_free(extra_plugin_paths);
Init();
@ -1641,22 +1637,11 @@ public:
{
multi_threaded_message_loop = r.multi_threaded_message_loop;
if(cache_path)
cef_string_free(cache_path);
cache_path = r.cache_path ? cef_string_alloc(r.cache_path) : NULL;
if(user_agent)
cef_string_free(user_agent);
user_agent = r.user_agent ? cef_string_alloc(r.user_agent) : NULL;
if(product_version)
cef_string_free(product_version);
product_version = r.product_version ?
cef_string_alloc(r.product_version) : NULL;
if(locale)
cef_string_free(locale);
locale = r.locale ? cef_string_alloc(r.locale) : NULL;
cef_string_copy(r.cache_path.str, r.cache_path.length, &cache_path);
cef_string_copy(r.user_agent.str, r.user_agent.length, &user_agent);
cef_string_copy(r.product_version.str, r.product_version.length,
&product_version);
cef_string_copy(r.locale.str, r.locale.length, &locale);
if(extra_plugin_paths)
cef_string_list_free(extra_plugin_paths);
@ -1701,22 +1686,14 @@ public:
void Reset()
{
if(standard_font_family)
cef_string_free(standard_font_family);
if(fixed_font_family)
cef_string_free(fixed_font_family);
if(serif_font_family)
cef_string_free(serif_font_family);
if(sans_serif_font_family)
cef_string_free(sans_serif_font_family);
if(cursive_font_family)
cef_string_free(cursive_font_family);
if(fantasy_font_family)
cef_string_free(fantasy_font_family);
if(default_encoding)
cef_string_free(default_encoding);
if(user_style_sheet_location)
cef_string_free(user_style_sheet_location);
cef_string_clear(&standard_font_family);
cef_string_clear(&fixed_font_family);
cef_string_clear(&serif_font_family);
cef_string_clear(&sans_serif_font_family);
cef_string_clear(&cursive_font_family);
cef_string_clear(&fantasy_font_family);
cef_string_clear(&default_encoding);
cef_string_clear(&user_style_sheet_location);
Init();
}
@ -1740,35 +1717,18 @@ public:
{
drag_drop_disabled = r.drag_drop_disabled;
if(standard_font_family)
cef_string_free(standard_font_family);
standard_font_family = r.standard_font_family ?
cef_string_alloc(r.standard_font_family) : NULL;
if(fixed_font_family)
cef_string_free(fixed_font_family);
fixed_font_family = r.fixed_font_family ?
cef_string_alloc(r.fixed_font_family) : NULL;
if(serif_font_family)
cef_string_free(serif_font_family);
serif_font_family = r.serif_font_family ?
cef_string_alloc(r.serif_font_family) : NULL;
if(sans_serif_font_family)
cef_string_free(sans_serif_font_family);
serif_font_family = r.sans_serif_font_family ?
cef_string_alloc(r.sans_serif_font_family) : NULL;
if(cursive_font_family)
cef_string_free(cursive_font_family);
cursive_font_family = r.cursive_font_family ?
cef_string_alloc(r.cursive_font_family) : NULL;
if(fantasy_font_family)
cef_string_free(fantasy_font_family);
fantasy_font_family = r.fantasy_font_family ?
cef_string_alloc(r.fantasy_font_family) : NULL;
cef_string_copy(r.standard_font_family.str, r.standard_font_family.length,
&standard_font_family);
cef_string_copy(r.fixed_font_family.str, r.fixed_font_family.length,
&fixed_font_family);
cef_string_copy(r.serif_font_family.str, r.serif_font_family.length,
&serif_font_family);
cef_string_copy(r.sans_serif_font_family.str,
r.sans_serif_font_family.length, &sans_serif_font_family);
cef_string_copy(r.cursive_font_family.str, r.cursive_font_family.length,
&cursive_font_family);
cef_string_copy(r.fantasy_font_family.str, r.fantasy_font_family.length,
&fantasy_font_family);
default_font_size = r.default_font_size;
default_fixed_font_size = r.default_fixed_font_size;
@ -1776,10 +1736,8 @@ public:
minimum_logical_font_size = r.minimum_logical_font_size;
remote_fonts_disabled = r.remote_fonts_disabled;
if(default_encoding)
cef_string_free(default_encoding);
default_encoding = r.default_encoding ?
cef_string_alloc(r.default_encoding) : NULL;
cef_string_copy(r.default_encoding.str, r.default_encoding.length,
&default_encoding);
encoding_detector_enabled = r.encoding_detector_enabled;
javascript_disabled = r.javascript_disabled;
@ -1805,10 +1763,8 @@ public:
hyperlink_auditing_disabled = r.hyperlink_auditing_disabled;
user_style_sheet_enabled = r.user_style_sheet_enabled;
if(user_style_sheet_location)
cef_string_free(user_style_sheet_location);
user_style_sheet_location = r.user_style_sheet_location ?
cef_string_alloc(r.user_style_sheet_location) : NULL;
cef_string_copy(r.user_style_sheet_location.str,
r.user_style_sheet_location.length, &user_style_sheet_location);
author_and_user_styles_disabled = r.author_and_user_styles_disabled;
local_storage_disabled = r.local_storage_disabled;

View File

@ -118,15 +118,16 @@ CEF_EXPORT void cef_do_message_loop_work();
// // Call another function.
// example.test.increment();
//
CEF_EXPORT int cef_register_extension(const wchar_t* extension_name,
const wchar_t* javascript_code, struct _cef_v8handler_t* handler);
CEF_EXPORT int cef_register_extension(const cef_string_t* extension_name,
const cef_string_t* javascript_code, struct _cef_v8handler_t* handler);
// Register a custom scheme handler factory for the specified |scheme_name| and
// |host_name|. All URLs beginning with scheme_name://host_name/ can be handled
// by cef_scheme_handler_t instances returned by the factory. Specify an NULL
// |host_name| value to match all host names.
CEF_EXPORT int cef_register_scheme(const wchar_t* scheme_name,
const wchar_t* host_name, struct _cef_scheme_handler_factory_t* factory);
CEF_EXPORT int cef_register_scheme(const cef_string_t* scheme_name,
const cef_string_t* host_name,
struct _cef_scheme_handler_factory_t* factory);
// CEF maintains multiple internal threads that are used for handling different
// types of tasks. The UI thread creates the browser window and is used for all
@ -236,7 +237,7 @@ typedef struct _cef_browser_t
// Returns the frame with the specified name, or NULL if not found.
struct _cef_frame_t* (CEF_CALLBACK *get_frame)(struct _cef_browser_t* self,
const wchar_t* name);
const cef_string_t* name);
// Returns the names of all existing frames.
void (CEF_CALLBACK *get_frame_names)(struct _cef_browser_t* self,
@ -248,7 +249,8 @@ typedef struct _cef_browser_t
// be case-sensitive. |findNext| indicates whether this is the first request
// or a follow-up.
void (CEF_CALLBACK *find)(struct _cef_browser_t* self, int identifier,
const wchar_t* searchText, int forward, int matchCase, int findNext);
const cef_string_t* searchText, int forward, int matchCase,
int findNext);
// Cancel all searches that are currently going on.
void (CEF_CALLBACK *stop_finding)(struct _cef_browser_t* self,
@ -262,14 +264,14 @@ typedef struct _cef_browser_t
// be created on the UI thread. The |popup| parameter should be true (1) if the
// new window is a popup window. This function call will not block.
CEF_EXPORT int cef_browser_create(cef_window_info_t* windowInfo, int popup,
struct _cef_handler_t* handler, const wchar_t* url);
struct _cef_handler_t* handler, const cef_string_t* url);
// Create a new browser window using the window parameters specified by
// |windowInfo|. The |popup| parameter should be true (1) if the new window is a
// popup window. This function call will block and can only be used if the
// |multi_threaded_message_loop| parameter to cef_initialize() is false (0).
CEF_EXPORT cef_browser_t* cef_browser_create_sync(cef_window_info_t* windowInfo,
int popup, struct _cef_handler_t* handler, const wchar_t* url);
int popup, struct _cef_handler_t* handler, const cef_string_t* url);
// Structure used to represent a frame in the browser window. All functions
@ -309,27 +311,28 @@ typedef struct _cef_frame_t
void (CEF_CALLBACK *view_source)(struct _cef_frame_t* self);
// Returns this frame's HTML source as a string.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_source)(struct _cef_frame_t* self);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_source)(struct _cef_frame_t* self);
// Returns this frame's display text as a string.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_text)(struct _cef_frame_t* self);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_text)(struct _cef_frame_t* self);
// Load the request represented by the |request| object.
void (CEF_CALLBACK *load_request)(struct _cef_frame_t* self,
struct _cef_request_t* request);
// Load the specified |url|.
void (CEF_CALLBACK *load_url)(struct _cef_frame_t* self, const wchar_t* url);
void (CEF_CALLBACK *load_url)(struct _cef_frame_t* self,
const cef_string_t* url);
// Load the contents of |string| with the optional dummy target |url|.
void (CEF_CALLBACK *load_string)(struct _cef_frame_t* self,
const wchar_t* string, const wchar_t* url);
const cef_string_t* string, const cef_string_t* url);
// Load the contents of |stream| with the optional dummy target |url|.
void (CEF_CALLBACK *load_stream)(struct _cef_frame_t* self,
struct _cef_stream_reader_t* stream, const wchar_t* url);
struct _cef_stream_reader_t* stream, const cef_string_t* url);
// Execute a string of JavaScript code in this frame. The |script_url|
// parameter is the URL where the script in question can be found, if any. The
@ -337,7 +340,8 @@ typedef struct _cef_frame_t
// error. The |start_line| parameter is the base line number to use for error
// reporting.
void (CEF_CALLBACK *execute_java_script)(struct _cef_frame_t* self,
const wchar_t* jsCode, const wchar_t* scriptUrl, int startLine);
const cef_string_t* jsCode, const cef_string_t* scriptUrl,
int startLine);
// Returns true (1) if this is the main frame.
int (CEF_CALLBACK *is_main)(struct _cef_frame_t* self);
@ -346,12 +350,12 @@ typedef struct _cef_frame_t
int (CEF_CALLBACK *is_focused)(struct _cef_frame_t* self);
// Returns this frame's name.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_name)(struct _cef_frame_t* self);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_name)(struct _cef_frame_t* self);
// Return the URL currently loaded in this frame.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_url)(struct _cef_frame_t* self);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_url)(struct _cef_frame_t* self);
} cef_frame_t;
@ -390,13 +394,13 @@ typedef struct _cef_handler_t
// currently ignored.
enum cef_retval_t (CEF_CALLBACK *handle_address_change)(
struct _cef_handler_t* self, struct _cef_browser_t* browser,
struct _cef_frame_t* frame, const wchar_t* url);
struct _cef_frame_t* frame, const cef_string_t* url);
// Event called when the page title changes. The return value is currently
// ignored.
enum cef_retval_t (CEF_CALLBACK *handle_title_change)(
struct _cef_handler_t* self, struct _cef_browser_t* browser,
const wchar_t* title);
const cef_string_t* title);
// Event called before browser navigation. The client has an opportunity to
// modify the |request| object if desired. Return RV_HANDLED to cancel
@ -428,7 +432,7 @@ typedef struct _cef_handler_t
enum cef_retval_t (CEF_CALLBACK *handle_load_error)(
struct _cef_handler_t* self, struct _cef_browser_t* browser,
struct _cef_frame_t* frame, enum cef_handler_errorcode_t errorCode,
const wchar_t* failedUrl, cef_string_t* errorText);
const cef_string_t* failedUrl, cef_string_t* errorText);
// Event called before a resource is loaded. To allow the resource to load
// normally return RV_CONTINUE. To redirect the resource to a new url populate
@ -453,8 +457,8 @@ typedef struct _cef_handler_t
// RV_HANDLED to cancel the file download.
enum cef_retval_t (CEF_CALLBACK *handle_download_response)(
struct _cef_handler_t* self, struct _cef_browser_t* browser,
const wchar_t* mimeType, const wchar_t* fileName, int64 contentLength,
struct _cef_download_handler_t** handler);
const cef_string_t* mimeType, const cef_string_t* fileName,
int64 contentLength, struct _cef_download_handler_t** handler);
// Event called before a context menu is displayed. To cancel display of the
// default context menu return RV_HANDLED.
@ -498,23 +502,23 @@ typedef struct _cef_handler_t
enum cef_retval_t (CEF_CALLBACK *handle_print_header_footer)(
struct _cef_handler_t* self, struct _cef_browser_t* browser,
struct _cef_frame_t* frame, struct _cef_print_info_t* printInfo,
const wchar_t* url, const wchar_t* title, int currentPage, int maxPages,
cef_string_t* topLeft, cef_string_t* topCenter, cef_string_t* topRight,
cef_string_t* bottomLeft, cef_string_t* bottomCenter,
cef_string_t* bottomRight);
const cef_string_t* url, const cef_string_t* title, int currentPage,
int maxPages, cef_string_t* topLeft, cef_string_t* topCenter,
cef_string_t* topRight, cef_string_t* bottomLeft,
cef_string_t* bottomCenter, cef_string_t* bottomRight);
// Run a JS alert message. Return RV_CONTINUE to display the default alert or
// RV_HANDLED if you displayed a custom alert.
enum cef_retval_t (CEF_CALLBACK *handle_jsalert)(struct _cef_handler_t* self,
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
const wchar_t* message);
const cef_string_t* message);
// Run a JS confirm request. Return RV_CONTINUE to display the default alert
// or RV_HANDLED if you displayed a custom alert. If you handled the alert
// set |retval| to true (1) if the user accepted the confirmation.
enum cef_retval_t (CEF_CALLBACK *handle_jsconfirm)(
struct _cef_handler_t* self, struct _cef_browser_t* browser,
struct _cef_frame_t* frame, const wchar_t* message, int* retval);
struct _cef_frame_t* frame, const cef_string_t* message, int* retval);
// Run a JS prompt request. Return RV_CONTINUE to display the default prompt
// or RV_HANDLED if you displayed a custom prompt. If you handled the prompt
@ -522,8 +526,8 @@ typedef struct _cef_handler_t
// |result| to the resulting value.
enum cef_retval_t (CEF_CALLBACK *handle_jsprompt)(struct _cef_handler_t* self,
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
const wchar_t* message, const wchar_t* defaultValue, int* retval,
cef_string_t* result);
const cef_string_t* message, const cef_string_t* defaultValue,
int* retval, cef_string_t* result);
// Event called for adding values to a frame's JavaScript 'window' object. The
// return value is currently ignored.
@ -576,7 +580,7 @@ typedef struct _cef_handler_t
// from being output to the console.
enum cef_retval_t (CEF_CALLBACK *handle_console_message)(
struct _cef_handler_t* self, struct _cef_browser_t* browser,
const wchar_t* message, const wchar_t* source, int line);
const cef_string_t* message, const cef_string_t* source, int line);
// Called to report find results returned by cef_browser_t::find().
// |identifer| is the identifier passed to cef_browser_t::find(), |count| is
@ -600,16 +604,17 @@ typedef struct _cef_request_t
cef_base_t base;
// Fully qualified URL to load.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_url)(struct _cef_request_t* self);
void (CEF_CALLBACK *set_url)(struct _cef_request_t* self, const wchar_t* url);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_url)(struct _cef_request_t* self);
void (CEF_CALLBACK *set_url)(struct _cef_request_t* self,
const cef_string_t* url);
// Optional request function type, defaulting to POST if post data is provided
// and GET otherwise.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_method)(struct _cef_request_t* self);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_method)(struct _cef_request_t* self);
void (CEF_CALLBACK *set_method)(struct _cef_request_t* self,
const wchar_t* method);
const cef_string_t* method);
// Optional post data.
struct _cef_post_data_t* (CEF_CALLBACK *get_post_data)(
@ -624,8 +629,8 @@ typedef struct _cef_request_t
cef_string_map_t headerMap);
// Set all values at one time.
void (CEF_CALLBACK *set)(struct _cef_request_t* self, const wchar_t* url,
const wchar_t* method, struct _cef_post_data_t* postData,
void (CEF_CALLBACK *set)(struct _cef_request_t* self, const cef_string_t* url,
const cef_string_t* method, struct _cef_post_data_t* postData,
cef_string_map_t headerMap);
} cef_request_t;
@ -678,7 +683,7 @@ typedef struct _cef_post_data_element_t
// The post data element will represent a file.
void (CEF_CALLBACK *set_to_file)(struct _cef_post_data_element_t* self,
const wchar_t* fileName);
const cef_string_t* fileName);
// The post data element will represent bytes. The bytes passed in will be
// copied.
@ -690,8 +695,9 @@ typedef struct _cef_post_data_element_t
struct _cef_post_data_element_t* self);
// Return the file name.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_file)(struct _cef_post_data_element_t* self);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_file)(
struct _cef_post_data_element_t* self);
// Return the number of bytes.
size_t (CEF_CALLBACK *get_bytes_count)(struct _cef_post_data_element_t* self);
@ -758,7 +764,7 @@ typedef struct _cef_stream_reader_t
// Create a new cef_stream_reader_t object.
CEF_EXPORT cef_stream_reader_t* cef_stream_reader_create_for_file(
const wchar_t* fileName);
const cef_string_t* fileName);
CEF_EXPORT cef_stream_reader_t* cef_stream_reader_create_for_data(void* data,
size_t size);
CEF_EXPORT cef_stream_reader_t* cef_stream_reader_create_for_handler(
@ -815,7 +821,7 @@ typedef struct _cef_stream_writer_t
// Create a new cef_stream_writer_t object.
CEF_EXPORT cef_stream_writer_t* cef_stream_writer_create_for_file(
const wchar_t* fileName);
const cef_string_t* fileName);
CEF_EXPORT cef_stream_writer_t* cef_stream_writer_create_for_handler(
cef_write_handler_t* handler);
@ -829,9 +835,9 @@ typedef struct _cef_v8handler_t
// Execute with the specified argument list and return value. Return true (1)
// if the function was handled.
int (CEF_CALLBACK *execute)(struct _cef_v8handler_t* self,
const wchar_t* name, struct _cef_v8value_t* object, size_t argumentCount,
struct _cef_v8value_t* const* arguments, struct _cef_v8value_t** retval,
cef_string_t* exception);
const cef_string_t* name, struct _cef_v8value_t* object,
size_t argumentCount, struct _cef_v8value_t* const* arguments,
struct _cef_v8value_t** retval, cef_string_t* exception);
} cef_v8handler_t;
@ -858,8 +864,9 @@ typedef struct _cef_v8value_t
int (CEF_CALLBACK *get_bool_value)(struct _cef_v8value_t* self);
int (CEF_CALLBACK *get_int_value)(struct _cef_v8value_t* self);
double (CEF_CALLBACK *get_double_value)(struct _cef_v8value_t* self);
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_string_value)(struct _cef_v8value_t* self);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_string_value)(
struct _cef_v8value_t* self);
// OBJECT METHODS - These functions are only available on objects. Arrays and
@ -869,24 +876,24 @@ typedef struct _cef_v8value_t
// Returns true (1) if the object has a value with the specified identifier.
int (CEF_CALLBACK *has_value_bykey)(struct _cef_v8value_t* self,
const wchar_t* key);
const cef_string_t* key);
int (CEF_CALLBACK *has_value_byindex)(struct _cef_v8value_t* self, int index);
// Delete the value with the specified identifier.
int (CEF_CALLBACK *delete_value_bykey)(struct _cef_v8value_t* self,
const wchar_t* key);
const cef_string_t* key);
int (CEF_CALLBACK *delete_value_byindex)(struct _cef_v8value_t* self,
int index);
// Returns the value with the specified identifier.
struct _cef_v8value_t* (CEF_CALLBACK *get_value_bykey)(
struct _cef_v8value_t* self, const wchar_t* key);
struct _cef_v8value_t* self, const cef_string_t* key);
struct _cef_v8value_t* (CEF_CALLBACK *get_value_byindex)(
struct _cef_v8value_t* self, int index);
// Associate value with the specified identifier.
int (CEF_CALLBACK *set_value_bykey)(struct _cef_v8value_t* self,
const wchar_t* key, struct _cef_v8value_t* value);
const cef_string_t* key, struct _cef_v8value_t* value);
int (CEF_CALLBACK *set_value_byindex)(struct _cef_v8value_t* self, int index,
struct _cef_v8value_t* value);
@ -909,8 +916,9 @@ typedef struct _cef_v8value_t
// FUNCTION METHODS - These functions are only available on functions.
// Returns the function name.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_function_name)(struct _cef_v8value_t* self);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_function_name)(
struct _cef_v8value_t* self);
// Returns the function handler or NULL if not a CEF-created function.
struct _cef_v8handler_t* (CEF_CALLBACK *get_function_handler)(
@ -934,10 +942,10 @@ CEF_EXPORT cef_v8value_t* cef_v8value_create_null();
CEF_EXPORT cef_v8value_t* cef_v8value_create_bool(int value);
CEF_EXPORT cef_v8value_t* cef_v8value_create_int(int value);
CEF_EXPORT cef_v8value_t* cef_v8value_create_double(double value);
CEF_EXPORT cef_v8value_t* cef_v8value_create_string(const wchar_t* value);
CEF_EXPORT cef_v8value_t* cef_v8value_create_string(const cef_string_t* value);
CEF_EXPORT cef_v8value_t* cef_v8value_create_object(cef_base_t* user_data);
CEF_EXPORT cef_v8value_t* cef_v8value_create_array();
CEF_EXPORT cef_v8value_t* cef_v8value_create_function(const wchar_t* name,
CEF_EXPORT cef_v8value_t* cef_v8value_create_function(const cef_string_t* name,
cef_v8handler_t* handler);
@ -1022,8 +1030,9 @@ typedef struct _cef_xml_reader_t
int (CEF_CALLBACK *has_error)(struct _cef_xml_reader_t* self);
// Returns the error string.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_error)(struct _cef_xml_reader_t* self);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_error)(
struct _cef_xml_reader_t* self);
// The below functions retrieve data for the node at the current cursor
@ -1038,35 +1047,39 @@ typedef struct _cef_xml_reader_t
// Returns the local name. See http://www.w3.org/TR/REC-xml-names/#NT-
// LocalPart for additional details.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_local_name)(struct _cef_xml_reader_t* self);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_local_name)(
struct _cef_xml_reader_t* self);
// Returns the namespace prefix. See http://www.w3.org/TR/REC-xml-names/ for
// additional details.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_prefix)(struct _cef_xml_reader_t* self);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_prefix)(
struct _cef_xml_reader_t* self);
// Returns the qualified name, equal to (Prefix:)LocalName. See
// http://www.w3.org/TR/REC-xml-names/#ns-qualnames for additional details.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_qualified_name)(
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_qualified_name)(
struct _cef_xml_reader_t* self);
// Returns the URI defining the namespace associated with the node. See
// http://www.w3.org/TR/REC-xml-names/ for additional details.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_namespace_uri)(
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_namespace_uri)(
struct _cef_xml_reader_t* self);
// Returns the base URI of the node. See http://www.w3.org/TR/xmlbase/ for
// additional details.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_base_uri)(struct _cef_xml_reader_t* self);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_base_uri)(
struct _cef_xml_reader_t* self);
// Returns the xml:lang scope within which the node resides. See
// http://www.w3.org/TR/REC-xml/#sec-lang-tag for additional details.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_xml_lang)(struct _cef_xml_reader_t* self);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_xml_lang)(
struct _cef_xml_reader_t* self);
// Returns true (1) if the node represents an NULL element. <a/> is considered
// NULL but <a></a> is not.
@ -1076,8 +1089,9 @@ typedef struct _cef_xml_reader_t
int (CEF_CALLBACK *has_value)(struct _cef_xml_reader_t* self);
// Returns the text value.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_value)(struct _cef_xml_reader_t* self);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_value)(
struct _cef_xml_reader_t* self);
// Returns true (1) if the node has attributes.
int (CEF_CALLBACK *has_attributes)(struct _cef_xml_reader_t* self);
@ -1086,29 +1100,31 @@ typedef struct _cef_xml_reader_t
size_t (CEF_CALLBACK *get_attribute_count)(struct _cef_xml_reader_t* self);
// Returns the value of the attribute at the specified 0-based index.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_attribute_byindex)(
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_attribute_byindex)(
struct _cef_xml_reader_t* self, int index);
// Returns the value of the attribute with the specified qualified name.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_attribute_byqname)(
struct _cef_xml_reader_t* self, const wchar_t* qualifiedName);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_attribute_byqname)(
struct _cef_xml_reader_t* self, const cef_string_t* qualifiedName);
// Returns the value of the attribute with the specified local name and
// namespace URI.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_attribute_bylname)(
struct _cef_xml_reader_t* self, const wchar_t* localName,
const wchar_t* namespaceURI);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_attribute_bylname)(
struct _cef_xml_reader_t* self, const cef_string_t* localName,
const cef_string_t* namespaceURI);
// Returns an XML representation of the current node's children.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_inner_xml)(struct _cef_xml_reader_t* self);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_inner_xml)(
struct _cef_xml_reader_t* self);
// Returns an XML representation of the current node including its children.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_outer_xml)(struct _cef_xml_reader_t* self);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_outer_xml)(
struct _cef_xml_reader_t* self);
// Returns the line number for the current node.
int (CEF_CALLBACK *get_line_number)(struct _cef_xml_reader_t* self);
@ -1127,13 +1143,13 @@ typedef struct _cef_xml_reader_t
// Moves the cursor to the attribute with the specified qualified name.
// Returns true (1) if the cursor position was set successfully.
int (CEF_CALLBACK *move_to_attribute_byqname)(struct _cef_xml_reader_t* self,
const wchar_t* qualifiedName);
const cef_string_t* qualifiedName);
// Moves the cursor to the attribute with the specified local name and
// namespace URI. Returns true (1) if the cursor position was set
// successfully.
int (CEF_CALLBACK *move_to_attribute_bylname)(struct _cef_xml_reader_t* self,
const wchar_t* localName, const wchar_t* namespaceURI);
const cef_string_t* localName, const cef_string_t* namespaceURI);
// Moves the cursor to the first attribute in the current element. Returns
// true (1) if the cursor position was set successfully.
@ -1153,7 +1169,7 @@ typedef struct _cef_xml_reader_t
// Create a new cef_xml_reader_t object. The returned object's functions can
// only be called from the thread that created the object.
CEF_EXPORT cef_xml_reader_t* cef_xml_reader_create(cef_stream_reader_t* stream,
enum cef_xml_encoding_type_t encodingType, const wchar_t* URI);
enum cef_xml_encoding_type_t encodingType, const cef_string_t* URI);
// Structure that supports the reading of zip archives via the zlib unzip API.
@ -1174,7 +1190,7 @@ typedef struct _cef_zip_reader_t
// is true (1) then the search will be case sensitive. Returns true (1) if the
// cursor position was set successfully.
int (CEF_CALLBACK *move_to_file)(struct _cef_zip_reader_t* self,
const wchar_t* fileName, int caseSensitive);
const cef_string_t* fileName, int caseSensitive);
// Closes the archive. This should be called directly to ensure that cleanup
// occurs on the correct thread.
@ -1184,8 +1200,9 @@ typedef struct _cef_zip_reader_t
// The below functions act on the file at the current cursor position.
// Returns the name of the file.
// The resulting string must be freed by calling cef_string_free().
cef_string_t (CEF_CALLBACK *get_file_name)(struct _cef_zip_reader_t* self);
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_file_name)(
struct _cef_zip_reader_t* self);
// Returns the uncompressed size of the file.
long (CEF_CALLBACK *get_file_size)(struct _cef_zip_reader_t* self);
@ -1196,7 +1213,7 @@ typedef struct _cef_zip_reader_t
// Opens the file for reading of uncompressed data. A read password may
// optionally be specified.
int (CEF_CALLBACK *open_file)(struct _cef_zip_reader_t* self,
const wchar_t* password);
const cef_string_t* password);
// Closes the file.
int (CEF_CALLBACK *close_file)(struct _cef_zip_reader_t* self);

View File

@ -99,8 +99,7 @@ public:
void Reset()
{
if(m_windowName)
cef_string_free(m_windowName);
cef_string_clear(&m_windowName);
Init();
}
@ -121,12 +120,7 @@ public:
}
CefWindowInfo& operator=(const cef_window_info_t& r)
{
if(m_windowName)
cef_string_free(m_windowName);
if(r.m_windowName)
m_windowName = cef_string_alloc(r.m_windowName);
else
m_windowName = NULL;
cef_string_copy(r.m_windowName.str, r.m_windowName.length, &m_windowName);
m_x = r.m_x;
m_y = r.m_y;
m_nWidth = r.m_nWidth;
@ -137,11 +131,7 @@ public:
protected:
void Init()
{
m_windowName = NULL;
m_x = 0;
m_y = 0;
m_nWidth = 0;
m_nHeight = 0;
memset(static_cast<cef_window_info_t*>(this), 0, sizeof(cef_window_info_t));
}
};
@ -168,11 +158,6 @@ public:
*this = r;
}
void Init()
{
m_Scale = 0;
}
CefPrintInfo& operator=(const CefPrintInfo& r)
{
return operator=(static_cast<const cef_print_info_t&>(r));
@ -182,6 +167,12 @@ public:
m_Scale = r.m_Scale;
return *this;
}
protected:
void Init()
{
m_Scale = 0;
}
};
// Window handle.

View File

@ -102,8 +102,7 @@ public:
void Reset()
{
if(m_windowName)
cef_string_free(m_windowName);
cef_string_clear(&m_windowName);
Init();
}
@ -136,12 +135,7 @@ public:
{
m_View = r.m_View;
m_ParentView = r.m_ParentView;
if(m_windowName)
cef_string_free(m_windowName);
if(r.m_windowName)
m_windowName = cef_string_alloc(r.m_windowName);
else
m_windowName = NULL;
cef_string_copy(r.m_windowName.str, r.m_windowName.length, &m_windowName);
m_x = r.m_x;
m_y = r.m_y;
m_nWidth = r.m_nWidth;
@ -152,13 +146,7 @@ public:
protected:
void Init()
{
m_View = NULL;
m_ParentView = NULL;
m_windowName = NULL;
m_x = 0;
m_y = 0;
m_nWidth = 0;
m_nHeight = 0;
memset(static_cast<cef_window_info_t*>(this), 0, sizeof(cef_window_info_t));
}
};
@ -185,11 +173,6 @@ public:
*this = r;
}
void Init()
{
m_Scale = 0;
}
CefPrintInfo& operator=(const CefPrintInfo& r)
{
return operator=(static_cast<const cef_print_info_t&>(r));
@ -199,6 +182,12 @@ public:
m_Scale = r.m_Scale;
return *this;
}
protected:
void Init()
{
m_Scale = 0;
}
};
#endif // defined(__APPLE__)

View File

@ -31,7 +31,7 @@
#ifndef _CEF_PLUGIN_H
#define _CEF_PLUGIN_H
#include <string>
#include "cef_string.h"
#include <vector>
#include "third_party/npapi/bindings/npapi.h"
#include "third_party/npapi/bindings/nphostapi.h"
@ -46,29 +46,29 @@
// This structure describes a mime type entry for a plugin.
struct CefPluginMimeType {
// The actual mime type.
std::wstring mime_type;
CefString mime_type;
// A list of all the file extensions for this mime type.
std::vector<std::wstring> file_extensions;
std::vector<CefString> file_extensions;
// Description of the mime type.
std::wstring description;
CefString description;
};
// This structure provides attribute information and entry point functions for
// a plugin.
struct CefPluginInfo {
// The unique name that identifies the plugin.
std::wstring unique_name;
CefString unique_name;
// The friendly display name of the plugin.
std::wstring display_name;
CefString display_name;
// The version string of the plugin.
std::wstring version;
CefString version;
// A description of the plugin.
std::wstring description;
CefString description;
// A list of all the mime types that this plugin supports.
std::vector<CefPluginMimeType> mime_types;

View File

@ -50,28 +50,28 @@ extern "C" {
// a plugin.
typedef struct _cef_plugin_info_t {
// The unique name that identifies the plugin.
const wchar_t* unique_name;
cef_string_t unique_name;
// The friendly display name of the plugin.
const wchar_t* display_name;
cef_string_t display_name;
// The version string of the plugin.
const wchar_t* version;
cef_string_t version;
// A description of the plugin.
const wchar_t* description;
cef_string_t description;
// A pipe (|) delimited list of mime type values that the plugin supports.
const wchar_t* mime_types;
cef_string_t mime_types;
// A pipe (|) delimited list of extension values. Each value is associated
// with the mime type value at the same position. Multiple file extensions
// for the same mime type may be delimited with commas (,).
const wchar_t* file_extensions;
cef_string_t file_extensions;
// A pipe (|) delimited list of description values. Each value is associated
// with the mime type value at the same position.
const wchar_t* type_descriptions;
cef_string_t type_descriptions;
// Entry point function pointers.
NP_GetEntryPointsFunc np_getentrypoints;

View File

@ -1,4 +1,4 @@
// Copyright (c) 2009 Marshall A. Greenblatt. All rights reserved.
// 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
@ -30,57 +30,83 @@
#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
extern "C" {
#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
#include "cef_export.h"
#include <wchar.h>
// CEF strings are NUL-terminated wide character strings prefixed with a size
// value, similar to the Microsoft BSTR type. Use the below API functions for
// allocating, managing and freeing CEF strings.
typedef wchar_t* cef_string_t;
// Return the wide character length of the CEF string as allocated by
// cef_string_alloc_len(). The returned value does not include the NUL
// terminating character. This length may differ from the string length
// as returned by wcslen().
CEF_EXPORT size_t cef_string_length(cef_string_t str);
// Allocate and return a new CEF string that is a copy of |str|. If |str| is
// NULL or if allocation fails NULL will be returned. If |str| is of length
// 0 a valid empty CEF string will be returned.
CEF_EXPORT cef_string_t cef_string_alloc(const wchar_t* str);
// Allocate and return a new CEF string that is a copy of |str|. |len| is the
// wide character length of the new CEF string not including the NUL
// terminating character. |str| will be copied without checking for a NUL
// terminating character. If |str| is NULL or if allocation fails NULL will
// be returned. If |str| is of length 0 a valid empty CEF string will be
// returned.
CEF_EXPORT cef_string_t cef_string_alloc_length(const wchar_t* str,
size_t len);
// Reallocate an existing CEF string. The contents of |oldstr| will be
// replaced with the contents of |newstr|; |newstr| may not be NULL. Returns 1
// on success and 0 on failure.
CEF_EXPORT int cef_string_realloc(cef_string_t* oldstr, const wchar_t* newstr);
// Reallocate an existing CEF string. If |newstr| is NULL the contents of
// |oldstr| will remain unchanged; otherwise, they will be replaced with the
// contents of |newstr|. |len| is the new wide character length of the string
// not including the NUL terminating character. Returns 1 on success and 0
// on failure.
CEF_EXPORT int cef_string_realloc_length(cef_string_t* oldstr,
const wchar_t* newstr,
size_t len);
// Free a CEF string. If |str| is NULL this function does nothing.
CEF_EXPORT void cef_string_free(cef_string_t str);
#ifdef __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

View File

@ -30,14 +30,13 @@
#ifndef _CEF_STRING_LIST_H
#define _CEF_STRING_LIST_H
#include "cef_export.h"
#include "cef_string.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "cef_export.h"
#include "cef_string.h"
#include <wchar.h>
// CEF string maps are a set of key/value string pairs.
typedef void* cef_string_list_t;
@ -47,11 +46,14 @@ 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);
// Return the value at the specified zero-based string list index.
CEF_EXPORT cef_string_t cef_string_list_value(cef_string_list_t list, int index);
// 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 key/value pair at the end of the string list.
CEF_EXPORT void cef_string_list_append(cef_string_list_t list, const wchar_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);

View File

@ -30,14 +30,13 @@
#ifndef _CEF_STRING_MAP_H
#define _CEF_STRING_MAP_H
#include "cef_export.h"
#include "cef_string.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "cef_export.h"
#include "cef_string.h"
#include <wchar.h>
// CEF string maps are a set of key/value string pairs.
typedef void* cef_string_map_t;
@ -48,18 +47,22 @@ CEF_EXPORT cef_string_map_t cef_string_map_alloc();
CEF_EXPORT int cef_string_map_size(cef_string_map_t map);
// Return the value assigned to the specified key.
CEF_EXPORT cef_string_t cef_string_map_find(cef_string_map_t map,
const wchar_t* 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 cef_string_t 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);
// Return the value at the specified zero-based string map index.
CEF_EXPORT cef_string_t 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);
// Append a new key/value pair at the end of the string map.
CEF_EXPORT void cef_string_map_append(cef_string_map_t map, const wchar_t* key,
const wchar_t* value);
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);

View File

@ -31,10 +31,6 @@
#ifndef _CEF_TYPES_H
#define _CEF_TYPES_H
#ifdef __cplusplus
extern "C" {
#endif
#include "cef_string_list.h"
// Bring in platform-specific definitions.
@ -54,6 +50,10 @@ typedef long int64;
typedef long long int64;
#endif
#ifdef __cplusplus
extern "C" {
#endif
// Initialization settings. Specify NULL or 0 to get the recommended default
// values.
typedef struct _cef_settings_t
@ -292,14 +292,14 @@ typedef struct _cef_handler_menuinfo_t
int typeFlags;
int x;
int y;
const wchar_t* linkUrl;
const wchar_t* imageUrl;
const wchar_t* pageUrl;
const wchar_t* frameUrl;
const wchar_t* selectionText;
const wchar_t* misspelledWord;
cef_string_t linkUrl;
cef_string_t imageUrl;
cef_string_t pageUrl;
cef_string_t frameUrl;
cef_string_t selectionText;
cef_string_t misspelledWord;
int editFlags;
const wchar_t* securityInfo;
cef_string_t securityInfo;
} cef_handler_menuinfo_t;
// The cef_handler_menuinfo_t typeFlags value will be a combination of the

View File

@ -31,13 +31,13 @@
#ifndef _CEF_TYPES_LINUX_H
#define _CEF_TYPES_LINUX_H
#if defined(__linux__)
#include "cef_string.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__linux__)
#include "cef_string.h"
// Window handle.
#define cef_window_handle_t void*
@ -58,10 +58,10 @@ typedef struct _cef_print_info_t
double m_Scale;
} cef_print_info_t;
#endif // defined(__linux__)
#ifdef __cplusplus
}
#endif
#endif // defined(__linux__)
#endif // _CEF_TYPES_LINUX_H

View File

@ -31,13 +31,13 @@
#ifndef _CEF_TYPES_MAC_H
#define _CEF_TYPES_MAC_H
#if defined(__APPLE__)
#include "cef_string.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__APPLE__)
#include "cef_string.h"
// Window handle.
#define cef_window_handle_t void*
@ -64,10 +64,10 @@ typedef struct _cef_print_info_t
double m_Scale;
} cef_print_info_t;
#endif // defined(__APPLE__)
#ifdef __cplusplus
}
#endif
#endif // defined(__APPLE__)
#endif // _CEF_TYPES_MAC_H

View File

@ -31,14 +31,14 @@
#ifndef _CEF_TYPES_WIN_H
#define _CEF_TYPES_WIN_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _WIN32
#include <windows.h>
#include "cef_string.h"
#ifdef __cplusplus
extern "C" {
#endif
// Window handle.
#define cef_window_handle_t HWND
@ -68,10 +68,10 @@ typedef struct _cef_print_info_t
double m_Scale;
} cef_print_info_t;
#endif // _WIN32
#ifdef __cplusplus
}
#endif
#endif // _WIN32
#endif // _CEF_TYPES_WIN_H

View File

@ -90,8 +90,7 @@ public:
void Reset()
{
if(m_windowName)
cef_string_free(m_windowName);
cef_string_clear(&m_windowName);
Init();
}
@ -113,12 +112,7 @@ public:
CefWindowInfo& operator=(const cef_window_info_t& r)
{
m_dwExStyle = r.m_dwExStyle;
if(m_windowName)
cef_string_free(m_windowName);
if(r.m_windowName)
m_windowName = cef_string_alloc(r.m_windowName);
else
m_windowName = NULL;
cef_string_copy(r.m_windowName.str, r.m_windowName.length, &m_windowName);
m_dwStyle = r.m_dwStyle;
m_x = r.m_x;
m_y = r.m_y;
@ -141,7 +135,7 @@ public:
m_nHeight = windowRect.bottom - windowRect.top;
}
void SetAsPopup(HWND hWndParent, LPCWSTR windowName)
void SetAsPopup(HWND hWndParent, const CefString& windowName)
{
m_dwStyle = WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
m_hWndParent = hWndParent;
@ -150,27 +144,13 @@ public:
m_nWidth = CW_USEDEFAULT;
m_nHeight = CW_USEDEFAULT;
if(m_windowName)
cef_string_free(m_windowName);
if(windowName)
m_windowName = cef_string_alloc(windowName);
else
m_windowName = NULL;
cef_string_copy(windowName.c_str(), windowName.length(), &m_windowName);
}
protected:
void Init()
{
m_dwExStyle = 0;
m_windowName = NULL;
m_dwStyle = 0;
m_x = 0;
m_y = 0;
m_nWidth = 0;
m_nHeight = 0;
m_hWndParent = NULL;
m_hMenu = 0;
m_hWnd = NULL;
memset(static_cast<cef_window_info_t*>(this), 0, sizeof(cef_window_info_t));
}
};

View File

@ -64,18 +64,18 @@ class CefXmlObject : public CefThreadSafeBase<CefBase>
{
public:
typedef std::vector<CefRefPtr<CefXmlObject> > ObjectVector;
typedef std::map<std::wstring, std::wstring > AttributeMap;
typedef std::map<CefString, CefString > AttributeMap;
// Create a new object with the specified name. An object name must always be
// at least one character long.
CefXmlObject(const std::wstring& name);
CefXmlObject(const CefString& name);
virtual ~CefXmlObject();
// Load the contents of the specified XML stream into this object. The
// existing children and attributes, if any, will first be cleared.
bool Load(CefRefPtr<CefStreamReader> stream,
CefXmlReader::EncodingType encodingType,
const std::wstring& URI, std::wstring* loadError);
const CefString& URI, CefString* loadError);
// 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,
@ -98,8 +98,8 @@ public:
// Access the object's name. An object name must always be at least one
// character long.
std::wstring GetName();
bool SetName(const std::wstring& name);
CefString GetName();
bool SetName(const CefString& name);
// Access the object's parent. The parent can be NULL if this object has not
// been added as the child on another object.
@ -109,15 +109,15 @@ public:
// 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.
bool HasValue();
std::wstring GetValue();
bool SetValue(const std::wstring& value);
CefString GetValue();
bool SetValue(const CefString& value);
// Access the object's attributes. Attributes must have unique names.
bool HasAttributes();
size_t GetAttributeCount();
bool HasAttribute(const std::wstring& name);
std::wstring GetAttributeValue(const std::wstring& name);
bool SetAttributeValue(const std::wstring& name, const std::wstring& value);
bool HasAttribute(const CefString& name);
CefString GetAttributeValue(const CefString& name);
bool SetAttributeValue(const CefString& name, const CefString& value);
size_t GetAttributes(AttributeMap& attributes);
void ClearAttributes();
@ -135,17 +135,17 @@ public:
void ClearChildren();
// Find the first child with the specified name.
CefRefPtr<CefXmlObject> FindChild(const std::wstring& name);
CefRefPtr<CefXmlObject> FindChild(const CefString& name);
// Find all children with the specified name.
size_t FindChildren(const std::wstring& name, ObjectVector& children);
size_t FindChildren(const CefString& name, ObjectVector& children);
private:
void SetParent(CefXmlObject* parent);
std::wstring name_;
CefString name_;
CefXmlObject* parent_;
std::wstring value_;
CefString value_;
AttributeMap attributes_;
ObjectVector children_;
};
@ -209,7 +209,7 @@ public:
// Returns a CefStreamReader object for streaming the contents of the file.
virtual CefRefPtr<CefStreamReader> GetStreamReader() =0;
};
typedef std::map<std::wstring, CefRefPtr<File> > FileMap;
typedef std::map<CefString, CefRefPtr<File> > FileMap;
// Create a new object.
CefZipArchive();
@ -228,13 +228,13 @@ public:
size_t GetFileCount();
// Returns true if the specified file exists and has contents.
bool HasFile(const std::wstring& fileName);
bool HasFile(const CefString& fileName);
// Returns the specified file.
CefRefPtr<File> GetFile(const std::wstring& fileName);
CefRefPtr<File> GetFile(const CefString& fileName);
// Removes the specified file.
bool RemoveFile(const std::wstring& fileName);
bool RemoveFile(const CefString& fileName);
// Returns the map of all files.
size_t GetFiles(FileMap& map);