mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Significant API changes for issue #218:
- Replace CefHandler with a new CefClient interface and separate handler interfaces. - Add support for virtual inheritance to allow multiple CefBase parented interfaces to be implemented in the same class. - Replace CefThreadSafeBase with IMPLEMENT_* macros to support virtual inheritance and to only provide locking implementations when needed. - Move the CefBrowserSettings parameter from CefInitialize to CreateBrowser. - Add a new cef_build.h header that provides platform-specific and OS_* defines. - Introduce the use of OVERRIDE to generate compiler errors on Windows if a child virtual method declaration doesn't match the parent declaration. - Use NDEBUG instead of _DEBUG because _DEBUG is not defined on Mac. (issue #240). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@235 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
64
cef.gyp
64
cef.gyp
@ -34,6 +34,10 @@
|
|||||||
'tests/cefclient/binding_test.h',
|
'tests/cefclient/binding_test.h',
|
||||||
'tests/cefclient/cefclient.cpp',
|
'tests/cefclient/cefclient.cpp',
|
||||||
'tests/cefclient/cefclient.h',
|
'tests/cefclient/cefclient.h',
|
||||||
|
'tests/cefclient/client_handler.cpp',
|
||||||
|
'tests/cefclient/client_handler.h',
|
||||||
|
'tests/cefclient/client_popup_handler.cpp',
|
||||||
|
'tests/cefclient/client_popup_handler.h',
|
||||||
'tests/cefclient/download_handler.cpp',
|
'tests/cefclient/download_handler.cpp',
|
||||||
'tests/cefclient/download_handler.h',
|
'tests/cefclient/download_handler.h',
|
||||||
'tests/cefclient/extension_test.cpp',
|
'tests/cefclient/extension_test.cpp',
|
||||||
@ -87,6 +91,7 @@
|
|||||||
'tests/cefclient/cefclient.ico',
|
'tests/cefclient/cefclient.ico',
|
||||||
'tests/cefclient/cefclient.rc',
|
'tests/cefclient/cefclient.rc',
|
||||||
'tests/cefclient/cefclient_win.cpp',
|
'tests/cefclient/cefclient_win.cpp',
|
||||||
|
'tests/cefclient/client_handler_win.cpp',
|
||||||
'tests/cefclient/clientplugin.cpp',
|
'tests/cefclient/clientplugin.cpp',
|
||||||
'tests/cefclient/clientplugin.h',
|
'tests/cefclient/clientplugin.h',
|
||||||
'tests/cefclient/osrplugin.cpp',
|
'tests/cefclient/osrplugin.cpp',
|
||||||
@ -162,6 +167,7 @@
|
|||||||
},
|
},
|
||||||
'sources': [
|
'sources': [
|
||||||
'tests/cefclient/cefclient_mac.mm',
|
'tests/cefclient/cefclient_mac.mm',
|
||||||
|
'tests/cefclient/client_handler_mac.mm',
|
||||||
'tests/cefclient/resource_util_mac.mm',
|
'tests/cefclient/resource_util_mac.mm',
|
||||||
],
|
],
|
||||||
}],
|
}],
|
||||||
@ -310,6 +316,7 @@
|
|||||||
],
|
],
|
||||||
'sources': [
|
'sources': [
|
||||||
'include/cef.h',
|
'include/cef.h',
|
||||||
|
'include/cef_build.h',
|
||||||
'include/cef_capi.h',
|
'include/cef_capi.h',
|
||||||
'include/cef_export.h',
|
'include/cef_export.h',
|
||||||
'include/cef_nplugin.h',
|
'include/cef_nplugin.h',
|
||||||
@ -357,19 +364,43 @@
|
|||||||
'libcef_dll/cpptoc/xml_reader_cpptoc.h',
|
'libcef_dll/cpptoc/xml_reader_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/zip_reader_cpptoc.cc',
|
'libcef_dll/cpptoc/zip_reader_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/zip_reader_cpptoc.h',
|
'libcef_dll/cpptoc/zip_reader_cpptoc.h',
|
||||||
|
'libcef_dll/ctocpp/client_ctocpp.cc',
|
||||||
|
'libcef_dll/ctocpp/client_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/cookie_visitor_ctocpp.cc',
|
'libcef_dll/ctocpp/cookie_visitor_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/cookie_visitor_ctocpp.h',
|
'libcef_dll/ctocpp/cookie_visitor_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/ctocpp.h',
|
'libcef_dll/ctocpp/ctocpp.h',
|
||||||
|
'libcef_dll/ctocpp/display_handler_ctocpp.cc',
|
||||||
|
'libcef_dll/ctocpp/display_handler_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/domevent_listener_ctocpp.cc',
|
'libcef_dll/ctocpp/domevent_listener_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/domevent_listener_ctocpp.h',
|
'libcef_dll/ctocpp/domevent_listener_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/domvisitor_ctocpp.cc',
|
'libcef_dll/ctocpp/domvisitor_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/domvisitor_ctocpp.h',
|
'libcef_dll/ctocpp/domvisitor_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/download_handler_ctocpp.cc',
|
'libcef_dll/ctocpp/download_handler_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/download_handler_ctocpp.h',
|
'libcef_dll/ctocpp/download_handler_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/handler_ctocpp.cc',
|
'libcef_dll/ctocpp/find_handler_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/handler_ctocpp.h',
|
'libcef_dll/ctocpp/find_handler_ctocpp.h',
|
||||||
|
'libcef_dll/ctocpp/focus_handler_ctocpp.cc',
|
||||||
|
'libcef_dll/ctocpp/focus_handler_ctocpp.h',
|
||||||
|
'libcef_dll/ctocpp/jsbinding_handler_ctocpp.cc',
|
||||||
|
'libcef_dll/ctocpp/jsbinding_handler_ctocpp.h',
|
||||||
|
'libcef_dll/ctocpp/jsdialog_handler_ctocpp.cc',
|
||||||
|
'libcef_dll/ctocpp/jsdialog_handler_ctocpp.h',
|
||||||
|
'libcef_dll/ctocpp/keyboard_handler_ctocpp.cc',
|
||||||
|
'libcef_dll/ctocpp/keyboard_handler_ctocpp.h',
|
||||||
|
'libcef_dll/ctocpp/life_span_handler_ctocpp.cc',
|
||||||
|
'libcef_dll/ctocpp/life_span_handler_ctocpp.h',
|
||||||
|
'libcef_dll/ctocpp/load_handler_ctocpp.cc',
|
||||||
|
'libcef_dll/ctocpp/load_handler_ctocpp.h',
|
||||||
|
'libcef_dll/ctocpp/menu_handler_ctocpp.cc',
|
||||||
|
'libcef_dll/ctocpp/menu_handler_ctocpp.h',
|
||||||
|
'libcef_dll/ctocpp/print_handler_ctocpp.cc',
|
||||||
|
'libcef_dll/ctocpp/print_handler_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/read_handler_ctocpp.cc',
|
'libcef_dll/ctocpp/read_handler_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/read_handler_ctocpp.h',
|
'libcef_dll/ctocpp/read_handler_ctocpp.h',
|
||||||
|
'libcef_dll/ctocpp/render_handler_ctocpp.cc',
|
||||||
|
'libcef_dll/ctocpp/render_handler_ctocpp.h',
|
||||||
|
'libcef_dll/ctocpp/request_handler_ctocpp.cc',
|
||||||
|
'libcef_dll/ctocpp/request_handler_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/scheme_handler_ctocpp.cc',
|
'libcef_dll/ctocpp/scheme_handler_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/scheme_handler_ctocpp.h',
|
'libcef_dll/ctocpp/scheme_handler_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.cc',
|
'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.cc',
|
||||||
@ -434,19 +465,43 @@
|
|||||||
'sources': [
|
'sources': [
|
||||||
'include/cef_wrapper.h',
|
'include/cef_wrapper.h',
|
||||||
'libcef_dll/cef_logging.h',
|
'libcef_dll/cef_logging.h',
|
||||||
|
'libcef_dll/cpptoc/client_cpptoc.cc',
|
||||||
|
'libcef_dll/cpptoc/client_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/cookie_visitor_cpptoc.cc',
|
'libcef_dll/cpptoc/cookie_visitor_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/cookie_visitor_cpptoc.h',
|
'libcef_dll/cpptoc/cookie_visitor_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/cpptoc.h',
|
'libcef_dll/cpptoc/cpptoc.h',
|
||||||
|
'libcef_dll/cpptoc/display_handler_cpptoc.cc',
|
||||||
|
'libcef_dll/cpptoc/display_handler_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/domevent_listener_cpptoc.cc',
|
'libcef_dll/cpptoc/domevent_listener_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/domevent_listener_cpptoc.h',
|
'libcef_dll/cpptoc/domevent_listener_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/domvisitor_cpptoc.cc',
|
'libcef_dll/cpptoc/domvisitor_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/domvisitor_cpptoc.h',
|
'libcef_dll/cpptoc/domvisitor_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/download_handler_cpptoc.cc',
|
'libcef_dll/cpptoc/download_handler_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/download_handler_cpptoc.h',
|
'libcef_dll/cpptoc/download_handler_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/handler_cpptoc.cc',
|
'libcef_dll/cpptoc/find_handler_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/handler_cpptoc.h',
|
'libcef_dll/cpptoc/find_handler_cpptoc.h',
|
||||||
|
'libcef_dll/cpptoc/focus_handler_cpptoc.cc',
|
||||||
|
'libcef_dll/cpptoc/focus_handler_cpptoc.h',
|
||||||
|
'libcef_dll/cpptoc/jsbinding_handler_cpptoc.cc',
|
||||||
|
'libcef_dll/cpptoc/jsbinding_handler_cpptoc.h',
|
||||||
|
'libcef_dll/cpptoc/jsdialog_handler_cpptoc.cc',
|
||||||
|
'libcef_dll/cpptoc/jsdialog_handler_cpptoc.h',
|
||||||
|
'libcef_dll/cpptoc/keyboard_handler_cpptoc.cc',
|
||||||
|
'libcef_dll/cpptoc/keyboard_handler_cpptoc.h',
|
||||||
|
'libcef_dll/cpptoc/life_span_handler_cpptoc.cc',
|
||||||
|
'libcef_dll/cpptoc/life_span_handler_cpptoc.h',
|
||||||
|
'libcef_dll/cpptoc/load_handler_cpptoc.cc',
|
||||||
|
'libcef_dll/cpptoc/load_handler_cpptoc.h',
|
||||||
|
'libcef_dll/cpptoc/menu_handler_cpptoc.cc',
|
||||||
|
'libcef_dll/cpptoc/menu_handler_cpptoc.h',
|
||||||
|
'libcef_dll/cpptoc/print_handler_cpptoc.cc',
|
||||||
|
'libcef_dll/cpptoc/print_handler_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/read_handler_cpptoc.cc',
|
'libcef_dll/cpptoc/read_handler_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/read_handler_cpptoc.h',
|
'libcef_dll/cpptoc/read_handler_cpptoc.h',
|
||||||
|
'libcef_dll/cpptoc/render_handler_cpptoc.cc',
|
||||||
|
'libcef_dll/cpptoc/render_handler_cpptoc.h',
|
||||||
|
'libcef_dll/cpptoc/request_handler_cpptoc.cc',
|
||||||
|
'libcef_dll/cpptoc/request_handler_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/scheme_handler_cpptoc.cc',
|
'libcef_dll/cpptoc/scheme_handler_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/scheme_handler_cpptoc.h',
|
'libcef_dll/cpptoc/scheme_handler_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.cc',
|
'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.cc',
|
||||||
@ -553,6 +608,7 @@
|
|||||||
],
|
],
|
||||||
'sources': [
|
'sources': [
|
||||||
'include/cef.h',
|
'include/cef.h',
|
||||||
|
'include/cef_build.h',
|
||||||
'include/cef_export.h',
|
'include/cef_export.h',
|
||||||
'include/cef_nplugin.h',
|
'include/cef_nplugin.h',
|
||||||
'include/cef_ptr.h',
|
'include/cef_ptr.h',
|
||||||
|
921
include/cef.h
921
include/cef.h
File diff suppressed because it is too large
Load Diff
112
include/cef_build.h
Normal file
112
include/cef_build.h
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||||
|
// Framework nor the names of its contributors may be used to endorse
|
||||||
|
// or promote products derived from this software without specific prior
|
||||||
|
// written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _CEF_BUILD_H
|
||||||
|
#define _CEF_BUILD_H
|
||||||
|
|
||||||
|
#if defined(BUILDING_CEF_SHARED)
|
||||||
|
|
||||||
|
#include "base/compiler_specific.h"
|
||||||
|
|
||||||
|
#else // !BUILDING_CEF_SHARED
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#define OS_WIN 1
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
#define OS_MACOSX 1
|
||||||
|
#elif defined(__linux__)
|
||||||
|
#define OS_LINUX 1
|
||||||
|
#else
|
||||||
|
#error Please add support for your platform in cef_build.h
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For access to standard POSIXish features, use OS_POSIX instead of a
|
||||||
|
// more specific macro.
|
||||||
|
#if defined(OS_MACOSX) || defined(OS_LINUX)
|
||||||
|
#define OS_POSIX 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Compiler detection.
|
||||||
|
#if defined(__GNUC__)
|
||||||
|
#define COMPILER_GCC 1
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
#define COMPILER_MSVC 1
|
||||||
|
#else
|
||||||
|
#error Please add support for your compiler in cef_build.h
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Annotate a virtual method indicating it must be overriding a virtual
|
||||||
|
// method in the parent class.
|
||||||
|
// Use like:
|
||||||
|
// virtual void foo() OVERRIDE;
|
||||||
|
#if defined(COMPILER_MSVC)
|
||||||
|
#define OVERRIDE override
|
||||||
|
#elif defined(__clang__)
|
||||||
|
#define OVERRIDE override
|
||||||
|
#else
|
||||||
|
#define OVERRIDE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(COMPILER_MSVC)
|
||||||
|
|
||||||
|
// MSVC_PUSH_DISABLE_WARNING pushes |n| onto a stack of warnings to be disabled.
|
||||||
|
// The warning remains disabled until popped by MSVC_POP_WARNING.
|
||||||
|
#define MSVC_PUSH_DISABLE_WARNING(n) __pragma(warning(push)) \
|
||||||
|
__pragma(warning(disable:n))
|
||||||
|
|
||||||
|
// MSVC_PUSH_WARNING_LEVEL pushes |n| as the global warning level. The level
|
||||||
|
// remains in effect until popped by MSVC_POP_WARNING(). Use 0 to disable all
|
||||||
|
// warnings.
|
||||||
|
#define MSVC_PUSH_WARNING_LEVEL(n) __pragma(warning(push, n))
|
||||||
|
|
||||||
|
// Pop effects of innermost MSVC_PUSH_* macro.
|
||||||
|
#define MSVC_POP_WARNING() __pragma(warning(pop))
|
||||||
|
|
||||||
|
// Allows |this| to be passed as an argument in constructor initializer lists.
|
||||||
|
// This uses push/pop instead of the seemingly simpler suppress feature to avoid
|
||||||
|
// having the warning be disabled for more than just |code|.
|
||||||
|
//
|
||||||
|
// Example usage:
|
||||||
|
// Foo::Foo() : x(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(y(this)), z(3) {}
|
||||||
|
//
|
||||||
|
// Compiler warning C4355: 'this': used in base member initializer list:
|
||||||
|
// http://msdn.microsoft.com/en-us/library/3c594ae3(VS.80).aspx
|
||||||
|
#define ALLOW_THIS_IN_INITIALIZER_LIST(code) MSVC_PUSH_DISABLE_WARNING(4355) \
|
||||||
|
code \
|
||||||
|
MSVC_POP_WARNING()
|
||||||
|
#else // !COMPILER_MSVC
|
||||||
|
|
||||||
|
#define ALLOW_THIS_IN_INITIALIZER_LIST(code) code
|
||||||
|
|
||||||
|
#endif // !COMPILER_MSVC
|
||||||
|
|
||||||
|
#endif // !BUILDING_CEF_SHARED
|
||||||
|
|
||||||
|
#endif // _CEF_BUILD_H
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 Marshall A. Greenblatt. All rights reserved.
|
// Copyright (c) 2011 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
|
||||||
@ -51,8 +51,7 @@ extern "C" {
|
|||||||
// This function should be called on the main application thread to initialize
|
// This function should be called on the main application thread to initialize
|
||||||
// CEF when the application is started. A return value of true (1) indicates
|
// CEF when the application is started. A return value of true (1) indicates
|
||||||
// that it succeeded and false (0) indicates that it failed.
|
// that it succeeded and false (0) indicates that it failed.
|
||||||
CEF_EXPORT int cef_initialize(const struct _cef_settings_t* settings,
|
CEF_EXPORT int cef_initialize(const struct _cef_settings_t* settings);
|
||||||
const struct _cef_browser_settings_t* browser_defaults);
|
|
||||||
|
|
||||||
// This function should be called on the main application thread to shut down
|
// This function should be called on the main application thread to shut down
|
||||||
// CEF before the application exits.
|
// CEF before the application exits.
|
||||||
@ -326,9 +325,8 @@ typedef struct _cef_browser_t
|
|||||||
// Returns true (1) if the window is a popup window.
|
// Returns true (1) if the window is a popup window.
|
||||||
int (CEF_CALLBACK *is_popup)(struct _cef_browser_t* self);
|
int (CEF_CALLBACK *is_popup)(struct _cef_browser_t* self);
|
||||||
|
|
||||||
// Returns the handler for this browser.
|
// Returns the client for this browser.
|
||||||
struct _cef_handler_t* (CEF_CALLBACK *get_handler)(
|
struct _cef_client_t* (CEF_CALLBACK *get_client)(struct _cef_browser_t* self);
|
||||||
struct _cef_browser_t* self);
|
|
||||||
|
|
||||||
// Returns the main (top-level) frame for the browser window.
|
// Returns the main (top-level) frame for the browser window.
|
||||||
struct _cef_frame_t* (CEF_CALLBACK *get_main_frame)(
|
struct _cef_frame_t* (CEF_CALLBACK *get_main_frame)(
|
||||||
@ -398,7 +396,7 @@ typedef struct _cef_browser_t
|
|||||||
|
|
||||||
// Invalidate the |dirtyRect| region of the view. This function is only used
|
// Invalidate the |dirtyRect| region of the view. This function is only used
|
||||||
// when window rendering is disabled and will result in a call to
|
// when window rendering is disabled and will result in a call to
|
||||||
// handle_paint().
|
// HandlePaint().
|
||||||
void (CEF_CALLBACK *invalidate)(struct _cef_browser_t* self,
|
void (CEF_CALLBACK *invalidate)(struct _cef_browser_t* self,
|
||||||
const cef_rect_t* dirtyRect);
|
const cef_rect_t* dirtyRect);
|
||||||
|
|
||||||
@ -444,16 +442,16 @@ typedef struct _cef_browser_t
|
|||||||
|
|
||||||
// Create a new browser window using the window parameters specified by
|
// Create a new browser window using the window parameters specified by
|
||||||
// |windowInfo|. All values will be copied internally and the actual window will
|
// |windowInfo|. All values will be copied internally and the actual window will
|
||||||
// be created on the UI thread. The |popup| parameter should be true (1) if the
|
// be created on the UI thread. This function call will not block.
|
||||||
// new window is a popup window. This function call will not block.
|
CEF_EXPORT int cef_browser_create(cef_window_info_t* windowInfo,
|
||||||
CEF_EXPORT int cef_browser_create(cef_window_info_t* windowInfo, int popup,
|
struct _cef_client_t* client, const cef_string_t* url,
|
||||||
struct _cef_handler_t* handler, const cef_string_t* url);
|
const struct _cef_browser_settings_t* settings);
|
||||||
|
|
||||||
// Create a new browser window using the window parameters specified by
|
// 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
|
// |windowInfo|. This function should only be called on the UI thread.
|
||||||
// popup window. This function should only be called on the UI thread.
|
|
||||||
CEF_EXPORT cef_browser_t* cef_browser_create_sync(cef_window_info_t* windowInfo,
|
CEF_EXPORT cef_browser_t* cef_browser_create_sync(cef_window_info_t* windowInfo,
|
||||||
int popup, struct _cef_handler_t* handler, const cef_string_t* url);
|
struct _cef_client_t* client, const cef_string_t* url,
|
||||||
|
const struct _cef_browser_settings_t* settings);
|
||||||
|
|
||||||
|
|
||||||
// Structure used to represent a frame in the browser window. The functions of
|
// Structure used to represent a frame in the browser window. The functions of
|
||||||
@ -554,120 +552,121 @@ typedef struct _cef_frame_t
|
|||||||
} cef_frame_t;
|
} cef_frame_t;
|
||||||
|
|
||||||
|
|
||||||
// Structure that should be implemented to handle events generated by the
|
// Implement this structure to handle events related to browser life span. The
|
||||||
// browser window. The functions of this structure will be called on the thread
|
// functions of this structure will be called on the UI thread.
|
||||||
// indicated in the function comments.
|
typedef struct _cef_life_span_handler_t
|
||||||
typedef struct _cef_handler_t
|
|
||||||
{
|
{
|
||||||
// Base structure.
|
// Base structure.
|
||||||
cef_base_t base;
|
cef_base_t base;
|
||||||
|
|
||||||
// Called on the UI thread before a new window is created. The |parentBrowser|
|
// Called before a new popup window is created. The |parentBrowser| parameter
|
||||||
// parameter will point to the parent browser window, if any. The |popup|
|
// will point to the parent browser window. The |popupFeatures| parameter will
|
||||||
// parameter will be true (1) if the new window is a popup window, in which
|
// contain information about the style of popup window requested. Return false
|
||||||
// case |popupFeatures| will contain information about the style of popup
|
// (0) to have the framework create the new popup window based on the
|
||||||
// window requested. If you create the window yourself you should populate the
|
// parameters in |windowInfo|. Return true (1) to cancel creation of the popup
|
||||||
// window handle member of |createInfo| and return RV_HANDLED. Otherwise,
|
// window. By default, a newly created popup window will have the same client
|
||||||
// return RV_CONTINUE and the framework will create the window. By default, a
|
// and settings as the parent window. To change the client for the new window
|
||||||
// newly created window will recieve the same handler as the parent window.
|
// modify the object that |client| points to. To change the settings for the
|
||||||
// To change the handler for the new window modify the object that |handler|
|
// new window modify the |settings| structure.
|
||||||
// points to.
|
int (CEF_CALLBACK *on_before_popup)(struct _cef_life_span_handler_t* self,
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_before_created)(
|
struct _cef_browser_t* parentBrowser,
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* parentBrowser,
|
|
||||||
struct _cef_window_info_t* windowInfo, int popup,
|
|
||||||
const struct _cef_popup_features_t* popupFeatures,
|
const struct _cef_popup_features_t* popupFeatures,
|
||||||
struct _cef_handler_t** handler, const cef_string_t* url,
|
struct _cef_window_info_t* windowInfo, const cef_string_t* url,
|
||||||
|
struct _cef_client_t** client,
|
||||||
struct _cef_browser_settings_t* settings);
|
struct _cef_browser_settings_t* settings);
|
||||||
|
|
||||||
// Called on the UI thread after a new window is created. The return value is
|
// Called after a new window is created.
|
||||||
// currently ignored.
|
void (CEF_CALLBACK *on_after_created)(struct _cef_life_span_handler_t* self,
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_after_created)(
|
struct _cef_browser_t* browser);
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser);
|
|
||||||
|
|
||||||
// Called on the UI thread when a frame's address has changed. The return
|
// Called just before a window is closed.
|
||||||
// value is currently ignored.
|
void (CEF_CALLBACK *on_before_close)(struct _cef_life_span_handler_t* self,
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_address_change)(
|
struct _cef_browser_t* browser);
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
|
||||||
struct _cef_frame_t* frame, const cef_string_t* url);
|
|
||||||
|
|
||||||
// Called on the UI thread when the page title changes. The return value is
|
} cef_life_span_handler_t;
|
||||||
// currently ignored.
|
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_title_change)(
|
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
|
||||||
const cef_string_t* title);
|
|
||||||
|
|
||||||
// Called on the UI thread when the navigation state has changed. The return
|
|
||||||
// value is currently ignored.
|
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_nav_state_change)(
|
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
|
||||||
int canGoBack, int canGoForward);
|
|
||||||
|
|
||||||
// Called on the UI thread before browser navigation. The client has an
|
// Implement this structure to handle events related to browser load status. The
|
||||||
// opportunity to modify the |request| object if desired. Return RV_HANDLED
|
// functions of this structure will be called on the UI thread.
|
||||||
// to cancel navigation.
|
typedef struct _cef_load_handler_t
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_before_browse)(
|
{
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
// Base structure.
|
||||||
struct _cef_frame_t* frame, struct _cef_request_t* request,
|
cef_base_t base;
|
||||||
enum cef_handler_navtype_t navType, int isRedirect);
|
|
||||||
|
|
||||||
// Called on the UI thread when the browser begins loading a frame. The
|
// Called when the browser begins loading a frame. The |frame| value will
|
||||||
// |frame| value will never be NULL -- call the is_main() function to check if
|
// never be NULL -- call the is_main() function to check if this frame is the
|
||||||
// this frame is the main frame. Multiple frames may be loading at the same
|
// main frame. Multiple frames may be loading at the same time. Sub-frames may
|
||||||
// time. Sub-frames may start or continue loading after the main frame load
|
// start or continue loading after the main frame load has ended. This
|
||||||
// has ended. This function may not be called for a particular frame if the
|
// function may not be called for a particular frame if the load request for
|
||||||
// load request for that frame fails. The return value is currently ignored.
|
// that frame fails.
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_load_start)(
|
void (CEF_CALLBACK *on_load_start)(struct _cef_load_handler_t* self,
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
struct _cef_browser_t* browser, struct _cef_frame_t* frame);
|
||||||
struct _cef_frame_t* frame);
|
|
||||||
|
|
||||||
// Called on the UI thread when the browser is done loading a frame. The
|
// Called when the browser is done loading a frame. The |frame| value will
|
||||||
// |frame| value will never be NULL -- call the is_main() function to check if
|
// never be NULL -- call the is_main() function to check if this frame is the
|
||||||
// this frame is the main frame. Multiple frames may be loading at the same
|
// main frame. Multiple frames may be loading at the same time. Sub-frames may
|
||||||
// time. Sub-frames may start or continue loading after the main frame load
|
// start or continue loading after the main frame load has ended. This
|
||||||
// has ended. This function will always be called for all frames irrespective
|
// function will always be called for all frames irrespective of whether the
|
||||||
// of whether the request completes successfully. The return value is
|
// request completes successfully.
|
||||||
// currently ignored.
|
void (CEF_CALLBACK *on_load_end)(struct _cef_load_handler_t* self,
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_load_end)(struct _cef_handler_t* self,
|
|
||||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||||
int httpStatusCode);
|
int httpStatusCode);
|
||||||
|
|
||||||
// Called on the UI thread when the browser fails to load a resource.
|
// Called when the browser fails to load a resource. |errorCode| is the error
|
||||||
// |errorCode| is the error code number and |failedUrl| is the URL that failed
|
// code number and |failedUrl| is the URL that failed to load. To provide
|
||||||
// to load. To provide custom error text assign the text to |errorText| and
|
// custom error text assign the text to |errorText| and return true (1).
|
||||||
// return RV_HANDLED. Otherwise, return RV_CONTINUE for the default error
|
// Otherwise, return false (0) for the default error text. See
|
||||||
// text.
|
// net\base\net_error_list.h for complete descriptions of the error codes.
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_load_error)(
|
int (CEF_CALLBACK *on_load_error)(struct _cef_load_handler_t* self,
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||||
struct _cef_frame_t* frame, enum cef_handler_errorcode_t errorCode,
|
enum cef_handler_errorcode_t errorCode, const cef_string_t* failedUrl,
|
||||||
const cef_string_t* failedUrl, cef_string_t* errorText);
|
cef_string_t* errorText);
|
||||||
|
|
||||||
|
} cef_load_handler_t;
|
||||||
|
|
||||||
|
|
||||||
|
// Implement this structure to handle events related to browser requests. The
|
||||||
|
// functions of this structure will be called on the thread indicated.
|
||||||
|
typedef struct _cef_request_handler_t
|
||||||
|
{
|
||||||
|
// Base structure.
|
||||||
|
cef_base_t base;
|
||||||
|
|
||||||
|
// Called on the UI thread before browser navigation. The client has an
|
||||||
|
// opportunity to modify the |request| object if desired. Return true (1) to
|
||||||
|
// cancel the navigation or false (0) to allow the navigation to proceed.
|
||||||
|
int (CEF_CALLBACK *on_before_browse)(struct _cef_request_handler_t* self,
|
||||||
|
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||||
|
struct _cef_request_t* request, enum cef_handler_navtype_t navType,
|
||||||
|
int isRedirect);
|
||||||
|
|
||||||
// Called on the IO thread before a resource is loaded. To allow the resource
|
// Called on the IO thread before a resource is loaded. To allow the resource
|
||||||
// to load normally return RV_CONTINUE. To redirect the resource to a new url
|
// to load normally return false (0). To redirect the resource to a new url
|
||||||
// populate the |redirectUrl| value and return RV_CONTINUE. To specify data
|
// populate the |redirectUrl| value and return false (0). To specify data for
|
||||||
// for the resource return a CefStream object in |resourceStream|, use the
|
// the resource return a CefStream object in |resourceStream|, use the
|
||||||
// |response| object to set mime type, HTTP status code and optional header
|
// |response| object to set mime type, HTTP status code and optional header
|
||||||
// values, and return RV_CONTINUE. To cancel loading of the resource return
|
// values, and return false (0). To cancel loading of the resource return true
|
||||||
// RV_HANDLED. Any modifications to |request| will be observed. If the URL in
|
// (1). Any modifications to |request| will be observed. If the URL in
|
||||||
// |request| is changed and |redirectUrl| is also set, the URL in |request|
|
// |request| is changed and |redirectUrl| is also set, the URL in |request|
|
||||||
// will be used.
|
// will be used.
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_before_resource_load)(
|
int (CEF_CALLBACK *on_before_resource_load)(
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
struct _cef_request_handler_t* self, struct _cef_browser_t* browser,
|
||||||
struct _cef_request_t* request, cef_string_t* redirectUrl,
|
struct _cef_request_t* request, cef_string_t* redirectUrl,
|
||||||
struct _cef_stream_reader_t** resourceStream,
|
struct _cef_stream_reader_t** resourceStream,
|
||||||
struct _cef_response_t* response, int loadFlags);
|
struct _cef_response_t* response, int loadFlags);
|
||||||
|
|
||||||
// Called on the IO thread to handle requests for URLs with an unknown
|
// Called on the IO thread to handle requests for URLs with an unknown
|
||||||
// protocol component. Return RV_HANDLED to indicate that the request should
|
// protocol component. Return true (1) to indicate that the request should
|
||||||
// succeed because it was externally handled. Set |allow_os_execution| to true
|
// succeed because it was handled externally. Set |allowOSExecution| to true
|
||||||
// (1) and return RV_CONTINUE to attempt execution via the registered OS
|
// (1) and return false (0) to attempt execution via the registered OS
|
||||||
// protocol handler, if any. If RV_CONTINUE is returned and either
|
// protocol handler, if any. If false (0) is returned and either
|
||||||
// |allow_os_execution| is false (0) or OS protocol handler execution fails
|
// |allow_os_execution| is false (0) or OS protocol handler execution fails
|
||||||
// then the request will fail with an error condition. SECURITY WARNING: YOU
|
// then the request will fail with an error condition. SECURITY WARNING: YOU
|
||||||
// SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED ON SCHEME, HOST OR
|
// SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED ON SCHEME, HOST OR
|
||||||
// OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION.
|
// OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION.
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_protocol_execution)(
|
int (CEF_CALLBACK *on_protocol_execution)(struct _cef_request_handler_t* self,
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
struct _cef_browser_t* browser, const cef_string_t* url,
|
||||||
const cef_string_t* url, int* allow_os_execution);
|
int* allowOSExecution);
|
||||||
|
|
||||||
// Called on the UI thread when a server indicates via the 'Content-
|
// Called on the UI thread when a server indicates via the 'Content-
|
||||||
// Disposition' header that a response represents a file to download.
|
// Disposition' header that a response represents a file to download.
|
||||||
@ -675,209 +674,351 @@ typedef struct _cef_handler_t
|
|||||||
// target file name and |contentLength| is either the value of the 'Content-
|
// target file name and |contentLength| is either the value of the 'Content-
|
||||||
// Size' header or -1 if no size was provided. Set |handler| to the
|
// Size' header or -1 if no size was provided. Set |handler| to the
|
||||||
// cef_download_handler_t instance that will recieve the file contents. Return
|
// cef_download_handler_t instance that will recieve the file contents. Return
|
||||||
// RV_CONTINUE to download the file or RV_HANDLED to cancel the file download.
|
// true (1) to download the file or false (0) to cancel the file download.
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_download_response)(
|
int (CEF_CALLBACK *get_download_handler)(struct _cef_request_handler_t* self,
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
struct _cef_browser_t* browser, const cef_string_t* mimeType,
|
||||||
const cef_string_t* mimeType, const cef_string_t* fileName,
|
const cef_string_t* fileName, int64 contentLength,
|
||||||
int64 contentLength, struct _cef_download_handler_t** handler);
|
struct _cef_download_handler_t** handler);
|
||||||
|
|
||||||
// Called on the IO thread when the browser needs credentials from the user.
|
// Called on the IO thread when the browser needs credentials from the user.
|
||||||
// |isProxy| indicates whether the host is a proxy server. |host| contains the
|
// |isProxy| indicates whether the host is a proxy server. |host| contains the
|
||||||
// hostname and port number. Set |username| and |password| and return
|
// hostname and port number. Set |username| and |password| and return true (1)
|
||||||
// RV_HANDLED to handle the request. Return RV_CONTINUE to cancel the request.
|
// to handle the request. Return false (0) to cancel the request.
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_authentication_request)(
|
int (CEF_CALLBACK *get_auth_credentials)(struct _cef_request_handler_t* self,
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser, int isProxy,
|
struct _cef_browser_t* browser, int isProxy, const cef_string_t* host,
|
||||||
const cef_string_t* host, const cef_string_t* realm,
|
const cef_string_t* realm, const cef_string_t* scheme,
|
||||||
const cef_string_t* scheme, cef_string_t* username,
|
cef_string_t* username, cef_string_t* password);
|
||||||
cef_string_t* password);
|
|
||||||
|
|
||||||
// Called on the UI thread before a context menu is displayed. To cancel
|
} cef_request_handler_t;
|
||||||
// display of the default context menu return RV_HANDLED.
|
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_before_menu)(
|
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
// Implement this structure to handle events related to browser display state.
|
||||||
|
// The functions of this structure will be called on the UI thread.
|
||||||
|
typedef struct _cef_display_handler_t
|
||||||
|
{
|
||||||
|
// Base structure.
|
||||||
|
cef_base_t base;
|
||||||
|
|
||||||
|
// Called when the navigation state has changed.
|
||||||
|
void (CEF_CALLBACK *on_nav_state_change)(struct _cef_display_handler_t* self,
|
||||||
|
struct _cef_browser_t* browser, int canGoBack, int canGoForward);
|
||||||
|
|
||||||
|
// Called when a frame's address has changed.
|
||||||
|
void (CEF_CALLBACK *on_address_change)(struct _cef_display_handler_t* self,
|
||||||
|
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||||
|
const cef_string_t* url);
|
||||||
|
|
||||||
|
// Called when the page title changes.
|
||||||
|
void (CEF_CALLBACK *on_title_change)(struct _cef_display_handler_t* self,
|
||||||
|
struct _cef_browser_t* browser, const cef_string_t* title);
|
||||||
|
|
||||||
|
// Called when the browser is about to display a tooltip. |text| contains the
|
||||||
|
// text that will be displayed in the tooltip. To handle the display of the
|
||||||
|
// tooltip yourself return true (1). Otherwise, you can optionally modify
|
||||||
|
// |text| and then return false (0) to allow the browser to display the
|
||||||
|
// tooltip.
|
||||||
|
int (CEF_CALLBACK *on_tooltip)(struct _cef_display_handler_t* self,
|
||||||
|
struct _cef_browser_t* browser, cef_string_t* text);
|
||||||
|
|
||||||
|
// Called when the browser receives a status message. |text| contains the text
|
||||||
|
// that will be displayed in the status message and |type| indicates the
|
||||||
|
// status message type.
|
||||||
|
void (CEF_CALLBACK *on_status_message)(struct _cef_display_handler_t* self,
|
||||||
|
struct _cef_browser_t* browser, const cef_string_t* value,
|
||||||
|
enum cef_handler_statustype_t type);
|
||||||
|
|
||||||
|
// Called to display a console message. Return true (1) to stop the message
|
||||||
|
// from being output to the console.
|
||||||
|
int (CEF_CALLBACK *on_console_message)(struct _cef_display_handler_t* self,
|
||||||
|
struct _cef_browser_t* browser, const cef_string_t* message,
|
||||||
|
const cef_string_t* source, int line);
|
||||||
|
|
||||||
|
} cef_display_handler_t;
|
||||||
|
|
||||||
|
|
||||||
|
// Implement this structure to handle events related to focus. The functions of
|
||||||
|
// this structure will be called on the UI thread.
|
||||||
|
typedef struct _cef_focus_handler_t
|
||||||
|
{
|
||||||
|
// Base structure.
|
||||||
|
cef_base_t base;
|
||||||
|
|
||||||
|
// Called when the browser component is about to loose focus. For instance, if
|
||||||
|
// focus was on the last HTML element and the user pressed the TAB key. |next|
|
||||||
|
// will be true (1) if the browser is giving focus to the next component and
|
||||||
|
// false (0) if the browser is giving focus to the previous component.
|
||||||
|
void (CEF_CALLBACK *on_take_focus)(struct _cef_focus_handler_t* self,
|
||||||
|
struct _cef_browser_t* browser, int next);
|
||||||
|
|
||||||
|
// Called when the browser component is requesting focus. |isWidget| will be
|
||||||
|
// true (1) if the focus is requested for a child widget of the browser
|
||||||
|
// window. Return false (0) to allow the focus to be set or true (1) to cancel
|
||||||
|
// setting the focus.
|
||||||
|
int (CEF_CALLBACK *on_set_focus)(struct _cef_focus_handler_t* self,
|
||||||
|
struct _cef_browser_t* browser, int isWidget);
|
||||||
|
|
||||||
|
} cef_focus_handler_t;
|
||||||
|
|
||||||
|
|
||||||
|
// Implement this structure to handle events related to keyboard input. The
|
||||||
|
// functions of this structure will be called on the UI thread.
|
||||||
|
typedef struct _cef_keyboard_handler_t
|
||||||
|
{
|
||||||
|
// Base structure.
|
||||||
|
cef_base_t base;
|
||||||
|
|
||||||
|
// Called when the browser component receives a keyboard event. |type| is the
|
||||||
|
// type of keyboard event, |code| is the windows scan-code for the event,
|
||||||
|
// |modifiers| is a set of bit-flags describing any pressed modifier keys and
|
||||||
|
// |isSystemKey| is true (1) if Windows considers this a 'system key' message
|
||||||
|
// (see http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx). Return
|
||||||
|
// true (1) if the keyboard event was handled or false (0) to allow the
|
||||||
|
// browser component to handle the event.
|
||||||
|
int (CEF_CALLBACK *on_key_event)(struct _cef_keyboard_handler_t* self,
|
||||||
|
struct _cef_browser_t* browser, enum cef_handler_keyevent_type_t type,
|
||||||
|
int code, int modifiers, int isSystemKey);
|
||||||
|
|
||||||
|
} cef_keyboard_handler_t;
|
||||||
|
|
||||||
|
|
||||||
|
// Implement this structure to handle events related to browser context menus.
|
||||||
|
// The functions of this structure will be called on the UI thread.
|
||||||
|
typedef struct _cef_menu_handler_t
|
||||||
|
{
|
||||||
|
// Base structure.
|
||||||
|
cef_base_t base;
|
||||||
|
|
||||||
|
// Called before a context menu is displayed. Return false (0) to display the
|
||||||
|
// default context menu or true (1) to cancel the display.
|
||||||
|
int (CEF_CALLBACK *on_before_menu)(struct _cef_menu_handler_t* self,
|
||||||
|
struct _cef_browser_t* browser,
|
||||||
const struct _cef_handler_menuinfo_t* menuInfo);
|
const struct _cef_handler_menuinfo_t* menuInfo);
|
||||||
|
|
||||||
// Called on the UI thread to optionally override the default text for a
|
// Called to optionally override the default text for a context menu item.
|
||||||
// context menu item. |label| contains the default text and may be modified to
|
// |label| contains the default text and may be modified to substitute
|
||||||
// substitute alternate text. The return value is currently ignored.
|
// alternate text.
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_get_menu_label)(
|
void (CEF_CALLBACK *get_menu_label)(struct _cef_menu_handler_t* self,
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
struct _cef_browser_t* browser, enum cef_handler_menuid_t menuId,
|
||||||
enum cef_handler_menuid_t menuId, cef_string_t* label);
|
cef_string_t* label);
|
||||||
|
|
||||||
// Called on the UI thread when an option is selected from the default context
|
// Called when an option is selected from the default context menu. Return
|
||||||
// menu. Return RV_HANDLED to cancel default handling of the action.
|
// false (0) to execute the default action or true (1) to cancel the action.
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_menu_action)(
|
int (CEF_CALLBACK *on_menu_action)(struct _cef_menu_handler_t* self,
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
struct _cef_browser_t* browser, enum cef_handler_menuid_t menuId);
|
||||||
enum cef_handler_menuid_t menuId);
|
|
||||||
|
|
||||||
// Called on the UI thread to allow customization of standard print options
|
} cef_menu_handler_t;
|
||||||
// before the print dialog is displayed. |printOptions| allows specification
|
|
||||||
// of paper size, orientation and margins. Note that the specified margins may
|
|
||||||
// be adjusted if they are outside the range supported by the printer. All
|
// Implement this structure to handle events related to printing. The functions
|
||||||
// units are in inches. Return RV_CONTINUE to display the default print
|
// of this structure will be called on the UI thread.
|
||||||
// options or RV_HANDLED to display the modified |printOptions|.
|
typedef struct _cef_print_handler_t
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_print_options)(
|
{
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
// Base structure.
|
||||||
|
cef_base_t base;
|
||||||
|
|
||||||
|
// Called to allow customization of standard print options before the print
|
||||||
|
// dialog is displayed. |printOptions| allows specification of paper size,
|
||||||
|
// orientation and margins. Note that the specified margins may be adjusted if
|
||||||
|
// they are outside the range supported by the printer. All units are in
|
||||||
|
// inches. Return false (0) to display the default print options or true (1)
|
||||||
|
// to display the modified |printOptions|.
|
||||||
|
int (CEF_CALLBACK *get_print_options)(struct _cef_print_handler_t* self,
|
||||||
|
struct _cef_browser_t* browser,
|
||||||
struct _cef_print_options_t* printOptions);
|
struct _cef_print_options_t* printOptions);
|
||||||
|
|
||||||
// Called on the UI thread to format print headers and footers. |printInfo|
|
// Called to format print headers and footers. |printInfo| contains platform-
|
||||||
// contains platform-specific information about the printer context. |url| is
|
// specific information about the printer context. |url| is the URL if the
|
||||||
// the URL if the currently printing page, |title| is the title of the
|
// currently printing page, |title| is the title of the currently printing
|
||||||
// currently printing page, |currentPage| is the current page number and
|
// page, |currentPage| is the current page number and |maxPages| is the total
|
||||||
// |maxPages| is the total number of pages. Six default header locations are
|
// number of pages. Six default header locations are provided by the
|
||||||
// provided by the implementation: top left, top center, top right, bottom
|
// implementation: top left, top center, top right, bottom left, bottom center
|
||||||
// left, bottom center and bottom right. To use one of these default locations
|
// and bottom right. To use one of these default locations just assign a
|
||||||
// just assign a string to the appropriate variable. To draw the header and
|
// string to the appropriate variable. To draw the header and footer yourself
|
||||||
// footer yourself return RV_HANDLED. Otherwise, populate the approprate
|
// return true (1). Otherwise, populate the approprate variables and return
|
||||||
// variables and return RV_CONTINUE.
|
// false (0).
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_print_header_footer)(
|
int (CEF_CALLBACK *get_print_header_footer)(struct _cef_print_handler_t* self,
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||||
struct _cef_frame_t* frame, struct _cef_print_info_t* printInfo,
|
const struct _cef_print_info_t* printInfo, const cef_string_t* url,
|
||||||
const cef_string_t* url, const cef_string_t* title, int currentPage,
|
const cef_string_t* title, int currentPage, int maxPages,
|
||||||
int maxPages, cef_string_t* topLeft, cef_string_t* topCenter,
|
cef_string_t* topLeft, cef_string_t* topCenter, cef_string_t* topRight,
|
||||||
cef_string_t* topRight, cef_string_t* bottomLeft,
|
cef_string_t* bottomLeft, cef_string_t* bottomCenter,
|
||||||
cef_string_t* bottomCenter, cef_string_t* bottomRight);
|
cef_string_t* bottomRight);
|
||||||
|
|
||||||
// Called on the UI thread to run a JS alert message. Return RV_CONTINUE to
|
} cef_print_handler_t;
|
||||||
// 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,
|
|
||||||
|
// Implement this structure to handle events related to find results. The
|
||||||
|
// functions of this structure will be called on the UI thread.
|
||||||
|
typedef struct _cef_find_handler_t
|
||||||
|
{
|
||||||
|
// Base structure.
|
||||||
|
cef_base_t base;
|
||||||
|
|
||||||
|
// Called to report find results returned by cef_browser_t::find().
|
||||||
|
// |identifer| is the identifier passed to cef_browser_t::find(), |count| is
|
||||||
|
// the number of matches currently identified, |selectionRect| is the location
|
||||||
|
// of where the match was found (in window coordinates), |activeMatchOrdinal|
|
||||||
|
// is the current position in the search results, and |finalUpdate| is true
|
||||||
|
// (1) if this is the last find notification.
|
||||||
|
void (CEF_CALLBACK *on_find_result)(struct _cef_find_handler_t* self,
|
||||||
|
struct _cef_browser_t* browser, int identifier, int count,
|
||||||
|
const cef_rect_t* selectionRect, int activeMatchOrdinal,
|
||||||
|
int finalUpdate);
|
||||||
|
|
||||||
|
} cef_find_handler_t;
|
||||||
|
|
||||||
|
|
||||||
|
// Implement this structure to handle events related to JavaScript dialogs. The
|
||||||
|
// functions of this structure will be called on the UI thread.
|
||||||
|
typedef struct _cef_jsdialog_handler_t
|
||||||
|
{
|
||||||
|
// Base structure.
|
||||||
|
cef_base_t base;
|
||||||
|
|
||||||
|
// Called to run a JavaScript alert message. Return false (0) to display the
|
||||||
|
// default alert or true (1) if you displayed a custom alert.
|
||||||
|
int (CEF_CALLBACK *on_jsalert)(struct _cef_jsdialog_handler_t* self,
|
||||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||||
const cef_string_t* message);
|
const cef_string_t* message);
|
||||||
|
|
||||||
// Called on the UI thread to run a JS confirm request. Return RV_CONTINUE to
|
// Called to run a JavaScript confirm request. Return false (0) to display the
|
||||||
// display the default alert or RV_HANDLED if you displayed a custom alert. If
|
// default alert or true (1) if you displayed a custom alert. If you handled
|
||||||
// you handled the alert set |retval| to true (1) if the user accepted the
|
// the alert set |retval| to true (1) if the user accepted the confirmation.
|
||||||
// confirmation.
|
int (CEF_CALLBACK *on_jsconfirm)(struct _cef_jsdialog_handler_t* self,
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_jsconfirm)(
|
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
const cef_string_t* message, int* retval);
|
||||||
struct _cef_frame_t* frame, const cef_string_t* message, int* retval);
|
|
||||||
|
|
||||||
// Called on the UI thread to run a JS prompt request. Return RV_CONTINUE to
|
// Called to run a JavaScript prompt request. Return false (0) to display the
|
||||||
// display the default prompt or RV_HANDLED if you displayed a custom prompt.
|
// default prompt or true (1) if you displayed a custom prompt. If you handled
|
||||||
// If you handled the prompt set |retval| to true (1) if the user accepted the
|
// the prompt set |retval| to true (1) if the user accepted the prompt and
|
||||||
// prompt and request and |result| to the resulting value.
|
// request and |result| to the resulting value.
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_jsprompt)(struct _cef_handler_t* self,
|
int (CEF_CALLBACK *on_jsprompt)(struct _cef_jsdialog_handler_t* self,
|
||||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||||
const cef_string_t* message, const cef_string_t* defaultValue,
|
const cef_string_t* message, const cef_string_t* defaultValue,
|
||||||
int* retval, cef_string_t* result);
|
int* retval, cef_string_t* result);
|
||||||
|
|
||||||
// Called on the UI thread for adding values to a frame's JavaScript 'window'
|
} cef_jsdialog_handler_t;
|
||||||
// object. The return value is currently ignored.
|
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_jsbinding)(
|
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
|
||||||
struct _cef_frame_t* frame, struct _cef_v8value_t* object);
|
|
||||||
|
|
||||||
// Called on the UI thread just before a window is closed. The return value is
|
|
||||||
// currently ignored.
|
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_before_window_close)(
|
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser);
|
|
||||||
|
|
||||||
// Called on the UI thread when the browser component is about to loose focus.
|
// Implement this structure to handle JavaScript binding. The functions of this
|
||||||
// For instance, if focus was on the last HTML element and the user pressed
|
// structure will be called on the UI thread.
|
||||||
// the TAB key. The return value is currently ignored.
|
typedef struct _cef_jsbinding_handler_t
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_take_focus)(
|
{
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
// Base structure.
|
||||||
int reverse);
|
cef_base_t base;
|
||||||
|
|
||||||
// Called on the UI thread when the browser component is requesting focus.
|
// Called for adding values to a frame's JavaScript 'window' object.
|
||||||
// |isWidget| will be true (1) if the focus is requested for a child widget of
|
void (CEF_CALLBACK *on_jsbinding)(struct _cef_jsbinding_handler_t* self,
|
||||||
// the browser window. Return RV_CONTINUE to allow the focus to be set or
|
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||||
// RV_HANDLED to cancel setting the focus.
|
struct _cef_v8value_t* object);
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_set_focus)(
|
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
|
||||||
int isWidget);
|
|
||||||
|
|
||||||
// Called on the UI thread when the browser component receives a keyboard
|
} cef_jsbinding_handler_t;
|
||||||
// event. |type| is the type of keyboard event, |code| is the windows scan-
|
|
||||||
// code for the event, |modifiers| is a set of bit-flags describing any
|
|
||||||
// pressed modifier keys and |isSystemKey| is true (1) if Windows considers
|
|
||||||
// this a 'system key' message (see http://msdn.microsoft.com/en-
|
|
||||||
// us/library/ms646286(VS.85).aspx). Return RV_HANDLED if the keyboard event
|
|
||||||
// was handled or RV_CONTINUE to allow the browser component to handle the
|
|
||||||
// event.
|
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_key_event)(
|
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
|
||||||
enum cef_handler_keyevent_type_t type, int code, int modifiers,
|
|
||||||
int isSystemKey);
|
|
||||||
|
|
||||||
// Called on the UI thread when the browser is about to display a tooltip.
|
|
||||||
// |text| contains the text that will be displayed in the tooltip. To handle
|
|
||||||
// the display of the tooltip yourself return RV_HANDLED. Otherwise, you can
|
|
||||||
// optionally modify |text| and then return RV_CONTINUE to allow the browser
|
|
||||||
// to display the tooltip.
|
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_tooltip)(struct _cef_handler_t* self,
|
|
||||||
struct _cef_browser_t* browser, cef_string_t* text);
|
|
||||||
|
|
||||||
// Called on the UI thread when the browser has a status message. |text|
|
// Implement this structure to handle events when window rendering is disabled.
|
||||||
// contains the text that will be displayed in the status message and |type|
|
// The functions of this structure will be called on the UI thread.
|
||||||
// indicates the status message type. The return value is currently ignored.
|
typedef struct _cef_render_handler_t
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_status)(struct _cef_handler_t* self,
|
{
|
||||||
struct _cef_browser_t* browser, const cef_string_t* value,
|
// Base structure.
|
||||||
enum cef_handler_statustype_t type);
|
cef_base_t base;
|
||||||
|
|
||||||
// Called on the UI thread to display a console message. Return RV_HANDLED to
|
// Called to retrieve the view rectangle which is relative to screen
|
||||||
// stop the message from being output to the console.
|
// coordinates. Return true (1) if the rectangle was provided.
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_console_message)(
|
int (CEF_CALLBACK *get_view_rect)(struct _cef_render_handler_t* self,
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
struct _cef_browser_t* browser, cef_rect_t* rect);
|
||||||
const cef_string_t* message, const cef_string_t* source, int line);
|
|
||||||
|
|
||||||
// Called on the UI thread to report find results returned by
|
// Called to retrieve the simulated screen rectangle. Return true (1) if the
|
||||||
// cef_browser_t::find(). |identifer| is the identifier passed to
|
|
||||||
// cef_browser_t::find(), |count| is the number of matches currently
|
|
||||||
// identified, |selectionRect| is the location of where the match was found
|
|
||||||
// (in window coordinates), |activeMatchOrdinal| is the current position in
|
|
||||||
// the search results, and |finalUpdate| is true (1) if this is the last find
|
|
||||||
// notification. The return value is currently ignored.
|
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_find_result)(
|
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
|
||||||
int identifier, int count, const cef_rect_t* selectionRect,
|
|
||||||
int activeMatchOrdinal, int finalUpdate);
|
|
||||||
|
|
||||||
// Called on the UI thread to retrieve either the simulated screen rectangle
|
|
||||||
// if |screen| is true (1) or the view rectangle if |screen| is false (0). The
|
|
||||||
// view rectangle is relative to the screen coordinates. This function is only
|
|
||||||
// called if window rendering has been disabled. Return RV_CONTINUE if the
|
|
||||||
// rectangle was provided.
|
// rectangle was provided.
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_get_rect)(struct _cef_handler_t* self,
|
int (CEF_CALLBACK *get_screen_rect)(struct _cef_render_handler_t* self,
|
||||||
struct _cef_browser_t* browser, int screen, cef_rect_t* rect);
|
struct _cef_browser_t* browser, cef_rect_t* rect);
|
||||||
|
|
||||||
// Called on the UI thread retrieve the translation from view coordinates to
|
// Called to retrieve the translation from view coordinates to actual screen
|
||||||
// actual screen coordinates. This function is only called if window rendering
|
// coordinates. Return true (1) if the screen coordinates were provided.
|
||||||
// has been disabled. Return RV_CONTINUE if the screen coordinates were
|
int (CEF_CALLBACK *get_screen_point)(struct _cef_render_handler_t* self,
|
||||||
// provided.
|
struct _cef_browser_t* browser, int viewX, int viewY, int* screenX,
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_get_screen_point)(
|
int* screenY);
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser, int viewX,
|
|
||||||
int viewY, int* screenX, int* screenY);
|
|
||||||
|
|
||||||
// Called on the UI thread when the browser wants to show, hide, resize or
|
// Called when the browser wants to show or hide the popup widget. The popup
|
||||||
// move the popup. If |show| is true (1) and |rect| is zero size then the
|
// should be shown if |show| is true (1) and hidden if |show| is false (0).
|
||||||
// popup should be shown. If |show| is true (1) and |rect| is non-zero size
|
void (CEF_CALLBACK *on_popup_show)(struct _cef_render_handler_t* self,
|
||||||
// then |rect| represents the popup location in view coordinates. If |show| is
|
struct _cef_browser_t* browser, int show);
|
||||||
// false (0) then the popup should be hidden. This function is only called if
|
|
||||||
// window rendering has been disabled. The return value is currently ignored.
|
// Called when the browser wants to move or resize the popup widget. |rect|
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_popup_change)(
|
// contains the new location and size.
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser, int show,
|
void (CEF_CALLBACK *on_popup_size)(struct _cef_render_handler_t* self,
|
||||||
const cef_rect_t* rect);
|
struct _cef_browser_t* browser, const cef_rect_t* rect);
|
||||||
|
|
||||||
// Called when an element should be painted. |type| indicates whether the
|
// Called when an element should be painted. |type| indicates whether the
|
||||||
// element is the view or the popup. |buffer| contains the pixel data for the
|
// element is the view or the popup widget. |buffer| contains the pixel data
|
||||||
// whole image. |dirtyRect| indicates the portion of the image that has been
|
// for the whole image. |dirtyRect| indicates the portion of the image that
|
||||||
// repainted. On Windows |buffer| will be width*height*4 bytes in size and
|
// has been repainted. On Windows |buffer| will be width*height*4 bytes in
|
||||||
// represents a BGRA image with an upper-left origin. This function is only
|
// size and represents a BGRA image with an upper-left origin.
|
||||||
// called if window rendering has been disabled. The return value is currently
|
void (CEF_CALLBACK *on_paint)(struct _cef_render_handler_t* self,
|
||||||
// ignored.
|
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_paint)(struct _cef_handler_t* self,
|
|
||||||
struct _cef_browser_t* browser, enum cef_paint_element_type_t type,
|
struct _cef_browser_t* browser, enum cef_paint_element_type_t type,
|
||||||
const cef_rect_t* dirtyRect, const void* buffer);
|
const cef_rect_t* dirtyRect, const void* buffer);
|
||||||
|
|
||||||
// Called when the browser window's cursor has changed. This function is only
|
// Called when the browser window's cursor has changed.
|
||||||
// called if window rendering has been disabled. The return value is currently
|
void (CEF_CALLBACK *on_cursor_change)(struct _cef_render_handler_t* self,
|
||||||
// ignored.
|
struct _cef_browser_t* browser, cef_cursor_handle_t cursor);
|
||||||
enum cef_retval_t (CEF_CALLBACK *handle_cursor_change)(
|
|
||||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
|
||||||
cef_cursor_handle_t cursor);
|
|
||||||
|
|
||||||
} cef_handler_t;
|
} cef_render_handler_t;
|
||||||
|
|
||||||
|
|
||||||
|
// Implement this structure to provide handler implementations.
|
||||||
|
typedef struct _cef_client_t
|
||||||
|
{
|
||||||
|
// Base structure.
|
||||||
|
cef_base_t base;
|
||||||
|
|
||||||
|
// Return the handler for browser life span events.
|
||||||
|
struct _cef_life_span_handler_t* (CEF_CALLBACK *get_life_span_handler)(
|
||||||
|
struct _cef_client_t* self);
|
||||||
|
|
||||||
|
// Return the handler for browser load status events.
|
||||||
|
struct _cef_load_handler_t* (CEF_CALLBACK *get_load_handler)(
|
||||||
|
struct _cef_client_t* self);
|
||||||
|
|
||||||
|
// Return the handler for browser request events.
|
||||||
|
struct _cef_request_handler_t* (CEF_CALLBACK *get_request_handler)(
|
||||||
|
struct _cef_client_t* self);
|
||||||
|
|
||||||
|
// Return the handler for browser display state events.
|
||||||
|
struct _cef_display_handler_t* (CEF_CALLBACK *get_display_handler)(
|
||||||
|
struct _cef_client_t* self);
|
||||||
|
|
||||||
|
// Return the handler for focus events.
|
||||||
|
struct _cef_focus_handler_t* (CEF_CALLBACK *get_focus_handler)(
|
||||||
|
struct _cef_client_t* self);
|
||||||
|
|
||||||
|
// Return the handler for keyboard events.
|
||||||
|
struct _cef_keyboard_handler_t* (CEF_CALLBACK *get_keyboard_handler)(
|
||||||
|
struct _cef_client_t* self);
|
||||||
|
|
||||||
|
// Return the handler for context menu events.
|
||||||
|
struct _cef_menu_handler_t* (CEF_CALLBACK *get_menu_handler)(
|
||||||
|
struct _cef_client_t* self);
|
||||||
|
|
||||||
|
// Return the handler for printing events.
|
||||||
|
struct _cef_print_handler_t* (CEF_CALLBACK *get_print_handler)(
|
||||||
|
struct _cef_client_t* self);
|
||||||
|
|
||||||
|
// Return the handler for find result events.
|
||||||
|
struct _cef_find_handler_t* (CEF_CALLBACK *get_find_handler)(
|
||||||
|
struct _cef_client_t* self);
|
||||||
|
|
||||||
|
// Return the handler for JavaScript dialog events.
|
||||||
|
struct _cef_jsdialog_handler_t* (CEF_CALLBACK *get_jsdialog_handler)(
|
||||||
|
struct _cef_client_t* self);
|
||||||
|
|
||||||
|
// Return the handler for JavaScript binding events.
|
||||||
|
struct _cef_jsbinding_handler_t* (CEF_CALLBACK *get_jsbinding_handler)(
|
||||||
|
struct _cef_client_t* self);
|
||||||
|
|
||||||
|
// Return the handler for off-screen rendering events.
|
||||||
|
struct _cef_render_handler_t* (CEF_CALLBACK *get_render_handler)(
|
||||||
|
struct _cef_client_t* self);
|
||||||
|
|
||||||
|
} cef_client_t;
|
||||||
|
|
||||||
|
|
||||||
// Structure used to represent a web request. The functions of this structure
|
// Structure used to represent a web request. The functions of this structure
|
||||||
@ -1447,7 +1588,7 @@ typedef struct _cef_download_handler_t
|
|||||||
|
|
||||||
|
|
||||||
// Structure used to make a Web URL request. Web URL requests are not associated
|
// Structure used to make a Web URL request. Web URL requests are not associated
|
||||||
// with a browser instance so no cef_handler_t callbacks will be executed. The
|
// with a browser instance so no cef_client_t callbacks will be executed. The
|
||||||
// functions of this structure may be called on any thread.
|
// functions of this structure may be called on any thread.
|
||||||
typedef struct _cef_web_urlrequest_t
|
typedef struct _cef_web_urlrequest_t
|
||||||
{
|
{
|
||||||
|
@ -28,18 +28,22 @@
|
|||||||
// (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.
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#include "cef_build.h"
|
||||||
#ifdef _MSC_VER // MSVC
|
|
||||||
|
#if defined(COMPILER_MSVC)
|
||||||
|
|
||||||
#ifdef BUILDING_CEF_SHARED
|
#ifdef BUILDING_CEF_SHARED
|
||||||
#define CEF_EXPORT __declspec(dllexport)
|
#define CEF_EXPORT __declspec(dllexport)
|
||||||
#elif USING_CEF_SHARED
|
#elif USING_CEF_SHARED
|
||||||
#define CEF_EXPORT __declspec(dllimport)
|
#define CEF_EXPORT __declspec(dllimport)
|
||||||
#else
|
#else
|
||||||
#define CEF_EXPORT
|
#define CEF_EXPORT
|
||||||
#endif // BUILDING_CEF_SHARED
|
#endif
|
||||||
#define CEF_CALLBACK __stdcall
|
#define CEF_CALLBACK __stdcall
|
||||||
#endif // MSVC
|
|
||||||
#elif defined(__GNUC__)
|
#elif defined(COMPILER_GCC)
|
||||||
|
|
||||||
#define CEF_EXPORT __attribute__ ((visibility("default")))
|
#define CEF_EXPORT __attribute__ ((visibility("default")))
|
||||||
#define CEF_CALLBACK
|
#define CEF_CALLBACK
|
||||||
#endif // defined(__GNUC__)
|
|
||||||
|
#endif // COMPILER_GCC
|
||||||
|
@ -130,7 +130,7 @@ struct CefRunnableMethodTraits {
|
|||||||
// CefRunnableMethod and NewCefRunnableMethod implementation ------------------
|
// CefRunnableMethod and NewCefRunnableMethod implementation ------------------
|
||||||
|
|
||||||
template <class T, class Method, class Params>
|
template <class T, class Method, class Params>
|
||||||
class CefRunnableMethod : public CefThreadSafeBase<CefTask> {
|
class CefRunnableMethod : public CefTask {
|
||||||
public:
|
public:
|
||||||
CefRunnableMethod(T* obj, Method meth, const Params& params)
|
CefRunnableMethod(T* obj, Method meth, const Params& params)
|
||||||
: obj_(obj), meth_(meth), params_(params) {
|
: obj_(obj), meth_(meth), params_(params) {
|
||||||
@ -154,6 +154,8 @@ class CefRunnableMethod : public CefThreadSafeBase<CefTask> {
|
|||||||
Method meth_;
|
Method meth_;
|
||||||
Params params_;
|
Params params_;
|
||||||
CefRunnableMethodTraits<T> traits_;
|
CefRunnableMethodTraits<T> traits_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefRunnableMethod);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T, class Method>
|
template <class T, class Method>
|
||||||
@ -241,7 +243,7 @@ inline CefRefPtr<CefTask> NewCefRunnableMethod(T* object, Method method,
|
|||||||
// CefRunnableFunction and NewCefRunnableFunction implementation --------------
|
// CefRunnableFunction and NewCefRunnableFunction implementation --------------
|
||||||
|
|
||||||
template <class Function, class Params>
|
template <class Function, class Params>
|
||||||
class CefRunnableFunction : public CefThreadSafeBase<CefTask> {
|
class CefRunnableFunction : public CefTask {
|
||||||
public:
|
public:
|
||||||
CefRunnableFunction(Function function, const Params& params)
|
CefRunnableFunction(Function function, const Params& params)
|
||||||
: function_(function), params_(params) {
|
: function_(function), params_(params) {
|
||||||
@ -258,6 +260,8 @@ class CefRunnableFunction : public CefThreadSafeBase<CefTask> {
|
|||||||
private:
|
private:
|
||||||
Function function_;
|
Function function_;
|
||||||
Params params_;
|
Params params_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefRunnableFunction);
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Function>
|
template <class Function>
|
||||||
|
@ -39,20 +39,21 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "cef_build.h"
|
||||||
#include "cef_export.h"
|
#include "cef_export.h"
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
// CEF character type definitions. wchat_t is 2 bytes on Windows and 4 bytes on
|
// CEF character type definitions. wchat_t is 2 bytes on Windows and 4 bytes on
|
||||||
// most other platforms.
|
// most other platforms.
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(OS_WIN)
|
||||||
typedef wchar_t char16_t;
|
typedef wchar_t char16_t;
|
||||||
#else // _WIN32
|
#else // !OS_WIN
|
||||||
typedef unsigned short char16_t;
|
typedef unsigned short char16_t;
|
||||||
#ifndef WCHAR_T_IS_UTF32
|
#ifndef WCHAR_T_IS_UTF32
|
||||||
#define WCHAR_T_IS_UTF32
|
#define WCHAR_T_IS_UTF32
|
||||||
#endif // WCHAR_T_IS_UTF32
|
#endif // WCHAR_T_IS_UTF32
|
||||||
#endif // _WIN32
|
#endif // !OS_WIN
|
||||||
|
|
||||||
|
|
||||||
// CEF string type definitions. Whomever allocates |str| is responsible for
|
// CEF string type definitions. Whomever allocates |str| is responsible for
|
||||||
|
@ -31,14 +31,16 @@
|
|||||||
#ifndef _CEF_TYPES_H
|
#ifndef _CEF_TYPES_H
|
||||||
#define _CEF_TYPES_H
|
#define _CEF_TYPES_H
|
||||||
|
|
||||||
|
#include "cef_build.h"
|
||||||
|
#include "cef_string.h"
|
||||||
#include "cef_string_list.h"
|
#include "cef_string_list.h"
|
||||||
|
|
||||||
// Bring in platform-specific definitions.
|
// Bring in platform-specific definitions.
|
||||||
#if defined(_WIN32)
|
#if defined(OS_WIN)
|
||||||
#include "cef_types_win.h"
|
#include "cef_types_win.h"
|
||||||
#elif defined(__APPLE__)
|
#elif defined(OS_MACOSX)
|
||||||
#include "cef_types_mac.h"
|
#include "cef_types_mac.h"
|
||||||
#elif defined(__linux__)
|
#elif defined(OS_LINUX)
|
||||||
#include "cef_types_linux.h"
|
#include "cef_types_linux.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -336,17 +338,6 @@ enum cef_key_type_t
|
|||||||
KT_CHAR,
|
KT_CHAR,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Define handler return value types. Returning RV_HANDLED indicates
|
|
||||||
// that the implementation completely handled the method and that no further
|
|
||||||
// processing is required. Returning RV_CONTINUE indicates that the
|
|
||||||
// implementation did not handle the method and that the default handler
|
|
||||||
// should be called.
|
|
||||||
enum cef_retval_t
|
|
||||||
{
|
|
||||||
RV_HANDLED = 0,
|
|
||||||
RV_CONTINUE = 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Various browser navigation types supported by chrome.
|
// Various browser navigation types supported by chrome.
|
||||||
enum cef_handler_navtype_t
|
enum cef_handler_navtype_t
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#ifndef _CEF_TYPES_LINUX_H
|
#ifndef _CEF_TYPES_LINUX_H
|
||||||
#define _CEF_TYPES_LINUX_H
|
#define _CEF_TYPES_LINUX_H
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(OS_LINUX)
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include "cef_string.h"
|
#include "cef_string.h"
|
||||||
|
|
||||||
@ -63,6 +63,6 @@ typedef struct _cef_print_info_t
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // defined(__linux__)
|
#endif // OS_LINUX
|
||||||
|
|
||||||
#endif // _CEF_TYPES_LINUX_H
|
#endif // _CEF_TYPES_LINUX_H
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#ifndef _CEF_TYPES_MAC_H
|
#ifndef _CEF_TYPES_MAC_H
|
||||||
#define _CEF_TYPES_MAC_H
|
#define _CEF_TYPES_MAC_H
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(OS_MACOSX)
|
||||||
#include "cef_string.h"
|
#include "cef_string.h"
|
||||||
|
|
||||||
// Window handle.
|
// Window handle.
|
||||||
@ -78,6 +78,6 @@ typedef struct _cef_print_info_t
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // defined(__APPLE__)
|
#endif // OS_MACOSX
|
||||||
|
|
||||||
#endif // _CEF_TYPES_MAC_H
|
#endif // _CEF_TYPES_MAC_H
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#ifndef _CEF_TYPES_WIN_H
|
#ifndef _CEF_TYPES_WIN_H
|
||||||
#define _CEF_TYPES_WIN_H
|
#define _CEF_TYPES_WIN_H
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(OS_WIN)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "cef_string.h"
|
#include "cef_string.h"
|
||||||
|
|
||||||
@ -78,6 +78,6 @@ typedef struct _cef_print_info_t
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // _WIN32
|
#endif // OS_WIN
|
||||||
|
|
||||||
#endif // _CEF_TYPES_WIN_H
|
#endif // _CEF_TYPES_WIN_H
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
// (b) Entity reference nodes are resolved to the corresponding entity
|
// (b) Entity reference nodes are resolved to the corresponding entity
|
||||||
// value.
|
// value.
|
||||||
// (c) Element nodes are represented by their outer XML string.
|
// (c) Element nodes are represented by their outer XML string.
|
||||||
class CefXmlObject : public CefThreadSafeBase<CefBase>
|
class CefXmlObject : public CefBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::vector<CefRefPtr<CefXmlObject> > ObjectVector;
|
typedef std::vector<CefRefPtr<CefXmlObject> > ObjectVector;
|
||||||
@ -148,12 +148,15 @@ private:
|
|||||||
CefString value_;
|
CefString value_;
|
||||||
AttributeMap attributes_;
|
AttributeMap attributes_;
|
||||||
ObjectVector children_;
|
ObjectVector children_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefXmlObject);
|
||||||
|
IMPLEMENT_LOCKING(CefXmlObject);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Thread safe implementation of the CefReadHandler class for reading an
|
// Thread safe implementation of the CefReadHandler class for reading an
|
||||||
// in-memory array of bytes.
|
// in-memory array of bytes.
|
||||||
class CefByteReadHandler : public CefThreadSafeBase<CefReadHandler>
|
class CefByteReadHandler : public CefReadHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Create a new object for reading an array of bytes. An optional |source|
|
// Create a new object for reading an array of bytes. An optional |source|
|
||||||
@ -180,6 +183,9 @@ private:
|
|||||||
size_t size_;
|
size_t size_;
|
||||||
size_t offset_;
|
size_t offset_;
|
||||||
CefRefPtr<CefBase> source_;
|
CefRefPtr<CefBase> source_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefByteReadHandler);
|
||||||
|
IMPLEMENT_LOCKING(CefByteReadHandler);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -192,7 +198,7 @@ private:
|
|||||||
// (3) File ordering from the original zip archive is not maintained. This
|
// (3) File ordering from the original zip archive is not maintained. This
|
||||||
// means that files from the same folder may not be located together in the
|
// means that files from the same folder may not be located together in the
|
||||||
// file content map.
|
// file content map.
|
||||||
class CefZipArchive : public CefThreadSafeBase<CefBase>
|
class CefZipArchive : public CefBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Class representing a file in the archive. Accessing the file data from
|
// Class representing a file in the archive. Accessing the file data from
|
||||||
@ -241,6 +247,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
FileMap contents_;
|
FileMap contents_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefZipArchive);
|
||||||
|
IMPLEMENT_LOCKING(CefZipArchive);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _CEF_WRAPPER_H
|
#endif // _CEF_WRAPPER_H
|
||||||
|
@ -50,21 +50,25 @@ namespace {
|
|||||||
class CreateBrowserHelper
|
class CreateBrowserHelper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CreateBrowserHelper(CefWindowInfo& windowInfo, bool popup,
|
CreateBrowserHelper(CefWindowInfo& windowInfo,
|
||||||
CefRefPtr<CefHandler> handler, const CefString& url)
|
CefRefPtr<CefClient> client,
|
||||||
: window_info_(windowInfo), popup_(popup),
|
const CefString& url,
|
||||||
handler_(handler), url_(url) {}
|
const CefBrowserSettings& settings)
|
||||||
|
: window_info_(windowInfo),
|
||||||
|
client_(client),
|
||||||
|
url_(url),
|
||||||
|
settings_(settings) {}
|
||||||
|
|
||||||
CefWindowInfo window_info_;
|
CefWindowInfo window_info_;
|
||||||
bool popup_;
|
CefRefPtr<CefClient> client_;
|
||||||
CefRefPtr<CefHandler> handler_;
|
|
||||||
CefString url_;
|
CefString url_;
|
||||||
|
CefBrowserSettings settings_;
|
||||||
};
|
};
|
||||||
|
|
||||||
void UIT_CreateBrowserWithHelper(CreateBrowserHelper* helper)
|
void UIT_CreateBrowserWithHelper(CreateBrowserHelper* helper)
|
||||||
{
|
{
|
||||||
CefBrowser::CreateBrowserSync(helper->window_info_, helper->popup_,
|
CefBrowser::CreateBrowserSync(helper->window_info_, helper->client_,
|
||||||
helper->handler_, helper->url_);
|
helper->url_, helper->settings_);
|
||||||
delete helper;
|
delete helper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,20 +87,24 @@ void CefBrowserImpl::PaintDelegate::Paint(bool popup,
|
|||||||
const gfx::Rect& dirtyRect,
|
const gfx::Rect& dirtyRect,
|
||||||
const void* buffer)
|
const void* buffer)
|
||||||
{
|
{
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
if (!client.get())
|
||||||
|
return;
|
||||||
|
CefRefPtr<CefRenderHandler> handler = client->GetRenderHandler();
|
||||||
if (!handler.get())
|
if (!handler.get())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CefRect rect(dirtyRect.x(), dirtyRect.y(), dirtyRect.width(),
|
CefRect rect(dirtyRect.x(), dirtyRect.y(), dirtyRect.width(),
|
||||||
dirtyRect.height());
|
dirtyRect.height());
|
||||||
handler->HandlePaint(browser_, (popup?PET_POPUP:PET_VIEW), rect, buffer);
|
handler->OnPaint(browser_, (popup?PET_POPUP:PET_VIEW), rect, buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// static
|
// static
|
||||||
bool CefBrowser::CreateBrowser(CefWindowInfo& windowInfo, bool popup,
|
bool CefBrowser::CreateBrowser(CefWindowInfo& windowInfo,
|
||||||
CefRefPtr<CefHandler> handler,
|
CefRefPtr<CefClient> client,
|
||||||
const CefString& url)
|
const CefString& url,
|
||||||
|
const CefBrowserSettings& settings)
|
||||||
{
|
{
|
||||||
// Verify that the context is in a valid state.
|
// Verify that the context is in a valid state.
|
||||||
if (!CONTEXT_STATE_VALID()) {
|
if (!CONTEXT_STATE_VALID()) {
|
||||||
@ -104,17 +112,24 @@ bool CefBrowser::CreateBrowser(CefWindowInfo& windowInfo, bool popup,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Verify that the settings structure is a valid size.
|
||||||
|
if (settings.size != sizeof(cef_browser_settings_t)) {
|
||||||
|
NOTREACHED();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Create the browser on the UI thread.
|
// Create the browser on the UI thread.
|
||||||
CreateBrowserHelper* helper =
|
CreateBrowserHelper* helper =
|
||||||
new CreateBrowserHelper(windowInfo, popup, handler, url);
|
new CreateBrowserHelper(windowInfo, client, url, settings);
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableFunction(
|
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableFunction(
|
||||||
UIT_CreateBrowserWithHelper, helper));
|
UIT_CreateBrowserWithHelper, helper));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
CefRefPtr<CefBrowser> CefBrowser::CreateBrowserSync(CefWindowInfo& windowInfo,
|
CefRefPtr<CefBrowser> CefBrowser::CreateBrowserSync(
|
||||||
bool popup, CefRefPtr<CefHandler> handler, const CefString& url)
|
CefWindowInfo& windowInfo, CefRefPtr<CefClient> client,
|
||||||
|
const CefString& url, const CefBrowserSettings& settings)
|
||||||
{
|
{
|
||||||
// Verify that the context is in a valid state.
|
// Verify that the context is in a valid state.
|
||||||
if (!CONTEXT_STATE_VALID()) {
|
if (!CONTEXT_STATE_VALID()) {
|
||||||
@ -122,27 +137,20 @@ CefRefPtr<CefBrowser> CefBrowser::CreateBrowserSync(CefWindowInfo& windowInfo,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Verify that the settings structure is a valid size.
|
||||||
|
if (settings.size != sizeof(cef_browser_settings_t)) {
|
||||||
|
NOTREACHED();
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// Verify that this method is being called on the UI thread.
|
// Verify that this method is being called on the UI thread.
|
||||||
if (!CefThread::CurrentlyOn(CefThread::UI)) {
|
if (!CefThread::CurrentlyOn(CefThread::UI)) {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CefRefPtr<CefBrowser> alternateBrowser;
|
|
||||||
CefBrowserSettings settings(_Context->browser_defaults());
|
|
||||||
|
|
||||||
if(handler.get())
|
|
||||||
{
|
|
||||||
// Give the handler an opportunity to modify window attributes, handler,
|
|
||||||
// or cancel the window creation.
|
|
||||||
CefHandler::RetVal rv = handler->HandleBeforeCreated(NULL, windowInfo,
|
|
||||||
popup, CefPopupFeatures(), handler, url, settings);
|
|
||||||
if(rv == RV_HANDLED)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CefRefPtr<CefBrowser> browser(
|
CefRefPtr<CefBrowser> browser(
|
||||||
new CefBrowserImpl(windowInfo, settings, popup, handler));
|
new CefBrowserImpl(windowInfo, settings, false, client));
|
||||||
static_cast<CefBrowserImpl*>(browser.get())->UIT_CreateBrowser(url);
|
static_cast<CefBrowserImpl*>(browser.get())->UIT_CreateBrowser(url);
|
||||||
|
|
||||||
return browser;
|
return browser;
|
||||||
@ -151,9 +159,9 @@ CefRefPtr<CefBrowser> CefBrowser::CreateBrowserSync(CefWindowInfo& windowInfo,
|
|||||||
|
|
||||||
CefBrowserImpl::CefBrowserImpl(const CefWindowInfo& windowInfo,
|
CefBrowserImpl::CefBrowserImpl(const CefWindowInfo& windowInfo,
|
||||||
const CefBrowserSettings& settings, bool popup,
|
const CefBrowserSettings& settings, bool popup,
|
||||||
CefRefPtr<CefHandler> handler)
|
CefRefPtr<CefClient> client)
|
||||||
: window_info_(windowInfo), settings_(settings), is_popup_(popup),
|
: window_info_(windowInfo), settings_(settings), is_popup_(popup),
|
||||||
is_modal_(false), handler_(handler), webviewhost_(NULL), popuphost_(NULL),
|
is_modal_(false), client_(client), webviewhost_(NULL), popuphost_(NULL),
|
||||||
zoom_level_(0.0), can_go_back_(false), can_go_forward_(false),
|
zoom_level_(0.0), can_go_back_(false), can_go_forward_(false),
|
||||||
main_frame_(NULL), unique_id_(0)
|
main_frame_(NULL), unique_id_(0)
|
||||||
{
|
{
|
||||||
@ -666,9 +674,12 @@ WebFrame* CefBrowserImpl::UIT_GetWebFrame(CefRefPtr<CefFrame> frame)
|
|||||||
|
|
||||||
void CefBrowserImpl::UIT_DestroyBrowser()
|
void CefBrowserImpl::UIT_DestroyBrowser()
|
||||||
{
|
{
|
||||||
if(handler_.get()) {
|
if(client_.get()) {
|
||||||
|
CefRefPtr<CefLifeSpanHandler> handler = client_->GetLifeSpanHandler();
|
||||||
|
if (handler.get()) {
|
||||||
// Notify the handler that the window is about to be closed.
|
// Notify the handler that the window is about to be closed.
|
||||||
handler_->HandleBeforeWindowClose(this);
|
handler->OnBeforeClose(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
UIT_GetWebViewDelegate()->RevokeDragDrop();
|
UIT_GetWebViewDelegate()->RevokeDragDrop();
|
||||||
|
|
||||||
@ -915,7 +926,9 @@ bool CefBrowserImpl::UIT_Navigate(const BrowserNavigationEntry& entry,
|
|||||||
// In case LoadRequest failed before DidCreateDataSource was called.
|
// In case LoadRequest failed before DidCreateDataSource was called.
|
||||||
delegate_->set_pending_extra_data(NULL);
|
delegate_->set_pending_extra_data(NULL);
|
||||||
|
|
||||||
if (handler_.get() && handler_->HandleSetFocus(this, false) == RV_CONTINUE) {
|
if (client_.get()) {
|
||||||
|
CefRefPtr<CefFocusHandler> handler = client_->GetFocusHandler();
|
||||||
|
if (handler.get() && !handler->OnSetFocus(this, false)) {
|
||||||
// Restore focus to the main frame prior to loading new request.
|
// Restore focus to the main frame prior to loading new request.
|
||||||
// This makes sure that we don't have a focused iframe. Otherwise, that
|
// This makes sure that we don't have a focused iframe. Otherwise, that
|
||||||
// iframe would keep focus when the SetFocus called immediately after
|
// iframe would keep focus when the SetFocus called immediately after
|
||||||
@ -932,6 +945,7 @@ bool CefBrowserImpl::UIT_Navigate(const BrowserNavigationEntry& entry,
|
|||||||
UIT_IsViewVisible(UIT_GetMainWndHandle()))
|
UIT_IsViewVisible(UIT_GetMainWndHandle()))
|
||||||
UIT_SetFocus(UIT_GetWebViewHost(), true);
|
UIT_SetFocus(UIT_GetWebViewHost(), true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1052,23 +1066,23 @@ CefRefPtr<CefBrowserImpl> CefBrowserImpl::UIT_CreatePopupWindow(
|
|||||||
if(features.heightSet)
|
if(features.heightSet)
|
||||||
info.m_nHeight = features.height;
|
info.m_nHeight = features.height;
|
||||||
|
|
||||||
CefRefPtr<CefHandler> handler = handler_;
|
CefRefPtr<CefClient> client = client_;
|
||||||
|
|
||||||
// Start with the current browser window's settings.
|
// Start with the current browser window's settings.
|
||||||
CefBrowserSettings settings(settings_);
|
CefBrowserSettings settings(settings_);
|
||||||
|
|
||||||
if(handler_.get())
|
if (client_.get()) {
|
||||||
{
|
CefRefPtr<CefLifeSpanHandler> handler = client_->GetLifeSpanHandler();
|
||||||
// Give the handler an opportunity to modify window attributes, handler,
|
// Give the handler an opportunity to modify window attributes, handler,
|
||||||
// or cancel the window creation.
|
// or cancel the window creation.
|
||||||
CefHandler::RetVal rv = handler_->HandleBeforeCreated(this, info, true,
|
if (handler.get() &&
|
||||||
features, handler, url, settings);
|
handler->OnBeforePopup(this, features, info, url, client, settings)) {
|
||||||
if(rv == RV_HANDLED)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CefRefPtr<CefBrowserImpl> browser(
|
CefRefPtr<CefBrowserImpl> browser(
|
||||||
new CefBrowserImpl(info, settings, true, handler));
|
new CefBrowserImpl(info, settings, true, client));
|
||||||
// Don't pass the URL to UIT_CreateBrowser for popup windows or the URL will
|
// Don't pass the URL to UIT_CreateBrowser for popup windows or the URL will
|
||||||
// be loaded twice.
|
// be loaded twice.
|
||||||
browser->UIT_CreateBrowser(CefString());
|
browser->UIT_CreateBrowser(CefString());
|
||||||
@ -1104,9 +1118,12 @@ void CefBrowserImpl::UIT_ClosePopupWidget()
|
|||||||
popuphost_ = NULL;
|
popuphost_ = NULL;
|
||||||
popup_rect_ = gfx::Rect();
|
popup_rect_ = gfx::Rect();
|
||||||
|
|
||||||
if (IsWindowRenderingDisabled() && handler_.get()) {
|
if (IsWindowRenderingDisabled() && client_.get()) {
|
||||||
|
CefRefPtr<CefRenderHandler> handler = client_->GetRenderHandler();
|
||||||
|
if (handler.get()) {
|
||||||
// Notify the handler of popup visibility change.
|
// Notify the handler of popup visibility change.
|
||||||
handler_->HandlePopupChange(this, false, CefRect());
|
handler->OnPopupShow(this, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1116,12 +1133,12 @@ void CefBrowserImpl::UIT_Show(WebKit::WebNavigationPolicy policy)
|
|||||||
delegate_->show(policy);
|
delegate_->show(policy);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::UIT_HandleActionView(CefHandler::MenuId menuId)
|
void CefBrowserImpl::UIT_HandleActionView(cef_handler_menuid_t menuId)
|
||||||
{
|
{
|
||||||
return UIT_HandleAction(menuId, NULL);
|
return UIT_HandleAction(menuId, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserImpl::UIT_HandleAction(CefHandler::MenuId menuId,
|
void CefBrowserImpl::UIT_HandleAction(cef_handler_menuid_t menuId,
|
||||||
CefRefPtr<CefFrame> frame)
|
CefRefPtr<CefFrame> frame)
|
||||||
{
|
{
|
||||||
REQUIRE_UIT();
|
REQUIRE_UIT();
|
||||||
@ -1342,11 +1359,14 @@ void CefBrowserImpl::UIT_NotifyFindStatus(int identifier, int count,
|
|||||||
int active_match_ordinal,
|
int active_match_ordinal,
|
||||||
bool final_update)
|
bool final_update)
|
||||||
{
|
{
|
||||||
if(handler_.get()) {
|
if(client_.get()) {
|
||||||
|
CefRefPtr<CefFindHandler> handler = client_->GetFindHandler();
|
||||||
|
if (handler.get()) {
|
||||||
CefRect rect(selection_rect.x, selection_rect.y, selection_rect.width,
|
CefRect rect(selection_rect.x, selection_rect.y, selection_rect.width,
|
||||||
selection_rect.height);
|
selection_rect.height);
|
||||||
handler_->HandleFindResult(this, identifier, count, rect,
|
handler->OnFindResult(this, identifier, count, rect, active_match_ordinal,
|
||||||
active_match_ordinal, final_update);
|
final_update);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ class WebView;
|
|||||||
|
|
||||||
|
|
||||||
// Implementation of CefBrowser.
|
// Implementation of CefBrowser.
|
||||||
class CefBrowserImpl : public CefThreadSafeBase<CefBrowser>
|
class CefBrowserImpl : public CefBrowser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
class PaintDelegate : public WebWidgetHost::PaintDelegate
|
class PaintDelegate : public WebWidgetHost::PaintDelegate
|
||||||
@ -51,7 +51,7 @@ public:
|
|||||||
|
|
||||||
CefBrowserImpl(const CefWindowInfo& windowInfo,
|
CefBrowserImpl(const CefWindowInfo& windowInfo,
|
||||||
const CefBrowserSettings& settings, bool popup,
|
const CefBrowserSettings& settings, bool popup,
|
||||||
CefRefPtr<CefHandler> handler);
|
CefRefPtr<CefClient> client);
|
||||||
virtual ~CefBrowserImpl() {}
|
virtual ~CefBrowserImpl() {}
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
@ -61,45 +61,46 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// CefBrowser methods
|
// CefBrowser methods
|
||||||
virtual void CloseBrowser();
|
virtual void CloseBrowser() OVERRIDE;
|
||||||
virtual bool CanGoBack() { return can_go_back(); }
|
virtual bool CanGoBack() OVERRIDE { return can_go_back(); }
|
||||||
virtual void GoBack();
|
virtual void GoBack() OVERRIDE;
|
||||||
virtual bool CanGoForward() { return can_go_forward(); }
|
virtual bool CanGoForward() OVERRIDE { return can_go_forward(); }
|
||||||
virtual void GoForward();
|
virtual void GoForward() OVERRIDE;
|
||||||
virtual void Reload();
|
virtual void Reload() OVERRIDE;
|
||||||
virtual void ReloadIgnoreCache();
|
virtual void ReloadIgnoreCache() OVERRIDE;
|
||||||
virtual void StopLoad();
|
virtual void StopLoad() OVERRIDE;
|
||||||
virtual void SetFocus(bool enable);
|
virtual void SetFocus(bool enable) OVERRIDE;
|
||||||
virtual CefWindowHandle GetWindowHandle();
|
virtual CefWindowHandle GetWindowHandle() OVERRIDE;
|
||||||
virtual bool IsPopup() { return is_popup(); }
|
virtual bool IsPopup() OVERRIDE { return is_popup(); }
|
||||||
virtual CefRefPtr<CefHandler> GetHandler() { return handler_; }
|
virtual CefRefPtr<CefClient> GetClient() OVERRIDE { return client_; }
|
||||||
virtual CefRefPtr<CefFrame> GetMainFrame() { return GetMainCefFrame(); }
|
virtual CefRefPtr<CefFrame> GetMainFrame() OVERRIDE
|
||||||
virtual CefRefPtr<CefFrame> GetFocusedFrame();
|
{ return GetMainCefFrame(); }
|
||||||
virtual CefRefPtr<CefFrame> GetFrame(const CefString& name);
|
virtual CefRefPtr<CefFrame> GetFocusedFrame() OVERRIDE;
|
||||||
virtual void GetFrameNames(std::vector<CefString>& names);
|
virtual CefRefPtr<CefFrame> GetFrame(const CefString& name) OVERRIDE;
|
||||||
|
virtual void GetFrameNames(std::vector<CefString>& names) OVERRIDE;
|
||||||
virtual void Find(int identifier, const CefString& searchText,
|
virtual void Find(int identifier, const CefString& searchText,
|
||||||
bool forward, bool matchCase, bool findNext);
|
bool forward, bool matchCase, bool findNext) OVERRIDE;
|
||||||
virtual void StopFinding(bool clearSelection);
|
virtual void StopFinding(bool clearSelection) OVERRIDE;
|
||||||
virtual double GetZoomLevel() { return zoom_level(); }
|
virtual double GetZoomLevel() OVERRIDE { return zoom_level(); }
|
||||||
virtual void SetZoomLevel(double zoomLevel);
|
virtual void SetZoomLevel(double zoomLevel) OVERRIDE;
|
||||||
virtual void ShowDevTools();
|
virtual void ShowDevTools() OVERRIDE;
|
||||||
virtual void CloseDevTools();
|
virtual void CloseDevTools() OVERRIDE;
|
||||||
virtual bool IsWindowRenderingDisabled();
|
virtual bool IsWindowRenderingDisabled() OVERRIDE;
|
||||||
virtual bool GetSize(PaintElementType type, int& width, int& height);
|
virtual bool GetSize(PaintElementType type, int& width, int& height) OVERRIDE;
|
||||||
virtual void SetSize(PaintElementType type, int width, int height);
|
virtual void SetSize(PaintElementType type, int width, int height) OVERRIDE;
|
||||||
virtual bool IsPopupVisible();
|
virtual bool IsPopupVisible() OVERRIDE;
|
||||||
virtual void HidePopup();
|
virtual void HidePopup() OVERRIDE;
|
||||||
virtual void Invalidate(const CefRect& dirtyRect);
|
virtual void Invalidate(const CefRect& dirtyRect) OVERRIDE;
|
||||||
virtual bool GetImage(PaintElementType type, int width, int height,
|
virtual bool GetImage(PaintElementType type, int width, int height,
|
||||||
void* buffer);
|
void* buffer) OVERRIDE;
|
||||||
virtual void SendKeyEvent(KeyType type, int key, int modifiers, bool sysChar,
|
virtual void SendKeyEvent(KeyType type, int key, int modifiers, bool sysChar,
|
||||||
bool imeChar);
|
bool imeChar) OVERRIDE;
|
||||||
virtual void SendMouseClickEvent(int x, int y, MouseButtonType type,
|
virtual void SendMouseClickEvent(int x, int y, MouseButtonType type,
|
||||||
bool mouseUp, int clickCount);
|
bool mouseUp, int clickCount) OVERRIDE;
|
||||||
virtual void SendMouseMoveEvent(int x, int y, bool mouseLeave);
|
virtual void SendMouseMoveEvent(int x, int y, bool mouseLeave) OVERRIDE;
|
||||||
virtual void SendMouseWheelEvent(int x, int y, int delta);
|
virtual void SendMouseWheelEvent(int x, int y, int delta) OVERRIDE;
|
||||||
virtual void SendFocusEvent(bool setFocus);
|
virtual void SendFocusEvent(bool setFocus) OVERRIDE;
|
||||||
virtual void SendCaptureLostEvent();
|
virtual void SendCaptureLostEvent() OVERRIDE;
|
||||||
|
|
||||||
// Frame-related methods
|
// Frame-related methods
|
||||||
void Undo(CefRefPtr<CefFrame> frame);
|
void Undo(CefRefPtr<CefFrame> frame);
|
||||||
@ -268,8 +269,8 @@ public:
|
|||||||
void UIT_Show(WebKit::WebNavigationPolicy policy);
|
void UIT_Show(WebKit::WebNavigationPolicy policy);
|
||||||
|
|
||||||
// Handles most simple browser actions
|
// Handles most simple browser actions
|
||||||
void UIT_HandleActionView(CefHandler::MenuId menuId);
|
void UIT_HandleActionView(cef_handler_menuid_t menuId);
|
||||||
void UIT_HandleAction(CefHandler::MenuId menuId, CefRefPtr<CefFrame> frame);
|
void UIT_HandleAction(cef_handler_menuid_t menuId, CefRefPtr<CefFrame> frame);
|
||||||
|
|
||||||
// Save the document HTML to a temporary file and open in the default viewing
|
// Save the document HTML to a temporary file and open in the default viewing
|
||||||
// application
|
// application
|
||||||
@ -333,7 +334,7 @@ protected:
|
|||||||
CefBrowserSettings settings_;
|
CefBrowserSettings settings_;
|
||||||
bool is_popup_;
|
bool is_popup_;
|
||||||
bool is_modal_;
|
bool is_modal_;
|
||||||
CefRefPtr<CefHandler> handler_;
|
CefRefPtr<CefClient> client_;
|
||||||
scoped_ptr<WebViewHost> webviewhost_;
|
scoped_ptr<WebViewHost> webviewhost_;
|
||||||
WebWidgetHost* popuphost_;
|
WebWidgetHost* popuphost_;
|
||||||
gfx::Rect popup_rect_;
|
gfx::Rect popup_rect_;
|
||||||
@ -369,52 +370,57 @@ protected:
|
|||||||
|
|
||||||
// A temporary directory for FileSystem API.
|
// A temporary directory for FileSystem API.
|
||||||
ScopedTempDir file_system_root_;
|
ScopedTempDir file_system_root_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefBrowserImpl);
|
||||||
|
IMPLEMENT_LOCKING(CefBrowserImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Implementation of CefFrame.
|
// Implementation of CefFrame.
|
||||||
class CefFrameImpl : public CefThreadSafeBase<CefFrame>
|
class CefFrameImpl : public CefFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefFrameImpl(CefBrowserImpl* browser, const CefString& name);
|
CefFrameImpl(CefBrowserImpl* browser, const CefString& name);
|
||||||
virtual ~CefFrameImpl();
|
virtual ~CefFrameImpl();
|
||||||
|
|
||||||
// CefFrame methods
|
// CefFrame methods
|
||||||
virtual void Undo() { browser_->Undo(this); }
|
virtual void Undo() OVERRIDE { browser_->Undo(this); }
|
||||||
virtual void Redo() { browser_->Redo(this); }
|
virtual void Redo() OVERRIDE { browser_->Redo(this); }
|
||||||
virtual void Cut() { browser_->Cut(this); }
|
virtual void Cut() OVERRIDE { browser_->Cut(this); }
|
||||||
virtual void Copy() { browser_->Copy(this); }
|
virtual void Copy() OVERRIDE { browser_->Copy(this); }
|
||||||
virtual void Paste() { browser_->Paste(this); }
|
virtual void Paste() OVERRIDE { browser_->Paste(this); }
|
||||||
virtual void Delete() { browser_->Delete(this); }
|
virtual void Delete() OVERRIDE { browser_->Delete(this); }
|
||||||
virtual void SelectAll() { browser_->SelectAll(this); }
|
virtual void SelectAll() OVERRIDE { browser_->SelectAll(this); }
|
||||||
virtual void Print() { browser_->Print(this); }
|
virtual void Print() OVERRIDE { browser_->Print(this); }
|
||||||
virtual void ViewSource() { browser_->ViewSource(this); }
|
virtual void ViewSource() OVERRIDE { browser_->ViewSource(this); }
|
||||||
virtual CefString GetSource() { return browser_->GetSource(this); }
|
virtual CefString GetSource() OVERRIDE { return browser_->GetSource(this); }
|
||||||
virtual CefString GetText() { return browser_->GetText(this); }
|
virtual CefString GetText() OVERRIDE { return browser_->GetText(this); }
|
||||||
virtual void LoadRequest(CefRefPtr<CefRequest> request)
|
virtual void LoadRequest(CefRefPtr<CefRequest> request) OVERRIDE
|
||||||
{ return browser_->LoadRequest(this, request); }
|
{ return browser_->LoadRequest(this, request); }
|
||||||
virtual void LoadURL(const CefString& url)
|
virtual void LoadURL(const CefString& url) OVERRIDE
|
||||||
{ return browser_->LoadURL(this, url); }
|
{ return browser_->LoadURL(this, url); }
|
||||||
virtual void LoadString(const CefString& string,
|
virtual void LoadString(const CefString& string,
|
||||||
const CefString& url)
|
const CefString& url) OVERRIDE
|
||||||
{ return browser_->LoadString(this, string, url); }
|
{ return browser_->LoadString(this, string, url); }
|
||||||
virtual void LoadStream(CefRefPtr<CefStreamReader> stream,
|
virtual void LoadStream(CefRefPtr<CefStreamReader> stream,
|
||||||
const CefString& url)
|
const CefString& url) OVERRIDE
|
||||||
{ return browser_->LoadStream(this, stream, url); }
|
{ return browser_->LoadStream(this, stream, url); }
|
||||||
virtual void ExecuteJavaScript(const CefString& jsCode,
|
virtual void ExecuteJavaScript(const CefString& jsCode,
|
||||||
const CefString& scriptUrl,
|
const CefString& scriptUrl,
|
||||||
int startLine)
|
int startLine) OVERRIDE
|
||||||
{ return browser_->ExecuteJavaScript(this, jsCode, scriptUrl, startLine); }
|
{ return browser_->ExecuteJavaScript(this, jsCode, scriptUrl, startLine); }
|
||||||
virtual bool IsMain() { return name_.empty(); }
|
virtual bool IsMain() OVERRIDE { return name_.empty(); }
|
||||||
virtual bool IsFocused();
|
virtual bool IsFocused() OVERRIDE;
|
||||||
virtual CefString GetName() { return name_; }
|
virtual CefString GetName() OVERRIDE { return name_; }
|
||||||
virtual CefString GetURL() { return browser_->GetURL(this); }
|
virtual CefString GetURL() OVERRIDE { return browser_->GetURL(this); }
|
||||||
virtual CefRefPtr<CefBrowser> GetBrowser() { return browser_.get(); }
|
virtual CefRefPtr<CefBrowser> GetBrowser() OVERRIDE { return browser_.get(); }
|
||||||
virtual void VisitDOM(CefRefPtr<CefDOMVisitor> visitor);
|
virtual void VisitDOM(CefRefPtr<CefDOMVisitor> visitor) OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CefRefPtr<CefBrowserImpl> browser_;
|
CefRefPtr<CefBrowserImpl> browser_;
|
||||||
CefString name_;
|
CefString name_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefFrameImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _BROWSER_IMPL_H
|
#endif // _BROWSER_IMPL_H
|
||||||
|
@ -167,9 +167,12 @@ void CefBrowserImpl::UIT_CreateBrowser(const CefString& url)
|
|||||||
cr.bottom, flags);
|
cr.bottom, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(handler_.get()) {
|
if(client_.get()) {
|
||||||
|
CefRefPtr<CefLifeSpanHandler> handler = client_->GetLifeSpanHandler();
|
||||||
|
if (handler.get()) {
|
||||||
// Notify the handler that we're done creating the new window
|
// Notify the handler that we're done creating the new window
|
||||||
handler_->HandleAfterCreated(this);
|
handler->OnAfterCreated(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(url.length() > 0)
|
if(url.length() > 0)
|
||||||
@ -303,7 +306,11 @@ void CefBrowserImpl::UIT_PrintPage(int page_number, int total_pages,
|
|||||||
res = RestoreDC(hDC, saved_state);
|
res = RestoreDC(hDC, saved_state);
|
||||||
DCHECK_NE(res, 0);
|
DCHECK_NE(res, 0);
|
||||||
|
|
||||||
if(handler_.get()) {
|
CefRefPtr<CefPrintHandler> handler;
|
||||||
|
if (client_.get())
|
||||||
|
handler = client_->GetPrintHandler();
|
||||||
|
|
||||||
|
if(handler.get()) {
|
||||||
saved_state = SaveDC(hDC);
|
saved_state = SaveDC(hDC);
|
||||||
DCHECK_NE(saved_state, 0);
|
DCHECK_NE(saved_state, 0);
|
||||||
|
|
||||||
@ -334,12 +341,12 @@ void CefBrowserImpl::UIT_PrintPage(int page_number, int total_pages,
|
|||||||
CefString topLeft, topCenter, topRight;
|
CefString topLeft, topCenter, topRight;
|
||||||
CefString bottomLeft, bottomCenter, bottomRight;
|
CefString bottomLeft, bottomCenter, bottomRight;
|
||||||
|
|
||||||
// allow the handler to format print header and/or footer
|
// Allow the handler to format print header and/or footer.
|
||||||
CefHandler::RetVal rv = handler_->HandlePrintHeaderFooter(this,
|
bool handled = handler->GetPrintHeaderFooter(this, UIT_GetCefFrame(frame),
|
||||||
UIT_GetCefFrame(frame), printInfo, url, title, page_number+1, total_pages,
|
printInfo, url, title, page_number+1, total_pages, topLeft, topCenter,
|
||||||
topLeft, topCenter, topRight, bottomLeft, bottomCenter, bottomRight);
|
topRight, bottomLeft, bottomCenter, bottomRight);
|
||||||
|
|
||||||
if(rv != RV_HANDLED) {
|
if (!handled) {
|
||||||
// Draw handler-defined headers and/or footers.
|
// Draw handler-defined headers and/or footers.
|
||||||
LOGFONT lf;
|
LOGFONT lf;
|
||||||
memset(&lf, 0, sizeof(lf));
|
memset(&lf, 0, sizeof(lf));
|
||||||
@ -414,9 +421,12 @@ void CefBrowserImpl::UIT_PrintPages(WebKit::WebFrame* frame) {
|
|||||||
memset(&print_options, 0, sizeof(print_options));
|
memset(&print_options, 0, sizeof(print_options));
|
||||||
settings.UpdatePrintOptions(print_options);
|
settings.UpdatePrintOptions(print_options);
|
||||||
|
|
||||||
|
CefRefPtr<CefPrintHandler> handler;
|
||||||
|
if (client_.get())
|
||||||
|
handler = client_->GetPrintHandler();
|
||||||
|
|
||||||
// Ask the handler if they want to update the print options.
|
// Ask the handler if they want to update the print options.
|
||||||
if (handler_.get() && RV_HANDLED ==
|
if (handler.get() && handler->GetPrintOptions(this, print_options)) {
|
||||||
handler_->HandlePrintOptions(this, print_options)) {
|
|
||||||
settings.UpdateFromPrintOptions(print_options);
|
settings.UpdateFromPrintOptions(print_options);
|
||||||
print_context_.InitWithSettings(settings);
|
print_context_.InitWithSettings(settings);
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,11 @@ class RequestProxy : public net::URLRequest::Delegate,
|
|||||||
const GURL& url, bool allow_download) {
|
const GURL& url, bool allow_download) {
|
||||||
|
|
||||||
if (browser_.get() && info.headers.get()) {
|
if (browser_.get() && info.headers.get()) {
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
CefRefPtr<CefRequestHandler> handler;
|
||||||
|
if (client.get())
|
||||||
|
handler = client->GetRequestHandler();
|
||||||
|
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
std::string content_disposition;
|
std::string content_disposition;
|
||||||
info.headers->GetNormalizedHeader("Content-Disposition",
|
info.headers->GetNormalizedHeader("Content-Disposition",
|
||||||
@ -206,9 +210,9 @@ class RequestProxy : public net::URLRequest::Delegate,
|
|||||||
string16 filename = net::GetSuggestedFilename(url,
|
string16 filename = net::GetSuggestedFilename(url,
|
||||||
content_disposition, info.charset, ASCIIToUTF16("download"));
|
content_disposition, info.charset, ASCIIToUTF16("download"));
|
||||||
CefRefPtr<CefDownloadHandler> dl_handler;
|
CefRefPtr<CefDownloadHandler> dl_handler;
|
||||||
if (handler->HandleDownloadResponse(browser_, info.mime_type,
|
if (handler->GetDownloadHandler(browser_, info.mime_type,
|
||||||
filename, info.content_length, dl_handler) ==
|
filename, info.content_length,
|
||||||
RV_CONTINUE) {
|
dl_handler)) {
|
||||||
download_handler_ = dl_handler;
|
download_handler_ = dl_handler;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -285,7 +289,11 @@ class RequestProxy : public net::URLRequest::Delegate,
|
|||||||
bool handled = false;
|
bool handled = false;
|
||||||
|
|
||||||
if (browser_.get()) {
|
if (browser_.get()) {
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
CefRefPtr<CefRequestHandler> handler;
|
||||||
|
if (client.get())
|
||||||
|
handler = client->GetRequestHandler();
|
||||||
|
|
||||||
if(handler.get()) {
|
if(handler.get()) {
|
||||||
// Build the request object for passing to the handler
|
// Build the request object for passing to the handler
|
||||||
CefRefPtr<CefRequest> request(new CefRequestImpl());
|
CefRefPtr<CefRequest> request(new CefRequestImpl());
|
||||||
@ -317,10 +325,9 @@ class RequestProxy : public net::URLRequest::Delegate,
|
|||||||
CefRefPtr<CefStreamReader> resourceStream;
|
CefRefPtr<CefStreamReader> resourceStream;
|
||||||
CefRefPtr<CefResponse> response(new CefResponseImpl());
|
CefRefPtr<CefResponse> response(new CefResponseImpl());
|
||||||
|
|
||||||
CefHandler::RetVal rv = handler->HandleBeforeResourceLoad(
|
handled = handler->OnBeforeResourceLoad(browser_, request, redirectUrl,
|
||||||
browser_, request, redirectUrl, resourceStream, response,
|
resourceStream, response, loadFlags);
|
||||||
loadFlags);
|
if (!handled) {
|
||||||
|
|
||||||
// Observe URL from request.
|
// Observe URL from request.
|
||||||
const std::string requestUrl(request->GetURL());
|
const std::string requestUrl(request->GetURL());
|
||||||
if(requestUrl != originalUrl) {
|
if(requestUrl != originalUrl) {
|
||||||
@ -350,15 +357,17 @@ class RequestProxy : public net::URLRequest::Delegate,
|
|||||||
params->upload = new net::UploadData();
|
params->upload = new net::UploadData();
|
||||||
static_cast<CefPostDataImpl*>(postData.get())->Get(*params->upload);
|
static_cast<CefPostDataImpl*>(postData.get())->Get(*params->upload);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(rv == RV_HANDLED) {
|
if (handled) {
|
||||||
// cancel the resource load
|
// cancel the resource load
|
||||||
handled = true;
|
|
||||||
OnCompletedRequest(
|
OnCompletedRequest(
|
||||||
URLRequestStatus(URLRequestStatus::CANCELED, net::ERR_ABORTED),
|
URLRequestStatus(URLRequestStatus::CANCELED, net::ERR_ABORTED),
|
||||||
std::string(), base::Time());
|
std::string(), base::Time());
|
||||||
} else if (!redirectUrl.empty()) {
|
} else if (!redirectUrl.empty()) {
|
||||||
// redirect to the specified URL
|
// redirect to the specified URL
|
||||||
|
handled = true;
|
||||||
|
|
||||||
params->url = GURL(std::string(redirectUrl));
|
params->url = GURL(std::string(redirectUrl));
|
||||||
ResourceResponseInfo info;
|
ResourceResponseInfo info;
|
||||||
bool defer_redirect;
|
bool defer_redirect;
|
||||||
@ -406,13 +415,11 @@ class RequestProxy : public net::URLRequest::Delegate,
|
|||||||
if (!handled && ResourceType::IsFrame(params->request_type) &&
|
if (!handled && ResourceType::IsFrame(params->request_type) &&
|
||||||
!net::URLRequest::IsHandledProtocol(params->url.scheme())) {
|
!net::URLRequest::IsHandledProtocol(params->url.scheme())) {
|
||||||
bool allow_os_execution = false;
|
bool allow_os_execution = false;
|
||||||
CefHandler::RetVal rv = handler->HandleProtocolExecution(browser_,
|
handled = handler->OnProtocolExecution(browser_, params->url.spec(),
|
||||||
params->url.spec(), allow_os_execution);
|
allow_os_execution);
|
||||||
if (rv == RV_CONTINUE && allow_os_execution &&
|
if (!handled && allow_os_execution &&
|
||||||
ExternalProtocolHandler::HandleExternalProtocol(params->url)) {
|
ExternalProtocolHandler::HandleExternalProtocol(params->url)) {
|
||||||
handled = true;
|
handled = true;
|
||||||
} else if(rv == RV_HANDLED) {
|
|
||||||
handled = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handled) {
|
if (handled) {
|
||||||
@ -599,19 +606,21 @@ class RequestProxy : public net::URLRequest::Delegate,
|
|||||||
virtual void OnAuthRequired(net::URLRequest* request,
|
virtual void OnAuthRequired(net::URLRequest* request,
|
||||||
net::AuthChallengeInfo* auth_info) {
|
net::AuthChallengeInfo* auth_info) {
|
||||||
if (browser_.get()) {
|
if (browser_.get()) {
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
|
||||||
if(handler.get()) {
|
if(handler.get()) {
|
||||||
CefString username, password;
|
CefString username, password;
|
||||||
CefHandler::RetVal rv = handler->HandleAuthenticationRequest(
|
if (handler->GetAuthCredentials(browser_, auth_info->is_proxy,
|
||||||
browser_, auth_info->is_proxy,
|
auth_info->host_and_port,
|
||||||
auth_info->host_and_port, auth_info->realm,
|
auth_info->realm, auth_info->scheme,
|
||||||
auth_info->scheme, username, password);
|
username, password)) {
|
||||||
if (rv == RV_HANDLED) {
|
|
||||||
request->SetAuth(username, password);
|
request->SetAuth(username, password);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
request->CancelAuth();
|
request->CancelAuth();
|
||||||
}
|
}
|
||||||
|
@ -95,78 +95,78 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||||||
WebKit::shutdown();
|
WebKit::shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual WebKit::WebMimeRegistry* mimeRegistry() {
|
virtual WebKit::WebMimeRegistry* mimeRegistry() OVERRIDE {
|
||||||
return &mime_registry_;
|
return &mime_registry_;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebKit::WebClipboard* clipboard() {
|
virtual WebKit::WebClipboard* clipboard() OVERRIDE {
|
||||||
return &clipboard_;
|
return &clipboard_;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual WebKit::WebFileUtilities* fileUtilities() {
|
virtual WebKit::WebFileUtilities* fileUtilities() OVERRIDE {
|
||||||
return &file_utilities_;
|
return &file_utilities_;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual WebKit::WebSandboxSupport* sandboxSupport() {
|
virtual WebKit::WebSandboxSupport* sandboxSupport() OVERRIDE {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual WebKit::WebBlobRegistry* blobRegistry() {
|
virtual WebKit::WebBlobRegistry* blobRegistry() OVERRIDE {
|
||||||
return blob_registry_.get();
|
return blob_registry_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual WebKit::WebCookieJar* cookieJar() {
|
virtual WebKit::WebCookieJar* cookieJar() OVERRIDE {
|
||||||
return &cookie_jar_;
|
return &cookie_jar_;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual WebKit::WebFileSystem* fileSystem() {
|
virtual WebKit::WebFileSystem* fileSystem() OVERRIDE {
|
||||||
return &file_system_;
|
return &file_system_;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool sandboxEnabled() {
|
virtual bool sandboxEnabled() OVERRIDE {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual WebKit::WebKitClient::FileHandle databaseOpenFile(
|
virtual WebKit::WebKitClient::FileHandle databaseOpenFile(
|
||||||
const WebKit::WebString& vfs_file_name, int desired_flags) {
|
const WebKit::WebString& vfs_file_name, int desired_flags) OVERRIDE {
|
||||||
return BrowserDatabaseSystem::GetInstance()->OpenFile(
|
return BrowserDatabaseSystem::GetInstance()->OpenFile(
|
||||||
vfs_file_name, desired_flags);
|
vfs_file_name, desired_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name,
|
virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name,
|
||||||
bool sync_dir) {
|
bool sync_dir) OVERRIDE {
|
||||||
return BrowserDatabaseSystem::GetInstance()->DeleteFile(
|
return BrowserDatabaseSystem::GetInstance()->DeleteFile(
|
||||||
vfs_file_name, sync_dir);
|
vfs_file_name, sync_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual long databaseGetFileAttributes(
|
virtual long databaseGetFileAttributes(
|
||||||
const WebKit::WebString& vfs_file_name) {
|
const WebKit::WebString& vfs_file_name) OVERRIDE {
|
||||||
return BrowserDatabaseSystem::GetInstance()->GetFileAttributes(
|
return BrowserDatabaseSystem::GetInstance()->GetFileAttributes(
|
||||||
vfs_file_name);
|
vfs_file_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual long long databaseGetFileSize(
|
virtual long long databaseGetFileSize(
|
||||||
const WebKit::WebString& vfs_file_name) {
|
const WebKit::WebString& vfs_file_name) OVERRIDE {
|
||||||
return BrowserDatabaseSystem::GetInstance()->GetFileSize(vfs_file_name);
|
return BrowserDatabaseSystem::GetInstance()->GetFileSize(vfs_file_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual unsigned long long visitedLinkHash(const char* canonicalURL,
|
virtual unsigned long long visitedLinkHash(const char* canonicalURL,
|
||||||
size_t length) {
|
size_t length) OVERRIDE {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool isLinkVisited(unsigned long long linkHash) {
|
virtual bool isLinkVisited(unsigned long long linkHash) OVERRIDE {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual WebKit::WebMessagePortChannel* createMessagePortChannel() {
|
virtual WebKit::WebMessagePortChannel* createMessagePortChannel() OVERRIDE {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void prefetchHostName(const WebKit::WebString&) {
|
virtual void prefetchHostName(const WebKit::WebString&) OVERRIDE {
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual WebKit::WebData loadResource(const char* name) {
|
virtual WebKit::WebData loadResource(const char* name) OVERRIDE {
|
||||||
if (!strcmp(name, "deleteButton")) {
|
if (!strcmp(name, "deleteButton")) {
|
||||||
// Create a red 30x30 square.
|
// Create a red 30x30 square.
|
||||||
const char red_square[] =
|
const char red_square[] =
|
||||||
@ -186,12 +186,12 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||||||
return webkit_glue::WebKitClientImpl::loadResource(name);
|
return webkit_glue::WebKitClientImpl::loadResource(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual WebKit::WebString defaultLocale() {
|
virtual WebKit::WebString defaultLocale() OVERRIDE {
|
||||||
return ASCIIToUTF16("en-US");
|
return ASCIIToUTF16("en-US");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual WebKit::WebStorageNamespace* createLocalStorageNamespace(
|
virtual WebKit::WebStorageNamespace* createLocalStorageNamespace(
|
||||||
const WebKit::WebString& path, unsigned quota) {
|
const WebKit::WebString& path, unsigned quota) OVERRIDE {
|
||||||
if (BrowserWebStorageNamespaceImpl::IsStorageActive()) {
|
if (BrowserWebStorageNamespaceImpl::IsStorageActive()) {
|
||||||
// Use the localStorage implementation that writes data to disk.
|
// Use the localStorage implementation that writes data to disk.
|
||||||
return new BrowserWebStorageNamespaceImpl(DOM_STORAGE_LOCAL);
|
return new BrowserWebStorageNamespaceImpl(DOM_STORAGE_LOCAL);
|
||||||
@ -205,18 +205,18 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||||||
void dispatchStorageEvent(const WebKit::WebString& key,
|
void dispatchStorageEvent(const WebKit::WebString& key,
|
||||||
const WebKit::WebString& old_value, const WebKit::WebString& new_value,
|
const WebKit::WebString& old_value, const WebKit::WebString& new_value,
|
||||||
const WebKit::WebString& origin, const WebKit::WebURL& url,
|
const WebKit::WebString& origin, const WebKit::WebURL& url,
|
||||||
bool is_local_storage) {
|
bool is_local_storage) OVERRIDE {
|
||||||
// The event is dispatched by the proxy.
|
// The event is dispatched by the proxy.
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual WebKit::WebIDBFactory* idbFactory() {
|
virtual WebKit::WebIDBFactory* idbFactory() OVERRIDE {
|
||||||
return WebKit::WebIDBFactory::create();
|
return WebKit::WebIDBFactory::create();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void createIDBKeysFromSerializedValuesAndKeyPath(
|
virtual void createIDBKeysFromSerializedValuesAndKeyPath(
|
||||||
const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values,
|
const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values,
|
||||||
const WebKit::WebString& keyPath,
|
const WebKit::WebString& keyPath,
|
||||||
WebKit::WebVector<WebKit::WebIDBKey>& keys_out) {
|
WebKit::WebVector<WebKit::WebIDBKey>& keys_out) OVERRIDE {
|
||||||
WebKit::WebVector<WebKit::WebIDBKey> keys(values.size());
|
WebKit::WebVector<WebKit::WebIDBKey> keys(values.size());
|
||||||
for (size_t i = 0; i < values.size(); ++i) {
|
for (size_t i = 0; i < values.size(); ++i) {
|
||||||
keys[i] = WebKit::WebIDBKey::createFromValueAndKeyPath(
|
keys[i] = WebKit::WebIDBKey::createFromValueAndKeyPath(
|
||||||
@ -228,18 +228,18 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||||||
virtual WebKit::WebSerializedScriptValue injectIDBKeyIntoSerializedValue(
|
virtual WebKit::WebSerializedScriptValue injectIDBKeyIntoSerializedValue(
|
||||||
const WebKit::WebIDBKey& key,
|
const WebKit::WebIDBKey& key,
|
||||||
const WebKit::WebSerializedScriptValue& value,
|
const WebKit::WebSerializedScriptValue& value,
|
||||||
const WebKit::WebString& keyPath) {
|
const WebKit::WebString& keyPath) OVERRIDE {
|
||||||
return WebKit::WebIDBKey::injectIDBKeyIntoSerializedValue(
|
return WebKit::WebIDBKey::injectIDBKeyIntoSerializedValue(
|
||||||
key, value, WebKit::WebIDBKeyPath::create(keyPath));
|
key, value, WebKit::WebIDBKeyPath::create(keyPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D() {
|
virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D() OVERRIDE {
|
||||||
gfx::BindSkiaToInProcessGL();
|
gfx::BindSkiaToInProcessGL();
|
||||||
return new webkit::gpu::WebGraphicsContext3DInProcessImpl();
|
return new webkit::gpu::WebGraphicsContext3DInProcessImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
WebKit::WebString queryLocalizedString(
|
WebKit::WebString queryLocalizedString(
|
||||||
WebKit::WebLocalizedString::Name name) {
|
WebKit::WebLocalizedString::Name name) OVERRIDE {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case WebKit::WebLocalizedString::ValidationValueMissing:
|
case WebKit::WebLocalizedString::ValidationValueMissing:
|
||||||
case WebKit::WebLocalizedString::ValidationValueMissingForCheckbox:
|
case WebKit::WebLocalizedString::ValidationValueMissingForCheckbox:
|
||||||
@ -269,7 +269,8 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
WebKit::WebString queryLocalizedString(
|
WebKit::WebString queryLocalizedString(
|
||||||
WebKit::WebLocalizedString::Name name, const WebKit::WebString& value) {
|
WebKit::WebLocalizedString::Name name, const WebKit::WebString& value)
|
||||||
|
OVERRIDE {
|
||||||
if (name == WebKit::WebLocalizedString::ValidationRangeUnderflow)
|
if (name == WebKit::WebLocalizedString::ValidationRangeUnderflow)
|
||||||
return ASCIIToUTF16("range underflow");
|
return ASCIIToUTF16("range underflow");
|
||||||
if (name == WebKit::WebLocalizedString::ValidationRangeOverflow)
|
if (name == WebKit::WebLocalizedString::ValidationRangeOverflow)
|
||||||
@ -280,7 +281,7 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||||||
WebKit::WebString queryLocalizedString(
|
WebKit::WebString queryLocalizedString(
|
||||||
WebKit::WebLocalizedString::Name name,
|
WebKit::WebLocalizedString::Name name,
|
||||||
const WebKit::WebString& value1,
|
const WebKit::WebString& value1,
|
||||||
const WebKit::WebString& value2) {
|
const WebKit::WebString& value2) OVERRIDE {
|
||||||
if (name == WebKit::WebLocalizedString::ValidationTooLong)
|
if (name == WebKit::WebLocalizedString::ValidationTooLong)
|
||||||
return ASCIIToUTF16("too long");
|
return ASCIIToUTF16("too long");
|
||||||
if (name == WebKit::WebLocalizedString::ValidationStepMismatch)
|
if (name == WebKit::WebLocalizedString::ValidationStepMismatch)
|
||||||
|
@ -197,14 +197,17 @@ void BrowserWebViewDelegate::didAddMessageToConsole(
|
|||||||
std::string messageStr = message.text.utf8();
|
std::string messageStr = message.text.utf8();
|
||||||
std::string sourceStr = source_name.utf8();
|
std::string sourceStr = source_name.utf8();
|
||||||
|
|
||||||
CefHandler::RetVal rv = RV_CONTINUE;
|
bool handled = false;
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefDisplayHandler> handler = client->GetDisplayHandler();
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
rv = handler->HandleConsoleMessage(browser_, messageStr, sourceStr,
|
handled = handler->OnConsoleMessage(browser_, messageStr, sourceStr,
|
||||||
source_line);
|
source_line);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(rv == RV_CONTINUE) {
|
if(!handled) {
|
||||||
logging::LogMessage("CONSOLE", 0).stream() << "\""
|
logging::LogMessage("CONSOLE", 0).stream() << "\""
|
||||||
<< messageStr
|
<< messageStr
|
||||||
<< ",\" source: "
|
<< ",\" source: "
|
||||||
@ -269,8 +272,13 @@ bool BrowserWebViewDelegate::isSelectTrailingWhitespaceEnabled() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool BrowserWebViewDelegate::handleCurrentKeyboardEvent() {
|
bool BrowserWebViewDelegate::handleCurrentKeyboardEvent() {
|
||||||
CefHandler::RetVal rv = RV_CONTINUE;
|
bool handled = false;
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
|
||||||
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
CefRefPtr<CefKeyboardHandler> handler;
|
||||||
|
if (client.get())
|
||||||
|
handler = client->GetKeyboardHandler();
|
||||||
|
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
WebWidgetHost* host = GetWidgetHost();
|
WebWidgetHost* host = GetWidgetHost();
|
||||||
if (host) {
|
if (host) {
|
||||||
@ -278,17 +286,17 @@ bool BrowserWebViewDelegate::handleCurrentKeyboardEvent() {
|
|||||||
switch (event.type)
|
switch (event.type)
|
||||||
{
|
{
|
||||||
case WebKeyboardEvent::RawKeyDown:
|
case WebKeyboardEvent::RawKeyDown:
|
||||||
rv = handler->HandleKeyEvent(browser_,
|
handled = handler->OnKeyEvent(browser_,
|
||||||
KEYEVENT_RAWKEYDOWN, event.windowsKeyCode,
|
KEYEVENT_RAWKEYDOWN, event.windowsKeyCode,
|
||||||
event.modifiers, event.isSystemKey?true:false);
|
event.modifiers, event.isSystemKey?true:false);
|
||||||
break;
|
break;
|
||||||
case WebKeyboardEvent::KeyUp:
|
case WebKeyboardEvent::KeyUp:
|
||||||
rv = handler->HandleKeyEvent(browser_,
|
handled = handler->OnKeyEvent(browser_,
|
||||||
KEYEVENT_KEYUP, event.windowsKeyCode,
|
KEYEVENT_KEYUP, event.windowsKeyCode,
|
||||||
event.modifiers, event.isSystemKey?true:false);
|
event.modifiers, event.isSystemKey?true:false);
|
||||||
break;
|
break;
|
||||||
case WebKeyboardEvent::Char:
|
case WebKeyboardEvent::Char:
|
||||||
rv = handler->HandleKeyEvent(browser_,
|
handled = handler->OnKeyEvent(browser_,
|
||||||
KEYEVENT_CHAR, event.windowsKeyCode,
|
KEYEVENT_CHAR, event.windowsKeyCode,
|
||||||
event.modifiers, event.isSystemKey?true:false);
|
event.modifiers, event.isSystemKey?true:false);
|
||||||
break;
|
break;
|
||||||
@ -297,7 +305,7 @@ bool BrowserWebViewDelegate::handleCurrentKeyboardEvent() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rv == RV_HANDLED)
|
if (handled)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (edit_command_name_.empty())
|
if (edit_command_name_.empty())
|
||||||
@ -337,28 +345,38 @@ bool BrowserWebViewDelegate::runFileChooser(
|
|||||||
|
|
||||||
void BrowserWebViewDelegate::runModalAlertDialog(
|
void BrowserWebViewDelegate::runModalAlertDialog(
|
||||||
WebFrame* frame, const WebString& message) {
|
WebFrame* frame, const WebString& message) {
|
||||||
CefHandler::RetVal rv = RV_CONTINUE;
|
|
||||||
CefString messageStr = string16(message);
|
CefString messageStr = string16(message);
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
bool handled = false;
|
||||||
|
|
||||||
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
CefRefPtr<CefJSDialogHandler> handler;
|
||||||
|
if (client.get())
|
||||||
|
handler = client->GetJSDialogHandler();
|
||||||
|
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
rv = handler->HandleJSAlert(browser_, browser_->UIT_GetCefFrame(frame),
|
handled = handler->OnJSAlert(browser_, browser_->UIT_GetCefFrame(frame),
|
||||||
messageStr);
|
messageStr);
|
||||||
}
|
}
|
||||||
if(rv != RV_HANDLED)
|
if (!handled)
|
||||||
ShowJavaScriptAlert(frame, messageStr);
|
ShowJavaScriptAlert(frame, messageStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BrowserWebViewDelegate::runModalConfirmDialog(
|
bool BrowserWebViewDelegate::runModalConfirmDialog(
|
||||||
WebFrame* frame, const WebString& message) {
|
WebFrame* frame, const WebString& message) {
|
||||||
CefHandler::RetVal rv = RV_CONTINUE;
|
|
||||||
CefString messageStr = string16(message);
|
CefString messageStr = string16(message);
|
||||||
bool retval = false;
|
bool retval = false;
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
bool handled = false;
|
||||||
|
|
||||||
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
CefRefPtr<CefJSDialogHandler> handler;
|
||||||
|
if (client.get())
|
||||||
|
handler = client->GetJSDialogHandler();
|
||||||
|
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
rv = handler->HandleJSConfirm(browser_, browser_->UIT_GetCefFrame(frame),
|
handled = handler->OnJSConfirm(browser_, browser_->UIT_GetCefFrame(frame),
|
||||||
messageStr, retval);
|
messageStr, retval);
|
||||||
}
|
}
|
||||||
if(rv != RV_HANDLED)
|
if (!handled)
|
||||||
retval = ShowJavaScriptConfirm(frame, messageStr);
|
retval = ShowJavaScriptConfirm(frame, messageStr);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@ -372,14 +390,19 @@ bool BrowserWebViewDelegate::runModalPromptDialog(
|
|||||||
if(actual_value)
|
if(actual_value)
|
||||||
actualValueStr = string16(*actual_value);
|
actualValueStr = string16(*actual_value);
|
||||||
|
|
||||||
CefHandler::RetVal rv = RV_CONTINUE;
|
|
||||||
bool retval = false;
|
bool retval = false;
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
bool handled = false;
|
||||||
|
|
||||||
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
CefRefPtr<CefJSDialogHandler> handler;
|
||||||
|
if (client.get())
|
||||||
|
handler = client->GetJSDialogHandler();
|
||||||
|
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
rv = handler->HandleJSPrompt(browser_, browser_->UIT_GetCefFrame(frame),
|
handled = handler->OnJSPrompt(browser_, browser_->UIT_GetCefFrame(frame),
|
||||||
messageStr, defaultValueStr, retval, actualValueStr);
|
messageStr, defaultValueStr, retval, actualValueStr);
|
||||||
}
|
}
|
||||||
if(rv != RV_HANDLED) {
|
if (!handled) {
|
||||||
retval = ShowJavaScriptPrompt(frame, messageStr, defaultValueStr,
|
retval = ShowJavaScriptPrompt(frame, messageStr, defaultValueStr,
|
||||||
&actualValueStr);
|
&actualValueStr);
|
||||||
}
|
}
|
||||||
@ -410,11 +433,16 @@ void BrowserWebViewDelegate::setToolTipText(
|
|||||||
const WebString& text, WebTextDirection hint)
|
const WebString& text, WebTextDirection hint)
|
||||||
{
|
{
|
||||||
CefString tooltipStr = string16(text);
|
CefString tooltipStr = string16(text);
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
bool handled = false;
|
||||||
if(handler.get() && handler->HandleTooltip(browser_, tooltipStr)
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
== RV_CONTINUE){
|
if (client.get()) {
|
||||||
GetWidgetHost()->SetTooltipText(tooltipStr);
|
CefRefPtr<CefDisplayHandler> handler = client->GetDisplayHandler();
|
||||||
|
if (handler.get())
|
||||||
|
handled = handler->OnTooltip(browser_, tooltipStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!handled)
|
||||||
|
GetWidgetHost()->SetTooltipText(tooltipStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserWebViewDelegate::startDragging(
|
void BrowserWebViewDelegate::startDragging(
|
||||||
@ -439,18 +467,24 @@ void BrowserWebViewDelegate::startDragging(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BrowserWebViewDelegate::focusNext() {
|
void BrowserWebViewDelegate::focusNext() {
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefFocusHandler> handler = client->GetFocusHandler();
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
// Notify the handler that it should take a focus
|
// Notify the handler that it should take a focus
|
||||||
handler->HandleTakeFocus(browser_, false);
|
handler->OnTakeFocus(browser_, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserWebViewDelegate::focusPrevious() {
|
void BrowserWebViewDelegate::focusPrevious() {
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefFocusHandler> handler = client->GetFocusHandler();
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
// Notify the handler that it should take a focus
|
// Notify the handler that it should take a focus
|
||||||
handler->HandleTakeFocus(browser_, true);
|
handler->OnTakeFocus(browser_, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -502,8 +536,15 @@ void BrowserWebViewDelegate::scheduleAnimation() {
|
|||||||
|
|
||||||
void BrowserWebViewDelegate::didFocus() {
|
void BrowserWebViewDelegate::didFocus() {
|
||||||
if (WebWidgetHost* host = GetWidgetHost()) {
|
if (WebWidgetHost* host = GetWidgetHost()) {
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
bool handled = false;
|
||||||
if (handler.get() && handler->HandleSetFocus(browser_, true) == RV_CONTINUE)
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefFocusHandler> handler = client->GetFocusHandler();
|
||||||
|
if (handler.get())
|
||||||
|
handled = handler->OnSetFocus(browser_, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!handled)
|
||||||
browser_->UIT_SetFocus(host, true);
|
browser_->UIT_SetFocus(host, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -527,16 +568,19 @@ WebScreenInfo BrowserWebViewDelegate::screenInfo() {
|
|||||||
|
|
||||||
if (browser_->IsWindowRenderingDisabled()) {
|
if (browser_->IsWindowRenderingDisabled()) {
|
||||||
// Retrieve the screen rectangle from the handler.
|
// Retrieve the screen rectangle from the handler.
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefRenderHandler> handler = client->GetRenderHandler();
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
CefRect rect(info.rect.x, info.rect.y, info.rect.width,
|
CefRect rect(info.rect.x, info.rect.y, info.rect.width,
|
||||||
info.rect.height);
|
info.rect.height);
|
||||||
if (handler->HandleGetRect(browser_, true, rect) == RV_CONTINUE) {
|
if (handler->GetScreenRect(browser_, rect)) {
|
||||||
info.rect = WebRect(rect.x, rect.y, rect.width, rect.height);
|
info.rect = WebRect(rect.x, rect.y, rect.width, rect.height);
|
||||||
info.availableRect = info.rect;
|
info.availableRect = info.rect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
@ -639,7 +683,7 @@ void BrowserWebViewDelegate::loadURLExternally(
|
|||||||
WebNavigationPolicy policy) {
|
WebNavigationPolicy policy) {
|
||||||
DCHECK_NE(policy, WebKit::WebNavigationPolicyCurrentTab);
|
DCHECK_NE(policy, WebKit::WebNavigationPolicyCurrentTab);
|
||||||
std::string url = request.url().spec().data();
|
std::string url = request.url().spec().data();
|
||||||
CefRefPtr<CefBrowser> newBrowser =
|
CefRefPtr<CefBrowserImpl> newBrowser =
|
||||||
browser_->UIT_CreatePopupWindow(url, CefPopupFeatures());
|
browser_->UIT_CreatePopupWindow(url, CefPopupFeatures());
|
||||||
if (newBrowser.get() && !url.empty())
|
if (newBrowser.get() && !url.empty())
|
||||||
newBrowser->GetMainFrame()->LoadURL(url);
|
newBrowser->GetMainFrame()->LoadURL(url);
|
||||||
@ -649,7 +693,9 @@ WebNavigationPolicy BrowserWebViewDelegate::decidePolicyForNavigation(
|
|||||||
WebFrame* frame, const WebURLRequest& request,
|
WebFrame* frame, const WebURLRequest& request,
|
||||||
WebNavigationType type, const WebNode& originating_node,
|
WebNavigationType type, const WebNode& originating_node,
|
||||||
WebNavigationPolicy default_policy, bool is_redirect) {
|
WebNavigationPolicy default_policy, bool is_redirect) {
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
// Gather browse request information
|
// Gather browse request information
|
||||||
CefRefPtr<CefRequest> req(CefRequest::CreateRequest());
|
CefRefPtr<CefRequest> req(CefRequest::CreateRequest());
|
||||||
@ -674,12 +720,13 @@ WebNavigationPolicy BrowserWebViewDelegate::decidePolicyForNavigation(
|
|||||||
static_cast<CefRequestImpl*>(req.get())->SetHeaderMap(map);
|
static_cast<CefRequestImpl*>(req.get())->SetHeaderMap(map);
|
||||||
|
|
||||||
// Notify the handler of a browse request
|
// Notify the handler of a browse request
|
||||||
CefHandler::RetVal rv = handler->HandleBeforeBrowse(browser_,
|
bool handled = handler->OnBeforeBrowse(browser_,
|
||||||
browser_->UIT_GetCefFrame(frame), req, (CefHandler::NavType)type,
|
browser_->UIT_GetCefFrame(frame), req, (cef_handler_navtype_t)type,
|
||||||
is_redirect);
|
is_redirect);
|
||||||
if(rv == RV_HANDLED)
|
if(handled)
|
||||||
return WebKit::WebNavigationPolicyIgnore;
|
return WebKit::WebNavigationPolicyIgnore;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WebNavigationPolicy result;
|
WebNavigationPolicy result;
|
||||||
if (policy_delegate_enabled_) {
|
if (policy_delegate_enabled_) {
|
||||||
@ -748,17 +795,21 @@ void BrowserWebViewDelegate::didFailProvisionalLoad(
|
|||||||
std::string error_text;
|
std::string error_text;
|
||||||
CefString errorStr;
|
CefString errorStr;
|
||||||
|
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
bool handled = false;
|
||||||
CefHandler::RetVal rv = RV_CONTINUE;
|
|
||||||
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefLoadHandler> handler = client->GetLoadHandler();
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
// give the handler an opportunity to generate a custom error message
|
// give the handler an opportunity to generate a custom error message
|
||||||
rv = handler->HandleLoadError(browser_,
|
handled = handler->OnLoadError(browser_,
|
||||||
browser_->UIT_GetCefFrame(frame),
|
browser_->UIT_GetCefFrame(frame),
|
||||||
static_cast<CefHandler::ErrorCode>(error.reason),
|
static_cast<cef_handler_errorcode_t>(error.reason),
|
||||||
std::string(failed_ds->request().url().spec().data()), errorStr);
|
std::string(failed_ds->request().url().spec().data()), errorStr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(rv == RV_HANDLED && !errorStr.empty()) {
|
if(handled && !errorStr.empty()) {
|
||||||
error_text = errorStr;
|
error_text = errorStr;
|
||||||
} else {
|
} else {
|
||||||
error_text = StringPrintf("Error %d when loading url %s",
|
error_text = StringPrintf("Error %d when loading url %s",
|
||||||
@ -785,10 +836,13 @@ void BrowserWebViewDelegate::didCommitProvisionalLoad(
|
|||||||
|
|
||||||
UpdateForCommittedLoad(frame, is_new_navigation);
|
UpdateForCommittedLoad(frame, is_new_navigation);
|
||||||
|
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefLoadHandler> handler = client->GetLoadHandler();
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
// Notify the handler that loading has started.
|
// Notify the handler that loading has started.
|
||||||
handler->HandleLoadStart(browser_, browser_->UIT_GetCefFrame(frame));
|
handler->OnLoadStart(browser_, browser_->UIT_GetCefFrame(frame));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply zoom settings only on top-level frames.
|
// Apply zoom settings only on top-level frames.
|
||||||
@ -802,7 +856,9 @@ void BrowserWebViewDelegate::didCommitProvisionalLoad(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BrowserWebViewDelegate::didClearWindowObject(WebFrame* frame) {
|
void BrowserWebViewDelegate::didClearWindowObject(WebFrame* frame) {
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefJSBindingHandler> handler = client->GetJSBindingHandler();
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
v8::HandleScope handle_scope;
|
v8::HandleScope handle_scope;
|
||||||
v8::Handle<v8::Context> context = webkit_glue::GetV8Context(frame);
|
v8::Handle<v8::Context> context = webkit_glue::GetV8Context(frame);
|
||||||
@ -813,7 +869,8 @@ void BrowserWebViewDelegate::didClearWindowObject(WebFrame* frame) {
|
|||||||
|
|
||||||
CefRefPtr<CefFrame> cframe(browser_->UIT_GetCefFrame(frame));
|
CefRefPtr<CefFrame> cframe(browser_->UIT_GetCefFrame(frame));
|
||||||
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(context->Global());
|
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(context->Global());
|
||||||
handler->HandleJSBinding(browser_, cframe, object);
|
handler->OnJSBinding(browser_, cframe, object);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -823,10 +880,13 @@ void BrowserWebViewDelegate::didReceiveTitle(
|
|||||||
if (is_main_frame) {
|
if (is_main_frame) {
|
||||||
CefString titleStr = string16(title);
|
CefString titleStr = string16(title);
|
||||||
browser_->UIT_SetTitle(titleStr);
|
browser_->UIT_SetTitle(titleStr);
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefDisplayHandler> handler = client->GetDisplayHandler();
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
// Notify the handler of a page title change
|
// Notify the handler of a page title change
|
||||||
handler->HandleTitleChange(browser_, titleStr);
|
handler->OnTitleChange(browser_, titleStr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -955,18 +1015,21 @@ void BrowserWebViewDelegate::WaitForPolicyDelegate() {
|
|||||||
// Private methods -----------------------------------------------------------
|
// Private methods -----------------------------------------------------------
|
||||||
|
|
||||||
void BrowserWebViewDelegate::ShowStatus(const WebString& text,
|
void BrowserWebViewDelegate::ShowStatus(const WebString& text,
|
||||||
CefHandler::StatusType type)
|
cef_handler_statustype_t type)
|
||||||
{
|
{
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefDisplayHandler> handler = client->GetDisplayHandler();
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
CefString textStr = string16(text);
|
CefString textStr = string16(text);
|
||||||
handler->HandleStatus(browser_, textStr, type);
|
handler->OnStatusMessage(browser_, textStr, type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserWebViewDelegate::LocationChangeDone(WebFrame* frame) {
|
void BrowserWebViewDelegate::LocationChangeDone(WebFrame* frame) {
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
if (!handler.get())
|
if (!client.get())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool is_main_frame = (frame->parent() == 0);
|
bool is_main_frame = (frame->parent() == 0);
|
||||||
@ -975,15 +1038,20 @@ void BrowserWebViewDelegate::LocationChangeDone(WebFrame* frame) {
|
|||||||
if (title.empty()) {
|
if (title.empty()) {
|
||||||
// No title was provided by the page, so send a blank string to the
|
// No title was provided by the page, so send a blank string to the
|
||||||
// client.
|
// client.
|
||||||
handler->HandleTitleChange(browser_, title);
|
CefRefPtr<CefDisplayHandler> handler = client->GetDisplayHandler();
|
||||||
|
if (handler.get())
|
||||||
|
handler->OnTitleChange(browser_, title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CefRefPtr<CefLoadHandler> handler = client->GetLoadHandler();
|
||||||
|
if (handler.get()) {
|
||||||
// Notify the handler that loading has ended.
|
// Notify the handler that loading has ended.
|
||||||
int httpStatusCode = frame->dataSource()->response().httpStatusCode();
|
int httpStatusCode = frame->dataSource()->response().httpStatusCode();
|
||||||
handler->HandleLoadEnd(browser_, browser_->UIT_GetCefFrame(frame),
|
handler->OnLoadEnd(browser_, browser_->UIT_GetCefFrame(frame),
|
||||||
httpStatusCode);
|
httpStatusCode);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WebWidgetHost* BrowserWebViewDelegate::GetWidgetHost() {
|
WebWidgetHost* BrowserWebViewDelegate::GetWidgetHost() {
|
||||||
if (this == browser_->UIT_GetWebViewDelegate())
|
if (this == browser_->UIT_GetWebViewDelegate())
|
||||||
@ -1043,13 +1111,15 @@ void BrowserWebViewDelegate::UpdateURL(WebFrame* frame) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool is_main_frame = (frame->parent() == 0);
|
bool is_main_frame = (frame->parent() == 0);
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
|
||||||
if (is_main_frame && handler.get()) {
|
if (is_main_frame && client.get()) {
|
||||||
|
CefRefPtr<CefDisplayHandler> handler = client->GetDisplayHandler();
|
||||||
|
if (handler.get()) {
|
||||||
// Notify the handler of an address change
|
// Notify the handler of an address change
|
||||||
std::string url = std::string(entry->GetURL().spec().c_str());
|
std::string url = std::string(entry->GetURL().spec().c_str());
|
||||||
handler->HandleAddressChange(browser_, browser_->UIT_GetCefFrame(frame),
|
handler->OnAddressChange(browser_, browser_->UIT_GetCefFrame(frame), url);
|
||||||
url);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const WebHistoryItem& history_item = frame->currentHistoryItem();
|
const WebHistoryItem& history_item = frame->currentHistoryItem();
|
||||||
@ -1070,10 +1140,10 @@ void BrowserWebViewDelegate::UpdateURL(WebFrame* frame) {
|
|||||||
if (old_can_go_back != new_can_go_back ||
|
if (old_can_go_back != new_can_go_back ||
|
||||||
old_can_go_forward != new_can_go_forward) {
|
old_can_go_forward != new_can_go_forward) {
|
||||||
browser_->set_nav_state(new_can_go_back, new_can_go_forward);
|
browser_->set_nav_state(new_can_go_back, new_can_go_forward);
|
||||||
|
CefRefPtr<CefDisplayHandler> handler = client->GetDisplayHandler();
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
// Notify the handler of a navigation state change
|
// Notify the handler of a navigation state change
|
||||||
handler->HandleNavStateChange(browser_, new_can_go_back,
|
handler->OnNavStateChange(browser_, new_can_go_back, new_can_go_forward);
|
||||||
new_can_go_forward);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,155 +54,156 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
|||||||
// WebKit::WebViewClient
|
// WebKit::WebViewClient
|
||||||
virtual WebKit::WebView* createView(
|
virtual WebKit::WebView* createView(
|
||||||
WebKit::WebFrame* creator, const WebKit::WebURLRequest& request,
|
WebKit::WebFrame* creator, const WebKit::WebURLRequest& request,
|
||||||
const WebKit::WebWindowFeatures& features, const WebKit::WebString& name);
|
const WebKit::WebWindowFeatures& features, const WebKit::WebString& name)
|
||||||
virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type);
|
OVERRIDE;
|
||||||
|
virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type)
|
||||||
|
OVERRIDE;
|
||||||
virtual WebKit::WebExternalPopupMenu* createExternalPopupMenu(
|
virtual WebKit::WebExternalPopupMenu* createExternalPopupMenu(
|
||||||
const WebKit::WebPopupMenuInfo& info,
|
const WebKit::WebPopupMenuInfo& info,
|
||||||
WebKit::WebExternalPopupMenuClient* client);
|
WebKit::WebExternalPopupMenuClient* client) OVERRIDE;
|
||||||
virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(
|
virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(
|
||||||
unsigned quota);
|
unsigned quota) OVERRIDE;
|
||||||
virtual void didAddMessageToConsole(
|
virtual void didAddMessageToConsole(
|
||||||
const WebKit::WebConsoleMessage& message,
|
const WebKit::WebConsoleMessage& message,
|
||||||
const WebKit::WebString& source_name, unsigned source_line);
|
const WebKit::WebString& source_name, unsigned source_line) OVERRIDE;
|
||||||
virtual void printPage(WebKit::WebFrame* frame);
|
virtual void printPage(WebKit::WebFrame* frame) OVERRIDE;
|
||||||
virtual bool shouldBeginEditing(const WebKit::WebRange& range);
|
virtual bool shouldBeginEditing(const WebKit::WebRange& range) OVERRIDE;
|
||||||
virtual bool shouldEndEditing(const WebKit::WebRange& range);
|
virtual bool shouldEndEditing(const WebKit::WebRange& range) OVERRIDE;
|
||||||
virtual bool shouldInsertNode(
|
virtual bool shouldInsertNode(
|
||||||
const WebKit::WebNode& node, const WebKit::WebRange& range,
|
const WebKit::WebNode& node, const WebKit::WebRange& range,
|
||||||
WebKit::WebEditingAction action);
|
WebKit::WebEditingAction action) OVERRIDE;
|
||||||
virtual bool shouldInsertText(
|
virtual bool shouldInsertText(
|
||||||
const WebKit::WebString& text, const WebKit::WebRange& range,
|
const WebKit::WebString& text, const WebKit::WebRange& range,
|
||||||
WebKit::WebEditingAction action);
|
WebKit::WebEditingAction action) OVERRIDE;
|
||||||
virtual bool shouldChangeSelectedRange(
|
virtual bool shouldChangeSelectedRange(
|
||||||
const WebKit::WebRange& from, const WebKit::WebRange& to,
|
const WebKit::WebRange& from, const WebKit::WebRange& to,
|
||||||
WebKit::WebTextAffinity affinity, bool still_selecting);
|
WebKit::WebTextAffinity affinity, bool still_selecting) OVERRIDE;
|
||||||
virtual bool shouldDeleteRange(const WebKit::WebRange& range);
|
virtual bool shouldDeleteRange(const WebKit::WebRange& range) OVERRIDE;
|
||||||
virtual bool shouldApplyStyle(
|
virtual bool shouldApplyStyle(
|
||||||
const WebKit::WebString& style, const WebKit::WebRange& range);
|
const WebKit::WebString& style, const WebKit::WebRange& range) OVERRIDE;
|
||||||
virtual bool isSmartInsertDeleteEnabled();
|
virtual bool isSmartInsertDeleteEnabled() OVERRIDE;
|
||||||
virtual bool isSelectTrailingWhitespaceEnabled();
|
virtual bool isSelectTrailingWhitespaceEnabled() OVERRIDE;
|
||||||
virtual bool handleCurrentKeyboardEvent();
|
virtual bool handleCurrentKeyboardEvent() OVERRIDE;
|
||||||
virtual bool runFileChooser(
|
virtual bool runFileChooser(
|
||||||
const WebKit::WebFileChooserParams& params,
|
const WebKit::WebFileChooserParams& params,
|
||||||
WebKit::WebFileChooserCompletion* chooser_completion);
|
WebKit::WebFileChooserCompletion* chooser_completion) OVERRIDE;
|
||||||
virtual void runModalAlertDialog(
|
virtual void runModalAlertDialog(
|
||||||
WebKit::WebFrame* frame, const WebKit::WebString& message);
|
WebKit::WebFrame* frame, const WebKit::WebString& message) OVERRIDE;
|
||||||
virtual bool runModalConfirmDialog(
|
virtual bool runModalConfirmDialog(
|
||||||
WebKit::WebFrame* frame, const WebKit::WebString& message);
|
WebKit::WebFrame* frame, const WebKit::WebString& message) OVERRIDE;
|
||||||
virtual bool runModalPromptDialog(
|
virtual bool runModalPromptDialog(
|
||||||
WebKit::WebFrame* frame, const WebKit::WebString& message,
|
WebKit::WebFrame* frame, const WebKit::WebString& message,
|
||||||
const WebKit::WebString& default_value, WebKit::WebString* actual_value);
|
const WebKit::WebString& default_value, WebKit::WebString* actual_value)
|
||||||
|
OVERRIDE;
|
||||||
virtual bool runModalBeforeUnloadDialog(
|
virtual bool runModalBeforeUnloadDialog(
|
||||||
WebKit::WebFrame* frame, const WebKit::WebString& message);
|
WebKit::WebFrame* frame, const WebKit::WebString& message) OVERRIDE;
|
||||||
virtual void showContextMenu(
|
virtual void showContextMenu(
|
||||||
WebKit::WebFrame* frame, const WebKit::WebContextMenuData& data);
|
WebKit::WebFrame* frame, const WebKit::WebContextMenuData& data) OVERRIDE;
|
||||||
virtual void setStatusText(const WebKit::WebString& text);
|
virtual void setStatusText(const WebKit::WebString& text) OVERRIDE;
|
||||||
virtual void setMouseOverURL(const WebKit::WebURL& url);
|
virtual void setMouseOverURL(const WebKit::WebURL& url) OVERRIDE;
|
||||||
virtual void setKeyboardFocusURL(const WebKit::WebURL& url);
|
virtual void setKeyboardFocusURL(const WebKit::WebURL& url) OVERRIDE;
|
||||||
virtual void setToolTipText(
|
virtual void setToolTipText(
|
||||||
const WebKit::WebString& text, WebKit::WebTextDirection hint);
|
const WebKit::WebString& text, WebKit::WebTextDirection hint) OVERRIDE;
|
||||||
virtual void startDragging(
|
virtual void startDragging(
|
||||||
const WebKit::WebDragData& data,
|
const WebKit::WebDragData& data,
|
||||||
WebKit::WebDragOperationsMask mask,
|
WebKit::WebDragOperationsMask mask,
|
||||||
const WebKit::WebImage& image,
|
const WebKit::WebImage& image,
|
||||||
const WebKit::WebPoint& image_offset);
|
const WebKit::WebPoint& image_offset) OVERRIDE;
|
||||||
virtual bool acceptsLoadDrops() { return true; }
|
virtual bool acceptsLoadDrops() OVERRIDE { return true; }
|
||||||
virtual void focusNext();
|
virtual void focusNext() OVERRIDE;
|
||||||
virtual void focusPrevious();
|
virtual void focusPrevious() OVERRIDE;
|
||||||
virtual void navigateBackForwardSoon(int offset);
|
virtual void navigateBackForwardSoon(int offset) OVERRIDE;
|
||||||
virtual int historyBackListCount();
|
virtual int historyBackListCount() OVERRIDE;
|
||||||
virtual int historyForwardListCount();
|
virtual int historyForwardListCount() OVERRIDE;
|
||||||
|
|
||||||
// WebKit::WebWidgetClient
|
// WebKit::WebWidgetClient
|
||||||
virtual void didInvalidateRect(const WebKit::WebRect& rect);
|
virtual void didInvalidateRect(const WebKit::WebRect& rect) OVERRIDE;
|
||||||
virtual void didScrollRect(int dx, int dy,
|
virtual void didScrollRect(int dx, int dy,
|
||||||
const WebKit::WebRect& clip_rect);
|
const WebKit::WebRect& clip_rect) OVERRIDE;
|
||||||
virtual void scheduleComposite();
|
virtual void scheduleComposite() OVERRIDE;
|
||||||
virtual void scheduleAnimation();
|
virtual void scheduleAnimation() OVERRIDE;
|
||||||
virtual void didFocus();
|
virtual void didFocus() OVERRIDE;
|
||||||
virtual void didBlur();
|
virtual void didBlur() OVERRIDE;
|
||||||
virtual void didChangeCursor(const WebKit::WebCursorInfo& cursor);
|
virtual void didChangeCursor(const WebKit::WebCursorInfo& cursor) OVERRIDE;
|
||||||
virtual void closeWidgetSoon();
|
virtual void closeWidgetSoon() OVERRIDE;
|
||||||
virtual void show(WebKit::WebNavigationPolicy policy);
|
virtual void show(WebKit::WebNavigationPolicy policy) OVERRIDE;
|
||||||
virtual void runModal();
|
virtual void runModal() OVERRIDE;
|
||||||
virtual WebKit::WebRect windowRect();
|
virtual WebKit::WebRect windowRect() OVERRIDE;
|
||||||
virtual void setWindowRect(const WebKit::WebRect& rect);
|
virtual void setWindowRect(const WebKit::WebRect& rect) OVERRIDE;
|
||||||
virtual WebKit::WebRect rootWindowRect();
|
virtual WebKit::WebRect rootWindowRect() OVERRIDE;
|
||||||
virtual WebKit::WebRect windowResizerRect();
|
virtual WebKit::WebRect windowResizerRect() OVERRIDE;
|
||||||
virtual WebKit::WebScreenInfo screenInfo();
|
virtual WebKit::WebScreenInfo screenInfo() OVERRIDE;
|
||||||
|
|
||||||
// WebKit::WebFrameClient
|
// WebKit::WebFrameClient
|
||||||
virtual WebKit::WebPlugin* createPlugin(
|
virtual WebKit::WebPlugin* createPlugin(
|
||||||
WebKit::WebFrame*, const WebKit::WebPluginParams&);
|
WebKit::WebFrame*, const WebKit::WebPluginParams&) OVERRIDE;
|
||||||
virtual WebKit::WebWorker* createWorker(
|
virtual WebKit::WebWorker* createWorker(
|
||||||
WebKit::WebFrame*, WebKit::WebWorkerClient*);
|
WebKit::WebFrame*, WebKit::WebWorkerClient*) OVERRIDE;
|
||||||
virtual WebKit::WebMediaPlayer* createMediaPlayer(
|
virtual WebKit::WebMediaPlayer* createMediaPlayer(
|
||||||
WebKit::WebFrame*, WebKit::WebMediaPlayerClient*);
|
WebKit::WebFrame*, WebKit::WebMediaPlayerClient*) OVERRIDE;
|
||||||
virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
|
virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
|
||||||
WebKit::WebFrame* frame, WebKit::WebApplicationCacheHostClient* client);
|
WebKit::WebFrame* frame, WebKit::WebApplicationCacheHostClient* client)
|
||||||
virtual void willClose(WebKit::WebFrame*);
|
OVERRIDE;
|
||||||
|
virtual void willClose(WebKit::WebFrame*) OVERRIDE;
|
||||||
virtual void loadURLExternally(
|
virtual void loadURLExternally(
|
||||||
WebKit::WebFrame*, const WebKit::WebURLRequest&,
|
WebKit::WebFrame*, const WebKit::WebURLRequest&,
|
||||||
WebKit::WebNavigationPolicy);
|
WebKit::WebNavigationPolicy) OVERRIDE;
|
||||||
virtual WebKit::WebNavigationPolicy decidePolicyForNavigation(
|
virtual WebKit::WebNavigationPolicy decidePolicyForNavigation(
|
||||||
WebKit::WebFrame*, const WebKit::WebURLRequest&,
|
WebKit::WebFrame*, const WebKit::WebURLRequest&,
|
||||||
WebKit::WebNavigationType, const WebKit::WebNode&,
|
WebKit::WebNavigationType, const WebKit::WebNode&,
|
||||||
WebKit::WebNavigationPolicy default_policy, bool isRedirect);
|
WebKit::WebNavigationPolicy default_policy, bool isRedirect) OVERRIDE;
|
||||||
virtual bool canHandleRequest(
|
virtual bool canHandleRequest(
|
||||||
WebKit::WebFrame*, const WebKit::WebURLRequest&) { return true; }
|
WebKit::WebFrame*, const WebKit::WebURLRequest&) OVERRIDE { return true; }
|
||||||
virtual WebKit::WebURLError cannotHandleRequestError(
|
virtual WebKit::WebURLError cannotHandleRequestError(
|
||||||
WebKit::WebFrame*, const WebKit::WebURLRequest& request);
|
WebKit::WebFrame*, const WebKit::WebURLRequest& request) OVERRIDE;
|
||||||
virtual WebKit::WebURLError cancelledError(
|
virtual WebKit::WebURLError cancelledError(
|
||||||
WebKit::WebFrame*, const WebKit::WebURLRequest& request);
|
WebKit::WebFrame*, const WebKit::WebURLRequest& request) OVERRIDE;
|
||||||
virtual void didCreateDataSource(
|
virtual void didCreateDataSource(
|
||||||
WebKit::WebFrame*, WebKit::WebDataSource*);
|
WebKit::WebFrame*, WebKit::WebDataSource*) OVERRIDE;
|
||||||
virtual void didStartProvisionalLoad(WebKit::WebFrame*);
|
virtual void didStartProvisionalLoad(WebKit::WebFrame*) OVERRIDE;
|
||||||
virtual void didReceiveServerRedirectForProvisionalLoad(WebKit::WebFrame*);
|
virtual void didReceiveServerRedirectForProvisionalLoad(WebKit::WebFrame*)
|
||||||
|
OVERRIDE;
|
||||||
virtual void didFailProvisionalLoad(
|
virtual void didFailProvisionalLoad(
|
||||||
WebKit::WebFrame*, const WebKit::WebURLError&);
|
WebKit::WebFrame*, const WebKit::WebURLError&) OVERRIDE;
|
||||||
virtual void didCommitProvisionalLoad(
|
virtual void didCommitProvisionalLoad(
|
||||||
WebKit::WebFrame*, bool is_new_navigation);
|
WebKit::WebFrame*, bool is_new_navigation) OVERRIDE;
|
||||||
virtual void didClearWindowObject(WebKit::WebFrame*);
|
virtual void didClearWindowObject(WebKit::WebFrame*) OVERRIDE;
|
||||||
virtual void didReceiveTitle(
|
virtual void didReceiveTitle(
|
||||||
WebKit::WebFrame*, const WebKit::WebString& title,
|
WebKit::WebFrame*, const WebKit::WebString& title,
|
||||||
WebKit::WebTextDirection direction);
|
WebKit::WebTextDirection direction) OVERRIDE;
|
||||||
virtual void didFailLoad(
|
virtual void didFailLoad(
|
||||||
WebKit::WebFrame*, const WebKit::WebURLError&);
|
WebKit::WebFrame*, const WebKit::WebURLError&) OVERRIDE;
|
||||||
virtual void didFinishLoad(WebKit::WebFrame*);
|
virtual void didFinishLoad(WebKit::WebFrame*) OVERRIDE;
|
||||||
virtual void didNavigateWithinPage(
|
virtual void didNavigateWithinPage(
|
||||||
WebKit::WebFrame*, bool isNewNavigation);
|
WebKit::WebFrame*, bool isNewNavigation) OVERRIDE;
|
||||||
virtual void willSendRequest(
|
virtual void willSendRequest(
|
||||||
WebKit::WebFrame*, unsigned identifier, WebKit::WebURLRequest&,
|
WebKit::WebFrame*, unsigned identifier, WebKit::WebURLRequest&,
|
||||||
const WebKit::WebURLResponse& redirectResponse);
|
const WebKit::WebURLResponse& redirectResponse) OVERRIDE;
|
||||||
virtual void reportFindInPageMatchCount(
|
virtual void reportFindInPageMatchCount(
|
||||||
int request_id, int count, bool final_update);
|
int request_id, int count, bool final_update) OVERRIDE;
|
||||||
virtual void reportFindInPageSelection(
|
virtual void reportFindInPageSelection(
|
||||||
int request_id, int active_match_ordinal, const WebKit::WebRect& sel);
|
int request_id, int active_match_ordinal, const WebKit::WebRect& sel)
|
||||||
|
OVERRIDE;
|
||||||
virtual void openFileSystem(
|
virtual void openFileSystem(
|
||||||
WebKit::WebFrame* frame,
|
WebKit::WebFrame* frame,
|
||||||
WebKit::WebFileSystem::Type type,
|
WebKit::WebFileSystem::Type type,
|
||||||
long long size,
|
long long size,
|
||||||
bool create,
|
bool create,
|
||||||
WebKit::WebFileSystemCallbacks* callbacks);
|
WebKit::WebFileSystemCallbacks* callbacks) OVERRIDE;
|
||||||
|
|
||||||
// webkit_glue::WebPluginPageDelegate
|
// webkit_glue::WebPluginPageDelegate
|
||||||
virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate(
|
virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate(
|
||||||
const FilePath& file_path,
|
const FilePath& file_path,
|
||||||
const std::string& mime_type);
|
const std::string& mime_type) OVERRIDE;
|
||||||
virtual void CreatedPluginWindow(
|
virtual void CreatedPluginWindow(
|
||||||
gfx::PluginWindowHandle handle);
|
gfx::PluginWindowHandle handle) OVERRIDE;
|
||||||
virtual void WillDestroyPluginWindow(
|
virtual void WillDestroyPluginWindow(
|
||||||
gfx::PluginWindowHandle handle);
|
gfx::PluginWindowHandle handle) OVERRIDE;
|
||||||
virtual void DidMovePlugin(
|
virtual void DidMovePlugin(
|
||||||
const webkit::npapi::WebPluginGeometry& move);
|
const webkit::npapi::WebPluginGeometry& move) OVERRIDE;
|
||||||
virtual void DidStartLoadingForPlugin() {}
|
virtual void DidStartLoadingForPlugin() OVERRIDE {}
|
||||||
virtual void DidStopLoadingForPlugin() {}
|
virtual void DidStopLoadingForPlugin() OVERRIDE {}
|
||||||
virtual void ShowModalHTMLDialogForPlugin(
|
virtual WebKit::WebCookieJar* GetCookieJar() OVERRIDE;
|
||||||
const GURL& url,
|
|
||||||
const gfx::Size& size,
|
|
||||||
const std::string& json_arguments,
|
|
||||||
std::string* json_retval) {}
|
|
||||||
virtual WebKit::WebCookieJar* GetCookieJar();
|
|
||||||
|
|
||||||
BrowserWebViewDelegate(CefBrowserImpl* browser);
|
BrowserWebViewDelegate(CefBrowserImpl* browser);
|
||||||
~BrowserWebViewDelegate();
|
~BrowserWebViewDelegate();
|
||||||
@ -275,7 +276,7 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
|||||||
const FilePath& default_file);
|
const FilePath& default_file);
|
||||||
|
|
||||||
// Called to show status messages.
|
// Called to show status messages.
|
||||||
void ShowStatus(const WebKit::WebString& text, CefHandler::StatusType type);
|
void ShowStatus(const WebKit::WebString& text, cef_handler_statustype_t type);
|
||||||
|
|
||||||
// In the Mac code, this is called to trigger the end of a test after the
|
// In the Mac code, this is called to trigger the end of a test after the
|
||||||
// page has finished loading. From here, we can generate the dump for the
|
// page has finished loading. From here, we can generate the dump for the
|
||||||
|
@ -76,9 +76,12 @@ void BrowserWebViewDelegate::show(WebNavigationPolicy) {
|
|||||||
ShowWindow(browser_->UIT_GetPopupWndHandle(), SW_SHOWNA);
|
ShowWindow(browser_->UIT_GetPopupWndHandle(), SW_SHOWNA);
|
||||||
} else {
|
} else {
|
||||||
// Notify the handler of popup visibility change.
|
// Notify the handler of popup visibility change.
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefRenderHandler> handler = client->GetRenderHandler();
|
||||||
if (handler.get())
|
if (handler.get())
|
||||||
handler->HandlePopupChange(browser_, true, CefRect());
|
handler->OnPopupShow(browser_, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,9 +98,12 @@ void BrowserWebViewDelegate::didChangeCursor(const WebCursorInfo& cursor_info) {
|
|||||||
host->SetCursor(hCursor);
|
host->SetCursor(hCursor);
|
||||||
} else {
|
} else {
|
||||||
// Notify the handler of cursor change.
|
// Notify the handler of cursor change.
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefRenderHandler> handler = client->GetRenderHandler();
|
||||||
if (handler.get())
|
if (handler.get())
|
||||||
handler->HandleCursorChange(browser_, hCursor);
|
handler->OnCursorChange(browser_, hCursor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,14 +116,17 @@ WebRect BrowserWebViewDelegate::windowRect() {
|
|||||||
return gfx::Rect(rect);
|
return gfx::Rect(rect);
|
||||||
} else {
|
} else {
|
||||||
// Retrieve the view rectangle from the handler.
|
// Retrieve the view rectangle from the handler.
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefRenderHandler> handler = client->GetRenderHandler();
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
CefRect rect(0, 0, 0, 0);
|
CefRect rect(0, 0, 0, 0);
|
||||||
if (handler->HandleGetRect(browser_, false, rect) == RV_CONTINUE)
|
if (handler->GetViewRect(browser_, rect))
|
||||||
return WebRect(rect.x, rect.y, rect.width, rect.height);
|
return WebRect(rect.x, rect.y, rect.width, rect.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return WebRect();
|
return WebRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,14 +142,17 @@ void BrowserWebViewDelegate::setWindowRect(const WebRect& rect) {
|
|||||||
browser_->UIT_GetPopupHost()->SetSize(rect.width, rect.height);
|
browser_->UIT_GetPopupHost()->SetSize(rect.width, rect.height);
|
||||||
|
|
||||||
// Notify the handler of popup size change.
|
// Notify the handler of popup size change.
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefRenderHandler> handler = client->GetRenderHandler();
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
handler->HandlePopupChange(browser_, true,
|
handler->OnPopupSize(browser_,
|
||||||
CefRect(rect.x, rect.y, rect.width, rect.height));
|
CefRect(rect.x, rect.y, rect.width, rect.height));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
WebRect BrowserWebViewDelegate::rootWindowRect() {
|
WebRect BrowserWebViewDelegate::rootWindowRect() {
|
||||||
if (WebWidgetHost* host = GetWidgetHost()) {
|
if (WebWidgetHost* host = GetWidgetHost()) {
|
||||||
@ -278,14 +290,17 @@ void BrowserWebViewDelegate::DidMovePlugin(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void AddMenuItem(CefRefPtr<CefBrowser> browser, HMENU menu, int index,
|
static void AddMenuItem(CefRefPtr<CefBrowser> browser, HMENU menu, int index,
|
||||||
CefHandler::MenuId id, const wchar_t* label,
|
cef_handler_menuid_t id, const wchar_t* label,
|
||||||
bool enabled, std::list<std::wstring>& label_list)
|
bool enabled, std::list<std::wstring>& label_list)
|
||||||
{
|
{
|
||||||
CefString actual_label(label);
|
CefString actual_label(label);
|
||||||
CefRefPtr<CefHandler> handler = browser->GetHandler();
|
CefRefPtr<CefClient> client = browser->GetClient();
|
||||||
|
if (client.get()) {
|
||||||
|
CefRefPtr<CefMenuHandler> handler = client->GetMenuHandler();
|
||||||
if(handler.get()) {
|
if(handler.get()) {
|
||||||
// Let the handler change the label if desired
|
// Let the handler change the label if desired
|
||||||
handler->HandleGetMenuLabel(browser, id, actual_label);
|
handler->GetMenuLabel(browser, id, actual_label);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// store the label in a list to simplify memory management
|
// store the label in a list to simplify memory management
|
||||||
@ -364,10 +379,14 @@ void BrowserWebViewDelegate::showContextMenu(
|
|||||||
if(data.mediaType == WebContextMenuData::MediaTypeAudio)
|
if(data.mediaType == WebContextMenuData::MediaTypeAudio)
|
||||||
type_flags |= MENUTYPE_AUDIO;
|
type_flags |= MENUTYPE_AUDIO;
|
||||||
|
|
||||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||||
|
CefRefPtr<CefMenuHandler> handler;
|
||||||
|
if (client.get())
|
||||||
|
handler = client->GetMenuHandler();
|
||||||
|
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
// Gather menu information
|
// Gather menu information
|
||||||
CefHandler::MenuInfo menuInfo;
|
cef_handler_menuinfo_t menuInfo;
|
||||||
memset(&menuInfo, 0, sizeof(menuInfo));
|
memset(&menuInfo, 0, sizeof(menuInfo));
|
||||||
|
|
||||||
CefString linkStr(std::string(data.linkURL.spec()));
|
CefString linkStr(std::string(data.linkURL.spec()));
|
||||||
@ -396,14 +415,15 @@ void BrowserWebViewDelegate::showContextMenu(
|
|||||||
&menuInfo.securityInfo, false);
|
&menuInfo.securityInfo, false);
|
||||||
|
|
||||||
// Notify the handler that a context menu is requested
|
// Notify the handler that a context menu is requested
|
||||||
CefHandler::RetVal rv = handler->HandleBeforeMenu(browser_, menuInfo);
|
if (handler->OnBeforeMenu(browser_, menuInfo))
|
||||||
if(rv == RV_HANDLED)
|
|
||||||
goto end;
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
if (browser_->IsWindowRenderingDisabled()) {
|
if (client.get() && browser_->IsWindowRenderingDisabled()) {
|
||||||
rv = handler->HandleGetScreenPoint(browser_, mouse_pt.x, mouse_pt.y,
|
CefRefPtr<CefRenderHandler> render_handler = client->GetRenderHandler();
|
||||||
screenX, screenY);
|
if (render_handler.get() &&
|
||||||
if(rv != RV_CONTINUE)
|
!render_handler->GetScreenPoint(browser_, mouse_pt.x, mouse_pt.y,
|
||||||
|
screenX, screenY)) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -452,12 +472,12 @@ void BrowserWebViewDelegate::showContextMenu(
|
|||||||
|
|
||||||
if (selected_id != 0) {
|
if (selected_id != 0) {
|
||||||
// An action was chosen
|
// An action was chosen
|
||||||
CefHandler::MenuId menuId = static_cast<CefHandler::MenuId>(selected_id);
|
cef_handler_menuid_t menuId =
|
||||||
|
static_cast<cef_handler_menuid_t>(selected_id);
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
// Ask the handler if it wants to handle the action
|
// Ask the handler if it wants to handle the action
|
||||||
CefHandler::RetVal rv = handler->HandleMenuAction(browser_, menuId);
|
handled = handler->OnMenuAction(browser_, menuId);
|
||||||
handled = (rv == RV_HANDLED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!handled) {
|
if(!handled) {
|
||||||
|
@ -158,15 +158,13 @@ void IOT_VisitUrlCookies(const GURL& url, bool includeHttpOnly,
|
|||||||
|
|
||||||
} // anonymous
|
} // anonymous
|
||||||
|
|
||||||
bool CefInitialize(const CefSettings& settings,
|
bool CefInitialize(const CefSettings& settings)
|
||||||
const CefBrowserSettings& browser_defaults)
|
|
||||||
{
|
{
|
||||||
// Return true if the global context already exists.
|
// Return true if the global context already exists.
|
||||||
if(_Context.get())
|
if(_Context.get())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if(settings.size != sizeof(cef_settings_t) ||
|
if(settings.size != sizeof(cef_settings_t)) {
|
||||||
browser_defaults.size != sizeof(cef_browser_settings_t)) {
|
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -175,7 +173,7 @@ bool CefInitialize(const CefSettings& settings,
|
|||||||
_Context = new CefContext();
|
_Context = new CefContext();
|
||||||
|
|
||||||
// Initialize the global context.
|
// Initialize the global context.
|
||||||
return _Context->Initialize(settings, browser_defaults);
|
return _Context->Initialize(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefShutdown()
|
void CefShutdown()
|
||||||
@ -477,11 +475,9 @@ CefContext::~CefContext()
|
|||||||
Shutdown();
|
Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefContext::Initialize(const CefSettings& settings,
|
bool CefContext::Initialize(const CefSettings& settings)
|
||||||
const CefBrowserSettings& browser_defaults)
|
|
||||||
{
|
{
|
||||||
settings_ = settings;
|
settings_ = settings;
|
||||||
browser_defaults_ = browser_defaults;
|
|
||||||
|
|
||||||
cache_path_ = FilePath(CefString(&settings.cache_path));
|
cache_path_ = FilePath(CefString(&settings.cache_path));
|
||||||
|
|
||||||
@ -529,7 +525,7 @@ bool CefContext::AddBrowser(CefRefPtr<CefBrowserImpl> browser)
|
|||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
|
|
||||||
// check that the browser isn't already in the list before adding
|
// check that the browser isn't already in the list before adding
|
||||||
BrowserList::const_iterator it = browserlist_.begin();
|
BrowserList::const_iterator it = browserlist_.begin();
|
||||||
@ -546,7 +542,6 @@ bool CefContext::AddBrowser(CefRefPtr<CefBrowserImpl> browser)
|
|||||||
browserlist_.push_back(browser);
|
browserlist_.push_back(browser);
|
||||||
}
|
}
|
||||||
|
|
||||||
Unlock();
|
|
||||||
return !found;
|
return !found;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -555,7 +550,8 @@ bool CefContext::RemoveBrowser(CefRefPtr<CefBrowserImpl> browser)
|
|||||||
bool deleted = false;
|
bool deleted = false;
|
||||||
bool empty = false;
|
bool empty = false;
|
||||||
|
|
||||||
Lock();
|
{
|
||||||
|
AutoLock lock_scope(this);
|
||||||
|
|
||||||
BrowserList::iterator it = browserlist_.begin();
|
BrowserList::iterator it = browserlist_.begin();
|
||||||
for(; it != browserlist_.end(); ++it) {
|
for(; it != browserlist_.end(); ++it) {
|
||||||
@ -570,8 +566,7 @@ bool CefContext::RemoveBrowser(CefRefPtr<CefBrowserImpl> browser)
|
|||||||
next_browser_id_ = kNextBrowserIdReset;
|
next_browser_id_ = kNextBrowserIdReset;
|
||||||
empty = true;
|
empty = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Unlock();
|
|
||||||
|
|
||||||
if (empty) {
|
if (empty) {
|
||||||
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||||
@ -583,20 +578,15 @@ bool CefContext::RemoveBrowser(CefRefPtr<CefBrowserImpl> browser)
|
|||||||
|
|
||||||
CefRefPtr<CefBrowserImpl> CefContext::GetBrowserByID(int id)
|
CefRefPtr<CefBrowserImpl> CefContext::GetBrowserByID(int id)
|
||||||
{
|
{
|
||||||
CefRefPtr<CefBrowserImpl> browser;
|
AutoLock lock_scope(this);
|
||||||
Lock();
|
|
||||||
|
|
||||||
BrowserList::const_iterator it = browserlist_.begin();
|
BrowserList::const_iterator it = browserlist_.begin();
|
||||||
for(; it != browserlist_.end(); ++it) {
|
for(; it != browserlist_.end(); ++it) {
|
||||||
if(it->get()->UIT_GetUniqueID() == id) {
|
if(it->get()->UIT_GetUniqueID() == id)
|
||||||
browser = it->get();
|
return it->get();
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Unlock();
|
return NULL;
|
||||||
|
|
||||||
return browser;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefContext::UIT_FinishShutdown(base::WaitableEvent* event)
|
void CefContext::UIT_FinishShutdown(base::WaitableEvent* event)
|
||||||
@ -605,12 +595,13 @@ void CefContext::UIT_FinishShutdown(base::WaitableEvent* event)
|
|||||||
|
|
||||||
BrowserList list;
|
BrowserList list;
|
||||||
|
|
||||||
Lock();
|
{
|
||||||
|
AutoLock lock_scope(this);
|
||||||
if (!browserlist_.empty()) {
|
if (!browserlist_.empty()) {
|
||||||
list = browserlist_;
|
list = browserlist_;
|
||||||
browserlist_.clear();
|
browserlist_.clear();
|
||||||
}
|
}
|
||||||
Unlock();
|
}
|
||||||
|
|
||||||
// Destroy any remaining browser windows.
|
// Destroy any remaining browser windows.
|
||||||
if (!list.empty()) {
|
if (!list.empty()) {
|
||||||
|
@ -21,7 +21,7 @@ class BrowserRequestContext;
|
|||||||
class CefBrowserImpl;
|
class CefBrowserImpl;
|
||||||
class WebViewHost;
|
class WebViewHost;
|
||||||
|
|
||||||
class CefContext : public CefThreadSafeBase<CefBase>
|
class CefContext : public CefBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef std::list<CefRefPtr<CefBrowserImpl> > BrowserList;
|
typedef std::list<CefRefPtr<CefBrowserImpl> > BrowserList;
|
||||||
@ -30,8 +30,7 @@ public:
|
|||||||
~CefContext();
|
~CefContext();
|
||||||
|
|
||||||
// These methods will be called on the main application thread.
|
// These methods will be called on the main application thread.
|
||||||
bool Initialize(const CefSettings& settings,
|
bool Initialize(const CefSettings& settings);
|
||||||
const CefBrowserSettings& browser_defaults);
|
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
// Returns true if the context is initialized.
|
// Returns true if the context is initialized.
|
||||||
@ -52,8 +51,6 @@ public:
|
|||||||
const FilePath& cache_path() const { return cache_path_; }
|
const FilePath& cache_path() const { return cache_path_; }
|
||||||
|
|
||||||
const CefSettings& settings() const { return settings_; }
|
const CefSettings& settings() const { return settings_; }
|
||||||
const CefBrowserSettings& browser_defaults() const
|
|
||||||
{ return browser_defaults_; }
|
|
||||||
|
|
||||||
// The BrowserRequestContext object is managed by CefProcessIOThread.
|
// The BrowserRequestContext object is managed by CefProcessIOThread.
|
||||||
void set_request_context(BrowserRequestContext* request_context)
|
void set_request_context(BrowserRequestContext* request_context)
|
||||||
@ -92,7 +89,6 @@ private:
|
|||||||
base::AtExitManager at_exit_manager_;
|
base::AtExitManager at_exit_manager_;
|
||||||
|
|
||||||
CefSettings settings_;
|
CefSettings settings_;
|
||||||
CefBrowserSettings browser_defaults_;
|
|
||||||
FilePath cache_path_;
|
FilePath cache_path_;
|
||||||
scoped_refptr<BrowserRequestContext> request_context_;
|
scoped_refptr<BrowserRequestContext> request_context_;
|
||||||
scoped_ptr<DOMStorageContext> storage_context_;
|
scoped_ptr<DOMStorageContext> storage_context_;
|
||||||
@ -104,6 +100,9 @@ private:
|
|||||||
int next_browser_id_;
|
int next_browser_id_;
|
||||||
|
|
||||||
WebViewHost* current_webviewhost_;
|
WebViewHost* current_webviewhost_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefContext);
|
||||||
|
IMPLEMENT_LOCKING(CefContext);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Global context object pointer.
|
// Global context object pointer.
|
||||||
|
@ -15,29 +15,29 @@ class WebNode;
|
|||||||
|
|
||||||
class CefBrowserImpl;
|
class CefBrowserImpl;
|
||||||
|
|
||||||
class CefDOMDocumentImpl : public CefThreadSafeBase<CefDOMDocument>
|
class CefDOMDocumentImpl : public CefDOMDocument
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefDOMDocumentImpl(CefBrowserImpl* browser,
|
CefDOMDocumentImpl(CefBrowserImpl* browser,
|
||||||
WebKit::WebFrame* frame);
|
WebKit::WebFrame* frame);
|
||||||
virtual ~CefDOMDocumentImpl();
|
virtual ~CefDOMDocumentImpl();
|
||||||
|
|
||||||
virtual Type GetType();
|
virtual Type GetType() OVERRIDE;
|
||||||
virtual CefRefPtr<CefDOMNode> GetDocument();
|
virtual CefRefPtr<CefDOMNode> GetDocument() OVERRIDE;
|
||||||
virtual CefRefPtr<CefDOMNode> GetBody();
|
virtual CefRefPtr<CefDOMNode> GetBody() OVERRIDE;
|
||||||
virtual CefRefPtr<CefDOMNode> GetHead();
|
virtual CefRefPtr<CefDOMNode> GetHead() OVERRIDE;
|
||||||
virtual CefString GetTitle();
|
virtual CefString GetTitle() OVERRIDE;
|
||||||
virtual CefRefPtr<CefDOMNode> GetElementById(const CefString& id);
|
virtual CefRefPtr<CefDOMNode> GetElementById(const CefString& id) OVERRIDE;
|
||||||
virtual CefRefPtr<CefDOMNode> GetFocusedNode();
|
virtual CefRefPtr<CefDOMNode> GetFocusedNode() OVERRIDE;
|
||||||
virtual bool HasSelection();
|
virtual bool HasSelection() OVERRIDE;
|
||||||
virtual CefRefPtr<CefDOMNode> GetSelectionStartNode();
|
virtual CefRefPtr<CefDOMNode> GetSelectionStartNode() OVERRIDE;
|
||||||
virtual int GetSelectionStartOffset();
|
virtual int GetSelectionStartOffset() OVERRIDE;
|
||||||
virtual CefRefPtr<CefDOMNode> GetSelectionEndNode();
|
virtual CefRefPtr<CefDOMNode> GetSelectionEndNode() OVERRIDE;
|
||||||
virtual int GetSelectionEndOffset();
|
virtual int GetSelectionEndOffset() OVERRIDE;
|
||||||
virtual CefString GetSelectionAsMarkup();
|
virtual CefString GetSelectionAsMarkup() OVERRIDE;
|
||||||
virtual CefString GetSelectionAsText();
|
virtual CefString GetSelectionAsText() OVERRIDE;
|
||||||
virtual CefString GetBaseURL();
|
virtual CefString GetBaseURL() OVERRIDE;
|
||||||
virtual CefString GetCompleteURL(const CefString& partialURL);
|
virtual CefString GetCompleteURL(const CefString& partialURL) OVERRIDE;
|
||||||
|
|
||||||
CefBrowserImpl* GetBrowser() { return browser_; }
|
CefBrowserImpl* GetBrowser() { return browser_; }
|
||||||
WebKit::WebFrame* GetFrame() { return frame_; }
|
WebKit::WebFrame* GetFrame() { return frame_; }
|
||||||
@ -58,6 +58,8 @@ protected:
|
|||||||
|
|
||||||
typedef std::map<WebKit::WebNode,CefDOMNode*> NodeMap;
|
typedef std::map<WebKit::WebNode,CefDOMNode*> NodeMap;
|
||||||
NodeMap node_map_;
|
NodeMap node_map_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefDOMDocumentImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _DOM_DOCUMENT_IMPL_H
|
#endif // _DOM_DOCUMENT_IMPL_H
|
||||||
|
@ -10,21 +10,21 @@
|
|||||||
|
|
||||||
class CefDOMDocumentImpl;
|
class CefDOMDocumentImpl;
|
||||||
|
|
||||||
class CefDOMEventImpl : public CefThreadSafeBase<CefDOMEvent>
|
class CefDOMEventImpl : public CefDOMEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefDOMEventImpl(CefRefPtr<CefDOMDocumentImpl> document,
|
CefDOMEventImpl(CefRefPtr<CefDOMDocumentImpl> document,
|
||||||
const WebKit::WebDOMEvent& event);
|
const WebKit::WebDOMEvent& event);
|
||||||
virtual ~CefDOMEventImpl();
|
virtual ~CefDOMEventImpl();
|
||||||
|
|
||||||
virtual CefString GetType();
|
virtual CefString GetType() OVERRIDE;
|
||||||
virtual Category GetCategory();
|
virtual Category GetCategory() OVERRIDE;
|
||||||
virtual Phase GetPhase();
|
virtual Phase GetPhase() OVERRIDE;
|
||||||
virtual bool CanBubble();
|
virtual bool CanBubble() OVERRIDE;
|
||||||
virtual bool CanCancel();
|
virtual bool CanCancel() OVERRIDE;
|
||||||
virtual CefRefPtr<CefDOMDocument> GetDocument();
|
virtual CefRefPtr<CefDOMDocument> GetDocument() OVERRIDE;
|
||||||
virtual CefRefPtr<CefDOMNode> GetTarget();
|
virtual CefRefPtr<CefDOMNode> GetTarget() OVERRIDE;
|
||||||
virtual CefRefPtr<CefDOMNode> GetCurrentTarget();
|
virtual CefRefPtr<CefDOMNode> GetCurrentTarget() OVERRIDE;
|
||||||
|
|
||||||
// Will be called from CefDOMEventListenerWrapper::handleEvent().
|
// Will be called from CefDOMEventListenerWrapper::handleEvent().
|
||||||
void Detach();
|
void Detach();
|
||||||
@ -35,6 +35,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
CefRefPtr<CefDOMDocumentImpl> document_;
|
CefRefPtr<CefDOMDocumentImpl> document_;
|
||||||
WebKit::WebDOMEvent event_;
|
WebKit::WebDOMEvent event_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefDOMEventImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _DOM_EVENT_IMPL_H
|
#endif // _DOM_EVENT_IMPL_H
|
||||||
|
@ -10,39 +10,39 @@
|
|||||||
|
|
||||||
class CefDOMDocumentImpl;
|
class CefDOMDocumentImpl;
|
||||||
|
|
||||||
class CefDOMNodeImpl : public CefThreadSafeBase<CefDOMNode>
|
class CefDOMNodeImpl : public CefDOMNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefDOMNodeImpl(CefRefPtr<CefDOMDocumentImpl> document,
|
CefDOMNodeImpl(CefRefPtr<CefDOMDocumentImpl> document,
|
||||||
const WebKit::WebNode& node);
|
const WebKit::WebNode& node);
|
||||||
virtual ~CefDOMNodeImpl();
|
virtual ~CefDOMNodeImpl();
|
||||||
|
|
||||||
virtual Type GetType();
|
virtual Type GetType() OVERRIDE;
|
||||||
virtual bool IsText();
|
virtual bool IsText() OVERRIDE;
|
||||||
virtual bool IsElement();
|
virtual bool IsElement() OVERRIDE;
|
||||||
virtual bool IsSame(CefRefPtr<CefDOMNode> that);
|
virtual bool IsSame(CefRefPtr<CefDOMNode> that) OVERRIDE;
|
||||||
virtual CefString GetName();
|
virtual CefString GetName() OVERRIDE;
|
||||||
virtual CefString GetValue();
|
virtual CefString GetValue() OVERRIDE;
|
||||||
virtual bool SetValue(const CefString& value);
|
virtual bool SetValue(const CefString& value) OVERRIDE;
|
||||||
virtual CefString GetAsMarkup();
|
virtual CefString GetAsMarkup() OVERRIDE;
|
||||||
virtual CefRefPtr<CefDOMDocument> GetDocument();
|
virtual CefRefPtr<CefDOMDocument> GetDocument() OVERRIDE;
|
||||||
virtual CefRefPtr<CefDOMNode> GetParent();
|
virtual CefRefPtr<CefDOMNode> GetParent() OVERRIDE;
|
||||||
virtual CefRefPtr<CefDOMNode> GetPreviousSibling();
|
virtual CefRefPtr<CefDOMNode> GetPreviousSibling() OVERRIDE;
|
||||||
virtual CefRefPtr<CefDOMNode> GetNextSibling();
|
virtual CefRefPtr<CefDOMNode> GetNextSibling() OVERRIDE;
|
||||||
virtual bool HasChildren();
|
virtual bool HasChildren() OVERRIDE;
|
||||||
virtual CefRefPtr<CefDOMNode> GetFirstChild();
|
virtual CefRefPtr<CefDOMNode> GetFirstChild() OVERRIDE;
|
||||||
virtual CefRefPtr<CefDOMNode> GetLastChild();
|
virtual CefRefPtr<CefDOMNode> GetLastChild() OVERRIDE;
|
||||||
virtual void AddEventListener(const CefString& eventType,
|
virtual void AddEventListener(const CefString& eventType,
|
||||||
CefRefPtr<CefDOMEventListener> listener,
|
CefRefPtr<CefDOMEventListener> listener,
|
||||||
bool useCapture);
|
bool useCapture) OVERRIDE;
|
||||||
virtual CefString GetElementTagName();
|
virtual CefString GetElementTagName() OVERRIDE;
|
||||||
virtual bool HasElementAttributes();
|
virtual bool HasElementAttributes() OVERRIDE;
|
||||||
virtual bool HasElementAttribute(const CefString& attrName);
|
virtual bool HasElementAttribute(const CefString& attrName) OVERRIDE;
|
||||||
virtual CefString GetElementAttribute(const CefString& attrName);
|
virtual CefString GetElementAttribute(const CefString& attrName) OVERRIDE;
|
||||||
virtual void GetElementAttributes(AttributeMap& attrMap);
|
virtual void GetElementAttributes(AttributeMap& attrMap) OVERRIDE;
|
||||||
virtual bool SetElementAttribute(const CefString& attrName,
|
virtual bool SetElementAttribute(const CefString& attrName,
|
||||||
const CefString& value);
|
const CefString& value) OVERRIDE;
|
||||||
virtual CefString GetElementInnerText();
|
virtual CefString GetElementInnerText() OVERRIDE;
|
||||||
|
|
||||||
// Will be called from CefDOMDocumentImpl::Detach().
|
// Will be called from CefDOMDocumentImpl::Detach().
|
||||||
void Detach();
|
void Detach();
|
||||||
@ -53,6 +53,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
CefRefPtr<CefDOMDocumentImpl> document_;
|
CefRefPtr<CefDOMDocumentImpl> document_;
|
||||||
WebKit::WebNode node_;
|
WebKit::WebNode node_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefDOMNodeImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _DOM_NODE_IMPL_H
|
#endif // _DOM_NODE_IMPL_H
|
||||||
|
@ -16,28 +16,28 @@ class URLRequest;
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Implementation of CefRequest
|
// Implementation of CefRequest
|
||||||
class CefRequestImpl : public CefThreadSafeBase<CefRequest>
|
class CefRequestImpl : public CefRequest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefRequestImpl();
|
CefRequestImpl();
|
||||||
~CefRequestImpl() {}
|
~CefRequestImpl() {}
|
||||||
|
|
||||||
virtual CefString GetURL();
|
virtual CefString GetURL() OVERRIDE;
|
||||||
virtual void SetURL(const CefString& url);
|
virtual void SetURL(const CefString& url) OVERRIDE;
|
||||||
virtual CefString GetMethod();
|
virtual CefString GetMethod() OVERRIDE;
|
||||||
virtual void SetMethod(const CefString& method);
|
virtual void SetMethod(const CefString& method) OVERRIDE;
|
||||||
virtual CefRefPtr<CefPostData> GetPostData();
|
virtual CefRefPtr<CefPostData> GetPostData() OVERRIDE;
|
||||||
virtual void SetPostData(CefRefPtr<CefPostData> postData);
|
virtual void SetPostData(CefRefPtr<CefPostData> postData) OVERRIDE;
|
||||||
virtual void GetHeaderMap(HeaderMap& headerMap);
|
virtual void GetHeaderMap(HeaderMap& headerMap) OVERRIDE;
|
||||||
virtual void SetHeaderMap(const HeaderMap& headerMap);
|
virtual void SetHeaderMap(const HeaderMap& headerMap) OVERRIDE;
|
||||||
virtual void Set(const CefString& url,
|
virtual void Set(const CefString& url,
|
||||||
const CefString& method,
|
const CefString& method,
|
||||||
CefRefPtr<CefPostData> postData,
|
CefRefPtr<CefPostData> postData,
|
||||||
const HeaderMap& headerMap);
|
const HeaderMap& headerMap) OVERRIDE;
|
||||||
virtual RequestFlags GetFlags();
|
virtual RequestFlags GetFlags() OVERRIDE;
|
||||||
virtual void SetFlags(RequestFlags flags);
|
virtual void SetFlags(RequestFlags flags) OVERRIDE;
|
||||||
virtual CefString GetFirstPartyForCookies();
|
virtual CefString GetFirstPartyForCookies() OVERRIDE;
|
||||||
virtual void SetFirstPartyForCookies(const CefString& url);
|
virtual void SetFirstPartyForCookies(const CefString& url) OVERRIDE;
|
||||||
|
|
||||||
void Set(net::URLRequest* request);
|
void Set(net::URLRequest* request);
|
||||||
void Set(const WebKit::WebURLRequest& request);
|
void Set(const WebKit::WebURLRequest& request);
|
||||||
@ -59,19 +59,22 @@ protected:
|
|||||||
// The below methods are used by WebURLRequest.
|
// The below methods are used by WebURLRequest.
|
||||||
RequestFlags flags_;
|
RequestFlags flags_;
|
||||||
CefString first_party_for_cookies_;
|
CefString first_party_for_cookies_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefRequestImpl);
|
||||||
|
IMPLEMENT_LOCKING(CefRequestImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implementation of CefPostData
|
// Implementation of CefPostData
|
||||||
class CefPostDataImpl : public CefThreadSafeBase<CefPostData>
|
class CefPostDataImpl : public CefPostData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefPostDataImpl();
|
CefPostDataImpl();
|
||||||
~CefPostDataImpl() {}
|
~CefPostDataImpl() {}
|
||||||
|
|
||||||
virtual size_t GetElementCount();
|
virtual size_t GetElementCount() OVERRIDE;
|
||||||
virtual void GetElements(ElementVector& elements);
|
virtual void GetElements(ElementVector& elements) OVERRIDE;
|
||||||
virtual bool RemoveElement(CefRefPtr<CefPostDataElement> element);
|
virtual bool RemoveElement(CefRefPtr<CefPostDataElement> element) OVERRIDE;
|
||||||
virtual bool AddElement(CefRefPtr<CefPostDataElement> element);
|
virtual bool AddElement(CefRefPtr<CefPostDataElement> element) OVERRIDE;
|
||||||
virtual void RemoveElements();
|
virtual void RemoveElements();
|
||||||
|
|
||||||
void Set(net::UploadData& data);
|
void Set(net::UploadData& data);
|
||||||
@ -81,22 +84,25 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
ElementVector elements_;
|
ElementVector elements_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefPostDataImpl);
|
||||||
|
IMPLEMENT_LOCKING(CefPostDataImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implementation of CefPostDataElement
|
// Implementation of CefPostDataElement
|
||||||
class CefPostDataElementImpl : public CefThreadSafeBase<CefPostDataElement>
|
class CefPostDataElementImpl : public CefPostDataElement
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefPostDataElementImpl();
|
CefPostDataElementImpl();
|
||||||
~CefPostDataElementImpl();
|
~CefPostDataElementImpl();
|
||||||
|
|
||||||
virtual void SetToEmpty();
|
virtual void SetToEmpty() OVERRIDE;
|
||||||
virtual void SetToFile(const CefString& fileName);
|
virtual void SetToFile(const CefString& fileName) OVERRIDE;
|
||||||
virtual void SetToBytes(size_t size, const void* bytes);
|
virtual void SetToBytes(size_t size, const void* bytes) OVERRIDE;
|
||||||
virtual Type GetType();
|
virtual Type GetType() OVERRIDE;
|
||||||
virtual CefString GetFile();
|
virtual CefString GetFile() OVERRIDE;
|
||||||
virtual size_t GetBytesCount();
|
virtual size_t GetBytesCount() OVERRIDE;
|
||||||
virtual size_t GetBytes(size_t size, void* bytes);
|
virtual size_t GetBytes(size_t size, void* bytes) OVERRIDE;
|
||||||
|
|
||||||
void* GetBytes() { return data_.bytes.bytes; }
|
void* GetBytes() { return data_.bytes.bytes; }
|
||||||
|
|
||||||
@ -114,6 +120,9 @@ protected:
|
|||||||
} bytes;
|
} bytes;
|
||||||
cef_string_t filename;
|
cef_string_t filename;
|
||||||
} data_;
|
} data_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefPostDataElementImpl);
|
||||||
|
IMPLEMENT_LOCKING(CefPostDataElementImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _REQUEST_IMPL_H
|
#endif // _REQUEST_IMPL_H
|
||||||
|
@ -12,7 +12,7 @@ class WebURLResponse;
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Implementation of CefResponse.
|
// Implementation of CefResponse.
|
||||||
class CefResponseImpl : public CefThreadSafeBase<CefResponse>
|
class CefResponseImpl : public CefResponse
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefResponseImpl();
|
CefResponseImpl();
|
||||||
@ -37,6 +37,9 @@ protected:
|
|||||||
CefString status_text_;
|
CefString status_text_;
|
||||||
CefString mime_type_;
|
CefString mime_type_;
|
||||||
HeaderMap header_map_;
|
HeaderMap header_map_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefResponseImpl);
|
||||||
|
IMPLEMENT_LOCKING(CefResponseImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _RESPONSE_IMPL_H
|
#endif // _RESPONSE_IMPL_H
|
||||||
|
@ -58,7 +58,7 @@ public:
|
|||||||
|
|
||||||
virtual ~CefUrlRequestJob(){}
|
virtual ~CefUrlRequestJob(){}
|
||||||
|
|
||||||
virtual void Start()
|
virtual void Start() OVERRIDE
|
||||||
{
|
{
|
||||||
handler_->Cancel();
|
handler_->Cancel();
|
||||||
// Continue asynchronously.
|
// Continue asynchronously.
|
||||||
@ -70,7 +70,7 @@ public:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Kill()
|
virtual void Kill() OVERRIDE
|
||||||
{
|
{
|
||||||
if (async_resolver_) {
|
if (async_resolver_) {
|
||||||
async_resolver_->Cancel();
|
async_resolver_->Cancel();
|
||||||
@ -81,6 +81,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual bool ReadRawData(net::IOBuffer* dest, int dest_size, int *bytes_read)
|
virtual bool ReadRawData(net::IOBuffer* dest, int dest_size, int *bytes_read)
|
||||||
|
OVERRIDE
|
||||||
{
|
{
|
||||||
DCHECK_NE(dest_size, 0);
|
DCHECK_NE(dest_size, 0);
|
||||||
DCHECK(bytes_read);
|
DCHECK(bytes_read);
|
||||||
@ -119,7 +120,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void GetResponseInfo(net::HttpResponseInfo* info) {
|
virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE {
|
||||||
CefResponseImpl* responseImpl =
|
CefResponseImpl* responseImpl =
|
||||||
static_cast<CefResponseImpl*>(response_.get());
|
static_cast<CefResponseImpl*>(response_.get());
|
||||||
scoped_refptr<net::HttpResponseHeaders> headers(
|
scoped_refptr<net::HttpResponseHeaders> headers(
|
||||||
@ -128,6 +129,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual bool IsRedirectResponse(GURL* location, int* http_status_code)
|
virtual bool IsRedirectResponse(GURL* location, int* http_status_code)
|
||||||
|
OVERRIDE
|
||||||
{
|
{
|
||||||
if (redirect_url_.is_valid()) {
|
if (redirect_url_.is_valid()) {
|
||||||
// Redirect to the new URL.
|
// Redirect to the new URL.
|
||||||
@ -138,7 +140,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool GetMimeType(std::string* mime_type) const
|
virtual bool GetMimeType(std::string* mime_type) const OVERRIDE
|
||||||
{
|
{
|
||||||
DCHECK(request_);
|
DCHECK(request_);
|
||||||
// call handler to get mime type
|
// call handler to get mime type
|
||||||
@ -146,10 +148,6 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void SetExtraRequestHeaders(const std::string& headers)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
CefRefPtr<CefSchemeHandler> handler_;
|
CefRefPtr<CefSchemeHandler> handler_;
|
||||||
CefRefPtr<CefResponse> response_;
|
CefRefPtr<CefResponse> response_;
|
||||||
int response_length_;
|
int response_length_;
|
||||||
@ -376,7 +374,7 @@ private:
|
|||||||
CefUrlRequestFilter* CefUrlRequestFilter::shared_instance_ = NULL;
|
CefUrlRequestFilter* CefUrlRequestFilter::shared_instance_ = NULL;
|
||||||
|
|
||||||
|
|
||||||
class SchemeRequestJobWrapper : public CefThreadSafeBase<CefBase> {
|
class SchemeRequestJobWrapper : public CefBase {
|
||||||
public:
|
public:
|
||||||
SchemeRequestJobWrapper(const std::string& scheme_name,
|
SchemeRequestJobWrapper(const std::string& scheme_name,
|
||||||
const std::string& host_name,
|
const std::string& host_name,
|
||||||
@ -411,6 +409,8 @@ private:
|
|||||||
std::string host_name_;
|
std::string host_name_;
|
||||||
bool is_standard_;
|
bool is_standard_;
|
||||||
CefSchemeHandlerFactory* factory_;
|
CefSchemeHandlerFactory* factory_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(SchemeRequestJobWrapper);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool CefRegisterScheme(const CefString& scheme_name,
|
bool CefRegisterScheme(const CefString& scheme_name,
|
||||||
|
@ -72,42 +72,33 @@ CefFileReader::CefFileReader(FILE* file, bool close)
|
|||||||
|
|
||||||
CefFileReader::~CefFileReader()
|
CefFileReader::~CefFileReader()
|
||||||
{
|
{
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
if(close_)
|
if(close_)
|
||||||
fclose(file_);
|
fclose(file_);
|
||||||
Unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t CefFileReader::Read(void* ptr, size_t size, size_t n)
|
size_t CefFileReader::Read(void* ptr, size_t size, size_t n)
|
||||||
{
|
{
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
size_t rv = fread(ptr, size, n, file_);
|
return fread(ptr, size, n, file_);
|
||||||
Unlock();
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CefFileReader::Seek(long offset, int whence)
|
int CefFileReader::Seek(long offset, int whence)
|
||||||
{
|
{
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
int rv = fseek(file_, offset, whence);
|
return fseek(file_, offset, whence);
|
||||||
Unlock();
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
long CefFileReader::Tell()
|
long CefFileReader::Tell()
|
||||||
{
|
{
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
long rv = ftell(file_);
|
return ftell(file_);
|
||||||
Unlock();
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CefFileReader::Eof()
|
int CefFileReader::Eof()
|
||||||
{
|
{
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
int rv = feof(file_);
|
return feof(file_);
|
||||||
Unlock();
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -120,42 +111,33 @@ CefFileWriter::CefFileWriter(FILE* file, bool close)
|
|||||||
|
|
||||||
CefFileWriter::~CefFileWriter()
|
CefFileWriter::~CefFileWriter()
|
||||||
{
|
{
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
if(close_)
|
if(close_)
|
||||||
fclose(file_);
|
fclose(file_);
|
||||||
Unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t CefFileWriter::Write(const void* ptr, size_t size, size_t n)
|
size_t CefFileWriter::Write(const void* ptr, size_t size, size_t n)
|
||||||
{
|
{
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
size_t rv = (size_t)fwrite(ptr, size, n, file_);
|
return (size_t)fwrite(ptr, size, n, file_);
|
||||||
Unlock();
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CefFileWriter::Seek(long offset, int whence)
|
int CefFileWriter::Seek(long offset, int whence)
|
||||||
{
|
{
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
int rv = fseek(file_, offset, whence);
|
return fseek(file_, offset, whence);
|
||||||
Unlock();
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
long CefFileWriter::Tell()
|
long CefFileWriter::Tell()
|
||||||
{
|
{
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
long rv = ftell(file_);
|
return ftell(file_);
|
||||||
Unlock();
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CefFileWriter::Flush()
|
int CefFileWriter::Flush()
|
||||||
{
|
{
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
int rv = fflush(file_);
|
return fflush(file_);
|
||||||
Unlock();
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -174,19 +156,18 @@ CefBytesReader::~CefBytesReader()
|
|||||||
|
|
||||||
size_t CefBytesReader::Read(void* ptr, size_t size, size_t n)
|
size_t CefBytesReader::Read(void* ptr, size_t size, size_t n)
|
||||||
{
|
{
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
size_t s = (datasize_ - offset_) / size;
|
size_t s = (datasize_ - offset_) / size;
|
||||||
size_t ret = (n < s ? n : s);
|
size_t ret = (n < s ? n : s);
|
||||||
memcpy(ptr, ((char*)data_) + offset_, ret * size);
|
memcpy(ptr, ((char*)data_) + offset_, ret * size);
|
||||||
offset_ += ret * size;
|
offset_ += ret * size;
|
||||||
Unlock();
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CefBytesReader::Seek(long offset, int whence)
|
int CefBytesReader::Seek(long offset, int whence)
|
||||||
{
|
{
|
||||||
int rv = -1L;
|
int rv = -1L;
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
switch(whence) {
|
switch(whence) {
|
||||||
case SEEK_CUR:
|
case SEEK_CUR:
|
||||||
if(offset_ + offset > datasize_) {
|
if(offset_ + offset > datasize_) {
|
||||||
@ -210,30 +191,25 @@ int CefBytesReader::Seek(long offset, int whence)
|
|||||||
rv = 0;
|
rv = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Unlock();
|
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
long CefBytesReader::Tell()
|
long CefBytesReader::Tell()
|
||||||
{
|
{
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
long rv = offset_;
|
return offset_;
|
||||||
Unlock();
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CefBytesReader::Eof()
|
int CefBytesReader::Eof()
|
||||||
{
|
{
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
int rv = (offset_ >= datasize_);
|
return (offset_ >= datasize_);
|
||||||
Unlock();
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBytesReader::SetData(void* data, long datasize, bool copy)
|
void CefBytesReader::SetData(void* data, long datasize, bool copy)
|
||||||
{
|
{
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
if(copy_)
|
if(copy_)
|
||||||
free(data_);
|
free(data_);
|
||||||
|
|
||||||
@ -249,7 +225,6 @@ void CefBytesReader::SetData(void* data, long datasize, bool copy)
|
|||||||
} else {
|
} else {
|
||||||
data_ = data;
|
data_ = data;
|
||||||
}
|
}
|
||||||
Unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -265,15 +240,14 @@ CefBytesWriter::CefBytesWriter(size_t grow)
|
|||||||
|
|
||||||
CefBytesWriter::~CefBytesWriter()
|
CefBytesWriter::~CefBytesWriter()
|
||||||
{
|
{
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
if(data_)
|
if(data_)
|
||||||
free(data_);
|
free(data_);
|
||||||
Unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t CefBytesWriter::Write(const void* ptr, size_t size, size_t n)
|
size_t CefBytesWriter::Write(const void* ptr, size_t size, size_t n)
|
||||||
{
|
{
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
size_t rv;
|
size_t rv;
|
||||||
if(offset_ + size * n >= datasize_ && Grow(size * n) == 0) {
|
if(offset_ + size * n >= datasize_ && Grow(size * n) == 0) {
|
||||||
rv = 0;
|
rv = 0;
|
||||||
@ -282,14 +256,14 @@ size_t CefBytesWriter::Write(const void* ptr, size_t size, size_t n)
|
|||||||
offset_ += size * n;
|
offset_ += size * n;
|
||||||
rv = n;
|
rv = n;
|
||||||
}
|
}
|
||||||
Unlock();
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CefBytesWriter::Seek(long offset, int whence)
|
int CefBytesWriter::Seek(long offset, int whence)
|
||||||
{
|
{
|
||||||
int rv = -1L;
|
int rv = -1L;
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
switch(whence) {
|
switch(whence) {
|
||||||
case SEEK_CUR:
|
case SEEK_CUR:
|
||||||
if(offset_ + offset > datasize_) {
|
if(offset_ + offset > datasize_) {
|
||||||
@ -312,17 +286,14 @@ int CefBytesWriter::Seek(long offset, int whence)
|
|||||||
rv = offset_;
|
rv = offset_;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Unlock();
|
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
long CefBytesWriter::Tell()
|
long CefBytesWriter::Tell()
|
||||||
{
|
{
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
long rv = offset_;
|
return offset_;
|
||||||
Unlock();
|
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int CefBytesWriter::Flush()
|
int CefBytesWriter::Flush()
|
||||||
@ -332,15 +303,14 @@ int CefBytesWriter::Flush()
|
|||||||
|
|
||||||
std::string CefBytesWriter::GetDataString()
|
std::string CefBytesWriter::GetDataString()
|
||||||
{
|
{
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
std::string str((char*)data_, offset_);
|
std::string str((char*)data_, offset_);
|
||||||
Unlock();
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t CefBytesWriter::Grow(size_t size)
|
size_t CefBytesWriter::Grow(size_t size)
|
||||||
{
|
{
|
||||||
Lock();
|
AutoLock lock_scope(this);
|
||||||
size_t rv;
|
size_t rv;
|
||||||
size_t s = (size > grow_ ? size : grow_);
|
size_t s = (size > grow_ ? size : grow_);
|
||||||
void* tmp = realloc(data_, datasize_ + s);
|
void* tmp = realloc(data_, datasize_ + s);
|
||||||
@ -352,6 +322,6 @@ size_t CefBytesWriter::Grow(size_t size)
|
|||||||
} else {
|
} else {
|
||||||
rv = 0;
|
rv = 0;
|
||||||
}
|
}
|
||||||
Unlock();
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -9,50 +9,56 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
// Implementation of CefStreamReader for files.
|
// Implementation of CefStreamReader for files.
|
||||||
class CefFileReader : public CefThreadSafeBase<CefStreamReader>
|
class CefFileReader : public CefStreamReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefFileReader(FILE* file, bool close);
|
CefFileReader(FILE* file, bool close);
|
||||||
virtual ~CefFileReader();
|
virtual ~CefFileReader();
|
||||||
|
|
||||||
virtual size_t Read(void* ptr, size_t size, size_t n);
|
virtual size_t Read(void* ptr, size_t size, size_t n) OVERRIDE;
|
||||||
virtual int Seek(long offset, int whence);
|
virtual int Seek(long offset, int whence) OVERRIDE;
|
||||||
virtual long Tell();
|
virtual long Tell() OVERRIDE;
|
||||||
virtual int Eof();
|
virtual int Eof() OVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool close_;
|
bool close_;
|
||||||
FILE *file_;
|
FILE *file_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefFileReader);
|
||||||
|
IMPLEMENT_LOCKING(CefFileReader);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implementation of CefStreamWriter for files.
|
// Implementation of CefStreamWriter for files.
|
||||||
class CefFileWriter : public CefThreadSafeBase<CefStreamWriter>
|
class CefFileWriter : public CefStreamWriter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefFileWriter(FILE* file, bool close);
|
CefFileWriter(FILE* file, bool close);
|
||||||
virtual ~CefFileWriter();
|
virtual ~CefFileWriter();
|
||||||
|
|
||||||
virtual size_t Write(const void* ptr, size_t size, size_t n);
|
virtual size_t Write(const void* ptr, size_t size, size_t n) OVERRIDE;
|
||||||
virtual int Seek(long offset, int whence);
|
virtual int Seek(long offset, int whence) OVERRIDE;
|
||||||
virtual long Tell();
|
virtual long Tell() OVERRIDE;
|
||||||
virtual int Flush();
|
virtual int Flush() OVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FILE *file_;
|
FILE *file_;
|
||||||
bool close_;
|
bool close_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefFileWriter);
|
||||||
|
IMPLEMENT_LOCKING(CefFileWriter);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implementation of CefStreamReader for byte buffers.
|
// Implementation of CefStreamReader for byte buffers.
|
||||||
class CefBytesReader : public CefThreadSafeBase<CefStreamReader>
|
class CefBytesReader : public CefStreamReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefBytesReader(void* data, long datasize, bool copy);
|
CefBytesReader(void* data, long datasize, bool copy);
|
||||||
virtual ~CefBytesReader();
|
virtual ~CefBytesReader();
|
||||||
|
|
||||||
virtual size_t Read(void* ptr, size_t size, size_t n);
|
virtual size_t Read(void* ptr, size_t size, size_t n) OVERRIDE;
|
||||||
virtual int Seek(long offset, int whence);
|
virtual int Seek(long offset, int whence) OVERRIDE;
|
||||||
virtual long Tell();
|
virtual long Tell() OVERRIDE;
|
||||||
virtual int Eof();
|
virtual int Eof() OVERRIDE;
|
||||||
|
|
||||||
void SetData(void* data, long datasize, bool copy);
|
void SetData(void* data, long datasize, bool copy);
|
||||||
|
|
||||||
@ -64,19 +70,22 @@ protected:
|
|||||||
size_t datasize_;
|
size_t datasize_;
|
||||||
bool copy_;
|
bool copy_;
|
||||||
size_t offset_;
|
size_t offset_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefBytesReader);
|
||||||
|
IMPLEMENT_LOCKING(CefBytesReader);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implementation of CefStreamWriter for byte buffers.
|
// Implementation of CefStreamWriter for byte buffers.
|
||||||
class CefBytesWriter : public CefThreadSafeBase<CefStreamWriter>
|
class CefBytesWriter : public CefStreamWriter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefBytesWriter(size_t grow);
|
CefBytesWriter(size_t grow);
|
||||||
virtual ~CefBytesWriter();
|
virtual ~CefBytesWriter();
|
||||||
|
|
||||||
virtual size_t Write(const void* ptr, size_t size, size_t n);
|
virtual size_t Write(const void* ptr, size_t size, size_t n) OVERRIDE;
|
||||||
virtual int Seek(long offset, int whence);
|
virtual int Seek(long offset, int whence) OVERRIDE;
|
||||||
virtual long Tell();
|
virtual long Tell() OVERRIDE;
|
||||||
virtual int Flush();
|
virtual int Flush() OVERRIDE;
|
||||||
|
|
||||||
void* GetData() { return data_; }
|
void* GetData() { return data_; }
|
||||||
size_t GetDataSize() { return offset_; }
|
size_t GetDataSize() { return offset_; }
|
||||||
@ -85,65 +94,71 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
size_t Grow(size_t size);
|
size_t Grow(size_t size);
|
||||||
|
|
||||||
protected:
|
|
||||||
size_t grow_;
|
size_t grow_;
|
||||||
void* data_;
|
void* data_;
|
||||||
size_t datasize_;
|
size_t datasize_;
|
||||||
size_t offset_;
|
size_t offset_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefBytesWriter);
|
||||||
|
IMPLEMENT_LOCKING(CefBytesWriter);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implementation of CefStreamReader for handlers.
|
// Implementation of CefStreamReader for handlers.
|
||||||
class CefHandlerReader : public CefThreadSafeBase<CefStreamReader>
|
class CefHandlerReader : public CefStreamReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefHandlerReader(CefRefPtr<CefReadHandler> handler) : handler_(handler) {}
|
CefHandlerReader(CefRefPtr<CefReadHandler> handler) : handler_(handler) {}
|
||||||
|
|
||||||
virtual size_t Read(void* ptr, size_t size, size_t n)
|
virtual size_t Read(void* ptr, size_t size, size_t n) OVERRIDE
|
||||||
{
|
{
|
||||||
return handler_->Read(ptr, size, n);
|
return handler_->Read(ptr, size, n);
|
||||||
}
|
}
|
||||||
virtual int Seek(long offset, int whence)
|
virtual int Seek(long offset, int whence) OVERRIDE
|
||||||
{
|
{
|
||||||
return handler_->Seek(offset, whence);
|
return handler_->Seek(offset, whence);
|
||||||
}
|
}
|
||||||
virtual long Tell()
|
virtual long Tell() OVERRIDE
|
||||||
{
|
{
|
||||||
return handler_->Tell();
|
return handler_->Tell();
|
||||||
}
|
}
|
||||||
virtual int Eof()
|
virtual int Eof() OVERRIDE
|
||||||
{
|
{
|
||||||
return handler_->Eof();
|
return handler_->Eof();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CefRefPtr<CefReadHandler> handler_;
|
CefRefPtr<CefReadHandler> handler_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefHandlerReader);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Implementation of CefStreamWriter for handlers.
|
// Implementation of CefStreamWriter for handlers.
|
||||||
class CefHandlerWriter : public CefThreadSafeBase<CefStreamWriter>
|
class CefHandlerWriter : public CefStreamWriter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefHandlerWriter(CefRefPtr<CefWriteHandler> handler) : handler_(handler) {}
|
CefHandlerWriter(CefRefPtr<CefWriteHandler> handler) : handler_(handler) {}
|
||||||
|
|
||||||
virtual size_t Write(const void* ptr, size_t size, size_t n)
|
virtual size_t Write(const void* ptr, size_t size, size_t n) OVERRIDE
|
||||||
{
|
{
|
||||||
return handler_->Write(ptr, size, n);
|
return handler_->Write(ptr, size, n);
|
||||||
}
|
}
|
||||||
virtual int Seek(long offset, int whence)
|
virtual int Seek(long offset, int whence) OVERRIDE
|
||||||
{
|
{
|
||||||
return handler_->Seek(offset, whence);
|
return handler_->Seek(offset, whence);
|
||||||
}
|
}
|
||||||
virtual long Tell()
|
virtual long Tell() OVERRIDE
|
||||||
{
|
{
|
||||||
return handler_->Tell();
|
return handler_->Tell();
|
||||||
}
|
}
|
||||||
virtual int Flush()
|
virtual int Flush() OVERRIDE
|
||||||
{
|
{
|
||||||
return handler_->Flush();
|
return handler_->Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CefRefPtr<CefWriteHandler> handler_;
|
CefRefPtr<CefWriteHandler> handler_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefHandlerWriter);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _STREAM_IMPL_H
|
#endif // _STREAM_IMPL_H
|
||||||
|
@ -74,7 +74,7 @@ private:
|
|||||||
// manager object is destroyed. A manager object can be created as either a
|
// manager object is destroyed. A manager object can be created as either a
|
||||||
// member variable of another class or by using lazy initialization:
|
// member variable of another class or by using lazy initialization:
|
||||||
// base::LazyInstance<CefTrackManager> g_singleton(base::LINKER_INITIALIZED);
|
// base::LazyInstance<CefTrackManager> g_singleton(base::LINKER_INITIALIZED);
|
||||||
class CefTrackManager : public CefThreadSafeBase<CefBase>
|
class CefTrackManager : public CefBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefTrackManager() : object_count_(0) {}
|
CefTrackManager() : object_count_(0) {}
|
||||||
@ -131,6 +131,9 @@ public:
|
|||||||
private:
|
private:
|
||||||
CefTrackObject tracker_;
|
CefTrackObject tracker_;
|
||||||
long object_count_;
|
long object_count_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefTrackManager);
|
||||||
|
IMPLEMENT_LOCKING(CefTrackManager);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _TRACKER_H
|
#endif // _TRACKER_H
|
||||||
|
@ -83,22 +83,18 @@ void TrackDestructor(v8::Persistent<v8::Value> object, void* parameter)
|
|||||||
// Return the browser associated with the specified WebFrame.
|
// Return the browser associated with the specified WebFrame.
|
||||||
CefRefPtr<CefBrowserImpl> FindBrowserForFrame(WebKit::WebFrame *frame)
|
CefRefPtr<CefBrowserImpl> FindBrowserForFrame(WebKit::WebFrame *frame)
|
||||||
{
|
{
|
||||||
CefRefPtr<CefBrowserImpl> browser;
|
CefContext::AutoLock lock_scope(_Context);
|
||||||
|
|
||||||
CefContext::BrowserList *list;
|
CefContext::BrowserList *list = _Context->GetBrowserList();
|
||||||
CefContext::BrowserList::const_iterator i;
|
CefContext::BrowserList::const_iterator i;
|
||||||
_Context->Lock();
|
|
||||||
list = _Context->GetBrowserList();
|
|
||||||
i = list->begin();
|
i = list->begin();
|
||||||
for (; i != list->end(); ++i) {
|
for (; i != list->end(); ++i) {
|
||||||
WebKit::WebFrame* thisframe = i->get()->UIT_GetMainWebFrame();
|
WebKit::WebFrame* thisframe = i->get()->UIT_GetMainWebFrame();
|
||||||
if (thisframe == frame) {
|
if (thisframe == frame)
|
||||||
browser = i->get();
|
return i->get();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
_Context->Unlock();
|
return NULL;
|
||||||
return browser;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert a wide string to a V8 string.
|
// Convert a wide string to a V8 string.
|
||||||
@ -293,7 +289,7 @@ CefRefPtr<CefV8Context> CefV8Context::GetEnteredContext()
|
|||||||
// CefV8ContextImpl
|
// CefV8ContextImpl
|
||||||
|
|
||||||
CefV8ContextImpl::CefV8ContextImpl(v8::Handle<v8::Context> context)
|
CefV8ContextImpl::CefV8ContextImpl(v8::Handle<v8::Context> context)
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
: enter_count_(0)
|
: enter_count_(0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -346,7 +342,7 @@ bool CefV8ContextImpl::Enter()
|
|||||||
{
|
{
|
||||||
CEF_REQUIRE_UI_THREAD(false);
|
CEF_REQUIRE_UI_THREAD(false);
|
||||||
v8_context_->GetHandle()->Enter();
|
v8_context_->GetHandle()->Enter();
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
++enter_count_;
|
++enter_count_;
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
@ -357,7 +353,7 @@ bool CefV8ContextImpl::Exit()
|
|||||||
CEF_REQUIRE_UI_THREAD(false);
|
CEF_REQUIRE_UI_THREAD(false);
|
||||||
DLOG_ASSERT(enter_count_ > 0);
|
DLOG_ASSERT(enter_count_ > 0);
|
||||||
v8_context_->GetHandle()->Exit();
|
v8_context_->GetHandle()->Exit();
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
--enter_count_;
|
--enter_count_;
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
|
@ -59,17 +59,17 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class CefV8ContextImpl : public CefThreadSafeBase<CefV8Context>
|
class CefV8ContextImpl : public CefV8Context
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefV8ContextImpl(v8::Handle<v8::Context> context);
|
CefV8ContextImpl(v8::Handle<v8::Context> context);
|
||||||
virtual ~CefV8ContextImpl();
|
virtual ~CefV8ContextImpl();
|
||||||
|
|
||||||
virtual CefRefPtr<CefBrowser> GetBrowser();
|
virtual CefRefPtr<CefBrowser> GetBrowser() OVERRIDE;
|
||||||
virtual CefRefPtr<CefFrame> GetFrame();
|
virtual CefRefPtr<CefFrame> GetFrame() OVERRIDE;
|
||||||
virtual CefRefPtr<CefV8Value> GetGlobal();
|
virtual CefRefPtr<CefV8Value> GetGlobal() OVERRIDE;
|
||||||
virtual bool Enter();
|
virtual bool Enter() OVERRIDE;
|
||||||
virtual bool Exit();
|
virtual bool Exit() OVERRIDE;
|
||||||
|
|
||||||
v8::Local<v8::Context> GetContext();
|
v8::Local<v8::Context> GetContext();
|
||||||
WebKit::WebFrame* GetWebFrame();
|
WebKit::WebFrame* GetWebFrame();
|
||||||
@ -77,10 +77,12 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
scoped_refptr<CefV8ContextHandle> v8_context_;
|
scoped_refptr<CefV8ContextHandle> v8_context_;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
// Used in debug builds to catch missing Exits in destructor.
|
// Used in debug builds to catch missing Exits in destructor.
|
||||||
int enter_count_;
|
int enter_count_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefV8ContextImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Special class for a v8::Value to ensure that it is deleted from the UI
|
// Special class for a v8::Value to ensure that it is deleted from the UI
|
||||||
@ -101,51 +103,52 @@ private:
|
|||||||
CefTrackObject *tracker_;
|
CefTrackObject *tracker_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CefV8ValueImpl : public CefThreadSafeBase<CefV8Value>
|
class CefV8ValueImpl : public CefV8Value
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefV8ValueImpl(v8::Handle<v8::Value> value, CefTrackObject* tracker = NULL);
|
CefV8ValueImpl(v8::Handle<v8::Value> value, CefTrackObject* tracker = NULL);
|
||||||
virtual ~CefV8ValueImpl();
|
virtual ~CefV8ValueImpl();
|
||||||
|
|
||||||
virtual bool IsUndefined();
|
virtual bool IsUndefined() OVERRIDE;
|
||||||
virtual bool IsNull();
|
virtual bool IsNull() OVERRIDE;
|
||||||
virtual bool IsBool();
|
virtual bool IsBool() OVERRIDE;
|
||||||
virtual bool IsInt();
|
virtual bool IsInt() OVERRIDE;
|
||||||
virtual bool IsDouble();
|
virtual bool IsDouble() OVERRIDE;
|
||||||
virtual bool IsString();
|
virtual bool IsString() OVERRIDE;
|
||||||
virtual bool IsObject();
|
virtual bool IsObject() OVERRIDE;
|
||||||
virtual bool IsArray();
|
virtual bool IsArray() OVERRIDE;
|
||||||
virtual bool IsFunction();
|
virtual bool IsFunction() OVERRIDE;
|
||||||
virtual bool IsSame(CefRefPtr<CefV8Value> value);
|
virtual bool IsSame(CefRefPtr<CefV8Value> value) OVERRIDE;
|
||||||
virtual bool GetBoolValue();
|
virtual bool GetBoolValue() OVERRIDE;
|
||||||
virtual int GetIntValue();
|
virtual int GetIntValue() OVERRIDE;
|
||||||
virtual double GetDoubleValue();
|
virtual double GetDoubleValue() OVERRIDE;
|
||||||
virtual CefString GetStringValue();
|
virtual CefString GetStringValue() OVERRIDE;
|
||||||
virtual bool HasValue(const CefString& key);
|
virtual bool HasValue(const CefString& key) OVERRIDE;
|
||||||
virtual bool HasValue(int index);
|
virtual bool HasValue(int index) OVERRIDE;
|
||||||
virtual bool DeleteValue(const CefString& key);
|
virtual bool DeleteValue(const CefString& key) OVERRIDE;
|
||||||
virtual bool DeleteValue(int index);
|
virtual bool DeleteValue(int index) OVERRIDE;
|
||||||
virtual CefRefPtr<CefV8Value> GetValue(const CefString& key);
|
virtual CefRefPtr<CefV8Value> GetValue(const CefString& key) OVERRIDE;
|
||||||
virtual CefRefPtr<CefV8Value> GetValue(int index);
|
virtual CefRefPtr<CefV8Value> GetValue(int index) OVERRIDE;
|
||||||
virtual bool SetValue(const CefString& key, CefRefPtr<CefV8Value> value);
|
virtual bool SetValue(const CefString& key, CefRefPtr<CefV8Value> value)
|
||||||
virtual bool SetValue(int index, CefRefPtr<CefV8Value> value);
|
OVERRIDE;
|
||||||
|
virtual bool SetValue(int index, CefRefPtr<CefV8Value> value) OVERRIDE;
|
||||||
virtual bool SetValue(const CefString& key, AccessControl settings,
|
virtual bool SetValue(const CefString& key, AccessControl settings,
|
||||||
PropertyAttribute attribute);
|
PropertyAttribute attribute) OVERRIDE;
|
||||||
virtual bool GetKeys(std::vector<CefString>& keys);
|
virtual bool GetKeys(std::vector<CefString>& keys) OVERRIDE;
|
||||||
virtual CefRefPtr<CefBase> GetUserData();
|
virtual CefRefPtr<CefBase> GetUserData() OVERRIDE;
|
||||||
virtual int GetArrayLength();
|
virtual int GetArrayLength() OVERRIDE;
|
||||||
virtual CefString GetFunctionName();
|
virtual CefString GetFunctionName() OVERRIDE;
|
||||||
virtual CefRefPtr<CefV8Handler> GetFunctionHandler();
|
virtual CefRefPtr<CefV8Handler> GetFunctionHandler() OVERRIDE;
|
||||||
virtual bool ExecuteFunction(CefRefPtr<CefV8Value> object,
|
virtual bool ExecuteFunction(CefRefPtr<CefV8Value> object,
|
||||||
const CefV8ValueList& arguments,
|
const CefV8ValueList& arguments,
|
||||||
CefRefPtr<CefV8Value>& retval,
|
CefRefPtr<CefV8Value>& retval,
|
||||||
CefString& exception);
|
CefString& exception) OVERRIDE;
|
||||||
virtual bool ExecuteFunctionWithContext(
|
virtual bool ExecuteFunctionWithContext(
|
||||||
CefRefPtr<CefV8Context> context,
|
CefRefPtr<CefV8Context> context,
|
||||||
CefRefPtr<CefV8Value> object,
|
CefRefPtr<CefV8Value> object,
|
||||||
const CefV8ValueList& arguments,
|
const CefV8ValueList& arguments,
|
||||||
CefRefPtr<CefV8Value>& retval,
|
CefRefPtr<CefV8Value>& retval,
|
||||||
CefString& exception);
|
CefString& exception) OVERRIDE;
|
||||||
|
|
||||||
inline v8::Handle<v8::Value> GetHandle()
|
inline v8::Handle<v8::Value> GetHandle()
|
||||||
{
|
{
|
||||||
@ -157,6 +160,8 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
scoped_refptr<CefV8ValueHandle> v8_value_;
|
scoped_refptr<CefV8ValueHandle> v8_value_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefV8ValueImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //_V8_IMPL_H
|
#endif //_V8_IMPL_H
|
||||||
|
@ -8,8 +8,7 @@
|
|||||||
#include "include/cef.h"
|
#include "include/cef.h"
|
||||||
#include "base/memory/ref_counted.h"
|
#include "base/memory/ref_counted.h"
|
||||||
|
|
||||||
class CefWebURLRequestImpl :
|
class CefWebURLRequestImpl : public CefWebURLRequest
|
||||||
public CefThreadSafeBase<CefWebURLRequest>
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
class Context;
|
class Context;
|
||||||
@ -19,8 +18,8 @@ public:
|
|||||||
virtual ~CefWebURLRequestImpl();
|
virtual ~CefWebURLRequestImpl();
|
||||||
|
|
||||||
// Can be called on any thread.
|
// Can be called on any thread.
|
||||||
virtual RequestState GetState();
|
virtual RequestState GetState() OVERRIDE;
|
||||||
virtual void Cancel();
|
virtual void Cancel() OVERRIDE;
|
||||||
|
|
||||||
// Can only be called on the UI thread.
|
// Can only be called on the UI thread.
|
||||||
void DoSend(CefRefPtr<CefRequest> request);
|
void DoSend(CefRefPtr<CefRequest> request);
|
||||||
@ -37,6 +36,9 @@ protected:
|
|||||||
// The below parameters are only modified on the UI thread.
|
// The below parameters are only modified on the UI thread.
|
||||||
RequestState state_;
|
RequestState state_;
|
||||||
scoped_refptr<Context> context_;
|
scoped_refptr<Context> context_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefWebURLRequestImpl);
|
||||||
|
IMPLEMENT_LOCKING(CefWebURLRequestImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _WEB_URL_REQUEST_CLIENT_IMPL_H
|
#endif // _WEB_URL_REQUEST_CLIENT_IMPL_H
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
// Implementation of CefXmlReader
|
// Implementation of CefXmlReader
|
||||||
class CefXmlReaderImpl : public CefThreadSafeBase<CefXmlReader>
|
class CefXmlReaderImpl : public CefXmlReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefXmlReaderImpl();
|
CefXmlReaderImpl();
|
||||||
@ -65,6 +65,8 @@ protected:
|
|||||||
CefRefPtr<CefStreamReader> stream_;
|
CefRefPtr<CefStreamReader> stream_;
|
||||||
xmlTextReaderPtr reader_;
|
xmlTextReaderPtr reader_;
|
||||||
std::stringstream error_buf_;
|
std::stringstream error_buf_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefXMLReaderImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _XML_READER_IMPL_H
|
#endif // _XML_READER_IMPL_H
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
// Implementation of CefZipReader
|
// Implementation of CefZipReader
|
||||||
class CefZipReaderImpl : public CefThreadSafeBase<CefZipReader>
|
class CefZipReaderImpl : public CefZipReader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefZipReaderImpl();
|
CefZipReaderImpl();
|
||||||
@ -47,6 +47,8 @@ protected:
|
|||||||
CefString filename_;
|
CefString filename_;
|
||||||
long filesize_;
|
long filesize_;
|
||||||
time_t filemodified_;
|
time_t filemodified_;
|
||||||
|
|
||||||
|
IMPLEMENT_REFCOUNTING(CefZipReaderImpl);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _ZIP_READER_IMPL_H
|
#endif // _ZIP_READER_IMPL_H
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// CefCppToC implementation for CefBase.
|
// CefCppToC implementation for CefBase.
|
||||||
class CefBaseCppToC : public CefThreadSafeBase<CefBase>
|
class CefBaseCppToC : public CefBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Use this method to retrieve the underlying class instance from our
|
// Use this method to retrieve the underlying class instance from our
|
||||||
@ -88,16 +88,20 @@ public:
|
|||||||
|
|
||||||
// CefBase methods increment/decrement reference counts on both this object
|
// CefBase methods increment/decrement reference counts on both this object
|
||||||
// and the underlying wrapper class.
|
// and the underlying wrapper class.
|
||||||
virtual int AddRef()
|
int AddRef()
|
||||||
{
|
{
|
||||||
UnderlyingAddRef();
|
UnderlyingAddRef();
|
||||||
return CefThreadSafeBase<CefBase>::AddRef();
|
return refct_.AddRef();
|
||||||
}
|
}
|
||||||
virtual int Release()
|
int Release()
|
||||||
{
|
{
|
||||||
UnderlyingRelease();
|
UnderlyingRelease();
|
||||||
return CefThreadSafeBase<CefBase>::Release();
|
int retval = refct_.Release();
|
||||||
|
if (retval == 0)
|
||||||
|
delete this;
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
int GetRefCt() { return refct_.GetRefCt(); }
|
||||||
|
|
||||||
// Increment/decrement reference counts on only the underlying class.
|
// Increment/decrement reference counts on only the underlying class.
|
||||||
int UnderlyingAddRef() { return class_->AddRef(); }
|
int UnderlyingAddRef() { return class_->AddRef(); }
|
||||||
@ -136,6 +140,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
CefRefCount refct_;
|
||||||
Struct struct_;
|
Struct struct_;
|
||||||
CefBase* class_;
|
CefBase* class_;
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
@ -12,41 +12,55 @@
|
|||||||
|
|
||||||
#include "libcef_dll/cpptoc/browser_cpptoc.h"
|
#include "libcef_dll/cpptoc/browser_cpptoc.h"
|
||||||
#include "libcef_dll/cpptoc/frame_cpptoc.h"
|
#include "libcef_dll/cpptoc/frame_cpptoc.h"
|
||||||
#include "libcef_dll/ctocpp/handler_ctocpp.h"
|
#include "libcef_dll/ctocpp/client_ctocpp.h"
|
||||||
#include "libcef_dll/transfer_util.h"
|
#include "libcef_dll/transfer_util.h"
|
||||||
|
|
||||||
|
|
||||||
// GLOBAL FUNCTIONS - Body may be edited by hand.
|
// GLOBAL FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
CEF_EXPORT int cef_browser_create(cef_window_info_t* windowInfo, int popup,
|
CEF_EXPORT int cef_browser_create(cef_window_info_t* windowInfo,
|
||||||
struct _cef_handler_t* handler, const cef_string_t* url)
|
struct _cef_client_t* client, const cef_string_t* url,
|
||||||
|
const struct _cef_browser_settings_t* settings)
|
||||||
{
|
{
|
||||||
DCHECK(windowInfo);
|
DCHECK(windowInfo);
|
||||||
|
if (!windowInfo)
|
||||||
|
return 0;
|
||||||
|
|
||||||
CefRefPtr<CefHandler> handlerPtr;
|
CefRefPtr<CefClient> clientPtr;
|
||||||
CefWindowInfo wi = *windowInfo;
|
CefWindowInfo windowInfoObj;
|
||||||
|
CefBrowserSettings browserSettingsObj;
|
||||||
|
|
||||||
if(handler)
|
windowInfoObj.Set(*windowInfo, false);
|
||||||
handlerPtr = CefHandlerCToCpp::Wrap(handler);
|
if(client)
|
||||||
|
clientPtr = CefClientCToCpp::Wrap(client);
|
||||||
|
if (settings)
|
||||||
|
browserSettingsObj.Set(*settings, false);
|
||||||
|
|
||||||
return CefBrowser::CreateBrowser(wi, popup?true:false, handlerPtr,
|
return CefBrowser::CreateBrowser(windowInfoObj, clientPtr, CefString(url),
|
||||||
CefString(url));
|
browserSettingsObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
CEF_EXPORT cef_browser_t* cef_browser_create_sync(cef_window_info_t* windowInfo,
|
CEF_EXPORT cef_browser_t* cef_browser_create_sync(cef_window_info_t* windowInfo,
|
||||||
int popup, struct _cef_handler_t* handler, const cef_string_t* url)
|
struct _cef_client_t* client, const cef_string_t* url,
|
||||||
|
const struct _cef_browser_settings_t* settings)
|
||||||
{
|
{
|
||||||
DCHECK(windowInfo);
|
DCHECK(windowInfo);
|
||||||
|
if (!windowInfo)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
CefRefPtr<CefHandler> handlerPtr;
|
CefRefPtr<CefClient> clientPtr;
|
||||||
CefWindowInfo wi = *windowInfo;
|
CefWindowInfo windowInfoObj;
|
||||||
|
CefBrowserSettings browserSettingsObj;
|
||||||
|
|
||||||
if(handler)
|
windowInfoObj.Set(*windowInfo, false);
|
||||||
handlerPtr = CefHandlerCToCpp::Wrap(handler);
|
if(client)
|
||||||
|
clientPtr = CefClientCToCpp::Wrap(client);
|
||||||
|
if (settings)
|
||||||
|
browserSettingsObj.Set(*settings, false);
|
||||||
|
|
||||||
CefRefPtr<CefBrowser> browserPtr(
|
CefRefPtr<CefBrowser> browserPtr(
|
||||||
CefBrowser::CreateBrowserSync(wi, popup?true:false, handlerPtr,
|
CefBrowser::CreateBrowserSync(windowInfoObj, clientPtr, CefString(url),
|
||||||
CefString(url)));
|
browserSettingsObj));
|
||||||
if(browserPtr.get())
|
if(browserPtr.get())
|
||||||
return CefBrowserCppToC::Wrap(browserPtr);
|
return CefBrowserCppToC::Wrap(browserPtr);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -155,17 +169,16 @@ int CEF_CALLBACK browser_is_popup(struct _cef_browser_t* self)
|
|||||||
return CefBrowserCppToC::Get(self)->IsPopup();
|
return CefBrowserCppToC::Get(self)->IsPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct _cef_handler_t* CEF_CALLBACK browser_get_handler(
|
struct _cef_client_t* CEF_CALLBACK browser_get_client(
|
||||||
struct _cef_browser_t* self)
|
struct _cef_browser_t* self)
|
||||||
{
|
{
|
||||||
DCHECK(self);
|
DCHECK(self);
|
||||||
if (!self)
|
if (!self)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
CefRefPtr<CefBrowser> browserPtr = CefBrowserCppToC::Get(self);
|
CefRefPtr<CefClient> clientPtr = CefBrowserCppToC::Get(self)->GetClient();
|
||||||
CefRefPtr<CefHandler> handlerPtr = browserPtr->GetHandler();
|
if(clientPtr.get())
|
||||||
if(handlerPtr.get())
|
return CefClientCToCpp::Unwrap(clientPtr);
|
||||||
return CefHandlerCToCpp::Unwrap(handlerPtr);
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -438,7 +451,7 @@ CefBrowserCppToC::CefBrowserCppToC(CefBrowser* cls)
|
|||||||
struct_.struct_.set_focus = browser_set_focus;
|
struct_.struct_.set_focus = browser_set_focus;
|
||||||
struct_.struct_.get_window_handle = browser_get_window_handle;
|
struct_.struct_.get_window_handle = browser_get_window_handle;
|
||||||
struct_.struct_.is_popup = browser_is_popup;
|
struct_.struct_.is_popup = browser_is_popup;
|
||||||
struct_.struct_.get_handler = browser_get_handler;
|
struct_.struct_.get_client = browser_get_client;
|
||||||
struct_.struct_.get_main_frame = browser_get_main_frame;
|
struct_.struct_.get_main_frame = browser_get_main_frame;
|
||||||
struct_.struct_.get_focused_frame = browser_get_focused_frame;
|
struct_.struct_.get_focused_frame = browser_get_focused_frame;
|
||||||
struct_.struct_.get_frame = browser_get_frame;
|
struct_.struct_.get_frame = browser_get_frame;
|
||||||
@ -465,7 +478,7 @@ CefBrowserCppToC::CefBrowserCppToC(CefBrowser* cls)
|
|||||||
struct_.struct_.send_capture_lost_event = browser_send_capture_lost_event;
|
struct_.struct_.send_capture_lost_event = browser_send_capture_lost_event;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCppToC<CefBrowserCppToC, CefBrowser,
|
template<> long CefCppToC<CefBrowserCppToC, CefBrowser,
|
||||||
cef_browser_t>::DebugObjCt = 0;
|
cef_browser_t>::DebugObjCt = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
|
234
libcef_dll/cpptoc/client_cpptoc.cc
Normal file
234
libcef_dll/cpptoc/client_cpptoc.cc
Normal file
@ -0,0 +1,234 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/cpptoc/client_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/display_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/find_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/focus_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/jsbinding_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/jsdialog_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/keyboard_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/life_span_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/load_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/menu_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/print_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/render_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/request_handler_cpptoc.h"
|
||||||
|
|
||||||
|
|
||||||
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
|
cef_life_span_handler_t* CEF_CALLBACK client_get_life_span_handler(
|
||||||
|
struct _cef_client_t* self)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CefRefPtr<CefLifeSpanHandler> handlerPtr =
|
||||||
|
CefClientCppToC::Get(self)->GetLifeSpanHandler();
|
||||||
|
if(handlerPtr.get())
|
||||||
|
return CefLifeSpanHandlerCppToC::Wrap(handlerPtr);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
cef_load_handler_t* CEF_CALLBACK client_get_load_handler(
|
||||||
|
struct _cef_client_t* self)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CefRefPtr<CefLoadHandler> handlerPtr =
|
||||||
|
CefClientCppToC::Get(self)->GetLoadHandler();
|
||||||
|
if(handlerPtr.get())
|
||||||
|
return CefLoadHandlerCppToC::Wrap(handlerPtr);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
cef_request_handler_t* CEF_CALLBACK client_get_request_handler(
|
||||||
|
struct _cef_client_t* self)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CefRefPtr<CefRequestHandler> handlerPtr =
|
||||||
|
CefClientCppToC::Get(self)->GetRequestHandler();
|
||||||
|
if(handlerPtr.get())
|
||||||
|
return CefRequestHandlerCppToC::Wrap(handlerPtr);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
cef_display_handler_t* CEF_CALLBACK client_get_display_handler(
|
||||||
|
struct _cef_client_t* self)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CefRefPtr<CefDisplayHandler> handlerPtr =
|
||||||
|
CefClientCppToC::Get(self)->GetDisplayHandler();
|
||||||
|
if(handlerPtr.get())
|
||||||
|
return CefDisplayHandlerCppToC::Wrap(handlerPtr);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
cef_focus_handler_t* CEF_CALLBACK client_get_focus_handler(
|
||||||
|
struct _cef_client_t* self)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CefRefPtr<CefFocusHandler> handlerPtr =
|
||||||
|
CefClientCppToC::Get(self)->GetFocusHandler();
|
||||||
|
if(handlerPtr.get())
|
||||||
|
return CefFocusHandlerCppToC::Wrap(handlerPtr);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
cef_keyboard_handler_t* CEF_CALLBACK client_get_keyboard_handler(
|
||||||
|
struct _cef_client_t* self)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CefRefPtr<CefKeyboardHandler> handlerPtr =
|
||||||
|
CefClientCppToC::Get(self)->GetKeyboardHandler();
|
||||||
|
if(handlerPtr.get())
|
||||||
|
return CefKeyboardHandlerCppToC::Wrap(handlerPtr);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
cef_menu_handler_t* CEF_CALLBACK client_get_menu_handler(
|
||||||
|
struct _cef_client_t* self)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CefRefPtr<CefMenuHandler> handlerPtr =
|
||||||
|
CefClientCppToC::Get(self)->GetMenuHandler();
|
||||||
|
if(handlerPtr.get())
|
||||||
|
return CefMenuHandlerCppToC::Wrap(handlerPtr);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
cef_print_handler_t* CEF_CALLBACK client_get_print_handler(
|
||||||
|
struct _cef_client_t* self)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CefRefPtr<CefPrintHandler> handlerPtr =
|
||||||
|
CefClientCppToC::Get(self)->GetPrintHandler();
|
||||||
|
if(handlerPtr.get())
|
||||||
|
return CefPrintHandlerCppToC::Wrap(handlerPtr);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
cef_find_handler_t* CEF_CALLBACK client_get_find_handler(
|
||||||
|
struct _cef_client_t* self)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CefRefPtr<CefFindHandler> handlerPtr =
|
||||||
|
CefClientCppToC::Get(self)->GetFindHandler();
|
||||||
|
if(handlerPtr.get())
|
||||||
|
return CefFindHandlerCppToC::Wrap(handlerPtr);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
cef_jsdialog_handler_t* CEF_CALLBACK client_get_jsdialog_handler(
|
||||||
|
struct _cef_client_t* self)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CefRefPtr<CefJSDialogHandler> handlerPtr =
|
||||||
|
CefClientCppToC::Get(self)->GetJSDialogHandler();
|
||||||
|
if(handlerPtr.get())
|
||||||
|
return CefJSDialogHandlerCppToC::Wrap(handlerPtr);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
cef_jsbinding_handler_t* CEF_CALLBACK client_get_jsbinding_handler(
|
||||||
|
struct _cef_client_t* self)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CefRefPtr<CefJSBindingHandler> handlerPtr =
|
||||||
|
CefClientCppToC::Get(self)->GetJSBindingHandler();
|
||||||
|
if(handlerPtr.get())
|
||||||
|
return CefJSBindingHandlerCppToC::Wrap(handlerPtr);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
cef_render_handler_t* CEF_CALLBACK client_get_render_handler(
|
||||||
|
struct _cef_client_t* self)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
if (!self)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CefRefPtr<CefRenderHandler> handlerPtr =
|
||||||
|
CefClientCppToC::Get(self)->GetRenderHandler();
|
||||||
|
if(handlerPtr.get())
|
||||||
|
return CefRenderHandlerCppToC::Wrap(handlerPtr);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
|
CefClientCppToC::CefClientCppToC(CefClient* cls)
|
||||||
|
: CefCppToC<CefClientCppToC, CefClient, cef_client_t>(cls)
|
||||||
|
{
|
||||||
|
struct_.struct_.get_life_span_handler = client_get_life_span_handler;
|
||||||
|
struct_.struct_.get_load_handler = client_get_load_handler;
|
||||||
|
struct_.struct_.get_request_handler = client_get_request_handler;
|
||||||
|
struct_.struct_.get_display_handler = client_get_display_handler;
|
||||||
|
struct_.struct_.get_focus_handler = client_get_focus_handler;
|
||||||
|
struct_.struct_.get_keyboard_handler = client_get_keyboard_handler;
|
||||||
|
struct_.struct_.get_menu_handler = client_get_menu_handler;
|
||||||
|
struct_.struct_.get_print_handler = client_get_print_handler;
|
||||||
|
struct_.struct_.get_find_handler = client_get_find_handler;
|
||||||
|
struct_.struct_.get_jsdialog_handler = client_get_jsdialog_handler;
|
||||||
|
struct_.struct_.get_jsbinding_handler = client_get_jsbinding_handler;
|
||||||
|
struct_.struct_.get_render_handler = client_get_render_handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCppToC<CefClientCppToC, CefClient,
|
||||||
|
cef_client_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
@ -8,8 +8,8 @@
|
|||||||
// 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 _HANDLER_CPPTOC_H
|
#ifndef _CLIENT_CPPTOC_H
|
||||||
#define _HANDLER_CPPTOC_H
|
#define _CLIENT_CPPTOC_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")
|
||||||
@ -21,14 +21,14 @@
|
|||||||
|
|
||||||
// Wrap a C++ class with a C structure.
|
// Wrap a C++ class with a C structure.
|
||||||
// This class may be instantiated and accessed wrapper-side only.
|
// This class may be instantiated and accessed wrapper-side only.
|
||||||
class CefHandlerCppToC
|
class CefClientCppToC
|
||||||
: public CefCppToC<CefHandlerCppToC, CefHandler, cef_handler_t>
|
: public CefCppToC<CefClientCppToC, CefClient, cef_client_t>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CefHandlerCppToC(CefHandler* cls);
|
CefClientCppToC(CefClient* cls);
|
||||||
virtual ~CefHandlerCppToC() {}
|
virtual ~CefClientCppToC() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // USING_CEF_SHARED
|
#endif // USING_CEF_SHARED
|
||||||
#endif // _HANDLER_CPPTOC_H
|
#endif // _CLIENT_CPPTOC_H
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
@ -46,7 +46,7 @@ CefCookieVisitorCppToC::CefCookieVisitorCppToC(CefCookieVisitor* cls)
|
|||||||
struct_.struct_.visit = cookie_visitor_visit;
|
struct_.struct_.visit = cookie_visitor_visit;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCppToC<CefCookieVisitorCppToC, CefCookieVisitor,
|
template<> long CefCppToC<CefCookieVisitorCppToC, CefCookieVisitor,
|
||||||
cef_cookie_visitor_t>::DebugObjCt = 0;
|
cef_cookie_visitor_t>::DebugObjCt = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
// implementation exists on this side of the DLL boundary but will have methods
|
// implementation exists on this side of the DLL boundary but will have methods
|
||||||
// called from the other side of the DLL boundary.
|
// called from the other side of the DLL boundary.
|
||||||
template <class ClassName, class BaseName, class StructName>
|
template <class ClassName, class BaseName, class StructName>
|
||||||
class CefCppToC : public CefThreadSafeBase<CefBase>
|
class CefCppToC : public CefBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// Structure representation with pointer to the C++ class.
|
// Structure representation with pointer to the C++ class.
|
||||||
@ -78,13 +78,13 @@ public:
|
|||||||
struct_.struct_.base.release = struct_release;
|
struct_.struct_.base.release = struct_release;
|
||||||
struct_.struct_.base.get_refct = struct_get_refct;
|
struct_.struct_.base.get_refct = struct_get_refct;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
CefAtomicIncrement(&DebugObjCt);
|
CefAtomicIncrement(&DebugObjCt);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
virtual ~CefCppToC()
|
virtual ~CefCppToC()
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
CefAtomicDecrement(&DebugObjCt);
|
CefAtomicDecrement(&DebugObjCt);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -98,23 +98,27 @@ public:
|
|||||||
|
|
||||||
// CefBase methods increment/decrement reference counts on both this object
|
// CefBase methods increment/decrement reference counts on both this object
|
||||||
// and the underlying wrapper class.
|
// and the underlying wrapper class.
|
||||||
virtual int AddRef()
|
int AddRef()
|
||||||
{
|
{
|
||||||
UnderlyingAddRef();
|
UnderlyingAddRef();
|
||||||
return CefThreadSafeBase<CefBase>::AddRef();
|
return refct_.AddRef();
|
||||||
}
|
}
|
||||||
virtual int Release()
|
int Release()
|
||||||
{
|
{
|
||||||
UnderlyingRelease();
|
UnderlyingRelease();
|
||||||
return CefThreadSafeBase<CefBase>::Release();
|
int retval = refct_.Release();
|
||||||
|
if (retval == 0)
|
||||||
|
delete this;
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
int GetRefCt() { return refct_.GetRefCt(); }
|
||||||
|
|
||||||
// Increment/decrement reference counts on only the underlying class.
|
// Increment/decrement reference counts on only the underlying class.
|
||||||
int UnderlyingAddRef() { return class_->AddRef(); }
|
int UnderlyingAddRef() { return class_->AddRef(); }
|
||||||
int UnderlyingRelease() { return class_->Release(); }
|
int UnderlyingRelease() { return class_->Release(); }
|
||||||
int UnderlyingGetRefCt() { return class_->GetRefCt(); }
|
int UnderlyingGetRefCt() { return class_->GetRefCt(); }
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
// Simple tracking of allocated objects.
|
// Simple tracking of allocated objects.
|
||||||
static long DebugObjCt;
|
static long DebugObjCt;
|
||||||
#endif
|
#endif
|
||||||
@ -151,6 +155,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
CefRefCount refct_;
|
||||||
Struct struct_;
|
Struct struct_;
|
||||||
BaseName* class_;
|
BaseName* class_;
|
||||||
};
|
};
|
||||||
|
123
libcef_dll/cpptoc/display_handler_cpptoc.cc
Normal file
123
libcef_dll/cpptoc/display_handler_cpptoc.cc
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/cpptoc/display_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
|
void CEF_CALLBACK display_handler_on_nav_state_change(
|
||||||
|
struct _cef_display_handler_t* self, cef_browser_t* browser, int canGoBack,
|
||||||
|
int canGoForward)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
if (!self || !browser)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CefDisplayHandlerCppToC::Get(self)->OnNavStateChange(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), (canGoBack?true:false),
|
||||||
|
(canGoForward?true:false));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEF_CALLBACK display_handler_on_address_change(
|
||||||
|
struct _cef_display_handler_t* self, cef_browser_t* browser,
|
||||||
|
cef_frame_t* frame, const cef_string_t* url)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(frame);
|
||||||
|
DCHECK(url);
|
||||||
|
if (!self || !browser || !frame || !url)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CefDisplayHandlerCppToC::Get(self)->OnAddressChange(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
||||||
|
CefString(url));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEF_CALLBACK display_handler_on_title_change(
|
||||||
|
struct _cef_display_handler_t* self, cef_browser_t* browser,
|
||||||
|
const cef_string_t* title)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
if (!self || !browser)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CefDisplayHandlerCppToC::Get(self)->OnTitleChange(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), CefString(title));
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEF_CALLBACK display_handler_on_tooltip(struct _cef_display_handler_t* self,
|
||||||
|
cef_browser_t* browser, cef_string_t* text)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
if (!self || !browser)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
CefString textStr(text);
|
||||||
|
return CefDisplayHandlerCppToC::Get(self)->OnTooltip(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), textStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEF_CALLBACK display_handler_on_status_message(
|
||||||
|
struct _cef_display_handler_t* self, cef_browser_t* browser,
|
||||||
|
const cef_string_t* value, enum cef_handler_statustype_t type)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
if (!self || !browser)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CefDisplayHandlerCppToC::Get(self)->OnStatusMessage(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), CefString(value), type);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEF_CALLBACK display_handler_on_console_message(
|
||||||
|
struct _cef_display_handler_t* self, cef_browser_t* browser,
|
||||||
|
const cef_string_t* message, const cef_string_t* source, int line)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(message);
|
||||||
|
if (!self || !browser || !message)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return CefDisplayHandlerCppToC::Get(self)->OnConsoleMessage(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), CefString(message), CefString(source),
|
||||||
|
line);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
|
CefDisplayHandlerCppToC::CefDisplayHandlerCppToC(CefDisplayHandler* cls)
|
||||||
|
: CefCppToC<CefDisplayHandlerCppToC, CefDisplayHandler,
|
||||||
|
cef_display_handler_t>(cls)
|
||||||
|
{
|
||||||
|
struct_.struct_.on_nav_state_change = display_handler_on_nav_state_change;
|
||||||
|
struct_.struct_.on_address_change = display_handler_on_address_change;
|
||||||
|
struct_.struct_.on_title_change = display_handler_on_title_change;
|
||||||
|
struct_.struct_.on_tooltip = display_handler_on_tooltip;
|
||||||
|
struct_.struct_.on_status_message = display_handler_on_status_message;
|
||||||
|
struct_.struct_.on_console_message = display_handler_on_console_message;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCppToC<CefDisplayHandlerCppToC, CefDisplayHandler,
|
||||||
|
cef_display_handler_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
35
libcef_dll/cpptoc/display_handler_cpptoc.h
Normal file
35
libcef_dll/cpptoc/display_handler_cpptoc.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// more information.
|
||||||
|
//
|
||||||
|
#ifndef _DISPLAYHANDLER_CPPTOC_H
|
||||||
|
#define _DISPLAYHANDLER_CPPTOC_H
|
||||||
|
|
||||||
|
#ifndef USING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||||
|
#else // USING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_capi.h"
|
||||||
|
#include "libcef_dll/cpptoc/cpptoc.h"
|
||||||
|
|
||||||
|
// Wrap a C++ class with a C structure.
|
||||||
|
// This class may be instantiated and accessed wrapper-side only.
|
||||||
|
class CefDisplayHandlerCppToC
|
||||||
|
: public CefCppToC<CefDisplayHandlerCppToC, CefDisplayHandler,
|
||||||
|
cef_display_handler_t>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CefDisplayHandlerCppToC(CefDisplayHandler* cls);
|
||||||
|
virtual ~CefDisplayHandlerCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USING_CEF_SHARED
|
||||||
|
#endif // _DISPLAYHANDLER_CPPTOC_H
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
@ -235,7 +235,7 @@ CefDOMDocumentCppToC::CefDOMDocumentCppToC(CefDOMDocument* cls)
|
|||||||
struct_.struct_.get_complete_url = domdocument_get_complete_url;
|
struct_.struct_.get_complete_url = domdocument_get_complete_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCppToC<CefDOMDocumentCppToC, CefDOMDocument,
|
template<> long CefCppToC<CefDOMDocumentCppToC, CefDOMDocument,
|
||||||
cef_domdocument_t>::DebugObjCt = 0;
|
cef_domdocument_t>::DebugObjCt = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
@ -122,7 +122,7 @@ CefDOMEventCppToC::CefDOMEventCppToC(CefDOMEvent* cls)
|
|||||||
struct_.struct_.get_current_target = domevent_get_current_target;
|
struct_.struct_.get_current_target = domevent_get_current_target;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCppToC<CefDOMEventCppToC, CefDOMEvent,
|
template<> long CefCppToC<CefDOMEventCppToC, CefDOMEvent,
|
||||||
cef_domevent_t>::DebugObjCt = 0;
|
cef_domevent_t>::DebugObjCt = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
@ -40,7 +40,7 @@ CefDOMEventListenerCppToC::CefDOMEventListenerCppToC(CefDOMEventListener* cls)
|
|||||||
struct_.struct_.handle_event = domevent_listener_handle_event;
|
struct_.struct_.handle_event = domevent_listener_handle_event;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCppToC<CefDOMEventListenerCppToC, CefDOMEventListener,
|
template<> long CefCppToC<CefDOMEventListenerCppToC, CefDOMEventListener,
|
||||||
cef_domevent_listener_t>::DebugObjCt = 0;
|
cef_domevent_listener_t>::DebugObjCt = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
@ -314,7 +314,7 @@ CefDOMNodeCppToC::CefDOMNodeCppToC(CefDOMNode* cls)
|
|||||||
struct_.struct_.get_element_inner_text = domnode_get_element_inner_text;
|
struct_.struct_.get_element_inner_text = domnode_get_element_inner_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCppToC<CefDOMNodeCppToC, CefDOMNode,
|
template<> long CefCppToC<CefDOMNodeCppToC, CefDOMNode,
|
||||||
cef_domnode_t>::DebugObjCt = 0;
|
cef_domnode_t>::DebugObjCt = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
@ -39,7 +39,7 @@ CefDOMVisitorCppToC::CefDOMVisitorCppToC(CefDOMVisitor* cls)
|
|||||||
struct_.struct_.visit = domvisitor_visit;
|
struct_.struct_.visit = domvisitor_visit;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCppToC<CefDOMVisitorCppToC, CefDOMVisitor,
|
template<> long CefCppToC<CefDOMVisitorCppToC, CefDOMVisitor,
|
||||||
cef_domvisitor_t>::DebugObjCt = 0;
|
cef_domvisitor_t>::DebugObjCt = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
@ -46,7 +46,7 @@ CefDownloadHandlerCppToC::CefDownloadHandlerCppToC(CefDownloadHandler* cls)
|
|||||||
struct_.struct_.complete = download_handler_complete;
|
struct_.struct_.complete = download_handler_complete;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCppToC<CefDownloadHandlerCppToC, CefDownloadHandler,
|
template<> long CefCppToC<CefDownloadHandlerCppToC, CefDownloadHandler,
|
||||||
cef_download_handler_t>::DebugObjCt = 0;
|
cef_download_handler_t>::DebugObjCt = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
|
48
libcef_dll/cpptoc/find_handler_cpptoc.cc
Normal file
48
libcef_dll/cpptoc/find_handler_cpptoc.cc
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/cpptoc/find_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
|
void CEF_CALLBACK find_handler_on_find_result(struct _cef_find_handler_t* self,
|
||||||
|
cef_browser_t* browser, int identifier, int count,
|
||||||
|
const cef_rect_t* selectionRect, int activeMatchOrdinal, int finalUpdate)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(selectionRect);
|
||||||
|
if (!self || !browser || !selectionRect)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CefRect rect(*selectionRect);
|
||||||
|
CefFindHandlerCppToC::Get(self)->OnFindResult(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), identifier, count, rect,
|
||||||
|
activeMatchOrdinal, finalUpdate?true:false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
|
CefFindHandlerCppToC::CefFindHandlerCppToC(CefFindHandler* cls)
|
||||||
|
: CefCppToC<CefFindHandlerCppToC, CefFindHandler, cef_find_handler_t>(cls)
|
||||||
|
{
|
||||||
|
struct_.struct_.on_find_result = find_handler_on_find_result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCppToC<CefFindHandlerCppToC, CefFindHandler,
|
||||||
|
cef_find_handler_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
34
libcef_dll/cpptoc/find_handler_cpptoc.h
Normal file
34
libcef_dll/cpptoc/find_handler_cpptoc.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// more information.
|
||||||
|
//
|
||||||
|
#ifndef _FINDHANDLER_CPPTOC_H
|
||||||
|
#define _FINDHANDLER_CPPTOC_H
|
||||||
|
|
||||||
|
#ifndef USING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||||
|
#else // USING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_capi.h"
|
||||||
|
#include "libcef_dll/cpptoc/cpptoc.h"
|
||||||
|
|
||||||
|
// Wrap a C++ class with a C structure.
|
||||||
|
// This class may be instantiated and accessed wrapper-side only.
|
||||||
|
class CefFindHandlerCppToC
|
||||||
|
: public CefCppToC<CefFindHandlerCppToC, CefFindHandler, cef_find_handler_t>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CefFindHandlerCppToC(CefFindHandler* cls);
|
||||||
|
virtual ~CefFindHandlerCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USING_CEF_SHARED
|
||||||
|
#endif // _FINDHANDLER_CPPTOC_H
|
||||||
|
|
58
libcef_dll/cpptoc/focus_handler_cpptoc.cc
Normal file
58
libcef_dll/cpptoc/focus_handler_cpptoc.cc
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/cpptoc/focus_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
|
void CEF_CALLBACK focus_handler_on_take_focus(struct _cef_focus_handler_t* self,
|
||||||
|
cef_browser_t* browser, int next)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
if (!self || !browser)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CefFocusHandlerCppToC::Get(self)->OnTakeFocus(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), next?true:false);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEF_CALLBACK focus_handler_on_set_focus(struct _cef_focus_handler_t* self,
|
||||||
|
cef_browser_t* browser, int isWidget)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
if (!self || !browser)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return CefFocusHandlerCppToC::Get(self)->OnSetFocus(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), isWidget?true:false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
|
CefFocusHandlerCppToC::CefFocusHandlerCppToC(CefFocusHandler* cls)
|
||||||
|
: CefCppToC<CefFocusHandlerCppToC, CefFocusHandler, cef_focus_handler_t>(
|
||||||
|
cls)
|
||||||
|
{
|
||||||
|
struct_.struct_.on_take_focus = focus_handler_on_take_focus;
|
||||||
|
struct_.struct_.on_set_focus = focus_handler_on_set_focus;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCppToC<CefFocusHandlerCppToC, CefFocusHandler,
|
||||||
|
cef_focus_handler_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
35
libcef_dll/cpptoc/focus_handler_cpptoc.h
Normal file
35
libcef_dll/cpptoc/focus_handler_cpptoc.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// more information.
|
||||||
|
//
|
||||||
|
#ifndef _FOCUSHANDLER_CPPTOC_H
|
||||||
|
#define _FOCUSHANDLER_CPPTOC_H
|
||||||
|
|
||||||
|
#ifndef USING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||||
|
#else // USING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_capi.h"
|
||||||
|
#include "libcef_dll/cpptoc/cpptoc.h"
|
||||||
|
|
||||||
|
// Wrap a C++ class with a C structure.
|
||||||
|
// This class may be instantiated and accessed wrapper-side only.
|
||||||
|
class CefFocusHandlerCppToC
|
||||||
|
: public CefCppToC<CefFocusHandlerCppToC, CefFocusHandler,
|
||||||
|
cef_focus_handler_t>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CefFocusHandlerCppToC(CefFocusHandler* cls);
|
||||||
|
virtual ~CefFocusHandlerCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USING_CEF_SHARED
|
||||||
|
#endif // _FOCUSHANDLER_CPPTOC_H
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
@ -267,7 +267,7 @@ CefFrameCppToC::CefFrameCppToC(CefFrame* cls)
|
|||||||
struct_.struct_.visit_dom = frame_visit_dom;
|
struct_.struct_.visit_dom = frame_visit_dom;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCppToC<CefFrameCppToC, CefFrame, cef_frame_t>::DebugObjCt =
|
template<> long CefCppToC<CefFrameCppToC, CefFrame, cef_frame_t>::DebugObjCt =
|
||||||
0;
|
0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
|
@ -1,681 +0,0 @@
|
|||||||
// 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 be found in the LICENSE file.
|
|
||||||
//
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// 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
|
|
||||||
// implementations. See the translator.README.txt file in the tools directory
|
|
||||||
// for more information.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include "libcef_dll/cpptoc/download_handler_cpptoc.h"
|
|
||||||
#include "libcef_dll/cpptoc/handler_cpptoc.h"
|
|
||||||
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
|
||||||
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
|
||||||
#include "libcef_dll/ctocpp/request_ctocpp.h"
|
|
||||||
#include "libcef_dll/ctocpp/response_ctocpp.h"
|
|
||||||
#include "libcef_dll/ctocpp/stream_reader_ctocpp.h"
|
|
||||||
#include "libcef_dll/ctocpp/v8value_ctocpp.h"
|
|
||||||
|
|
||||||
|
|
||||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_before_created(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* parentBrowser,
|
|
||||||
cef_window_info_t* windowInfo, int popup,
|
|
||||||
const struct _cef_popup_features_t* popupFeatures,
|
|
||||||
struct _cef_handler_t** handler, const cef_string_t* url,
|
|
||||||
struct _cef_browser_settings_t* settings)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(windowInfo);
|
|
||||||
DCHECK(handler && *handler);
|
|
||||||
if(!self || !windowInfo || !handler || !*handler)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
CefWindowInfo wndInfo;
|
|
||||||
CefBrowserSettings browserSettings;
|
|
||||||
CefPopupFeatures features;
|
|
||||||
|
|
||||||
// Take ownership of the values.
|
|
||||||
wndInfo.AttachTo(*windowInfo);
|
|
||||||
browserSettings.AttachTo(*settings);
|
|
||||||
|
|
||||||
// Reference the existing values instead of copying.
|
|
||||||
features.Set(*popupFeatures, false);
|
|
||||||
|
|
||||||
// |newHandler| will start off pointing to the current handler.
|
|
||||||
CefRefPtr<CefHandler> handlerPtr = CefHandlerCppToC::Unwrap(*handler);
|
|
||||||
CefHandler* origHandler = handlerPtr.get();
|
|
||||||
|
|
||||||
// |parentBrowser| will be NULL if this is a top-level browser window.
|
|
||||||
CefRefPtr<CefBrowser> browserPtr;
|
|
||||||
if(parentBrowser)
|
|
||||||
browserPtr = CefBrowserCToCpp::Wrap(parentBrowser);
|
|
||||||
|
|
||||||
enum cef_retval_t rv = CefHandlerCppToC::Get(self)->HandleBeforeCreated(
|
|
||||||
browserPtr, wndInfo, popup?true:false, features, handlerPtr,
|
|
||||||
CefString(url), browserSettings);
|
|
||||||
|
|
||||||
if(handlerPtr.get() != origHandler) {
|
|
||||||
// The handler has been changed.
|
|
||||||
*handler = CefHandlerCppToC::Wrap(handlerPtr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return the values to the structures.
|
|
||||||
wndInfo.DetachTo(*windowInfo);
|
|
||||||
browserSettings.DetachTo(*settings);
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_after_created(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
if(!self || !browser)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleAfterCreated(
|
|
||||||
CefBrowserCToCpp::Wrap(browser));
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_address_change(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
|
||||||
const cef_string_t* url)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(frame);
|
|
||||||
if(!self || !browser || !frame)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleAddressChange(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
|
||||||
CefString(url));
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_title_change(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser,
|
|
||||||
const cef_string_t* title)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
if(!self || !browser)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleTitleChange(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), CefString(title));
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_nav_state_change(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, int canGoBack,
|
|
||||||
int canGoForward)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
if(!self || !browser)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleNavStateChange(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), (canGoBack?true:false),
|
|
||||||
(canGoForward?true:false));
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_before_browse(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
|
||||||
struct _cef_request_t* request, enum cef_handler_navtype_t navType,
|
|
||||||
int isRedirect)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(frame);
|
|
||||||
DCHECK(request);
|
|
||||||
if(!self || !browser || !request || !frame)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleBeforeBrowse(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
|
||||||
CefRequestCToCpp::Wrap(request), navType, (isRedirect ? true : false));
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_load_start(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
if(!self || !browser)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
CefRefPtr<CefFrame> framePtr;
|
|
||||||
if(frame)
|
|
||||||
framePtr = CefFrameCToCpp::Wrap(frame);
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleLoadStart(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), framePtr);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_load_end(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
|
||||||
int httpStatusCode)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
if(!self || !browser)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
CefRefPtr<CefFrame> framePtr;
|
|
||||||
if(frame)
|
|
||||||
framePtr = CefFrameCToCpp::Wrap(frame);
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleLoadEnd(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), framePtr, httpStatusCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_load_error(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
|
||||||
enum cef_handler_errorcode_t errorCode, const cef_string_t* failedUrl,
|
|
||||||
cef_string_t* errorText)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(frame);
|
|
||||||
DCHECK(errorText);
|
|
||||||
if(!self || !browser || !errorText || !frame)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
CefString errorTextStr(errorText);
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleLoadError(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame), errorCode,
|
|
||||||
CefString(failedUrl), errorTextStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_before_resource_load(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser,
|
|
||||||
struct _cef_request_t* request, cef_string_t* redirectUrl,
|
|
||||||
struct _cef_stream_reader_t** resourceStream,
|
|
||||||
struct _cef_response_t* response, int loadFlags)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(redirectUrl);
|
|
||||||
DCHECK(resourceStream);
|
|
||||||
DCHECK(response);
|
|
||||||
if(!self || !browser || !redirectUrl || !resourceStream || !response)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
CefRefPtr<CefStreamReader> streamPtr;
|
|
||||||
|
|
||||||
CefString redirectUrlStr(redirectUrl);
|
|
||||||
enum cef_retval_t rv = CefHandlerCppToC::Get(self)->
|
|
||||||
HandleBeforeResourceLoad(CefBrowserCToCpp::Wrap(browser),
|
|
||||||
CefRequestCToCpp::Wrap(request), redirectUrlStr, streamPtr,
|
|
||||||
CefResponseCToCpp::Wrap(response), loadFlags);
|
|
||||||
|
|
||||||
if(streamPtr.get())
|
|
||||||
*resourceStream = CefStreamReaderCToCpp::Unwrap(streamPtr);
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_protocol_execution(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser,
|
|
||||||
const cef_string_t* url, int* allow_os_execution)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
if(!self || !browser)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
bool allowExec = *allow_os_execution?true:false;
|
|
||||||
enum cef_retval_t rv = CefHandlerCppToC::Get(self)->HandleProtocolExecution(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), CefString(url), allowExec);
|
|
||||||
*allow_os_execution = allowExec;
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_download_response(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser,
|
|
||||||
const cef_string_t* mimeType, const cef_string_t* fileName,
|
|
||||||
int64 contentLength, struct _cef_download_handler_t** handler)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(mimeType);
|
|
||||||
DCHECK(fileName);
|
|
||||||
if(!self || !browser || !mimeType || !fileName)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
CefRefPtr<CefDownloadHandler> downloadPtr;
|
|
||||||
|
|
||||||
enum cef_retval_t rv = CefHandlerCppToC::Get(self)->
|
|
||||||
HandleDownloadResponse(CefBrowserCToCpp::Wrap(browser),
|
|
||||||
CefString(mimeType), CefString(fileName), contentLength, downloadPtr);
|
|
||||||
|
|
||||||
if(downloadPtr.get())
|
|
||||||
*handler = CefDownloadHandlerCppToC::Wrap(downloadPtr);
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_authentication_request(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, int isProxy,
|
|
||||||
const cef_string_t* host, const cef_string_t* realm,
|
|
||||||
const cef_string_t* scheme, cef_string_t* username,
|
|
||||||
cef_string_t* password)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(username && password);
|
|
||||||
if (!self || !browser || !username || !password)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
CefString usernameStr(username);
|
|
||||||
CefString passwordStr(password);
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->
|
|
||||||
HandleAuthenticationRequest(CefBrowserCToCpp::Wrap(browser),
|
|
||||||
(isProxy ? true : false), CefString(host), CefString(realm),
|
|
||||||
CefString(scheme), usernameStr, passwordStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_before_menu(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser,
|
|
||||||
const cef_handler_menuinfo_t* menuInfo)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(menuInfo);
|
|
||||||
if(!self || !browser || !menuInfo)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleBeforeMenu(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), *menuInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_get_menu_label(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser,
|
|
||||||
enum cef_handler_menuid_t menuId, cef_string_t* label)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(label);
|
|
||||||
if(!self || !browser || !label)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
CefString labelStr(label);
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleGetMenuLabel(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), menuId, labelStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_menu_action(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser,
|
|
||||||
enum cef_handler_menuid_t menuId)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
if(!self || !browser)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleMenuAction(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), menuId);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_print_options(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser,
|
|
||||||
struct _cef_print_options_t* printOptions)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(printOptions);
|
|
||||||
if(!self || !browser || !printOptions)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandlePrintOptions(CefBrowserCToCpp::Wrap(browser), *printOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_print_header_footer(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
|
||||||
cef_print_info_t* printInfo, 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)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(frame);
|
|
||||||
DCHECK(printInfo);
|
|
||||||
DCHECK(topLeft && topCenter && topRight);
|
|
||||||
DCHECK(bottomLeft && bottomCenter && bottomRight);
|
|
||||||
if(!self || !browser || !frame || !printInfo || !topLeft || !topCenter
|
|
||||||
|| !topRight || !bottomLeft || !bottomCenter || !bottomRight)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
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)->
|
|
||||||
HandlePrintHeaderFooter(CefBrowserCToCpp::Wrap(browser),
|
|
||||||
CefFrameCToCpp::Wrap(frame), info, CefString(url), CefString(title),
|
|
||||||
currentPage, maxPages, topLeftStr, topCenterStr, topRightStr,
|
|
||||||
bottomLeftStr, bottomCenterStr, bottomRightStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_jsalert(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
|
||||||
const cef_string_t* message)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(frame);
|
|
||||||
if(!self || !browser || !frame)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleJSAlert(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
|
||||||
CefString(message));
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_jsconfirm(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
|
||||||
const cef_string_t* message, int* retval)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(frame);
|
|
||||||
DCHECK(retval);
|
|
||||||
if(!self || !browser || !retval || !frame)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
bool ret = false;
|
|
||||||
enum cef_retval_t rv = CefHandlerCppToC::Get(self)->HandleJSConfirm(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
|
||||||
CefString(message), ret);
|
|
||||||
*retval = (ret ? 1 : 0);
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_jsprompt(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
|
||||||
const cef_string_t* message, const cef_string_t* defaultValue, int* retval,
|
|
||||||
cef_string_t* result)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(frame);
|
|
||||||
DCHECK(retval);
|
|
||||||
DCHECK(result);
|
|
||||||
if(!self || !browser || !frame || !retval || !result)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
bool ret = false;
|
|
||||||
CefString resultStr(result);
|
|
||||||
enum cef_retval_t rv = CefHandlerCppToC::Get(self)->HandleJSPrompt(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
|
||||||
CefString(message), CefString(defaultValue), ret, resultStr);
|
|
||||||
*retval = (ret ? 1 : 0);
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_jsbinding(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
|
||||||
struct _cef_v8value_t* object)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(frame);
|
|
||||||
DCHECK(object);
|
|
||||||
if(!self || !browser || !frame || !object)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleJSBinding(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
|
||||||
CefV8ValueCToCpp::Wrap(object));
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_before_window_close(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
if(!self || !browser)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleBeforeWindowClose(
|
|
||||||
CefBrowserCToCpp::Wrap(browser));
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_take_focus(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, int reverse)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
if(!self || !browser)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleTakeFocus(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), (reverse ? true : false));
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_set_focus(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, int isWidget)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
if(!self || !browser)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleSetFocus(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), isWidget?true:false);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_key_event(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser,
|
|
||||||
enum cef_handler_keyevent_type_t type, int code, int modifiers,
|
|
||||||
int isSystemKey)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
if(!self || !browser)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleKeyEvent(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), type, code,
|
|
||||||
modifiers, isSystemKey?true:false);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_tooltip(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_string_t* text)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(text);
|
|
||||||
if(!self || !browser || !text)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
CefString textStr(text);
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleTooltip(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), textStr);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_status(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser,
|
|
||||||
const cef_string_t* value, enum cef_handler_statustype_t type)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
if(!self || !browser)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleStatus(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), CefString(value), type);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_console_message(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser,
|
|
||||||
const cef_string_t* message, const cef_string_t* source, int line)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
if(!self || !browser)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleConsoleMessage(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), CefString(message), CefString(source),
|
|
||||||
line);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_find_result(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, int identifier,
|
|
||||||
int count, const cef_rect_t* selectionRect, int activeMatchOrdinal,
|
|
||||||
int finalUpdate)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
if(!self || !browser)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
CefRect rect(*selectionRect);
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleFindResult(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), identifier, count, rect,
|
|
||||||
activeMatchOrdinal, finalUpdate?true:false);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_get_rect(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, int screen,
|
|
||||||
cef_rect_t* rect)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(rect);
|
|
||||||
if(!self || !browser || !rect)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
CefRect changeRect(*rect);
|
|
||||||
cef_retval_t rv = CefHandlerCppToC::Get(self)->HandleGetRect(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), screen?true:false, changeRect);
|
|
||||||
*rect = changeRect;
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_get_screen_point(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, int viewX, int viewY,
|
|
||||||
int* screenX, int* screenY)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(screenX);
|
|
||||||
DCHECK(screenY);
|
|
||||||
if(!self || !browser || !screenX || !screenY)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleGetScreenPoint(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), viewX, viewY, *screenX, *screenY);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_popup_change(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser, int show,
|
|
||||||
const cef_rect_t* rect)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(rect);
|
|
||||||
if(!self || !browser || !rect)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
CefRect changeRect(*rect);
|
|
||||||
return CefHandlerCppToC::Get(self)->HandlePopupChange(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), show?true:false, changeRect);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_paint(struct _cef_handler_t* self,
|
|
||||||
cef_browser_t* browser, enum cef_paint_element_type_t type,
|
|
||||||
const cef_rect_t* dirtyRect, const void* buffer)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
DCHECK(dirtyRect);
|
|
||||||
if(!self || !browser || !dirtyRect)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
CefRect rect(*dirtyRect);
|
|
||||||
return CefHandlerCppToC::Get(self)->HandlePaint(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), type, rect, buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum cef_retval_t CEF_CALLBACK handler_handle_cursor_change(
|
|
||||||
struct _cef_handler_t* self, cef_browser_t* browser,
|
|
||||||
cef_cursor_handle_t cursor)
|
|
||||||
{
|
|
||||||
DCHECK(self);
|
|
||||||
DCHECK(browser);
|
|
||||||
if(!self || !browser)
|
|
||||||
return RV_CONTINUE;
|
|
||||||
|
|
||||||
return CefHandlerCppToC::Get(self)->HandleCursorChange(
|
|
||||||
CefBrowserCToCpp::Wrap(browser), cursor);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// CONSTRUCTOR - Do not edit by hand.
|
|
||||||
|
|
||||||
CefHandlerCppToC::CefHandlerCppToC(CefHandler* cls)
|
|
||||||
: CefCppToC<CefHandlerCppToC, CefHandler, cef_handler_t>(cls)
|
|
||||||
{
|
|
||||||
struct_.struct_.handle_before_created = handler_handle_before_created;
|
|
||||||
struct_.struct_.handle_after_created = handler_handle_after_created;
|
|
||||||
struct_.struct_.handle_address_change = handler_handle_address_change;
|
|
||||||
struct_.struct_.handle_title_change = handler_handle_title_change;
|
|
||||||
struct_.struct_.handle_nav_state_change = handler_handle_nav_state_change;
|
|
||||||
struct_.struct_.handle_before_browse = handler_handle_before_browse;
|
|
||||||
struct_.struct_.handle_load_start = handler_handle_load_start;
|
|
||||||
struct_.struct_.handle_load_end = handler_handle_load_end;
|
|
||||||
struct_.struct_.handle_load_error = handler_handle_load_error;
|
|
||||||
struct_.struct_.handle_before_resource_load =
|
|
||||||
handler_handle_before_resource_load;
|
|
||||||
struct_.struct_.handle_protocol_execution = handler_handle_protocol_execution;
|
|
||||||
struct_.struct_.handle_download_response = handler_handle_download_response;
|
|
||||||
struct_.struct_.handle_authentication_request =
|
|
||||||
handler_handle_authentication_request;
|
|
||||||
struct_.struct_.handle_before_menu = handler_handle_before_menu;
|
|
||||||
struct_.struct_.handle_get_menu_label = handler_handle_get_menu_label;
|
|
||||||
struct_.struct_.handle_menu_action = handler_handle_menu_action;
|
|
||||||
struct_.struct_.handle_print_options = handler_handle_print_options;
|
|
||||||
struct_.struct_.handle_print_header_footer =
|
|
||||||
handler_handle_print_header_footer;
|
|
||||||
struct_.struct_.handle_jsalert = handler_handle_jsalert;
|
|
||||||
struct_.struct_.handle_jsconfirm = handler_handle_jsconfirm;
|
|
||||||
struct_.struct_.handle_jsprompt = handler_handle_jsprompt;
|
|
||||||
struct_.struct_.handle_jsbinding = handler_handle_jsbinding;
|
|
||||||
struct_.struct_.handle_before_window_close =
|
|
||||||
handler_handle_before_window_close;
|
|
||||||
struct_.struct_.handle_take_focus = handler_handle_take_focus;
|
|
||||||
struct_.struct_.handle_set_focus = handler_handle_set_focus;
|
|
||||||
struct_.struct_.handle_key_event = handler_handle_key_event;
|
|
||||||
struct_.struct_.handle_tooltip = handler_handle_tooltip;
|
|
||||||
struct_.struct_.handle_status = handler_handle_status;
|
|
||||||
struct_.struct_.handle_console_message = handler_handle_console_message;
|
|
||||||
struct_.struct_.handle_find_result = handler_handle_find_result;
|
|
||||||
struct_.struct_.handle_get_rect = handler_handle_get_rect;
|
|
||||||
struct_.struct_.handle_get_screen_point = handler_handle_get_screen_point;
|
|
||||||
struct_.struct_.handle_popup_change = handler_handle_popup_change;
|
|
||||||
struct_.struct_.handle_paint = handler_handle_paint;
|
|
||||||
struct_.struct_.handle_cursor_change = handler_handle_cursor_change;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
|
||||||
template<> long CefCppToC<CefHandlerCppToC, CefHandler,
|
|
||||||
cef_handler_t>::DebugObjCt = 0;
|
|
||||||
#endif
|
|
||||||
|
|
51
libcef_dll/cpptoc/jsbinding_handler_cpptoc.cc
Normal file
51
libcef_dll/cpptoc/jsbinding_handler_cpptoc.cc
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/cpptoc/jsbinding_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/v8value_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
|
void CEF_CALLBACK jsbinding_handler_on_jsbinding(
|
||||||
|
struct _cef_jsbinding_handler_t* self, cef_browser_t* browser,
|
||||||
|
cef_frame_t* frame, struct _cef_v8value_t* object)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(frame);
|
||||||
|
DCHECK(object);
|
||||||
|
if (!self || !browser || !frame || !object)
|
||||||
|
return;
|
||||||
|
|
||||||
|
return CefJSBindingHandlerCppToC::Get(self)->OnJSBinding(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
||||||
|
CefV8ValueCToCpp::Wrap(object));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
|
CefJSBindingHandlerCppToC::CefJSBindingHandlerCppToC(CefJSBindingHandler* cls)
|
||||||
|
: CefCppToC<CefJSBindingHandlerCppToC, CefJSBindingHandler,
|
||||||
|
cef_jsbinding_handler_t>(cls)
|
||||||
|
{
|
||||||
|
struct_.struct_.on_jsbinding = jsbinding_handler_on_jsbinding;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCppToC<CefJSBindingHandlerCppToC, CefJSBindingHandler,
|
||||||
|
cef_jsbinding_handler_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
35
libcef_dll/cpptoc/jsbinding_handler_cpptoc.h
Normal file
35
libcef_dll/cpptoc/jsbinding_handler_cpptoc.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// more information.
|
||||||
|
//
|
||||||
|
#ifndef _JSBINDINGHANDLER_CPPTOC_H
|
||||||
|
#define _JSBINDINGHANDLER_CPPTOC_H
|
||||||
|
|
||||||
|
#ifndef USING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||||
|
#else // USING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_capi.h"
|
||||||
|
#include "libcef_dll/cpptoc/cpptoc.h"
|
||||||
|
|
||||||
|
// Wrap a C++ class with a C structure.
|
||||||
|
// This class may be instantiated and accessed wrapper-side only.
|
||||||
|
class CefJSBindingHandlerCppToC
|
||||||
|
: public CefCppToC<CefJSBindingHandlerCppToC, CefJSBindingHandler,
|
||||||
|
cef_jsbinding_handler_t>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CefJSBindingHandlerCppToC(CefJSBindingHandler* cls);
|
||||||
|
virtual ~CefJSBindingHandlerCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USING_CEF_SHARED
|
||||||
|
#endif // _JSBINDINGHANDLER_CPPTOC_H
|
||||||
|
|
99
libcef_dll/cpptoc/jsdialog_handler_cpptoc.cc
Normal file
99
libcef_dll/cpptoc/jsdialog_handler_cpptoc.cc
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/cpptoc/jsdialog_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
|
int CEF_CALLBACK jsdialog_handler_on_jsalert(
|
||||||
|
struct _cef_jsdialog_handler_t* self, cef_browser_t* browser,
|
||||||
|
cef_frame_t* frame, const cef_string_t* message)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(frame);
|
||||||
|
DCHECK(message);
|
||||||
|
if (!self || !browser || !frame || !message)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return CefJSDialogHandlerCppToC::Get(self)->OnJSAlert(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
||||||
|
CefString(message));
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEF_CALLBACK jsdialog_handler_on_jsconfirm(
|
||||||
|
struct _cef_jsdialog_handler_t* self, cef_browser_t* browser,
|
||||||
|
cef_frame_t* frame, const cef_string_t* message, int* retval)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(frame);
|
||||||
|
DCHECK(message);
|
||||||
|
DCHECK(retval);
|
||||||
|
if (!self || !browser || !frame || !message || !retval)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
bool ret = false;
|
||||||
|
int rv = CefJSDialogHandlerCppToC::Get(self)->OnJSConfirm(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
||||||
|
CefString(message), ret);
|
||||||
|
*retval = (ret ? 1 : 0);
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEF_CALLBACK jsdialog_handler_on_jsprompt(
|
||||||
|
struct _cef_jsdialog_handler_t* self, cef_browser_t* browser,
|
||||||
|
cef_frame_t* frame, const cef_string_t* message,
|
||||||
|
const cef_string_t* defaultValue, int* retval, cef_string_t* result)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(frame);
|
||||||
|
DCHECK(message);
|
||||||
|
DCHECK(defaultValue);
|
||||||
|
DCHECK(retval);
|
||||||
|
DCHECK(result);
|
||||||
|
if (!self || !browser || !frame || !message || !defaultValue || !retval ||
|
||||||
|
!result)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
bool ret = false;
|
||||||
|
CefString resultStr(result);
|
||||||
|
int rv = CefJSDialogHandlerCppToC::Get(self)->OnJSPrompt(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
||||||
|
CefString(message), CefString(defaultValue), ret, resultStr);
|
||||||
|
*retval = (ret ? 1 : 0);
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
|
CefJSDialogHandlerCppToC::CefJSDialogHandlerCppToC(CefJSDialogHandler* cls)
|
||||||
|
: CefCppToC<CefJSDialogHandlerCppToC, CefJSDialogHandler,
|
||||||
|
cef_jsdialog_handler_t>(cls)
|
||||||
|
{
|
||||||
|
struct_.struct_.on_jsalert = jsdialog_handler_on_jsalert;
|
||||||
|
struct_.struct_.on_jsconfirm = jsdialog_handler_on_jsconfirm;
|
||||||
|
struct_.struct_.on_jsprompt = jsdialog_handler_on_jsprompt;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCppToC<CefJSDialogHandlerCppToC, CefJSDialogHandler,
|
||||||
|
cef_jsdialog_handler_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
35
libcef_dll/cpptoc/jsdialog_handler_cpptoc.h
Normal file
35
libcef_dll/cpptoc/jsdialog_handler_cpptoc.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// more information.
|
||||||
|
//
|
||||||
|
#ifndef _JSDIALOGHANDLER_CPPTOC_H
|
||||||
|
#define _JSDIALOGHANDLER_CPPTOC_H
|
||||||
|
|
||||||
|
#ifndef USING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||||
|
#else // USING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_capi.h"
|
||||||
|
#include "libcef_dll/cpptoc/cpptoc.h"
|
||||||
|
|
||||||
|
// Wrap a C++ class with a C structure.
|
||||||
|
// This class may be instantiated and accessed wrapper-side only.
|
||||||
|
class CefJSDialogHandlerCppToC
|
||||||
|
: public CefCppToC<CefJSDialogHandlerCppToC, CefJSDialogHandler,
|
||||||
|
cef_jsdialog_handler_t>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CefJSDialogHandlerCppToC(CefJSDialogHandler* cls);
|
||||||
|
virtual ~CefJSDialogHandlerCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USING_CEF_SHARED
|
||||||
|
#endif // _JSDIALOGHANDLER_CPPTOC_H
|
||||||
|
|
48
libcef_dll/cpptoc/keyboard_handler_cpptoc.cc
Normal file
48
libcef_dll/cpptoc/keyboard_handler_cpptoc.cc
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/cpptoc/keyboard_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
|
int CEF_CALLBACK keyboard_handler_on_key_event(
|
||||||
|
struct _cef_keyboard_handler_t* self, cef_browser_t* browser,
|
||||||
|
enum cef_handler_keyevent_type_t type, int code, int modifiers,
|
||||||
|
int isSystemKey)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
if (!self || !browser)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return CefKeyboardHandlerCppToC::Get(self)->OnKeyEvent(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), type, code,
|
||||||
|
modifiers, isSystemKey?true:false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
|
CefKeyboardHandlerCppToC::CefKeyboardHandlerCppToC(CefKeyboardHandler* cls)
|
||||||
|
: CefCppToC<CefKeyboardHandlerCppToC, CefKeyboardHandler,
|
||||||
|
cef_keyboard_handler_t>(cls)
|
||||||
|
{
|
||||||
|
struct_.struct_.on_key_event = keyboard_handler_on_key_event;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCppToC<CefKeyboardHandlerCppToC, CefKeyboardHandler,
|
||||||
|
cef_keyboard_handler_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
35
libcef_dll/cpptoc/keyboard_handler_cpptoc.h
Normal file
35
libcef_dll/cpptoc/keyboard_handler_cpptoc.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// more information.
|
||||||
|
//
|
||||||
|
#ifndef _KEYBOARDHANDLER_CPPTOC_H
|
||||||
|
#define _KEYBOARDHANDLER_CPPTOC_H
|
||||||
|
|
||||||
|
#ifndef USING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||||
|
#else // USING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_capi.h"
|
||||||
|
#include "libcef_dll/cpptoc/cpptoc.h"
|
||||||
|
|
||||||
|
// Wrap a C++ class with a C structure.
|
||||||
|
// This class may be instantiated and accessed wrapper-side only.
|
||||||
|
class CefKeyboardHandlerCppToC
|
||||||
|
: public CefCppToC<CefKeyboardHandlerCppToC, CefKeyboardHandler,
|
||||||
|
cef_keyboard_handler_t>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CefKeyboardHandlerCppToC(CefKeyboardHandler* cls);
|
||||||
|
virtual ~CefKeyboardHandlerCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USING_CEF_SHARED
|
||||||
|
#endif // _KEYBOARDHANDLER_CPPTOC_H
|
||||||
|
|
117
libcef_dll/cpptoc/life_span_handler_cpptoc.cc
Normal file
117
libcef_dll/cpptoc/life_span_handler_cpptoc.cc
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/cpptoc/client_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/life_span_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
|
int CEF_CALLBACK life_span_handler_on_before_popup(
|
||||||
|
struct _cef_life_span_handler_t* self, cef_browser_t* parentBrowser,
|
||||||
|
const struct _cef_popup_features_t* popupFeatures,
|
||||||
|
cef_window_info_t* windowInfo, const cef_string_t* url,
|
||||||
|
struct _cef_client_t** client, struct _cef_browser_settings_t* settings)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(parentBrowser);
|
||||||
|
DCHECK(popupFeatures);
|
||||||
|
DCHECK(windowInfo);
|
||||||
|
DCHECK(url);
|
||||||
|
DCHECK(client);
|
||||||
|
DCHECK(settings);
|
||||||
|
if (!self || !parentBrowser || !popupFeatures || !windowInfo || !url ||
|
||||||
|
!client || !settings)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
CefWindowInfo wndInfo;
|
||||||
|
CefBrowserSettings browserSettings;
|
||||||
|
CefPopupFeatures features;
|
||||||
|
|
||||||
|
// Take ownership of the values.
|
||||||
|
wndInfo.AttachTo(*windowInfo);
|
||||||
|
browserSettings.AttachTo(*settings);
|
||||||
|
|
||||||
|
// Reference the existing values instead of copying.
|
||||||
|
features.Set(*popupFeatures, false);
|
||||||
|
|
||||||
|
// |newHandler| will start off pointing to the current handler.
|
||||||
|
CefRefPtr<CefClient> clientPtr;
|
||||||
|
if (*client)
|
||||||
|
clientPtr = CefClientCppToC::Unwrap(*client);
|
||||||
|
CefClient* origClient = clientPtr.get();
|
||||||
|
|
||||||
|
// |parentBrowser| will be NULL if this is a top-level browser window.
|
||||||
|
CefRefPtr<CefBrowser> browserPtr(CefBrowserCToCpp::Wrap(parentBrowser));
|
||||||
|
|
||||||
|
bool rv = CefLifeSpanHandlerCppToC::Get(self)->OnBeforePopup(
|
||||||
|
browserPtr, features, wndInfo, CefString(url), clientPtr,
|
||||||
|
browserSettings);
|
||||||
|
|
||||||
|
if (clientPtr.get()) {
|
||||||
|
if (clientPtr.get() != origClient) {
|
||||||
|
// The handler has been changed.
|
||||||
|
*client = CefClientCppToC::Wrap(clientPtr);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
*client = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the values to the structures.
|
||||||
|
wndInfo.DetachTo(*windowInfo);
|
||||||
|
browserSettings.DetachTo(*settings);
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEF_CALLBACK life_span_handler_on_after_created(
|
||||||
|
struct _cef_life_span_handler_t* self, cef_browser_t* browser)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
if (!self || !browser)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CefLifeSpanHandlerCppToC::Get(self)->OnAfterCreated(
|
||||||
|
CefBrowserCToCpp::Wrap(browser));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEF_CALLBACK life_span_handler_on_before_close(
|
||||||
|
struct _cef_life_span_handler_t* self, cef_browser_t* browser)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
if (!self || !browser)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CefLifeSpanHandlerCppToC::Get(self)->OnBeforeClose(
|
||||||
|
CefBrowserCToCpp::Wrap(browser));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
|
CefLifeSpanHandlerCppToC::CefLifeSpanHandlerCppToC(CefLifeSpanHandler* cls)
|
||||||
|
: CefCppToC<CefLifeSpanHandlerCppToC, CefLifeSpanHandler,
|
||||||
|
cef_life_span_handler_t>(cls)
|
||||||
|
{
|
||||||
|
struct_.struct_.on_before_popup = life_span_handler_on_before_popup;
|
||||||
|
struct_.struct_.on_after_created = life_span_handler_on_after_created;
|
||||||
|
struct_.struct_.on_before_close = life_span_handler_on_before_close;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCppToC<CefLifeSpanHandlerCppToC, CefLifeSpanHandler,
|
||||||
|
cef_life_span_handler_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
35
libcef_dll/cpptoc/life_span_handler_cpptoc.h
Normal file
35
libcef_dll/cpptoc/life_span_handler_cpptoc.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// more information.
|
||||||
|
//
|
||||||
|
#ifndef _LIFESPANHANDLER_CPPTOC_H
|
||||||
|
#define _LIFESPANHANDLER_CPPTOC_H
|
||||||
|
|
||||||
|
#ifndef USING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||||
|
#else // USING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_capi.h"
|
||||||
|
#include "libcef_dll/cpptoc/cpptoc.h"
|
||||||
|
|
||||||
|
// Wrap a C++ class with a C structure.
|
||||||
|
// This class may be instantiated and accessed wrapper-side only.
|
||||||
|
class CefLifeSpanHandlerCppToC
|
||||||
|
: public CefCppToC<CefLifeSpanHandlerCppToC, CefLifeSpanHandler,
|
||||||
|
cef_life_span_handler_t>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CefLifeSpanHandlerCppToC(CefLifeSpanHandler* cls);
|
||||||
|
virtual ~CefLifeSpanHandlerCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USING_CEF_SHARED
|
||||||
|
#endif // _LIFESPANHANDLER_CPPTOC_H
|
||||||
|
|
81
libcef_dll/cpptoc/load_handler_cpptoc.cc
Normal file
81
libcef_dll/cpptoc/load_handler_cpptoc.cc
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/cpptoc/load_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
|
void CEF_CALLBACK load_handler_on_load_start(struct _cef_load_handler_t* self,
|
||||||
|
cef_browser_t* browser, cef_frame_t* frame)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(frame);
|
||||||
|
if (!self || !browser || !frame)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CefLoadHandlerCppToC::Get(self)->OnLoadStart(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEF_CALLBACK load_handler_on_load_end(struct _cef_load_handler_t* self,
|
||||||
|
cef_browser_t* browser, cef_frame_t* frame, int httpStatusCode)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(frame);
|
||||||
|
if (!self || !browser || !frame)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CefLoadHandlerCppToC::Get(self)->OnLoadEnd(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
||||||
|
httpStatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEF_CALLBACK load_handler_on_load_error(struct _cef_load_handler_t* self,
|
||||||
|
cef_browser_t* browser, cef_frame_t* frame,
|
||||||
|
enum cef_handler_errorcode_t errorCode, const cef_string_t* failedUrl,
|
||||||
|
cef_string_t* errorText)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(frame);
|
||||||
|
DCHECK(failedUrl);
|
||||||
|
DCHECK(errorText);
|
||||||
|
if (!self || !browser || !frame || !failedUrl || !errorText)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
CefString errorTextStr(errorText);
|
||||||
|
return CefLoadHandlerCppToC::Get(self)->OnLoadError(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame), errorCode,
|
||||||
|
CefString(failedUrl), errorTextStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
|
CefLoadHandlerCppToC::CefLoadHandlerCppToC(CefLoadHandler* cls)
|
||||||
|
: CefCppToC<CefLoadHandlerCppToC, CefLoadHandler, cef_load_handler_t>(cls)
|
||||||
|
{
|
||||||
|
struct_.struct_.on_load_start = load_handler_on_load_start;
|
||||||
|
struct_.struct_.on_load_end = load_handler_on_load_end;
|
||||||
|
struct_.struct_.on_load_error = load_handler_on_load_error;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCppToC<CefLoadHandlerCppToC, CefLoadHandler,
|
||||||
|
cef_load_handler_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
34
libcef_dll/cpptoc/load_handler_cpptoc.h
Normal file
34
libcef_dll/cpptoc/load_handler_cpptoc.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// more information.
|
||||||
|
//
|
||||||
|
#ifndef _LOADHANDLER_CPPTOC_H
|
||||||
|
#define _LOADHANDLER_CPPTOC_H
|
||||||
|
|
||||||
|
#ifndef USING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||||
|
#else // USING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_capi.h"
|
||||||
|
#include "libcef_dll/cpptoc/cpptoc.h"
|
||||||
|
|
||||||
|
// Wrap a C++ class with a C structure.
|
||||||
|
// This class may be instantiated and accessed wrapper-side only.
|
||||||
|
class CefLoadHandlerCppToC
|
||||||
|
: public CefCppToC<CefLoadHandlerCppToC, CefLoadHandler, cef_load_handler_t>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CefLoadHandlerCppToC(CefLoadHandler* cls);
|
||||||
|
virtual ~CefLoadHandlerCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USING_CEF_SHARED
|
||||||
|
#endif // _LOADHANDLER_CPPTOC_H
|
||||||
|
|
74
libcef_dll/cpptoc/menu_handler_cpptoc.cc
Normal file
74
libcef_dll/cpptoc/menu_handler_cpptoc.cc
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/cpptoc/menu_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
|
int CEF_CALLBACK menu_handler_on_before_menu(struct _cef_menu_handler_t* self,
|
||||||
|
cef_browser_t* browser, const cef_handler_menuinfo_t* menuInfo)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(menuInfo);
|
||||||
|
if (!self || !browser || !menuInfo)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return CefMenuHandlerCppToC::Get(self)->OnBeforeMenu(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), *menuInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEF_CALLBACK menu_handler_get_menu_label(struct _cef_menu_handler_t* self,
|
||||||
|
cef_browser_t* browser, enum cef_handler_menuid_t menuId,
|
||||||
|
cef_string_t* label)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(label);
|
||||||
|
if (!self || !browser || !label)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CefString labelStr(label);
|
||||||
|
CefMenuHandlerCppToC::Get(self)->GetMenuLabel(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), menuId, labelStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEF_CALLBACK menu_handler_on_menu_action(struct _cef_menu_handler_t* self,
|
||||||
|
cef_browser_t* browser, enum cef_handler_menuid_t menuId)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
if (!self || !browser)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return CefMenuHandlerCppToC::Get(self)->OnMenuAction(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), menuId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
|
CefMenuHandlerCppToC::CefMenuHandlerCppToC(CefMenuHandler* cls)
|
||||||
|
: CefCppToC<CefMenuHandlerCppToC, CefMenuHandler, cef_menu_handler_t>(cls)
|
||||||
|
{
|
||||||
|
struct_.struct_.on_before_menu = menu_handler_on_before_menu;
|
||||||
|
struct_.struct_.get_menu_label = menu_handler_get_menu_label;
|
||||||
|
struct_.struct_.on_menu_action = menu_handler_on_menu_action;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCppToC<CefMenuHandlerCppToC, CefMenuHandler,
|
||||||
|
cef_menu_handler_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
34
libcef_dll/cpptoc/menu_handler_cpptoc.h
Normal file
34
libcef_dll/cpptoc/menu_handler_cpptoc.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// more information.
|
||||||
|
//
|
||||||
|
#ifndef _MENUHANDLER_CPPTOC_H
|
||||||
|
#define _MENUHANDLER_CPPTOC_H
|
||||||
|
|
||||||
|
#ifndef USING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||||
|
#else // USING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_capi.h"
|
||||||
|
#include "libcef_dll/cpptoc/cpptoc.h"
|
||||||
|
|
||||||
|
// Wrap a C++ class with a C structure.
|
||||||
|
// This class may be instantiated and accessed wrapper-side only.
|
||||||
|
class CefMenuHandlerCppToC
|
||||||
|
: public CefCppToC<CefMenuHandlerCppToC, CefMenuHandler, cef_menu_handler_t>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CefMenuHandlerCppToC(CefMenuHandler* cls);
|
||||||
|
virtual ~CefMenuHandlerCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USING_CEF_SHARED
|
||||||
|
#endif // _MENUHANDLER_CPPTOC_H
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
@ -100,7 +100,7 @@ CefPostDataCppToC::CefPostDataCppToC(CefPostData* cls)
|
|||||||
struct_.struct_.remove_elements = post_data_remove_elements;
|
struct_.struct_.remove_elements = post_data_remove_elements;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCppToC<CefPostDataCppToC, CefPostData,
|
template<> long CefCppToC<CefPostDataCppToC, CefPostData,
|
||||||
cef_post_data_t>::DebugObjCt = 0;
|
cef_post_data_t>::DebugObjCt = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
@ -114,7 +114,7 @@ CefPostDataElementCppToC::CefPostDataElementCppToC(CefPostDataElement* cls)
|
|||||||
struct_.struct_.get_bytes = post_data_element_get_bytes;
|
struct_.struct_.get_bytes = post_data_element_get_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCppToC<CefPostDataElementCppToC, CefPostDataElement,
|
template<> long CefCppToC<CefPostDataElementCppToC, CefPostDataElement,
|
||||||
cef_post_data_element_t>::DebugObjCt = 0;
|
cef_post_data_element_t>::DebugObjCt = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
|
87
libcef_dll/cpptoc/print_handler_cpptoc.cc
Normal file
87
libcef_dll/cpptoc/print_handler_cpptoc.cc
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/cpptoc/print_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
|
int CEF_CALLBACK print_handler_get_print_options(
|
||||||
|
struct _cef_print_handler_t* self, cef_browser_t* browser,
|
||||||
|
struct _cef_print_options_t* printOptions)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(printOptions);
|
||||||
|
if (!self || !browser || !printOptions)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return CefPrintHandlerCppToC::Get(self)->GetPrintOptions(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), *printOptions);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEF_CALLBACK print_handler_get_print_header_footer(
|
||||||
|
struct _cef_print_handler_t* self, cef_browser_t* browser,
|
||||||
|
cef_frame_t* frame, const cef_print_info_t* printInfo,
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(frame);
|
||||||
|
DCHECK(printInfo);
|
||||||
|
DCHECK(url);
|
||||||
|
DCHECK(title);
|
||||||
|
DCHECK(topLeft);
|
||||||
|
DCHECK(topCenter);
|
||||||
|
DCHECK(topRight);
|
||||||
|
DCHECK(bottomLeft);
|
||||||
|
DCHECK(bottomCenter);
|
||||||
|
DCHECK(bottomRight);
|
||||||
|
if (!self || !browser || !frame || !printInfo || !url || !title || !topLeft ||
|
||||||
|
!topCenter || !topRight || !bottomLeft || !bottomCenter || !bottomRight)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
CefString topLeftStr(topLeft);
|
||||||
|
CefString topCenterStr(topCenter);
|
||||||
|
CefString topRightStr(topRight);
|
||||||
|
CefString bottomLeftStr(bottomLeft);
|
||||||
|
CefString bottomCenterStr(bottomCenter);
|
||||||
|
CefString bottomRightStr(bottomRight);
|
||||||
|
return CefPrintHandlerCppToC::Get(self)->GetPrintHeaderFooter(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame), *printInfo,
|
||||||
|
CefString(url), CefString(title), currentPage, maxPages, topLeftStr,
|
||||||
|
topCenterStr, topRightStr, bottomLeftStr, bottomCenterStr,
|
||||||
|
bottomRightStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
|
CefPrintHandlerCppToC::CefPrintHandlerCppToC(CefPrintHandler* cls)
|
||||||
|
: CefCppToC<CefPrintHandlerCppToC, CefPrintHandler, cef_print_handler_t>(
|
||||||
|
cls)
|
||||||
|
{
|
||||||
|
struct_.struct_.get_print_options = print_handler_get_print_options;
|
||||||
|
struct_.struct_.get_print_header_footer =
|
||||||
|
print_handler_get_print_header_footer;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCppToC<CefPrintHandlerCppToC, CefPrintHandler,
|
||||||
|
cef_print_handler_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
35
libcef_dll/cpptoc/print_handler_cpptoc.h
Normal file
35
libcef_dll/cpptoc/print_handler_cpptoc.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// more information.
|
||||||
|
//
|
||||||
|
#ifndef _PRINTHANDLER_CPPTOC_H
|
||||||
|
#define _PRINTHANDLER_CPPTOC_H
|
||||||
|
|
||||||
|
#ifndef USING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||||
|
#else // USING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_capi.h"
|
||||||
|
#include "libcef_dll/cpptoc/cpptoc.h"
|
||||||
|
|
||||||
|
// Wrap a C++ class with a C structure.
|
||||||
|
// This class may be instantiated and accessed wrapper-side only.
|
||||||
|
class CefPrintHandlerCppToC
|
||||||
|
: public CefCppToC<CefPrintHandlerCppToC, CefPrintHandler,
|
||||||
|
cef_print_handler_t>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CefPrintHandlerCppToC(CefPrintHandler* cls);
|
||||||
|
virtual ~CefPrintHandlerCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USING_CEF_SHARED
|
||||||
|
#endif // _PRINTHANDLER_CPPTOC_H
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
@ -65,7 +65,7 @@ CefReadHandlerCppToC::CefReadHandlerCppToC(CefReadHandler* cls)
|
|||||||
struct_.struct_.eof = read_handler_eof;
|
struct_.struct_.eof = read_handler_eof;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCppToC<CefReadHandlerCppToC, CefReadHandler,
|
template<> long CefCppToC<CefReadHandlerCppToC, CefReadHandler,
|
||||||
cef_read_handler_t>::DebugObjCt = 0;
|
cef_read_handler_t>::DebugObjCt = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
|
144
libcef_dll/cpptoc/render_handler_cpptoc.cc
Normal file
144
libcef_dll/cpptoc/render_handler_cpptoc.cc
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/cpptoc/render_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
|
int CEF_CALLBACK render_handler_get_view_rect(
|
||||||
|
struct _cef_render_handler_t* self, cef_browser_t* browser,
|
||||||
|
cef_rect_t* rect)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(rect);
|
||||||
|
if (!self || !browser || !rect)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
CefRect changeRect(*rect);
|
||||||
|
int rv = CefRenderHandlerCppToC::Get(self)->GetViewRect(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), changeRect);
|
||||||
|
*rect = changeRect;
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEF_CALLBACK render_handler_get_screen_rect(
|
||||||
|
struct _cef_render_handler_t* self, cef_browser_t* browser,
|
||||||
|
cef_rect_t* rect)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(rect);
|
||||||
|
if (!self || !browser || !rect)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
CefRect changeRect(*rect);
|
||||||
|
int rv = CefRenderHandlerCppToC::Get(self)->GetScreenRect(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), changeRect);
|
||||||
|
*rect = changeRect;
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEF_CALLBACK render_handler_get_screen_point(
|
||||||
|
struct _cef_render_handler_t* self, cef_browser_t* browser, int viewX,
|
||||||
|
int viewY, int* screenX, int* screenY)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(screenX);
|
||||||
|
DCHECK(screenY);
|
||||||
|
if (!self || !browser || !screenX || !screenY)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return CefRenderHandlerCppToC::Get(self)->GetScreenPoint(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), viewX, viewY, *screenX, *screenY);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEF_CALLBACK render_handler_on_popup_show(
|
||||||
|
struct _cef_render_handler_t* self, cef_browser_t* browser, int show)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
if (!self || !browser)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CefRenderHandlerCppToC::Get(self)->OnPopupShow(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), show?true:false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEF_CALLBACK render_handler_on_popup_size(
|
||||||
|
struct _cef_render_handler_t* self, cef_browser_t* browser,
|
||||||
|
const cef_rect_t* rect)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(rect);
|
||||||
|
if (!self || !browser || !rect)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CefRect sizeRect(*rect);
|
||||||
|
return CefRenderHandlerCppToC::Get(self)->OnPopupSize(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), sizeRect);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEF_CALLBACK render_handler_on_paint(struct _cef_render_handler_t* self,
|
||||||
|
cef_browser_t* browser, enum cef_paint_element_type_t type,
|
||||||
|
const cef_rect_t* dirtyRect, const void* buffer)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(dirtyRect);
|
||||||
|
DCHECK(buffer);
|
||||||
|
if (!self || !browser || !dirtyRect || !buffer)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CefRect rect(*dirtyRect);
|
||||||
|
return CefRenderHandlerCppToC::Get(self)->OnPaint(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), type, rect, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEF_CALLBACK render_handler_on_cursor_change(
|
||||||
|
struct _cef_render_handler_t* self, cef_browser_t* browser,
|
||||||
|
cef_cursor_handle_t cursor)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
if (!self || !browser)
|
||||||
|
return;
|
||||||
|
|
||||||
|
return CefRenderHandlerCppToC::Get(self)->OnCursorChange(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
|
CefRenderHandlerCppToC::CefRenderHandlerCppToC(CefRenderHandler* cls)
|
||||||
|
: CefCppToC<CefRenderHandlerCppToC, CefRenderHandler, cef_render_handler_t>(
|
||||||
|
cls)
|
||||||
|
{
|
||||||
|
struct_.struct_.get_view_rect = render_handler_get_view_rect;
|
||||||
|
struct_.struct_.get_screen_rect = render_handler_get_screen_rect;
|
||||||
|
struct_.struct_.get_screen_point = render_handler_get_screen_point;
|
||||||
|
struct_.struct_.on_popup_show = render_handler_on_popup_show;
|
||||||
|
struct_.struct_.on_popup_size = render_handler_on_popup_size;
|
||||||
|
struct_.struct_.on_paint = render_handler_on_paint;
|
||||||
|
struct_.struct_.on_cursor_change = render_handler_on_cursor_change;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCppToC<CefRenderHandlerCppToC, CefRenderHandler,
|
||||||
|
cef_render_handler_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
35
libcef_dll/cpptoc/render_handler_cpptoc.h
Normal file
35
libcef_dll/cpptoc/render_handler_cpptoc.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// more information.
|
||||||
|
//
|
||||||
|
#ifndef _RENDERHANDLER_CPPTOC_H
|
||||||
|
#define _RENDERHANDLER_CPPTOC_H
|
||||||
|
|
||||||
|
#ifndef USING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||||
|
#else // USING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_capi.h"
|
||||||
|
#include "libcef_dll/cpptoc/cpptoc.h"
|
||||||
|
|
||||||
|
// Wrap a C++ class with a C structure.
|
||||||
|
// This class may be instantiated and accessed wrapper-side only.
|
||||||
|
class CefRenderHandlerCppToC
|
||||||
|
: public CefCppToC<CefRenderHandlerCppToC, CefRenderHandler,
|
||||||
|
cef_render_handler_t>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CefRenderHandlerCppToC(CefRenderHandler* cls);
|
||||||
|
virtual ~CefRenderHandlerCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USING_CEF_SHARED
|
||||||
|
#endif // _RENDERHANDLER_CPPTOC_H
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
@ -208,7 +208,7 @@ CefRequestCppToC::CefRequestCppToC(CefRequest* cls)
|
|||||||
request_set_first_party_for_cookies;
|
request_set_first_party_for_cookies;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCppToC<CefRequestCppToC, CefRequest,
|
template<> long CefCppToC<CefRequestCppToC, CefRequest,
|
||||||
cef_request_t>::DebugObjCt = 0;
|
cef_request_t>::DebugObjCt = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
|
157
libcef_dll/cpptoc/request_handler_cpptoc.cc
Normal file
157
libcef_dll/cpptoc/request_handler_cpptoc.cc
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/cpptoc/download_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/cpptoc/request_handler_cpptoc.h"
|
||||||
|
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/request_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/response_ctocpp.h"
|
||||||
|
#include "libcef_dll/ctocpp/stream_reader_ctocpp.h"
|
||||||
|
|
||||||
|
|
||||||
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
|
int CEF_CALLBACK request_handler_on_before_browse(
|
||||||
|
struct _cef_request_handler_t* self, cef_browser_t* browser,
|
||||||
|
cef_frame_t* frame, struct _cef_request_t* request,
|
||||||
|
enum cef_handler_navtype_t navType, int isRedirect)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(frame);
|
||||||
|
DCHECK(request);
|
||||||
|
if (!self || !browser || !frame || !request)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return CefRequestHandlerCppToC::Get(self)->OnBeforeBrowse(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
||||||
|
CefRequestCToCpp::Wrap(request), navType, (isRedirect ? true : false));
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEF_CALLBACK request_handler_on_before_resource_load(
|
||||||
|
struct _cef_request_handler_t* self, cef_browser_t* browser,
|
||||||
|
struct _cef_request_t* request, cef_string_t* redirectUrl,
|
||||||
|
struct _cef_stream_reader_t** resourceStream,
|
||||||
|
struct _cef_response_t* response, int loadFlags)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(request);
|
||||||
|
DCHECK(redirectUrl);
|
||||||
|
DCHECK(resourceStream);
|
||||||
|
DCHECK(response);
|
||||||
|
if (!self || !browser || !request || !redirectUrl || !resourceStream ||
|
||||||
|
!response)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
CefRefPtr<CefStreamReader> streamPtr;
|
||||||
|
|
||||||
|
CefString redirectUrlStr(redirectUrl);
|
||||||
|
int rv = CefRequestHandlerCppToC::Get(self)->OnBeforeResourceLoad(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), CefRequestCToCpp::Wrap(request),
|
||||||
|
redirectUrlStr, streamPtr, CefResponseCToCpp::Wrap(response), loadFlags);
|
||||||
|
|
||||||
|
if(streamPtr.get())
|
||||||
|
*resourceStream = CefStreamReaderCToCpp::Unwrap(streamPtr);
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEF_CALLBACK request_handler_on_protocol_execution(
|
||||||
|
struct _cef_request_handler_t* self, cef_browser_t* browser,
|
||||||
|
const cef_string_t* url, int* allowOSExecution)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(url);
|
||||||
|
DCHECK(allowOSExecution);
|
||||||
|
if (!self || !browser || !url || !allowOSExecution)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
bool allowExec = *allowOSExecution?true:false;
|
||||||
|
int rv = CefRequestHandlerCppToC::Get(self)->OnProtocolExecution(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), CefString(url), allowExec);
|
||||||
|
*allowOSExecution = allowExec;
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEF_CALLBACK request_handler_get_download_handler(
|
||||||
|
struct _cef_request_handler_t* self, cef_browser_t* browser,
|
||||||
|
const cef_string_t* mimeType, const cef_string_t* fileName,
|
||||||
|
int64 contentLength, struct _cef_download_handler_t** handler)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(mimeType);
|
||||||
|
DCHECK(fileName);
|
||||||
|
DCHECK(handler);
|
||||||
|
if (!self || !browser || !mimeType || !fileName || !handler)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
CefRefPtr<CefDownloadHandler> downloadPtr;
|
||||||
|
|
||||||
|
int rv = CefRequestHandlerCppToC::Get(self)->GetDownloadHandler(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), CefString(mimeType), CefString(fileName),
|
||||||
|
contentLength, downloadPtr);
|
||||||
|
|
||||||
|
if(downloadPtr.get())
|
||||||
|
*handler = CefDownloadHandlerCppToC::Wrap(downloadPtr);
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CEF_CALLBACK request_handler_get_auth_credentials(
|
||||||
|
struct _cef_request_handler_t* self, cef_browser_t* browser, int isProxy,
|
||||||
|
const cef_string_t* host, const cef_string_t* realm,
|
||||||
|
const cef_string_t* scheme, cef_string_t* username,
|
||||||
|
cef_string_t* password)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
DCHECK(browser);
|
||||||
|
DCHECK(host);
|
||||||
|
DCHECK(realm);
|
||||||
|
DCHECK(scheme);
|
||||||
|
DCHECK(username);
|
||||||
|
DCHECK(password);
|
||||||
|
if (!self || !browser || !host || !realm || !scheme || !username || !password)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
CefString usernameStr(username);
|
||||||
|
CefString passwordStr(password);
|
||||||
|
return CefRequestHandlerCppToC::Get(self)->GetAuthCredentials(
|
||||||
|
CefBrowserCToCpp::Wrap(browser), (isProxy ? true : false),
|
||||||
|
CefString(host), CefString(realm), CefString(scheme), usernameStr,
|
||||||
|
passwordStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
|
CefRequestHandlerCppToC::CefRequestHandlerCppToC(CefRequestHandler* cls)
|
||||||
|
: CefCppToC<CefRequestHandlerCppToC, CefRequestHandler,
|
||||||
|
cef_request_handler_t>(cls)
|
||||||
|
{
|
||||||
|
struct_.struct_.on_before_browse = request_handler_on_before_browse;
|
||||||
|
struct_.struct_.on_before_resource_load =
|
||||||
|
request_handler_on_before_resource_load;
|
||||||
|
struct_.struct_.on_protocol_execution = request_handler_on_protocol_execution;
|
||||||
|
struct_.struct_.get_download_handler = request_handler_get_download_handler;
|
||||||
|
struct_.struct_.get_auth_credentials = request_handler_get_auth_credentials;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
|
template<> long CefCppToC<CefRequestHandlerCppToC, CefRequestHandler,
|
||||||
|
cef_request_handler_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
35
libcef_dll/cpptoc/request_handler_cpptoc.h
Normal file
35
libcef_dll/cpptoc/request_handler_cpptoc.h
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// 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
|
||||||
|
// more information.
|
||||||
|
//
|
||||||
|
#ifndef _REQUESTHANDLER_CPPTOC_H
|
||||||
|
#define _REQUESTHANDLER_CPPTOC_H
|
||||||
|
|
||||||
|
#ifndef USING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||||
|
#else // USING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_capi.h"
|
||||||
|
#include "libcef_dll/cpptoc/cpptoc.h"
|
||||||
|
|
||||||
|
// Wrap a C++ class with a C structure.
|
||||||
|
// This class may be instantiated and accessed wrapper-side only.
|
||||||
|
class CefRequestHandlerCppToC
|
||||||
|
: public CefCppToC<CefRequestHandlerCppToC, CefRequestHandler,
|
||||||
|
cef_request_handler_t>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CefRequestHandlerCppToC(CefRequestHandler* cls);
|
||||||
|
virtual ~CefRequestHandlerCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USING_CEF_SHARED
|
||||||
|
#endif // _REQUESTHANDLER_CPPTOC_H
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
@ -130,7 +130,7 @@ CefResponseCppToC::CefResponseCppToC(CefResponse* cls)
|
|||||||
struct_.struct_.set_header_map = response_set_header_map;
|
struct_.struct_.set_header_map = response_set_header_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCppToC<CefResponseCppToC, CefResponse,
|
template<> long CefCppToC<CefResponseCppToC, CefResponse,
|
||||||
cef_response_t>::DebugObjCt = 0;
|
cef_response_t>::DebugObjCt = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
@ -72,7 +72,7 @@ CefSchemeHandlerCppToC::CefSchemeHandlerCppToC(CefSchemeHandler* cls)
|
|||||||
struct_.struct_.read_response = scheme_handler_read_response;
|
struct_.struct_.read_response = scheme_handler_read_response;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCppToC<CefSchemeHandlerCppToC, CefSchemeHandler,
|
template<> long CefCppToC<CefSchemeHandlerCppToC, CefSchemeHandler,
|
||||||
cef_scheme_handler_t>::DebugObjCt = 0;
|
cef_scheme_handler_t>::DebugObjCt = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
@ -36,7 +36,7 @@ CefSchemeHandlerFactoryCppToC::CefSchemeHandlerFactoryCppToC(
|
|||||||
struct_.struct_.create = scheme_handler_factory_create;
|
struct_.struct_.create = scheme_handler_factory_create;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCppToC<CefSchemeHandlerFactoryCppToC,
|
template<> long CefCppToC<CefSchemeHandlerFactoryCppToC,
|
||||||
CefSchemeHandlerFactory, cef_scheme_handler_factory_t>::DebugObjCt = 0;
|
CefSchemeHandlerFactory, cef_scheme_handler_factory_t>::DebugObjCt = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
@ -99,7 +99,7 @@ CefStreamReaderCppToC::CefStreamReaderCppToC(CefStreamReader* cls)
|
|||||||
struct_.struct_.eof = stream_reader_eof;
|
struct_.struct_.eof = stream_reader_eof;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCppToC<CefStreamReaderCppToC, CefStreamReader,
|
template<> long CefCppToC<CefStreamReaderCppToC, CefStreamReader,
|
||||||
cef_stream_reader_t>::DebugObjCt = 0;
|
cef_stream_reader_t>::DebugObjCt = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
// Copyright (c) 2011 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.
|
||||||
//
|
//
|
||||||
@ -98,7 +98,7 @@ CefStreamWriterCppToC::CefStreamWriterCppToC(CefStreamWriter* cls)
|
|||||||
struct_.struct_.flush = stream_writer_flush;
|
struct_.struct_.flush = stream_writer_flush;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifndef NDEBUG
|
||||||
template<> long CefCppToC<CefStreamWriterCppToC, CefStreamWriter,
|
template<> long CefCppToC<CefStreamWriterCppToC, CefStreamWriter,
|
||||||
cef_stream_writer_t>::DebugObjCt = 0;
|
cef_stream_writer_t>::DebugObjCt = 0;
|
||||||
#endif
|
#endif
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user