- Fix Mac compile errors due to string type changes (issue #146).

- Fix Windows crash due to string type changes (issue #147).
- Add missing svn:eol-style properties.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@149 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2010-11-23 14:46:01 +00:00
parent 81b7d378f7
commit e826c9b1a0
22 changed files with 1699 additions and 1707 deletions

View File

@ -1,183 +1,184 @@
// Copyright (c) 2010 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 // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
// //
// * Redistributions of source code must retain the above copyright // * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer. // notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above // * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer // copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the // in the documentation and/or other materials provided with the
// distribution. // distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded // * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse // Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior // or promote products derived from this software without specific prior
// written permission. // written permission.
// //
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef _CEF_STRING_TYPES_T #ifndef _CEF_STRING_TYPES_T
#define _CEF_STRING_TYPES_T #define _CEF_STRING_TYPES_T
// CEF provides functions for converting between UTF-8, -16 and -32 strings. // CEF provides functions for converting between UTF-8, -16 and -32 strings.
// CEF string types are safe for reading from multiple threads but not for // CEF string types are safe for reading from multiple threads but not for
// modification. It is the user's responsibility to provide synchronization if // modification. It is the user's responsibility to provide synchronization if
// modifying CEF strings from multiple threads. // modifying CEF strings from multiple threads.
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#include "cef_export.h" #include "cef_export.h"
#include <stddef.h>
// CEF character type definitions. wchat_t is 2 bytes on Windows and 4 bytes on
// most other platforms. // CEF character type definitions. wchat_t is 2 bytes on Windows and 4 bytes on
// most other platforms.
#ifdef _WIN32
typedef wchar_t char16_t; #ifdef _WIN32
#else // _WIN32 typedef wchar_t char16_t;
typedef uint16 char16_t; #else // _WIN32
#ifndef WCHAR_T_IS_UTF32 typedef unsigned short char16_t;
#define WCHAR_T_IS_UTF32 #ifndef WCHAR_T_IS_UTF32
#endif // WCHAR_T_IS_UTF32 #define WCHAR_T_IS_UTF32
#endif // _WIN32 #endif // WCHAR_T_IS_UTF32
#endif // _WIN32
// CEF string type definitions. Whomever allocates |str| is responsible for
// providing an appropriate |dtor| implementation that will free the string in // CEF string type definitions. Whomever allocates |str| is responsible for
// the same memory space. When reusing an existing string structure make sure // providing an appropriate |dtor| implementation that will free the string in
// to call |dtor| for the old value before assigning new |str| and |dtor| // the same memory space. When reusing an existing string structure make sure
// values. Static strings will have a NULL |dtor| value. Using the below // to call |dtor| for the old value before assigning new |str| and |dtor|
// functions if you want this managed for you. // values. Static strings will have a NULL |dtor| value. Using the below
// functions if you want this managed for you.
typedef struct _cef_string_wide_t {
wchar_t* str; typedef struct _cef_string_wide_t {
size_t length; wchar_t* str;
void (*dtor)(wchar_t* str); size_t length;
} cef_string_wide_t; void (*dtor)(wchar_t* str);
} cef_string_wide_t;
typedef struct _cef_string_utf8_t {
char* str; typedef struct _cef_string_utf8_t {
size_t length; char* str;
void (*dtor)(char* str); size_t length;
} cef_string_utf8_t; void (*dtor)(char* str);
} cef_string_utf8_t;
typedef struct _cef_string_utf16_t {
char16_t* str; typedef struct _cef_string_utf16_t {
size_t length; char16_t* str;
void (*dtor)(char16_t* str); size_t length;
} cef_string_utf16_t; void (*dtor)(char16_t* str);
} cef_string_utf16_t;
// These functions set string values. If |copy| is true (1) the value will be
// copied instead of referenced. It is up to the user to properly manage // These functions set string values. If |copy| is true (1) the value will be
// the lifespan of references. // copied instead of referenced. It is up to the user to properly manage
// the lifespan of references.
CEF_EXPORT int cef_string_wide_set(const wchar_t* src, size_t src_len,
cef_string_wide_t* output, int copy); CEF_EXPORT int cef_string_wide_set(const wchar_t* src, size_t src_len,
CEF_EXPORT int cef_string_utf8_set(const char* src, size_t src_len, cef_string_wide_t* output, int copy);
cef_string_utf8_t* output, int copy); CEF_EXPORT int cef_string_utf8_set(const char* src, size_t src_len,
CEF_EXPORT int cef_string_utf16_set(const char16_t* src, size_t src_len, cef_string_utf8_t* output, int copy);
cef_string_utf16_t* output, int copy); CEF_EXPORT int cef_string_utf16_set(const char16_t* src, size_t src_len,
cef_string_utf16_t* output, int copy);
// Convenience macros for copying values.
// Convenience macros for copying values.
#define cef_string_wide_copy(src, src_len, output) \
cef_string_wide_set(src, src_len, output, true) #define cef_string_wide_copy(src, src_len, output) \
#define cef_string_utf8_copy(src, src_len, output) \ cef_string_wide_set(src, src_len, output, true)
cef_string_utf8_set(src, src_len, output, true) #define cef_string_utf8_copy(src, src_len, output) \
#define cef_string_utf16_copy(src, src_len, output) \ cef_string_utf8_set(src, src_len, output, true)
cef_string_utf16_set(src, src_len, output, true) #define cef_string_utf16_copy(src, src_len, output) \
cef_string_utf16_set(src, src_len, output, true)
// These functions clear string values. The structure itself is not freed.
// These functions clear string values. The structure itself is not freed.
CEF_EXPORT void cef_string_wide_clear(cef_string_wide_t* str);
CEF_EXPORT void cef_string_utf8_clear(cef_string_utf8_t* str); CEF_EXPORT void cef_string_wide_clear(cef_string_wide_t* str);
CEF_EXPORT void cef_string_utf16_clear(cef_string_utf16_t* str); CEF_EXPORT void cef_string_utf8_clear(cef_string_utf8_t* str);
CEF_EXPORT void cef_string_utf16_clear(cef_string_utf16_t* str);
// These functions compare two string values with the same results as strcmp().
// These functions compare two string values with the same results as strcmp().
CEF_EXPORT int cef_string_wide_cmp(const cef_string_wide_t* str1,
const cef_string_wide_t* str2); CEF_EXPORT int cef_string_wide_cmp(const cef_string_wide_t* str1,
CEF_EXPORT int cef_string_utf8_cmp(const cef_string_utf8_t* str1, const cef_string_wide_t* str2);
const cef_string_utf8_t* str2); CEF_EXPORT int cef_string_utf8_cmp(const cef_string_utf8_t* str1,
CEF_EXPORT int cef_string_utf16_cmp(const cef_string_utf16_t* str1, const cef_string_utf8_t* str2);
const cef_string_utf16_t* str2); CEF_EXPORT int cef_string_utf16_cmp(const cef_string_utf16_t* str1,
const cef_string_utf16_t* str2);
// These functions convert between UTF-8, -16, and -32 strings. They are
// potentially slow so unnecessary conversions should be avoided. The best // These functions convert between UTF-8, -16, and -32 strings. They are
// possible result will always be written to |output| with the boolean return // potentially slow so unnecessary conversions should be avoided. The best
// value indicating whether the conversion is 100% valid. // possible result will always be written to |output| with the boolean return
// value indicating whether the conversion is 100% valid.
CEF_EXPORT int cef_string_wide_to_utf8(const wchar_t* src, size_t src_len,
cef_string_utf8_t* output); CEF_EXPORT int cef_string_wide_to_utf8(const wchar_t* src, size_t src_len,
CEF_EXPORT int cef_string_utf8_to_wide(const char* src, size_t src_len, cef_string_utf8_t* output);
cef_string_wide_t* output); CEF_EXPORT int cef_string_utf8_to_wide(const char* src, size_t src_len,
cef_string_wide_t* output);
CEF_EXPORT int cef_string_wide_to_utf16(const wchar_t* src, size_t src_len,
cef_string_utf16_t* output); CEF_EXPORT int cef_string_wide_to_utf16(const wchar_t* src, size_t src_len,
CEF_EXPORT int cef_string_utf16_to_wide(const char16_t* src, size_t src_len, cef_string_utf16_t* output);
cef_string_wide_t* output); CEF_EXPORT int cef_string_utf16_to_wide(const char16_t* src, size_t src_len,
cef_string_wide_t* output);
CEF_EXPORT int cef_string_utf8_to_utf16(const char* src, size_t src_len,
cef_string_utf16_t* output); CEF_EXPORT int cef_string_utf8_to_utf16(const char* src, size_t src_len,
CEF_EXPORT int cef_string_utf16_to_utf8(const char16_t* src, size_t src_len, cef_string_utf16_t* output);
cef_string_utf8_t* output); CEF_EXPORT int cef_string_utf16_to_utf8(const char16_t* src, size_t src_len,
cef_string_utf8_t* output);
// These functions convert an ASCII string, typically a hardcoded constant, to a
// Wide/UTF16 string. Use instead of the UTF8 conversion routines if you know // These functions convert an ASCII string, typically a hardcoded constant, to a
// the string is ASCII. // Wide/UTF16 string. Use instead of the UTF8 conversion routines if you know
// the string is ASCII.
CEF_EXPORT int cef_string_ascii_to_wide(const char* src, size_t src_len,
cef_string_wide_t* output); CEF_EXPORT int cef_string_ascii_to_wide(const char* src, size_t src_len,
CEF_EXPORT int cef_string_ascii_to_utf16(const char* src, size_t src_len, cef_string_wide_t* output);
cef_string_utf16_t* output); CEF_EXPORT int cef_string_ascii_to_utf16(const char* src, size_t src_len,
cef_string_utf16_t* output);
// It is sometimes necessary for the system to allocate string structures with
// the expectation that the user will free them. The userfree types act as a // It is sometimes necessary for the system to allocate string structures with
// hint that the user is responsible for freeing the structure. // the expectation that the user will free them. The userfree types act as a
// hint that the user is responsible for freeing the structure.
typedef cef_string_wide_t* cef_string_userfree_wide_t;
typedef cef_string_utf8_t* cef_string_userfree_utf8_t; typedef cef_string_wide_t* cef_string_userfree_wide_t;
typedef cef_string_utf16_t* cef_string_userfree_utf16_t; typedef cef_string_utf8_t* cef_string_userfree_utf8_t;
typedef cef_string_utf16_t* cef_string_userfree_utf16_t;
// These functions allocate a new string structure. They must be freed by
// calling the associated free function. // These functions allocate a new string structure. They must be freed by
// calling the associated free function.
CEF_EXPORT cef_string_userfree_wide_t cef_string_userfree_wide_alloc();
CEF_EXPORT cef_string_userfree_utf8_t cef_string_userfree_utf8_alloc(); CEF_EXPORT cef_string_userfree_wide_t cef_string_userfree_wide_alloc();
CEF_EXPORT cef_string_userfree_utf16_t cef_string_userfree_utf16_alloc(); CEF_EXPORT cef_string_userfree_utf8_t cef_string_userfree_utf8_alloc();
CEF_EXPORT cef_string_userfree_utf16_t cef_string_userfree_utf16_alloc();
// These functions free the string structure allocated by the associated
// alloc function. Any string contents will first be cleared. // These functions free the string structure allocated by the associated
// alloc function. Any string contents will first be cleared.
CEF_EXPORT void cef_string_userfree_wide_free(cef_string_userfree_wide_t str);
CEF_EXPORT void cef_string_userfree_utf8_free(cef_string_userfree_utf8_t str); CEF_EXPORT void cef_string_userfree_wide_free(cef_string_userfree_wide_t str);
CEF_EXPORT void cef_string_userfree_utf16_free(cef_string_userfree_utf16_t str); CEF_EXPORT void cef_string_userfree_utf8_free(cef_string_userfree_utf8_t str);
CEF_EXPORT void cef_string_userfree_utf16_free(cef_string_userfree_utf16_t str);
#ifdef __cplusplus
} #ifdef __cplusplus
#endif }
#endif
#endif // _CEF_STRING_TYPES_T
#endif // _CEF_STRING_TYPES_T

File diff suppressed because it is too large Load Diff

View File

@ -245,7 +245,7 @@ CefRefPtr<CefFrame> CefBrowserImpl::GetCefFrame(WebFrame* frame)
cef_frame = frame_main_; cef_frame = frame_main_;
} else { } else {
// Locate or create the appropriate named reference. // Locate or create the appropriate named reference.
CefString name = frame->name(); CefString name = string16(frame->name());
DCHECK(!name.empty()); DCHECK(!name.empty());
FrameMap::const_iterator it = frames_.find(name); FrameMap::const_iterator it = frames_.find(name);
if(it != frames_.end()) if(it != frames_.end())
@ -381,7 +381,7 @@ CefString CefBrowserImpl::GetSource(CefRefPtr<CefFrame> frame)
// Retrieve the document string directly // Retrieve the document string directly
WebKit::WebFrame* web_frame = GetWebFrame(frame); WebKit::WebFrame* web_frame = GetWebFrame(frame);
if(web_frame) if(web_frame)
return web_frame->contentAsMarkup(); return string16(web_frame->contentAsMarkup());
return CefString(); return CefString();
} }
} }
@ -474,7 +474,7 @@ CefString CefBrowserImpl::GetURL(CefRefPtr<CefFrame> frame)
{ {
WebFrame* web_frame = GetWebFrame(frame); WebFrame* web_frame = GetWebFrame(frame);
if(web_frame) if(web_frame)
return web_frame->url().spec(); return std::string(web_frame->url().spec());
return CefString(); return CefString();
} }

View File

@ -391,6 +391,7 @@ void CefBrowserImpl::UIT_PrintPages(WebKit::WebFrame* frame) {
// Make a copy of settings. // Make a copy of settings.
printing::PrintSettings settings = print_context_.settings(); printing::PrintSettings settings = print_context_.settings();
cef_print_options_t print_options; cef_print_options_t print_options;
memset(&print_options, 0, sizeof(print_options));
settings.UpdatePrintOptions(print_options); settings.UpdatePrintOptions(print_options);
// Ask the handler if they want to update the print options. // Ask the handler if they want to update the print options.

View File

@ -1,13 +1,13 @@
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights // Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that can // reserved. Use of this source code is governed by a BSD-style license that can
// be found in the LICENSE file. // be found in the LICENSE file.
#ifndef _CEF_BROWSER_SETTINGS_H #ifndef _CEF_BROWSER_SETTINGS_H
#define _CEF_BROWSER_SETTINGS_H #define _CEF_BROWSER_SETTINGS_H
class CefBrowserSettings; class CefBrowserSettings;
struct WebPreferences; struct WebPreferences;
void BrowserToWebSettings(const CefBrowserSettings& cef, WebPreferences& web); void BrowserToWebSettings(const CefBrowserSettings& cef, WebPreferences& web);
#endif // _CEF_BROWSER_SETTINGS_H #endif // _CEF_BROWSER_SETTINGS_H

View File

@ -195,27 +195,26 @@ void BrowserWebViewDelegate::DidMovePlugin(
// Protected methods ---------------------------------------------------------- // Protected methods ----------------------------------------------------------
void BrowserWebViewDelegate::ShowJavaScriptAlert( void BrowserWebViewDelegate::ShowJavaScriptAlert(
WebKit::WebFrame* webframe, const std::wstring& message) { WebKit::WebFrame* webframe, const CefString& message) {
NSString *text = std::string messageStr(message);
[NSString stringWithUTF8String:(std::string(message).c_str())]; NSString *text = [NSString stringWithUTF8String:messageStr.c_str()];
NSAlert *alert = [NSAlert alertWithMessageText:@"JavaScript Alert" NSAlert *alert = [NSAlert alertWithMessageText:@"JavaScript Alert"
defaultButton:@"OK" defaultButton:@"OK"
alternateButton:nil alternateButton:nil
otherButton:nil otherButton:nil
informativeTextWithFormat:text]; informativeTextWithFormat:text];
[alert runModal]; [alert runModal];
[text release];
} }
bool BrowserWebViewDelegate::ShowJavaScriptConfirm( bool BrowserWebViewDelegate::ShowJavaScriptConfirm(
WebKit::WebFrame* webframe, const std::wstring& message) { WebKit::WebFrame* webframe, const CefString& message) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return false; return false;
} }
bool BrowserWebViewDelegate::ShowJavaScriptPrompt( bool BrowserWebViewDelegate::ShowJavaScriptPrompt(
WebKit::WebFrame* webframe, const std::wstring& message, WebKit::WebFrame* webframe, const CefString& message,
const std::wstring& default_value, std::wstring* result) { const CefString& default_value, CefString* result) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return false; return false;
} }
@ -228,17 +227,3 @@ bool BrowserWebViewDelegate::ShowFileChooser(std::vector<FilePath>& file_names,
NOTIMPLEMENTED(); NOTIMPLEMENTED();
return false; return false;
} }
// Private methods ------------------------------------------------------------
/*
void BrowserWebViewDelegate::SetPageTitle(const std::wstring& title) {
[[browser_->GetWebViewHost()->view_handle() window]
setTitle:[NSString stringWithUTF8String:(std::string(title).c_str())]];
}
void BrowserWebViewDelegate::SetAddressBarURL(const GURL& url) {
const char* frameURL = url.spec().c_str();
NSString *address = [NSString stringWithUTF8String:frameURL];
[browser_->GetEditWnd() setStringValue:address];
}
*/

View File

@ -283,6 +283,8 @@ void BrowserWebViewDelegate::showContextMenu(
if(handler.get()) { if(handler.get()) {
// Gather menu information // Gather menu information
CefHandler::MenuInfo menuInfo; CefHandler::MenuInfo menuInfo;
memset(&menuInfo, 0, sizeof(menuInfo));
CefString linkStr(std::string(data.linkURL.spec())); CefString linkStr(std::string(data.linkURL.spec()));
CefString imageStr(std::string(data.srcURL.spec())); CefString imageStr(std::string(data.srcURL.spec()));
CefString pageStr(std::string(data.pageURL.spec())); CefString pageStr(std::string(data.pageURL.spec()));

View File

@ -67,11 +67,7 @@ static void UIT_RegisterPlugin(struct CefPluginInfo* plugin_info)
NPAPI::PluginVersionInfo info; NPAPI::PluginVersionInfo info;
#if defined(OS_WIN)
info.path = FilePath(plugin_info->unique_name); info.path = FilePath(plugin_info->unique_name);
#else
info.path = FilePath(WideToUTF8(plugin_info->unique_name));
#endif
info.product_name = plugin_info->display_name; info.product_name = plugin_info->display_name;
info.file_description = plugin_info->description; info.file_description = plugin_info->description;
info.file_version =plugin_info->version; info.file_version =plugin_info->version;

View File

@ -167,7 +167,8 @@ CEF_EXPORT int cef_string_utf16_cmp(const cef_string_utf16_t* str1,
if (str1->length == 0 && str2->length == 0) if (str1->length == 0 && str2->length == 0)
return 0; return 0;
#if defined(WCHAR_T_IS_UTF32) #if defined(WCHAR_T_IS_UTF32)
int r = c16memcmp(str1->str, str2->str, std::min(str1->length, str2->length)); int r = base::c16memcmp(str1->str, str2->str, std::min(str1->length,
str2->length));
#else #else
int r = wcsncmp(str1->str, str2->str, std::min(str1->length, str2->length)); int r = wcsncmp(str1->str, str2->str, std::min(str1->length, str2->length));
#endif #endif

View File

@ -448,11 +448,7 @@ void CefPostDataElementImpl::Set(const net::UploadData::Element& element)
std::string(element.bytes().begin(), std::string(element.bytes().begin(),
element.bytes().end()).c_str())); element.bytes().end()).c_str()));
} else if (element.type() == net::UploadData::TYPE_FILE) { } else if (element.type() == net::UploadData::TYPE_FILE) {
#if defined(OS_WIN)
SetToFile(element.file_path().value()); SetToFile(element.file_path().value());
#else
SetToFile(UTF8ToWide(element.file_path().value()));
#endif
} else { } else {
NOTREACHED(); NOTREACHED();
} }

View File

@ -214,7 +214,7 @@ void WebWidgetHost::Paint() {
} }
} }
void WebWidgetHost::SetTooltipText(const std::string& tooltip_text) { void WebWidgetHost::SetTooltipText(const CefString& tooltip_text) {
// TODO(port): Implement this method. // TODO(port): Implement this method.
} }

View File

@ -53,9 +53,10 @@ enum cef_retval_t CEF_CALLBACK handler_handle_before_created(
if(parentBrowser) if(parentBrowser)
browserPtr = CefBrowserCToCpp::Wrap(parentBrowser); browserPtr = CefBrowserCToCpp::Wrap(parentBrowser);
CefString urlStr(url);
enum cef_retval_t rv = CefHandlerCppToC::Get(self)->HandleBeforeCreated( enum cef_retval_t rv = CefHandlerCppToC::Get(self)->HandleBeforeCreated(
browserPtr, wndInfo, popup?true:false, features, handlerPtr, browserPtr, wndInfo, popup?true:false, features, handlerPtr,
CefString(url), browserSettings); urlStr, browserSettings);
if(handlerPtr.get() != origHandler) { if(handlerPtr.get() != origHandler) {
// The handler has been changed. // The handler has been changed.
@ -177,9 +178,10 @@ enum cef_retval_t CEF_CALLBACK handler_handle_load_error(
if(!self || !browser || !errorText || !frame) if(!self || !browser || !errorText || !frame)
return RV_CONTINUE; return RV_CONTINUE;
CefString errorTextStr(errorText);
return CefHandlerCppToC::Get(self)->HandleLoadError( return CefHandlerCppToC::Get(self)->HandleLoadError(
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame), errorCode, CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame), errorCode,
CefString(failedUrl), CefString(errorText)); CefString(failedUrl), errorTextStr);
} }
enum cef_retval_t CEF_CALLBACK handler_handle_before_resource_load( enum cef_retval_t CEF_CALLBACK handler_handle_before_resource_load(
@ -198,10 +200,12 @@ enum cef_retval_t CEF_CALLBACK handler_handle_before_resource_load(
CefRefPtr<CefStreamReader> streamPtr; CefRefPtr<CefStreamReader> streamPtr;
CefString redirectUrlStr(redirectUrl);
CefString mimeTypeStr(mimeType);
enum cef_retval_t rv = CefHandlerCppToC::Get(self)-> enum cef_retval_t rv = CefHandlerCppToC::Get(self)->
HandleBeforeResourceLoad(CefBrowserCToCpp::Wrap(browser), HandleBeforeResourceLoad(CefBrowserCToCpp::Wrap(browser),
CefRequestCToCpp::Wrap(request), CefString(redirectUrl), streamPtr, CefRequestCToCpp::Wrap(request), redirectUrlStr, streamPtr, mimeTypeStr,
CefString(mimeType), loadFlags); loadFlags);
if(streamPtr.get()) if(streamPtr.get())
*resourceStream = CefStreamReaderCToCpp::Unwrap(streamPtr); *resourceStream = CefStreamReaderCToCpp::Unwrap(streamPtr);
@ -257,8 +261,9 @@ enum cef_retval_t CEF_CALLBACK handler_handle_get_menu_label(
if(!self || !browser || !label) if(!self || !browser || !label)
return RV_CONTINUE; return RV_CONTINUE;
CefString labelStr(label);
return CefHandlerCppToC::Get(self)->HandleGetMenuLabel( return CefHandlerCppToC::Get(self)->HandleGetMenuLabel(
CefBrowserCToCpp::Wrap(browser), menuId, CefString(label)); CefBrowserCToCpp::Wrap(browser), menuId, labelStr);
} }
enum cef_retval_t CEF_CALLBACK handler_handle_menu_action( enum cef_retval_t CEF_CALLBACK handler_handle_menu_action(
@ -307,12 +312,17 @@ enum cef_retval_t CEF_CALLBACK handler_handle_print_header_footer(
CefPrintInfo info = *printInfo; CefPrintInfo info = *printInfo;
CefString topLeftStr(topLeft);
CefString topCenterStr(topCenter);
CefString topRightStr(topRight);
CefString bottomLeftStr(bottomLeft);
CefString bottomCenterStr(bottomCenter);
CefString bottomRightStr(bottomRight);
return CefHandlerCppToC::Get(self)-> return CefHandlerCppToC::Get(self)->
HandlePrintHeaderFooter(CefBrowserCToCpp::Wrap(browser), HandlePrintHeaderFooter(CefBrowserCToCpp::Wrap(browser),
CefFrameCToCpp::Wrap(frame), info, CefString(url), CefString(title), CefFrameCToCpp::Wrap(frame), info, CefString(url), CefString(title),
currentPage, maxPages, CefString(topLeft), CefString(topCenter), currentPage, maxPages, topLeftStr, topCenterStr, topRightStr,
CefString(topRight), CefString(bottomLeft), CefString(bottomCenter), bottomLeftStr, bottomCenterStr, bottomRightStr);
CefString(bottomRight));
} }
enum cef_retval_t CEF_CALLBACK handler_handle_jsalert( enum cef_retval_t CEF_CALLBACK handler_handle_jsalert(
@ -364,9 +374,10 @@ enum cef_retval_t CEF_CALLBACK handler_handle_jsprompt(
return RV_CONTINUE; return RV_CONTINUE;
bool ret = false; bool ret = false;
CefString resultStr(result);
enum cef_retval_t rv = CefHandlerCppToC::Get(self)->HandleJSPrompt( enum cef_retval_t rv = CefHandlerCppToC::Get(self)->HandleJSPrompt(
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame), CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
CefString(message), CefString(defaultValue), ret, CefString(result)); CefString(message), CefString(defaultValue), ret, resultStr);
*retval = (ret ? 1 : 0); *retval = (ret ? 1 : 0);
return rv; return rv;
@ -448,8 +459,9 @@ enum cef_retval_t CEF_CALLBACK handler_handle_tooltip(
if(!self || !browser || !text) if(!self || !browser || !text)
return RV_CONTINUE; return RV_CONTINUE;
CefString textStr(text);
return CefHandlerCppToC::Get(self)->HandleTooltip( return CefHandlerCppToC::Get(self)->HandleTooltip(
CefBrowserCToCpp::Wrap(browser), CefString(text)); CefBrowserCToCpp::Wrap(browser), textStr);
} }
enum cef_retval_t CEF_CALLBACK handler_handle_console_message( enum cef_retval_t CEF_CALLBACK handler_handle_console_message(

View File

@ -27,8 +27,9 @@ int CEF_CALLBACK scheme_handler_process_request(
if(!self || !request || !mime_type || !response_length) if(!self || !request || !mime_type || !response_length)
return 0; return 0;
CefString mimeTypeStr(mime_type);
return CefSchemeHandlerCppToC::Get(self)->ProcessRequest( return CefSchemeHandlerCppToC::Get(self)->ProcessRequest(
CefRequestCToCpp::Wrap(request), CefString(mime_type), response_length); CefRequestCToCpp::Wrap(request), mimeTypeStr, response_length);
} }
void CEF_CALLBACK scheme_handler_cancel(struct _cef_scheme_handler_t* self) void CEF_CALLBACK scheme_handler_cancel(struct _cef_scheme_handler_t* self)

View File

@ -35,8 +35,9 @@ int CEF_CALLBACK v8handler_execute(struct _cef_v8handler_t* self,
} }
CefRefPtr<CefV8Value> retValPtr; CefRefPtr<CefV8Value> retValPtr;
CefString exceptionStr(exception);
bool rv = CefV8HandlerCppToC::Get(self)->Execute(CefString(name), objectPtr, bool rv = CefV8HandlerCppToC::Get(self)->Execute(CefString(name), objectPtr,
list, retValPtr, CefString(exception)); list, retValPtr, exceptionStr);
if(rv) { if(rv) {
if(retValPtr.get() && retval) if(retValPtr.get() && retval)
*retval = CefV8ValueCToCpp::Unwrap(retValPtr); *retval = CefV8ValueCToCpp::Unwrap(retValPtr);

View File

@ -385,8 +385,9 @@ int CEF_CALLBACK v8value_execute_function(struct _cef_v8value_t* self,
} }
CefRefPtr<CefV8Value> retvalPtr; CefRefPtr<CefV8Value> retvalPtr;
CefString exceptionStr(exception);
bool rv = CefV8ValueCppToC::Get(self)->ExecuteFunction(objectPtr, bool rv = CefV8ValueCppToC::Get(self)->ExecuteFunction(objectPtr,
argsList, retvalPtr, CefString(exception)); argsList, retvalPtr, exceptionStr);
if(retvalPtr.get() && retval) if(retvalPtr.get() && retval)
*retval = CefV8ValueCppToC::Wrap(retvalPtr); *retval = CefV8ValueCppToC::Wrap(retvalPtr);

View File

@ -1,384 +1,384 @@
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights // Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that // reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file. // can be found in the LICENSE file.
// //
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// //
// A portion of this file was generated by the CEF translator tool. When // A portion of this file was generated by the CEF translator tool. When
// making changes by hand only do so within the body of existing function // making changes by hand only do so within the body of existing function
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
#include "libcef_dll/cpptoc/stream_reader_cpptoc.h" #include "libcef_dll/cpptoc/stream_reader_cpptoc.h"
#include "libcef_dll/cpptoc/xml_reader_cpptoc.h" #include "libcef_dll/cpptoc/xml_reader_cpptoc.h"
// GLOBAL FUNCTIONS - Body may be edited by hand. // GLOBAL FUNCTIONS - Body may be edited by hand.
CEF_EXPORT cef_xml_reader_t* cef_xml_reader_create(cef_stream_reader_t* stream, CEF_EXPORT cef_xml_reader_t* cef_xml_reader_create(cef_stream_reader_t* stream,
enum cef_xml_encoding_type_t encodingType, const cef_string_t* URI) enum cef_xml_encoding_type_t encodingType, const cef_string_t* URI)
{ {
CefRefPtr<CefXmlReader> impl = CefXmlReader::Create( CefRefPtr<CefXmlReader> impl = CefXmlReader::Create(
CefStreamReaderCppToC::Unwrap(stream), encodingType, CefString(URI)); CefStreamReaderCppToC::Unwrap(stream), encodingType, CefString(URI));
if(impl.get()) if(impl.get())
return CefXmlReaderCppToC::Wrap(impl); return CefXmlReaderCppToC::Wrap(impl);
return NULL; return NULL;
} }
// MEMBER FUNCTIONS - Body may be edited by hand. // MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK xml_reader_move_to_next_node(struct _cef_xml_reader_t* self) int CEF_CALLBACK xml_reader_move_to_next_node(struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return 0; return 0;
return CefXmlReaderCppToC::Get(self)->MoveToNextNode(); return CefXmlReaderCppToC::Get(self)->MoveToNextNode();
} }
int CEF_CALLBACK xml_reader_close(struct _cef_xml_reader_t* self) int CEF_CALLBACK xml_reader_close(struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return 0; return 0;
return CefXmlReaderCppToC::Get(self)->Close(); return CefXmlReaderCppToC::Get(self)->Close();
} }
int CEF_CALLBACK xml_reader_has_error(struct _cef_xml_reader_t* self) int CEF_CALLBACK xml_reader_has_error(struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return 0; return 0;
return CefXmlReaderCppToC::Get(self)->HasError(); return CefXmlReaderCppToC::Get(self)->HasError();
} }
cef_string_userfree_t CEF_CALLBACK xml_reader_get_error( cef_string_userfree_t CEF_CALLBACK xml_reader_get_error(
struct _cef_xml_reader_t* self) struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return NULL; return NULL;
CefString retStr = CefXmlReaderCppToC::Get(self)->GetError(); CefString retStr = CefXmlReaderCppToC::Get(self)->GetError();
return retStr.DetachToUserFree(); return retStr.DetachToUserFree();
} }
enum cef_xml_node_type_t CEF_CALLBACK xml_reader_get_type( enum cef_xml_node_type_t CEF_CALLBACK xml_reader_get_type(
struct _cef_xml_reader_t* self) struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return XML_NODE_UNSUPPORTED; return XML_NODE_UNSUPPORTED;
return CefXmlReaderCppToC::Get(self)->GetType(); return CefXmlReaderCppToC::Get(self)->GetType();
} }
int CEF_CALLBACK xml_reader_get_depth(struct _cef_xml_reader_t* self) int CEF_CALLBACK xml_reader_get_depth(struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return -1; return -1;
return CefXmlReaderCppToC::Get(self)->GetDepth(); return CefXmlReaderCppToC::Get(self)->GetDepth();
} }
cef_string_userfree_t CEF_CALLBACK xml_reader_get_local_name( cef_string_userfree_t CEF_CALLBACK xml_reader_get_local_name(
struct _cef_xml_reader_t* self) struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return NULL; return NULL;
CefString retStr = CefXmlReaderCppToC::Get(self)->GetLocalName(); CefString retStr = CefXmlReaderCppToC::Get(self)->GetLocalName();
return retStr.DetachToUserFree(); return retStr.DetachToUserFree();
} }
cef_string_userfree_t CEF_CALLBACK xml_reader_get_prefix( cef_string_userfree_t CEF_CALLBACK xml_reader_get_prefix(
struct _cef_xml_reader_t* self) struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return NULL; return NULL;
CefString retStr = CefXmlReaderCppToC::Get(self)->GetPrefix(); CefString retStr = CefXmlReaderCppToC::Get(self)->GetPrefix();
return retStr.DetachToUserFree(); return retStr.DetachToUserFree();
} }
cef_string_userfree_t CEF_CALLBACK xml_reader_get_qualified_name( cef_string_userfree_t CEF_CALLBACK xml_reader_get_qualified_name(
struct _cef_xml_reader_t* self) struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return NULL; return NULL;
CefString retStr = CefXmlReaderCppToC::Get(self)->GetQualifiedName(); CefString retStr = CefXmlReaderCppToC::Get(self)->GetQualifiedName();
return retStr.DetachToUserFree(); return retStr.DetachToUserFree();
} }
cef_string_userfree_t CEF_CALLBACK xml_reader_get_namespace_uri( cef_string_userfree_t CEF_CALLBACK xml_reader_get_namespace_uri(
struct _cef_xml_reader_t* self) struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return NULL; return NULL;
CefString retStr = CefXmlReaderCppToC::Get(self)->GetNamespaceURI(); CefString retStr = CefXmlReaderCppToC::Get(self)->GetNamespaceURI();
return retStr.DetachToUserFree(); return retStr.DetachToUserFree();
} }
cef_string_userfree_t CEF_CALLBACK xml_reader_get_base_uri( cef_string_userfree_t CEF_CALLBACK xml_reader_get_base_uri(
struct _cef_xml_reader_t* self) struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return NULL; return NULL;
CefString retStr = CefXmlReaderCppToC::Get(self)->GetBaseURI(); CefString retStr = CefXmlReaderCppToC::Get(self)->GetBaseURI();
return retStr.DetachToUserFree(); return retStr.DetachToUserFree();
} }
cef_string_userfree_t CEF_CALLBACK xml_reader_get_xml_lang( cef_string_userfree_t CEF_CALLBACK xml_reader_get_xml_lang(
struct _cef_xml_reader_t* self) struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return NULL; return NULL;
CefString retStr = CefXmlReaderCppToC::Get(self)->GetXmlLang(); CefString retStr = CefXmlReaderCppToC::Get(self)->GetXmlLang();
return retStr.DetachToUserFree(); return retStr.DetachToUserFree();
} }
int CEF_CALLBACK xml_reader_is_empty_element(struct _cef_xml_reader_t* self) int CEF_CALLBACK xml_reader_is_empty_element(struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return 0; return 0;
return CefXmlReaderCppToC::Get(self)->IsEmptyElement(); return CefXmlReaderCppToC::Get(self)->IsEmptyElement();
} }
int CEF_CALLBACK xml_reader_has_value(struct _cef_xml_reader_t* self) int CEF_CALLBACK xml_reader_has_value(struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return 0; return 0;
return CefXmlReaderCppToC::Get(self)->HasValue(); return CefXmlReaderCppToC::Get(self)->HasValue();
} }
cef_string_userfree_t CEF_CALLBACK xml_reader_get_value( cef_string_userfree_t CEF_CALLBACK xml_reader_get_value(
struct _cef_xml_reader_t* self) struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return NULL; return NULL;
CefString retStr = CefXmlReaderCppToC::Get(self)->GetValue(); CefString retStr = CefXmlReaderCppToC::Get(self)->GetValue();
return retStr.DetachToUserFree(); return retStr.DetachToUserFree();
} }
int CEF_CALLBACK xml_reader_has_attributes(struct _cef_xml_reader_t* self) int CEF_CALLBACK xml_reader_has_attributes(struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return 0; return 0;
return CefXmlReaderCppToC::Get(self)->HasAttributes(); return CefXmlReaderCppToC::Get(self)->HasAttributes();
} }
size_t CEF_CALLBACK xml_reader_get_attribute_count( size_t CEF_CALLBACK xml_reader_get_attribute_count(
struct _cef_xml_reader_t* self) struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return 0; return 0;
return CefXmlReaderCppToC::Get(self)->GetAttributeCount(); return CefXmlReaderCppToC::Get(self)->GetAttributeCount();
} }
cef_string_userfree_t CEF_CALLBACK xml_reader_get_attribute_byindex( cef_string_userfree_t CEF_CALLBACK xml_reader_get_attribute_byindex(
struct _cef_xml_reader_t* self, int index) struct _cef_xml_reader_t* self, int index)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return NULL; return NULL;
CefString retStr = CefXmlReaderCppToC::Get(self)->GetAttribute(index); CefString retStr = CefXmlReaderCppToC::Get(self)->GetAttribute(index);
return retStr.DetachToUserFree(); return retStr.DetachToUserFree();
} }
cef_string_userfree_t CEF_CALLBACK xml_reader_get_attribute_byqname( cef_string_userfree_t CEF_CALLBACK xml_reader_get_attribute_byqname(
struct _cef_xml_reader_t* self, const cef_string_t* qualifiedName) struct _cef_xml_reader_t* self, const cef_string_t* qualifiedName)
{ {
DCHECK(self); DCHECK(self);
DCHECK(qualifiedName); DCHECK(qualifiedName);
if(!self || !qualifiedName) if(!self || !qualifiedName)
return NULL; return NULL;
CefString retStr = CefXmlReaderCppToC::Get(self)->GetAttribute( CefString retStr = CefXmlReaderCppToC::Get(self)->GetAttribute(
CefString(qualifiedName)); CefString(qualifiedName));
return retStr.DetachToUserFree(); return retStr.DetachToUserFree();
} }
cef_string_userfree_t CEF_CALLBACK xml_reader_get_attribute_bylname( cef_string_userfree_t CEF_CALLBACK xml_reader_get_attribute_bylname(
struct _cef_xml_reader_t* self, const cef_string_t* localName, struct _cef_xml_reader_t* self, const cef_string_t* localName,
const cef_string_t* namespaceURI) const cef_string_t* namespaceURI)
{ {
DCHECK(self); DCHECK(self);
DCHECK(localName); DCHECK(localName);
DCHECK(namespaceURI); DCHECK(namespaceURI);
if(!self || !localName || !namespaceURI) if(!self || !localName || !namespaceURI)
return NULL; return NULL;
CefString retStr = CefXmlReaderCppToC::Get(self)->GetAttribute( CefString retStr = CefXmlReaderCppToC::Get(self)->GetAttribute(
CefString(localName), CefString(namespaceURI)); CefString(localName), CefString(namespaceURI));
return retStr.DetachToUserFree(); return retStr.DetachToUserFree();
} }
cef_string_userfree_t CEF_CALLBACK xml_reader_get_inner_xml( cef_string_userfree_t CEF_CALLBACK xml_reader_get_inner_xml(
struct _cef_xml_reader_t* self) struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return NULL; return NULL;
CefString retStr = CefXmlReaderCppToC::Get(self)->GetInnerXml(); CefString retStr = CefXmlReaderCppToC::Get(self)->GetInnerXml();
return retStr.DetachToUserFree(); return retStr.DetachToUserFree();
} }
cef_string_userfree_t CEF_CALLBACK xml_reader_get_outer_xml( cef_string_userfree_t CEF_CALLBACK xml_reader_get_outer_xml(
struct _cef_xml_reader_t* self) struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return NULL; return NULL;
CefString retStr = CefXmlReaderCppToC::Get(self)->GetOuterXml(); CefString retStr = CefXmlReaderCppToC::Get(self)->GetOuterXml();
return retStr.DetachToUserFree(); return retStr.DetachToUserFree();
} }
int CEF_CALLBACK xml_reader_get_line_number(struct _cef_xml_reader_t* self) int CEF_CALLBACK xml_reader_get_line_number(struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return 0; return 0;
return CefXmlReaderCppToC::Get(self)->GetLineNumber(); return CefXmlReaderCppToC::Get(self)->GetLineNumber();
} }
int CEF_CALLBACK xml_reader_move_to_attribute_byindex( int CEF_CALLBACK xml_reader_move_to_attribute_byindex(
struct _cef_xml_reader_t* self, int index) struct _cef_xml_reader_t* self, int index)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return 0; return 0;
return CefXmlReaderCppToC::Get(self)->MoveToAttribute(index); return CefXmlReaderCppToC::Get(self)->MoveToAttribute(index);
} }
int CEF_CALLBACK xml_reader_move_to_attribute_byqname( int CEF_CALLBACK xml_reader_move_to_attribute_byqname(
struct _cef_xml_reader_t* self, const cef_string_t* qualifiedName) struct _cef_xml_reader_t* self, const cef_string_t* qualifiedName)
{ {
DCHECK(self); DCHECK(self);
DCHECK(qualifiedName); DCHECK(qualifiedName);
if(!self || !qualifiedName) if(!self || !qualifiedName)
return 0; return 0;
return CefXmlReaderCppToC::Get(self)->MoveToAttribute( return CefXmlReaderCppToC::Get(self)->MoveToAttribute(
CefString(qualifiedName)); CefString(qualifiedName));
} }
int CEF_CALLBACK xml_reader_move_to_attribute_bylname( int CEF_CALLBACK xml_reader_move_to_attribute_bylname(
struct _cef_xml_reader_t* self, const cef_string_t* localName, struct _cef_xml_reader_t* self, const cef_string_t* localName,
const cef_string_t* namespaceURI) const cef_string_t* namespaceURI)
{ {
DCHECK(self); DCHECK(self);
DCHECK(localName); DCHECK(localName);
DCHECK(namespaceURI); DCHECK(namespaceURI);
if(!self || !localName || !namespaceURI) if(!self || !localName || !namespaceURI)
return 0; return 0;
return CefXmlReaderCppToC::Get(self)->MoveToAttribute(CefString(localName), return CefXmlReaderCppToC::Get(self)->MoveToAttribute(CefString(localName),
CefString(namespaceURI)); CefString(namespaceURI));
} }
int CEF_CALLBACK xml_reader_move_to_first_attribute( int CEF_CALLBACK xml_reader_move_to_first_attribute(
struct _cef_xml_reader_t* self) struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return 0; return 0;
return CefXmlReaderCppToC::Get(self)->MoveToFirstAttribute(); return CefXmlReaderCppToC::Get(self)->MoveToFirstAttribute();
} }
int CEF_CALLBACK xml_reader_move_to_next_attribute( int CEF_CALLBACK xml_reader_move_to_next_attribute(
struct _cef_xml_reader_t* self) struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return 0; return 0;
return CefXmlReaderCppToC::Get(self)->MoveToNextAttribute(); return CefXmlReaderCppToC::Get(self)->MoveToNextAttribute();
} }
int CEF_CALLBACK xml_reader_move_to_carrying_element( int CEF_CALLBACK xml_reader_move_to_carrying_element(
struct _cef_xml_reader_t* self) struct _cef_xml_reader_t* self)
{ {
DCHECK(self); DCHECK(self);
if(!self) if(!self)
return 0; return 0;
return CefXmlReaderCppToC::Get(self)->MoveToCarryingElement(); return CefXmlReaderCppToC::Get(self)->MoveToCarryingElement();
} }
// CONSTRUCTOR - Do not edit by hand. // CONSTRUCTOR - Do not edit by hand.
CefXmlReaderCppToC::CefXmlReaderCppToC(CefXmlReader* cls) CefXmlReaderCppToC::CefXmlReaderCppToC(CefXmlReader* cls)
: CefCppToC<CefXmlReaderCppToC, CefXmlReader, cef_xml_reader_t>(cls) : CefCppToC<CefXmlReaderCppToC, CefXmlReader, cef_xml_reader_t>(cls)
{ {
struct_.struct_.move_to_next_node = xml_reader_move_to_next_node; struct_.struct_.move_to_next_node = xml_reader_move_to_next_node;
struct_.struct_.close = xml_reader_close; struct_.struct_.close = xml_reader_close;
struct_.struct_.has_error = xml_reader_has_error; struct_.struct_.has_error = xml_reader_has_error;
struct_.struct_.get_error = xml_reader_get_error; struct_.struct_.get_error = xml_reader_get_error;
struct_.struct_.get_type = xml_reader_get_type; struct_.struct_.get_type = xml_reader_get_type;
struct_.struct_.get_depth = xml_reader_get_depth; struct_.struct_.get_depth = xml_reader_get_depth;
struct_.struct_.get_local_name = xml_reader_get_local_name; struct_.struct_.get_local_name = xml_reader_get_local_name;
struct_.struct_.get_prefix = xml_reader_get_prefix; struct_.struct_.get_prefix = xml_reader_get_prefix;
struct_.struct_.get_qualified_name = xml_reader_get_qualified_name; struct_.struct_.get_qualified_name = xml_reader_get_qualified_name;
struct_.struct_.get_namespace_uri = xml_reader_get_namespace_uri; struct_.struct_.get_namespace_uri = xml_reader_get_namespace_uri;
struct_.struct_.get_base_uri = xml_reader_get_base_uri; struct_.struct_.get_base_uri = xml_reader_get_base_uri;
struct_.struct_.get_xml_lang = xml_reader_get_xml_lang; struct_.struct_.get_xml_lang = xml_reader_get_xml_lang;
struct_.struct_.is_empty_element = xml_reader_is_empty_element; struct_.struct_.is_empty_element = xml_reader_is_empty_element;
struct_.struct_.has_value = xml_reader_has_value; struct_.struct_.has_value = xml_reader_has_value;
struct_.struct_.get_value = xml_reader_get_value; struct_.struct_.get_value = xml_reader_get_value;
struct_.struct_.has_attributes = xml_reader_has_attributes; struct_.struct_.has_attributes = xml_reader_has_attributes;
struct_.struct_.get_attribute_count = xml_reader_get_attribute_count; struct_.struct_.get_attribute_count = xml_reader_get_attribute_count;
struct_.struct_.get_attribute_byindex = xml_reader_get_attribute_byindex; struct_.struct_.get_attribute_byindex = xml_reader_get_attribute_byindex;
struct_.struct_.get_attribute_byqname = xml_reader_get_attribute_byqname; struct_.struct_.get_attribute_byqname = xml_reader_get_attribute_byqname;
struct_.struct_.get_attribute_bylname = xml_reader_get_attribute_bylname; struct_.struct_.get_attribute_bylname = xml_reader_get_attribute_bylname;
struct_.struct_.get_inner_xml = xml_reader_get_inner_xml; struct_.struct_.get_inner_xml = xml_reader_get_inner_xml;
struct_.struct_.get_outer_xml = xml_reader_get_outer_xml; struct_.struct_.get_outer_xml = xml_reader_get_outer_xml;
struct_.struct_.get_line_number = xml_reader_get_line_number; struct_.struct_.get_line_number = xml_reader_get_line_number;
struct_.struct_.move_to_attribute_byindex = struct_.struct_.move_to_attribute_byindex =
xml_reader_move_to_attribute_byindex; xml_reader_move_to_attribute_byindex;
struct_.struct_.move_to_attribute_byqname = struct_.struct_.move_to_attribute_byqname =
xml_reader_move_to_attribute_byqname; xml_reader_move_to_attribute_byqname;
struct_.struct_.move_to_attribute_bylname = struct_.struct_.move_to_attribute_bylname =
xml_reader_move_to_attribute_bylname; xml_reader_move_to_attribute_bylname;
struct_.struct_.move_to_first_attribute = xml_reader_move_to_first_attribute; struct_.struct_.move_to_first_attribute = xml_reader_move_to_first_attribute;
struct_.struct_.move_to_next_attribute = xml_reader_move_to_next_attribute; struct_.struct_.move_to_next_attribute = xml_reader_move_to_next_attribute;
struct_.struct_.move_to_carrying_element = struct_.struct_.move_to_carrying_element =
xml_reader_move_to_carrying_element; xml_reader_move_to_carrying_element;
} }
#ifdef _DEBUG #ifdef _DEBUG
long CefCppToC<CefXmlReaderCppToC, CefXmlReader, cef_xml_reader_t>::DebugObjCt = long CefCppToC<CefXmlReaderCppToC, CefXmlReader, cef_xml_reader_t>::DebugObjCt =
0; 0;
#endif #endif

View File

@ -1,34 +1,34 @@
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights // Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that // reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file. // can be found in the LICENSE file.
// //
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// //
// This file was generated by the CEF translator tool and should not edited // This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
#ifndef _XMLREADER_CPPTOC_H #ifndef _XMLREADER_CPPTOC_H
#define _XMLREADER_CPPTOC_H #define _XMLREADER_CPPTOC_H
#ifndef BUILDING_CEF_SHARED #ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only") #pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED #else // BUILDING_CEF_SHARED
#include "include/cef.h" #include "include/cef.h"
#include "include/cef_capi.h" #include "include/cef_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h" #include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure. // Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only. // This class may be instantiated and accessed DLL-side only.
class CefXmlReaderCppToC class CefXmlReaderCppToC
: public CefCppToC<CefXmlReaderCppToC, CefXmlReader, cef_xml_reader_t> : public CefCppToC<CefXmlReaderCppToC, CefXmlReader, cef_xml_reader_t>
{ {
public: public:
CefXmlReaderCppToC(CefXmlReader* cls); CefXmlReaderCppToC(CefXmlReader* cls);
virtual ~CefXmlReaderCppToC() {} virtual ~CefXmlReaderCppToC() {}
}; };
#endif // BUILDING_CEF_SHARED #endif // BUILDING_CEF_SHARED
#endif // _XMLREADER_CPPTOC_H #endif // _XMLREADER_CPPTOC_H

View File

@ -1,314 +1,314 @@
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights // Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that // reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file. // can be found in the LICENSE file.
// //
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// //
// A portion of this file was generated by the CEF translator tool. When // A portion of this file was generated by the CEF translator tool. When
// making changes by hand only do so within the body of existing static and // making changes by hand only do so within the body of existing static and
// virtual method implementations. See the translator.README.txt file in the // virtual method implementations. See the translator.README.txt file in the
// tools directory for more information. // tools directory for more information.
// //
#include "libcef_dll/ctocpp/stream_reader_ctocpp.h" #include "libcef_dll/ctocpp/stream_reader_ctocpp.h"
#include "libcef_dll/ctocpp/xml_reader_ctocpp.h" #include "libcef_dll/ctocpp/xml_reader_ctocpp.h"
// STATIC METHODS - Body may be edited by hand. // STATIC METHODS - Body may be edited by hand.
CefRefPtr<CefXmlReader> CefXmlReader::Create(CefRefPtr<CefStreamReader> stream, CefRefPtr<CefXmlReader> CefXmlReader::Create(CefRefPtr<CefStreamReader> stream,
EncodingType encodingType, const CefString& URI) EncodingType encodingType, const CefString& URI)
{ {
cef_xml_reader_t* impl = cef_xml_reader_create( cef_xml_reader_t* impl = cef_xml_reader_create(
CefStreamReaderCToCpp::Unwrap(stream), encodingType, URI.GetStruct()); CefStreamReaderCToCpp::Unwrap(stream), encodingType, URI.GetStruct());
if(impl) if(impl)
return CefXmlReaderCToCpp::Wrap(impl); return CefXmlReaderCToCpp::Wrap(impl);
return NULL; return NULL;
} }
// VIRTUAL METHODS - Body may be edited by hand. // VIRTUAL METHODS - Body may be edited by hand.
bool CefXmlReaderCToCpp::MoveToNextNode() bool CefXmlReaderCToCpp::MoveToNextNode()
{ {
if(CEF_MEMBER_MISSING(struct_, move_to_next_node)) if(CEF_MEMBER_MISSING(struct_, move_to_next_node))
return false; return false;
return struct_->move_to_next_node(struct_) ? true : false; return struct_->move_to_next_node(struct_) ? true : false;
} }
bool CefXmlReaderCToCpp::Close() bool CefXmlReaderCToCpp::Close()
{ {
if(CEF_MEMBER_MISSING(struct_, close)) if(CEF_MEMBER_MISSING(struct_, close))
return false; return false;
return struct_->close(struct_) ? true : false; return struct_->close(struct_) ? true : false;
} }
bool CefXmlReaderCToCpp::HasError() bool CefXmlReaderCToCpp::HasError()
{ {
if(CEF_MEMBER_MISSING(struct_, has_error)) if(CEF_MEMBER_MISSING(struct_, has_error))
return false; return false;
return struct_->has_error(struct_) ? true : false; return struct_->has_error(struct_) ? true : false;
} }
CefString CefXmlReaderCToCpp::GetError() CefString CefXmlReaderCToCpp::GetError()
{ {
CefString str; CefString str;
if(CEF_MEMBER_MISSING(struct_, get_error)) if(CEF_MEMBER_MISSING(struct_, get_error))
return str; return str;
cef_string_userfree_t strPtr = struct_->get_error(struct_); cef_string_userfree_t strPtr = struct_->get_error(struct_);
str.AttachToUserFree(strPtr); str.AttachToUserFree(strPtr);
return str; return str;
} }
CefXmlReader::NodeType CefXmlReaderCToCpp::GetType() CefXmlReader::NodeType CefXmlReaderCToCpp::GetType()
{ {
if(CEF_MEMBER_MISSING(struct_, get_type)) if(CEF_MEMBER_MISSING(struct_, get_type))
return XML_NODE_UNSUPPORTED; return XML_NODE_UNSUPPORTED;
return struct_->get_type(struct_); return struct_->get_type(struct_);
} }
int CefXmlReaderCToCpp::GetDepth() int CefXmlReaderCToCpp::GetDepth()
{ {
if(CEF_MEMBER_MISSING(struct_, get_depth)) if(CEF_MEMBER_MISSING(struct_, get_depth))
return -1; return -1;
return struct_->get_depth(struct_); return struct_->get_depth(struct_);
} }
CefString CefXmlReaderCToCpp::GetLocalName() CefString CefXmlReaderCToCpp::GetLocalName()
{ {
CefString str; CefString str;
if(CEF_MEMBER_MISSING(struct_, get_local_name)) if(CEF_MEMBER_MISSING(struct_, get_local_name))
return str; return str;
cef_string_userfree_t strPtr = struct_->get_local_name(struct_); cef_string_userfree_t strPtr = struct_->get_local_name(struct_);
str.AttachToUserFree(strPtr); str.AttachToUserFree(strPtr);
return str; return str;
} }
CefString CefXmlReaderCToCpp::GetPrefix() CefString CefXmlReaderCToCpp::GetPrefix()
{ {
CefString str; CefString str;
if(CEF_MEMBER_MISSING(struct_, get_prefix)) if(CEF_MEMBER_MISSING(struct_, get_prefix))
return str; return str;
cef_string_userfree_t strPtr = struct_->get_prefix(struct_); cef_string_userfree_t strPtr = struct_->get_prefix(struct_);
str.AttachToUserFree(strPtr); str.AttachToUserFree(strPtr);
return str; return str;
} }
CefString CefXmlReaderCToCpp::GetQualifiedName() CefString CefXmlReaderCToCpp::GetQualifiedName()
{ {
CefString str; CefString str;
if(CEF_MEMBER_MISSING(struct_, get_qualified_name)) if(CEF_MEMBER_MISSING(struct_, get_qualified_name))
return str; return str;
cef_string_userfree_t strPtr = struct_->get_qualified_name(struct_); cef_string_userfree_t strPtr = struct_->get_qualified_name(struct_);
str.AttachToUserFree(strPtr); str.AttachToUserFree(strPtr);
return str; return str;
} }
CefString CefXmlReaderCToCpp::GetNamespaceURI() CefString CefXmlReaderCToCpp::GetNamespaceURI()
{ {
CefString str; CefString str;
if(CEF_MEMBER_MISSING(struct_, get_namespace_uri)) if(CEF_MEMBER_MISSING(struct_, get_namespace_uri))
return str; return str;
cef_string_userfree_t strPtr = struct_->get_namespace_uri(struct_); cef_string_userfree_t strPtr = struct_->get_namespace_uri(struct_);
str.AttachToUserFree(strPtr); str.AttachToUserFree(strPtr);
return str; return str;
} }
CefString CefXmlReaderCToCpp::GetBaseURI() CefString CefXmlReaderCToCpp::GetBaseURI()
{ {
CefString str; CefString str;
if(CEF_MEMBER_MISSING(struct_, get_base_uri)) if(CEF_MEMBER_MISSING(struct_, get_base_uri))
return str; return str;
cef_string_userfree_t strPtr = struct_->get_base_uri(struct_); cef_string_userfree_t strPtr = struct_->get_base_uri(struct_);
str.AttachToUserFree(strPtr); str.AttachToUserFree(strPtr);
return str; return str;
} }
CefString CefXmlReaderCToCpp::GetXmlLang() CefString CefXmlReaderCToCpp::GetXmlLang()
{ {
CefString str; CefString str;
if(CEF_MEMBER_MISSING(struct_, get_xml_lang)) if(CEF_MEMBER_MISSING(struct_, get_xml_lang))
return str; return str;
cef_string_userfree_t strPtr = struct_->get_xml_lang(struct_); cef_string_userfree_t strPtr = struct_->get_xml_lang(struct_);
str.AttachToUserFree(strPtr); str.AttachToUserFree(strPtr);
return str; return str;
} }
bool CefXmlReaderCToCpp::IsEmptyElement() bool CefXmlReaderCToCpp::IsEmptyElement()
{ {
if(CEF_MEMBER_MISSING(struct_, is_empty_element)) if(CEF_MEMBER_MISSING(struct_, is_empty_element))
return false; return false;
return struct_->is_empty_element(struct_) ? true : false; return struct_->is_empty_element(struct_) ? true : false;
} }
bool CefXmlReaderCToCpp::HasValue() bool CefXmlReaderCToCpp::HasValue()
{ {
if(CEF_MEMBER_MISSING(struct_, has_value)) if(CEF_MEMBER_MISSING(struct_, has_value))
return false; return false;
return struct_->has_value(struct_) ? true : false; return struct_->has_value(struct_) ? true : false;
} }
CefString CefXmlReaderCToCpp::GetValue() CefString CefXmlReaderCToCpp::GetValue()
{ {
CefString str; CefString str;
if(CEF_MEMBER_MISSING(struct_, get_value)) if(CEF_MEMBER_MISSING(struct_, get_value))
return str; return str;
cef_string_userfree_t strPtr = struct_->get_value(struct_); cef_string_userfree_t strPtr = struct_->get_value(struct_);
str.AttachToUserFree(strPtr); str.AttachToUserFree(strPtr);
return str; return str;
} }
bool CefXmlReaderCToCpp::HasAttributes() bool CefXmlReaderCToCpp::HasAttributes()
{ {
if(CEF_MEMBER_MISSING(struct_, has_attributes)) if(CEF_MEMBER_MISSING(struct_, has_attributes))
return false; return false;
return struct_->has_attributes(struct_) ? true : false; return struct_->has_attributes(struct_) ? true : false;
} }
size_t CefXmlReaderCToCpp::GetAttributeCount() size_t CefXmlReaderCToCpp::GetAttributeCount()
{ {
if(CEF_MEMBER_MISSING(struct_, get_attribute_count)) if(CEF_MEMBER_MISSING(struct_, get_attribute_count))
return 0; return 0;
return struct_->get_attribute_count(struct_); return struct_->get_attribute_count(struct_);
} }
CefString CefXmlReaderCToCpp::GetAttribute(int index) CefString CefXmlReaderCToCpp::GetAttribute(int index)
{ {
CefString str; CefString str;
if(CEF_MEMBER_MISSING(struct_, get_attribute_byindex)) if(CEF_MEMBER_MISSING(struct_, get_attribute_byindex))
return str; return str;
cef_string_userfree_t strPtr = struct_->get_attribute_byindex(struct_, index); cef_string_userfree_t strPtr = struct_->get_attribute_byindex(struct_, index);
str.AttachToUserFree(strPtr); str.AttachToUserFree(strPtr);
return str; return str;
} }
CefString CefXmlReaderCToCpp::GetAttribute(const CefString& qualifiedName) CefString CefXmlReaderCToCpp::GetAttribute(const CefString& qualifiedName)
{ {
CefString str; CefString str;
if(CEF_MEMBER_MISSING(struct_, get_attribute_byqname)) if(CEF_MEMBER_MISSING(struct_, get_attribute_byqname))
return str; return str;
cef_string_userfree_t strPtr = struct_->get_attribute_byqname(struct_, cef_string_userfree_t strPtr = struct_->get_attribute_byqname(struct_,
qualifiedName.GetStruct()); qualifiedName.GetStruct());
str.AttachToUserFree(strPtr); str.AttachToUserFree(strPtr);
return str; return str;
} }
CefString CefXmlReaderCToCpp::GetAttribute(const CefString& localName, CefString CefXmlReaderCToCpp::GetAttribute(const CefString& localName,
const CefString& namespaceURI) const CefString& namespaceURI)
{ {
CefString str; CefString str;
if(CEF_MEMBER_MISSING(struct_, get_attribute_bylname)) if(CEF_MEMBER_MISSING(struct_, get_attribute_bylname))
return str; return str;
cef_string_userfree_t strPtr = struct_->get_attribute_bylname(struct_, cef_string_userfree_t strPtr = struct_->get_attribute_bylname(struct_,
localName.GetStruct(), namespaceURI.GetStruct()); localName.GetStruct(), namespaceURI.GetStruct());
str.AttachToUserFree(strPtr); str.AttachToUserFree(strPtr);
return str; return str;
} }
CefString CefXmlReaderCToCpp::GetInnerXml() CefString CefXmlReaderCToCpp::GetInnerXml()
{ {
CefString str; CefString str;
if(CEF_MEMBER_MISSING(struct_, get_inner_xml)) if(CEF_MEMBER_MISSING(struct_, get_inner_xml))
return str; return str;
cef_string_userfree_t strPtr = struct_->get_inner_xml(struct_); cef_string_userfree_t strPtr = struct_->get_inner_xml(struct_);
str.AttachToUserFree(strPtr); str.AttachToUserFree(strPtr);
return str; return str;
} }
CefString CefXmlReaderCToCpp::GetOuterXml() CefString CefXmlReaderCToCpp::GetOuterXml()
{ {
CefString str; CefString str;
if(CEF_MEMBER_MISSING(struct_, get_outer_xml)) if(CEF_MEMBER_MISSING(struct_, get_outer_xml))
return str; return str;
cef_string_userfree_t strPtr = struct_->get_outer_xml(struct_); cef_string_userfree_t strPtr = struct_->get_outer_xml(struct_);
str.AttachToUserFree(strPtr); str.AttachToUserFree(strPtr);
return str; return str;
} }
int CefXmlReaderCToCpp::GetLineNumber() int CefXmlReaderCToCpp::GetLineNumber()
{ {
if(CEF_MEMBER_MISSING(struct_, get_line_number)) if(CEF_MEMBER_MISSING(struct_, get_line_number))
return false; return false;
return struct_->get_line_number(struct_); return struct_->get_line_number(struct_);
} }
bool CefXmlReaderCToCpp::MoveToAttribute(int index) bool CefXmlReaderCToCpp::MoveToAttribute(int index)
{ {
if(CEF_MEMBER_MISSING(struct_, move_to_attribute_byindex)) if(CEF_MEMBER_MISSING(struct_, move_to_attribute_byindex))
return false; return false;
return struct_->move_to_attribute_byindex(struct_, index) ? true : false; return struct_->move_to_attribute_byindex(struct_, index) ? true : false;
} }
bool CefXmlReaderCToCpp::MoveToAttribute(const CefString& qualifiedName) bool CefXmlReaderCToCpp::MoveToAttribute(const CefString& qualifiedName)
{ {
if(CEF_MEMBER_MISSING(struct_, move_to_attribute_byqname)) if(CEF_MEMBER_MISSING(struct_, move_to_attribute_byqname))
return false; return false;
return struct_->move_to_attribute_byqname(struct_, qualifiedName.GetStruct())? return struct_->move_to_attribute_byqname(struct_, qualifiedName.GetStruct())?
true : false; true : false;
} }
bool CefXmlReaderCToCpp::MoveToAttribute(const CefString& localName, bool CefXmlReaderCToCpp::MoveToAttribute(const CefString& localName,
const CefString& namespaceURI) const CefString& namespaceURI)
{ {
if(CEF_MEMBER_MISSING(struct_, move_to_attribute_bylname)) if(CEF_MEMBER_MISSING(struct_, move_to_attribute_bylname))
return false; return false;
return struct_->move_to_attribute_bylname(struct_, localName.GetStruct(), return struct_->move_to_attribute_bylname(struct_, localName.GetStruct(),
namespaceURI.GetStruct()) ? true : false; namespaceURI.GetStruct()) ? true : false;
} }
bool CefXmlReaderCToCpp::MoveToFirstAttribute() bool CefXmlReaderCToCpp::MoveToFirstAttribute()
{ {
if(CEF_MEMBER_MISSING(struct_, move_to_first_attribute)) if(CEF_MEMBER_MISSING(struct_, move_to_first_attribute))
return false; return false;
return struct_->move_to_first_attribute(struct_) ? true : false; return struct_->move_to_first_attribute(struct_) ? true : false;
} }
bool CefXmlReaderCToCpp::MoveToNextAttribute() bool CefXmlReaderCToCpp::MoveToNextAttribute()
{ {
if(CEF_MEMBER_MISSING(struct_, move_to_next_attribute)) if(CEF_MEMBER_MISSING(struct_, move_to_next_attribute))
return false; return false;
return struct_->move_to_next_attribute(struct_) ? true : false; return struct_->move_to_next_attribute(struct_) ? true : false;
} }
bool CefXmlReaderCToCpp::MoveToCarryingElement() bool CefXmlReaderCToCpp::MoveToCarryingElement()
{ {
if(CEF_MEMBER_MISSING(struct_, move_to_carrying_element)) if(CEF_MEMBER_MISSING(struct_, move_to_carrying_element))
return false; return false;
return struct_->move_to_carrying_element(struct_) ? true : false; return struct_->move_to_carrying_element(struct_) ? true : false;
} }
#ifdef _DEBUG #ifdef _DEBUG
long CefCToCpp<CefXmlReaderCToCpp, CefXmlReader, cef_xml_reader_t>::DebugObjCt = long CefCToCpp<CefXmlReaderCToCpp, CefXmlReader, cef_xml_reader_t>::DebugObjCt =
0; 0;
#endif #endif

View File

@ -1,69 +1,69 @@
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights // Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that // reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file. // can be found in the LICENSE file.
// //
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
// //
// This file was generated by the CEF translator tool and should not edited // This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
#ifndef _XMLREADER_CTOCPP_H #ifndef _XMLREADER_CTOCPP_H
#define _XMLREADER_CTOCPP_H #define _XMLREADER_CTOCPP_H
#ifndef USING_CEF_SHARED #ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") #pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED #else // USING_CEF_SHARED
#include "include/cef.h" #include "include/cef.h"
#include "include/cef_capi.h" #include "include/cef_capi.h"
#include "libcef_dll/ctocpp/ctocpp.h" #include "libcef_dll/ctocpp/ctocpp.h"
// Wrap a C structure with a C++ class. // Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only. // This class may be instantiated and accessed wrapper-side only.
class CefXmlReaderCToCpp class CefXmlReaderCToCpp
: public CefCToCpp<CefXmlReaderCToCpp, CefXmlReader, cef_xml_reader_t> : public CefCToCpp<CefXmlReaderCToCpp, CefXmlReader, cef_xml_reader_t>
{ {
public: public:
CefXmlReaderCToCpp(cef_xml_reader_t* str) CefXmlReaderCToCpp(cef_xml_reader_t* str)
: CefCToCpp<CefXmlReaderCToCpp, CefXmlReader, cef_xml_reader_t>(str) {} : CefCToCpp<CefXmlReaderCToCpp, CefXmlReader, cef_xml_reader_t>(str) {}
virtual ~CefXmlReaderCToCpp() {} virtual ~CefXmlReaderCToCpp() {}
// CefXmlReader methods // CefXmlReader methods
virtual bool MoveToNextNode(); virtual bool MoveToNextNode();
virtual bool Close(); virtual bool Close();
virtual bool HasError(); virtual bool HasError();
virtual CefString GetError(); virtual CefString GetError();
virtual NodeType GetType(); virtual NodeType GetType();
virtual int GetDepth(); virtual int GetDepth();
virtual CefString GetLocalName(); virtual CefString GetLocalName();
virtual CefString GetPrefix(); virtual CefString GetPrefix();
virtual CefString GetQualifiedName(); virtual CefString GetQualifiedName();
virtual CefString GetNamespaceURI(); virtual CefString GetNamespaceURI();
virtual CefString GetBaseURI(); virtual CefString GetBaseURI();
virtual CefString GetXmlLang(); virtual CefString GetXmlLang();
virtual bool IsEmptyElement(); virtual bool IsEmptyElement();
virtual bool HasValue(); virtual bool HasValue();
virtual CefString GetValue(); virtual CefString GetValue();
virtual bool HasAttributes(); virtual bool HasAttributes();
virtual size_t GetAttributeCount(); virtual size_t GetAttributeCount();
virtual CefString GetAttribute(int index); virtual CefString GetAttribute(int index);
virtual CefString GetAttribute(const CefString& qualifiedName); virtual CefString GetAttribute(const CefString& qualifiedName);
virtual CefString GetAttribute(const CefString& localName, virtual CefString GetAttribute(const CefString& localName,
const CefString& namespaceURI); const CefString& namespaceURI);
virtual CefString GetInnerXml(); virtual CefString GetInnerXml();
virtual CefString GetOuterXml(); virtual CefString GetOuterXml();
virtual int GetLineNumber(); virtual int GetLineNumber();
virtual bool MoveToAttribute(int index); virtual bool MoveToAttribute(int index);
virtual bool MoveToAttribute(const CefString& qualifiedName); virtual bool MoveToAttribute(const CefString& qualifiedName);
virtual bool MoveToAttribute(const CefString& localName, virtual bool MoveToAttribute(const CefString& localName,
const CefString& namespaceURI); const CefString& namespaceURI);
virtual bool MoveToFirstAttribute(); virtual bool MoveToFirstAttribute();
virtual bool MoveToNextAttribute(); virtual bool MoveToNextAttribute();
virtual bool MoveToCarryingElement(); virtual bool MoveToCarryingElement();
}; };
#endif // USING_CEF_SHARED #endif // USING_CEF_SHARED
#endif // _XMLREADER_CTOCPP_H #endif // _XMLREADER_CTOCPP_H

View File

@ -95,7 +95,6 @@ const int kWindowHeight = 600;
ss << "Console messages will be written to " << g_handler->GetLogFile(); ss << "Console messages will be written to " << g_handler->GetLogFile();
NSString* str = [NSString stringWithUTF8String:(ss.str().c_str())]; NSString* str = [NSString stringWithUTF8String:(ss.str().c_str())];
[self alert:@"Console Messages" withMessage:str]; [self alert:@"Console Messages" withMessage:str];
[str release];
} }
- (void)notifyDownloadComplete:(id)object { - (void)notifyDownloadComplete:(id)object {
@ -104,7 +103,6 @@ const int kWindowHeight = 600;
"\" downloaded successfully."; "\" downloaded successfully.";
NSString* str = [NSString stringWithUTF8String:(ss.str().c_str())]; NSString* str = [NSString stringWithUTF8String:(ss.str().c_str())];
[self alert:@"File Download" withMessage:str]; [self alert:@"File Download" withMessage:str];
[str release];
} }
- (void)notifyDownloadError:(id)object { - (void)notifyDownloadError:(id)object {
@ -113,7 +111,6 @@ const int kWindowHeight = 600;
"\" failed to download."; "\" failed to download.";
NSString* str = [NSString stringWithUTF8String:(ss.str().c_str())]; NSString* str = [NSString stringWithUTF8String:(ss.str().c_str())];
[self alert:@"File Download" withMessage:str]; [self alert:@"File Download" withMessage:str];
[str release];
} }
- (void)windowDidBecomeKey:(NSNotification*)notification { - (void)windowDidBecomeKey:(NSNotification*)notification {
@ -236,7 +233,7 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
// Create the buttons. // Create the buttons.
NSRect button_rect = [[mainWnd contentView] bounds]; NSRect button_rect = [[mainWnd contentView] bounds];
button_rect.origin.y = window_rect.size.height - URLBAR_HEIGHT + button_rect.origin.y = window_rect.size.height - URLBAR_HEIGHT +
(URLBAR_HEIGHT - BUTTON_HEIGHT) / 2; (URLBAR_HEIGHT - BUTTON_HEIGHT) / 2;
button_rect.size.height = BUTTON_HEIGHT; button_rect.size.height = BUTTON_HEIGHT;
button_rect.origin.x += BUTTON_MARGIN; button_rect.origin.x += BUTTON_MARGIN;
button_rect.size.width = BUTTON_WIDTH; button_rect.size.width = BUTTON_WIDTH;
@ -281,7 +278,7 @@ NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
window_info.SetAsChild((void*)[mainWnd contentView], 0, 0, window_info.SetAsChild((void*)[mainWnd contentView], 0, 0,
kWindowWidth, kWindowHeight); kWindowWidth, kWindowHeight);
CefBrowser::CreateBrowser(window_info, false, g_handler.get(), CefBrowser::CreateBrowser(window_info, false, g_handler.get(),
L"http://www.google.com"); "http://www.google.com");
// Show the window. // Show the window.
[mainWnd makeKeyAndOrderFront: nil]; [mainWnd makeKeyAndOrderFront: nil];
@ -378,10 +375,9 @@ CefHandler::RetVal ClientHandler::HandleAddressChange(
{ {
// Set the edit window text // Set the edit window text
NSTextField* textField = (NSTextField*)m_EditHwnd; NSTextField* textField = (NSTextField*)m_EditHwnd;
NSString* str = std::string urlStr(url);
[NSString stringWithUTF8String:(std::string(url).c_str())]; NSString* str = [NSString stringWithUTF8String:urlStr.c_str()];
[textField setStringValue:str]; [textField setStringValue:str];
[str release];
} }
return RV_CONTINUE; return RV_CONTINUE;
} }
@ -391,10 +387,9 @@ CefHandler::RetVal ClientHandler::HandleTitleChange(
{ {
// Set the frame window title bar // Set the frame window title bar
NSWindow* window = (NSWindow*)m_MainHwnd; NSWindow* window = (NSWindow*)m_MainHwnd;
NSString* str = std::string titleStr(title);
[NSString stringWithUTF8String:(std::string(title).c_str())]; NSString* str = [NSString stringWithUTF8String:titleStr.c_str()];
[window setTitle:str]; [window setTitle:str];
[str release];
return RV_CONTINUE; return RV_CONTINUE;
} }

View File

@ -1,24 +1,24 @@
<html> <html>
<body> <body>
<script language="JavaScript"> <script language="JavaScript">
var val = window.localStorage.getItem('val'); var val = window.localStorage.getItem('val');
function addLine() { function addLine() {
if(val == null) if(val == null)
val = '<br/>One Line.'; val = '<br/>One Line.';
else else
val += '<br/>Another Line.'; val += '<br/>Another Line.';
window.localStorage.setItem('val', val); window.localStorage.setItem('val', val);
document.getElementById('out').innerHTML = val; document.getElementById('out').innerHTML = val;
} }
</script> </script>
Click the "Add Line" button to add a line or the "Clear" button to clear.<br/> Click the "Add Line" button to add a line or the "Clear" button to clear.<br/>
This data will persist across sessions if a cache path was specified.<br/> This data will persist across sessions if a cache path was specified.<br/>
<input type="button" value="Add Line" onClick="addLine();"/> <input type="button" value="Add Line" onClick="addLine();"/>
<input type="button" value="Clear" onClick="window.localStorage.removeItem('val'); window.location.reload();"/> <input type="button" value="Clear" onClick="window.localStorage.removeItem('val'); window.location.reload();"/>
<div id="out"></div> <div id="out"></div>
<script language="JavaScript"> <script language="JavaScript">
if(val != null) if(val != null)
document.getElementById('out').innerHTML = val; document.getElementById('out').innerHTML = val;
</script> </script>
</body> </body>
</html> </html>

View File

@ -13,7 +13,7 @@
TEST(StringTest, UTF8) TEST(StringTest, UTF8)
{ {
CefStringUTF8 str1("Test String"); CefStringUTF8 str1("Test String");
ASSERT_EQ(str1.length(), 11); ASSERT_EQ(str1.length(), (size_t)11);
ASSERT_FALSE(str1.empty()); ASSERT_FALSE(str1.empty());
ASSERT_TRUE(str1.IsOwner()); ASSERT_TRUE(str1.IsOwner());
@ -52,7 +52,7 @@ TEST(StringTest, UTF8)
TEST(StringTest, UTF16) TEST(StringTest, UTF16)
{ {
CefStringUTF16 str1("Test String"); CefStringUTF16 str1("Test String");
ASSERT_EQ(str1.length(), 11); ASSERT_EQ(str1.length(), (size_t)11);
ASSERT_FALSE(str1.empty()); ASSERT_FALSE(str1.empty());
ASSERT_TRUE(str1.IsOwner()); ASSERT_TRUE(str1.IsOwner());
@ -91,7 +91,7 @@ TEST(StringTest, UTF16)
TEST(StringTest, Wide) TEST(StringTest, Wide)
{ {
CefStringWide str1("Test String"); CefStringWide str1("Test String");
ASSERT_EQ(str1.length(), 11); ASSERT_EQ(str1.length(), (size_t)11);
ASSERT_FALSE(str1.empty()); ASSERT_FALSE(str1.empty());
ASSERT_TRUE(str1.IsOwner()); ASSERT_TRUE(str1.IsOwner());