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:
parent
9a69e96950
commit
dbe8de277f
64
cef.gyp
64
cef.gyp
|
@ -34,6 +34,10 @@
|
|||
'tests/cefclient/binding_test.h',
|
||||
'tests/cefclient/cefclient.cpp',
|
||||
'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.h',
|
||||
'tests/cefclient/extension_test.cpp',
|
||||
|
@ -87,6 +91,7 @@
|
|||
'tests/cefclient/cefclient.ico',
|
||||
'tests/cefclient/cefclient.rc',
|
||||
'tests/cefclient/cefclient_win.cpp',
|
||||
'tests/cefclient/client_handler_win.cpp',
|
||||
'tests/cefclient/clientplugin.cpp',
|
||||
'tests/cefclient/clientplugin.h',
|
||||
'tests/cefclient/osrplugin.cpp',
|
||||
|
@ -162,6 +167,7 @@
|
|||
},
|
||||
'sources': [
|
||||
'tests/cefclient/cefclient_mac.mm',
|
||||
'tests/cefclient/client_handler_mac.mm',
|
||||
'tests/cefclient/resource_util_mac.mm',
|
||||
],
|
||||
}],
|
||||
|
@ -310,6 +316,7 @@
|
|||
],
|
||||
'sources': [
|
||||
'include/cef.h',
|
||||
'include/cef_build.h',
|
||||
'include/cef_capi.h',
|
||||
'include/cef_export.h',
|
||||
'include/cef_nplugin.h',
|
||||
|
@ -357,19 +364,43 @@
|
|||
'libcef_dll/cpptoc/xml_reader_cpptoc.h',
|
||||
'libcef_dll/cpptoc/zip_reader_cpptoc.cc',
|
||||
'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.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.h',
|
||||
'libcef_dll/ctocpp/domvisitor_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/domvisitor_ctocpp.h',
|
||||
'libcef_dll/ctocpp/download_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/download_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/find_handler_ctocpp.cc',
|
||||
'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.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.h',
|
||||
'libcef_dll/ctocpp/scheme_handler_factory_ctocpp.cc',
|
||||
|
@ -434,19 +465,43 @@
|
|||
'sources': [
|
||||
'include/cef_wrapper.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.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.h',
|
||||
'libcef_dll/cpptoc/domvisitor_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/domvisitor_cpptoc.h',
|
||||
'libcef_dll/cpptoc/download_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/download_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/find_handler_cpptoc.cc',
|
||||
'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.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.h',
|
||||
'libcef_dll/cpptoc/scheme_handler_factory_cpptoc.cc',
|
||||
|
@ -553,6 +608,7 @@
|
|||
],
|
||||
'sources': [
|
||||
'include/cef.h',
|
||||
'include/cef_build.h',
|
||||
'include/cef_export.h',
|
||||
'include/cef_nplugin.h',
|
||||
'include/cef_ptr.h',
|
||||
|
|
1003
include/cef.h
1003
include/cef.h
File diff suppressed because it is too large
Load Diff
|
@ -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
|
||||
// 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
|
||||
// CEF when the application is started. A return value of true (1) indicates
|
||||
// that it succeeded and false (0) indicates that it failed.
|
||||
CEF_EXPORT int cef_initialize(const struct _cef_settings_t* settings,
|
||||
const struct _cef_browser_settings_t* browser_defaults);
|
||||
CEF_EXPORT int cef_initialize(const struct _cef_settings_t* settings);
|
||||
|
||||
// This function should be called on the main application thread to shut down
|
||||
// CEF before the application exits.
|
||||
|
@ -326,9 +325,8 @@ typedef struct _cef_browser_t
|
|||
// Returns true (1) if the window is a popup window.
|
||||
int (CEF_CALLBACK *is_popup)(struct _cef_browser_t* self);
|
||||
|
||||
// Returns the handler for this browser.
|
||||
struct _cef_handler_t* (CEF_CALLBACK *get_handler)(
|
||||
struct _cef_browser_t* self);
|
||||
// Returns the client for this browser.
|
||||
struct _cef_client_t* (CEF_CALLBACK *get_client)(struct _cef_browser_t* self);
|
||||
|
||||
// Returns the main (top-level) frame for the browser window.
|
||||
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
|
||||
// when window rendering is disabled and will result in a call to
|
||||
// handle_paint().
|
||||
// HandlePaint().
|
||||
void (CEF_CALLBACK *invalidate)(struct _cef_browser_t* self,
|
||||
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
|
||||
// |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
|
||||
// new window is a popup window. This function call will not block.
|
||||
CEF_EXPORT int cef_browser_create(cef_window_info_t* windowInfo, int popup,
|
||||
struct _cef_handler_t* handler, const cef_string_t* url);
|
||||
// be created on the UI thread. This function call will not block.
|
||||
CEF_EXPORT int cef_browser_create(cef_window_info_t* windowInfo,
|
||||
struct _cef_client_t* client, const cef_string_t* url,
|
||||
const struct _cef_browser_settings_t* settings);
|
||||
|
||||
// Create a new browser window using the window parameters specified by
|
||||
// |windowInfo|. The |popup| parameter should be true (1) if the new window is a
|
||||
// popup window. This function should only be called on the UI thread.
|
||||
// |windowInfo|. This function should only be called on the UI thread.
|
||||
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
|
||||
|
@ -554,120 +552,121 @@ typedef struct _cef_frame_t
|
|||
} cef_frame_t;
|
||||
|
||||
|
||||
// Structure that should be implemented to handle events generated by the
|
||||
// browser window. The functions of this structure will be called on the thread
|
||||
// indicated in the function comments.
|
||||
typedef struct _cef_handler_t
|
||||
// Implement this structure to handle events related to browser life span. The
|
||||
// functions of this structure will be called on the UI thread.
|
||||
typedef struct _cef_life_span_handler_t
|
||||
{
|
||||
// Base structure.
|
||||
cef_base_t base;
|
||||
|
||||
// Called on the UI thread before a new window is created. The |parentBrowser|
|
||||
// parameter will point to the parent browser window, if any. The |popup|
|
||||
// parameter will be true (1) if the new window is a popup window, in which
|
||||
// case |popupFeatures| will contain information about the style of popup
|
||||
// window requested. If you create the window yourself you should populate the
|
||||
// window handle member of |createInfo| and return RV_HANDLED. Otherwise,
|
||||
// return RV_CONTINUE and the framework will create the window. By default, a
|
||||
// newly created window will recieve the same handler as the parent window.
|
||||
// To change the handler for the new window modify the object that |handler|
|
||||
// points to.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_before_created)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* parentBrowser,
|
||||
struct _cef_window_info_t* windowInfo, int popup,
|
||||
// Called before a new popup window is created. The |parentBrowser| parameter
|
||||
// will point to the parent browser window. The |popupFeatures| parameter will
|
||||
// contain information about the style of popup window requested. Return false
|
||||
// (0) to have the framework create the new popup window based on the
|
||||
// parameters in |windowInfo|. Return true (1) to cancel creation of the popup
|
||||
// window. By default, a newly created popup window will have the same client
|
||||
// and settings as the parent window. To change the client for the new window
|
||||
// modify the object that |client| points to. To change the settings for the
|
||||
// new window modify the |settings| structure.
|
||||
int (CEF_CALLBACK *on_before_popup)(struct _cef_life_span_handler_t* self,
|
||||
struct _cef_browser_t* parentBrowser,
|
||||
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);
|
||||
|
||||
// Called on the UI thread after a new window is created. The return value is
|
||||
// currently ignored.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_after_created)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser);
|
||||
// Called after a new window is created.
|
||||
void (CEF_CALLBACK *on_after_created)(struct _cef_life_span_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
|
||||
// Called on the UI thread when a frame's address has changed. The return
|
||||
// value is currently ignored.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_address_change)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame, const cef_string_t* url);
|
||||
// Called just before a window is closed.
|
||||
void (CEF_CALLBACK *on_before_close)(struct _cef_life_span_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
|
||||
// Called on the UI thread when the page title changes. The return value is
|
||||
// currently ignored.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_title_change)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
const cef_string_t* title);
|
||||
} cef_life_span_handler_t;
|
||||
|
||||
// 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
|
||||
// opportunity to modify the |request| object if desired. Return RV_HANDLED
|
||||
// to cancel navigation.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_before_browse)(
|
||||
struct _cef_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);
|
||||
// Implement this structure to handle events related to browser load status. The
|
||||
// functions of this structure will be called on the UI thread.
|
||||
typedef struct _cef_load_handler_t
|
||||
{
|
||||
// Base structure.
|
||||
cef_base_t base;
|
||||
|
||||
// Called on the UI thread when the browser begins loading a frame. The
|
||||
// |frame| value will never be NULL -- call the is_main() function to check if
|
||||
// this frame is the main frame. Multiple frames may be loading at the same
|
||||
// time. Sub-frames may start or continue loading after the main frame load
|
||||
// has ended. This function may not be called for a particular frame if the
|
||||
// load request for that frame fails. The return value is currently ignored.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_load_start)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame);
|
||||
// Called when the browser begins loading a frame. The |frame| value will
|
||||
// never be NULL -- call the is_main() function to check if this frame is the
|
||||
// main frame. Multiple frames may be loading at the same time. Sub-frames may
|
||||
// start or continue loading after the main frame load has ended. This
|
||||
// function may not be called for a particular frame if the load request for
|
||||
// that frame fails.
|
||||
void (CEF_CALLBACK *on_load_start)(struct _cef_load_handler_t* self,
|
||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame);
|
||||
|
||||
// Called on the UI thread when the browser is done loading a frame. The
|
||||
// |frame| value will never be NULL -- call the is_main() function to check if
|
||||
// this frame is the main frame. Multiple frames may be loading at the same
|
||||
// time. Sub-frames may start or continue loading after the main frame load
|
||||
// has ended. This function will always be called for all frames irrespective
|
||||
// of whether the request completes successfully. The return value is
|
||||
// currently ignored.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_load_end)(struct _cef_handler_t* self,
|
||||
// Called when the browser is done loading a frame. The |frame| value will
|
||||
// never be NULL -- call the is_main() function to check if this frame is the
|
||||
// main frame. Multiple frames may be loading at the same time. Sub-frames may
|
||||
// start or continue loading after the main frame load has ended. This
|
||||
// function will always be called for all frames irrespective of whether the
|
||||
// request completes successfully.
|
||||
void (CEF_CALLBACK *on_load_end)(struct _cef_load_handler_t* self,
|
||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||
int httpStatusCode);
|
||||
|
||||
// Called on the UI thread when the browser fails to load a resource.
|
||||
// |errorCode| is the error code number and |failedUrl| is the URL that failed
|
||||
// to load. To provide custom error text assign the text to |errorText| and
|
||||
// return RV_HANDLED. Otherwise, return RV_CONTINUE for the default error
|
||||
// text.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_load_error)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame, enum cef_handler_errorcode_t errorCode,
|
||||
const cef_string_t* failedUrl, cef_string_t* errorText);
|
||||
// Called when the browser fails to load a resource. |errorCode| is the error
|
||||
// code number and |failedUrl| is the URL that failed to load. To provide
|
||||
// custom error text assign the text to |errorText| and return true (1).
|
||||
// Otherwise, return false (0) for the default error text. See
|
||||
// net\base\net_error_list.h for complete descriptions of the error codes.
|
||||
int (CEF_CALLBACK *on_load_error)(struct _cef_load_handler_t* self,
|
||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||
enum cef_handler_errorcode_t errorCode, const cef_string_t* failedUrl,
|
||||
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
|
||||
// to load normally return RV_CONTINUE. To redirect the resource to a new url
|
||||
// populate the |redirectUrl| value and return RV_CONTINUE. To specify data
|
||||
// for the resource return a CefStream object in |resourceStream|, use the
|
||||
// to load normally return false (0). To redirect the resource to a new url
|
||||
// populate the |redirectUrl| value and return false (0). To specify data for
|
||||
// the resource return a CefStream object in |resourceStream|, use the
|
||||
// |response| object to set mime type, HTTP status code and optional header
|
||||
// values, and return RV_CONTINUE. To cancel loading of the resource return
|
||||
// RV_HANDLED. Any modifications to |request| will be observed. If the URL in
|
||||
// values, and return false (0). To cancel loading of the resource return true
|
||||
// (1). Any modifications to |request| will be observed. If the URL in
|
||||
// |request| is changed and |redirectUrl| is also set, the URL in |request|
|
||||
// will be used.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_before_resource_load)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
int (CEF_CALLBACK *on_before_resource_load)(
|
||||
struct _cef_request_handler_t* self, struct _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);
|
||||
|
||||
// Called on the IO thread to handle requests for URLs with an unknown
|
||||
// protocol component. Return RV_HANDLED to indicate that the request should
|
||||
// succeed because it was externally handled. Set |allow_os_execution| to true
|
||||
// (1) and return RV_CONTINUE to attempt execution via the registered OS
|
||||
// protocol handler, if any. If RV_CONTINUE is returned and either
|
||||
// protocol component. Return true (1) to indicate that the request should
|
||||
// succeed because it was handled externally. Set |allowOSExecution| to true
|
||||
// (1) and return false (0) to attempt execution via the registered OS
|
||||
// protocol handler, if any. If false (0) is returned and either
|
||||
// |allow_os_execution| is false (0) or OS protocol handler execution fails
|
||||
// then the request will fail with an error condition. SECURITY WARNING: YOU
|
||||
// SHOULD USE THIS METHOD TO ENFORCE RESTRICTIONS BASED ON SCHEME, HOST OR
|
||||
// OTHER URL ANALYSIS BEFORE ALLOWING OS EXECUTION.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_protocol_execution)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
const cef_string_t* url, int* allow_os_execution);
|
||||
int (CEF_CALLBACK *on_protocol_execution)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser, const cef_string_t* url,
|
||||
int* allowOSExecution);
|
||||
|
||||
// Called on the UI thread when a server indicates via the 'Content-
|
||||
// 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-
|
||||
// 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
|
||||
// RV_CONTINUE to download the file or RV_HANDLED to cancel the file download.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_download_response)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
const cef_string_t* mimeType, const cef_string_t* fileName,
|
||||
int64 contentLength, struct _cef_download_handler_t** handler);
|
||||
// true (1) to download the file or false (0) to cancel the file download.
|
||||
int (CEF_CALLBACK *get_download_handler)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser, const cef_string_t* mimeType,
|
||||
const cef_string_t* fileName, int64 contentLength,
|
||||
struct _cef_download_handler_t** handler);
|
||||
|
||||
// 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
|
||||
// hostname and port number. Set |username| and |password| and return
|
||||
// RV_HANDLED to handle the request. Return RV_CONTINUE to cancel the request.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_authentication_request)(
|
||||
struct _cef_handler_t* self, struct _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);
|
||||
// hostname and port number. Set |username| and |password| and return true (1)
|
||||
// to handle the request. Return false (0) to cancel the request.
|
||||
int (CEF_CALLBACK *get_auth_credentials)(struct _cef_request_handler_t* self,
|
||||
struct _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);
|
||||
|
||||
// Called on the UI thread before a context menu is displayed. To cancel
|
||||
// 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,
|
||||
} cef_request_handler_t;
|
||||
|
||||
|
||||
// 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);
|
||||
|
||||
// Called on the UI thread to optionally override the default text for a
|
||||
// context menu item. |label| contains the default text and may be modified to
|
||||
// substitute alternate text. The return value is currently ignored.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_get_menu_label)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
enum cef_handler_menuid_t menuId, cef_string_t* label);
|
||||
// Called to optionally override the default text for a context menu item.
|
||||
// |label| contains the default text and may be modified to substitute
|
||||
// alternate text.
|
||||
void (CEF_CALLBACK *get_menu_label)(struct _cef_menu_handler_t* self,
|
||||
struct _cef_browser_t* browser, enum cef_handler_menuid_t menuId,
|
||||
cef_string_t* label);
|
||||
|
||||
// Called on the UI thread when an option is selected from the default context
|
||||
// menu. Return RV_HANDLED to cancel default handling of the action.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_menu_action)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
enum cef_handler_menuid_t menuId);
|
||||
// Called when an option is selected from the default context menu. Return
|
||||
// false (0) to execute the default action or true (1) to cancel the action.
|
||||
int (CEF_CALLBACK *on_menu_action)(struct _cef_menu_handler_t* self,
|
||||
struct _cef_browser_t* browser, enum cef_handler_menuid_t menuId);
|
||||
|
||||
// Called on the UI thread 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 RV_CONTINUE to display the default print
|
||||
// options or RV_HANDLED to display the modified |printOptions|.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_print_options)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
} cef_menu_handler_t;
|
||||
|
||||
|
||||
// Implement this structure to handle events related to printing. The functions
|
||||
// of this structure will be called on the UI thread.
|
||||
typedef struct _cef_print_handler_t
|
||||
{
|
||||
// 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);
|
||||
|
||||
// Called on the UI thread to format print headers and footers. |printInfo|
|
||||
// contains platform-specific information about the printer context. |url| is
|
||||
// the URL if the currently printing page, |title| is the title of the
|
||||
// currently printing page, |currentPage| is the current page number and
|
||||
// |maxPages| is the total number of pages. Six default header locations are
|
||||
// provided by the implementation: top left, top center, top right, bottom
|
||||
// left, bottom center and bottom right. To use one of these default locations
|
||||
// just assign a string to the appropriate variable. To draw the header and
|
||||
// footer yourself return RV_HANDLED. Otherwise, populate the approprate
|
||||
// variables and return RV_CONTINUE.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_print_header_footer)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame, struct _cef_print_info_t* printInfo,
|
||||
const 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);
|
||||
// Called to format print headers and footers. |printInfo| contains platform-
|
||||
// specific information about the printer context. |url| is the URL if the
|
||||
// currently printing page, |title| is the title of the currently printing
|
||||
// page, |currentPage| is the current page number and |maxPages| is the total
|
||||
// number of pages. Six default header locations are provided by the
|
||||
// implementation: top left, top center, top right, bottom left, bottom center
|
||||
// and bottom right. To use one of these default locations just assign a
|
||||
// string to the appropriate variable. To draw the header and footer yourself
|
||||
// return true (1). Otherwise, populate the approprate variables and return
|
||||
// false (0).
|
||||
int (CEF_CALLBACK *get_print_header_footer)(struct _cef_print_handler_t* self,
|
||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||
const struct _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);
|
||||
|
||||
// Called on the UI thread to run a JS alert message. Return RV_CONTINUE to
|
||||
// display the default alert or RV_HANDLED if you displayed a custom alert.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_jsalert)(struct _cef_handler_t* self,
|
||||
} cef_print_handler_t;
|
||||
|
||||
|
||||
// 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,
|
||||
const cef_string_t* message);
|
||||
|
||||
// Called on the UI thread to run a JS confirm request. Return RV_CONTINUE to
|
||||
// display the default alert or RV_HANDLED if you displayed a custom alert. If
|
||||
// you handled the alert set |retval| to true (1) if the user accepted the
|
||||
// confirmation.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_jsconfirm)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame, const cef_string_t* message, int* retval);
|
||||
// Called to run a JavaScript confirm request. Return false (0) to display the
|
||||
// default alert or true (1) if you displayed a custom alert. If you handled
|
||||
// the alert set |retval| to true (1) if the user accepted the confirmation.
|
||||
int (CEF_CALLBACK *on_jsconfirm)(struct _cef_jsdialog_handler_t* self,
|
||||
struct _cef_browser_t* browser, 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
|
||||
// display the default prompt or RV_HANDLED if you displayed a custom prompt.
|
||||
// If you handled the prompt set |retval| to true (1) if the user accepted the
|
||||
// prompt and request and |result| to the resulting value.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_jsprompt)(struct _cef_handler_t* self,
|
||||
// Called to run a JavaScript prompt request. Return false (0) to display the
|
||||
// default prompt or true (1) if you displayed a custom prompt. If you handled
|
||||
// the prompt set |retval| to true (1) if the user accepted the prompt and
|
||||
// request and |result| to the resulting value.
|
||||
int (CEF_CALLBACK *on_jsprompt)(struct _cef_jsdialog_handler_t* self,
|
||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||
const cef_string_t* message, const cef_string_t* defaultValue,
|
||||
int* retval, cef_string_t* result);
|
||||
|
||||
// Called on the UI thread for adding values to a frame's JavaScript 'window'
|
||||
// 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);
|
||||
} cef_jsdialog_handler_t;
|
||||
|
||||
// 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.
|
||||
// For instance, if focus was on the last HTML element and the user pressed
|
||||
// the TAB key. The return value is currently ignored.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_take_focus)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
int reverse);
|
||||
// Implement this structure to handle JavaScript binding. The functions of this
|
||||
// structure will be called on the UI thread.
|
||||
typedef struct _cef_jsbinding_handler_t
|
||||
{
|
||||
// Base structure.
|
||||
cef_base_t base;
|
||||
|
||||
// Called on the UI thread 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 RV_CONTINUE to allow the focus to be set or
|
||||
// RV_HANDLED to cancel setting the focus.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_set_focus)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
int isWidget);
|
||||
// Called for adding values to a frame's JavaScript 'window' object.
|
||||
void (CEF_CALLBACK *on_jsbinding)(struct _cef_jsbinding_handler_t* self,
|
||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||
struct _cef_v8value_t* object);
|
||||
|
||||
// Called on the UI thread 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 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);
|
||||
} cef_jsbinding_handler_t;
|
||||
|
||||
// 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|
|
||||
// contains the text that will be displayed in the status message and |type|
|
||||
// indicates the status message type. The return value is currently ignored.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_status)(struct _cef_handler_t* self,
|
||||
struct _cef_browser_t* browser, const cef_string_t* value,
|
||||
enum cef_handler_statustype_t type);
|
||||
// Implement this structure to handle events when window rendering is disabled.
|
||||
// The functions of this structure will be called on the UI thread.
|
||||
typedef struct _cef_render_handler_t
|
||||
{
|
||||
// Base structure.
|
||||
cef_base_t base;
|
||||
|
||||
// Called on the UI thread to display a console message. Return RV_HANDLED to
|
||||
// stop the message from being output to the console.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_console_message)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
const cef_string_t* message, const cef_string_t* source, int line);
|
||||
// Called to retrieve the view rectangle which is relative to screen
|
||||
// coordinates. Return true (1) if the rectangle was provided.
|
||||
int (CEF_CALLBACK *get_view_rect)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser, cef_rect_t* rect);
|
||||
|
||||
// Called on the UI thread 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. 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
|
||||
// Called to retrieve the simulated screen rectangle. Return true (1) if the
|
||||
// rectangle was provided.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_get_rect)(struct _cef_handler_t* self,
|
||||
struct _cef_browser_t* browser, int screen, cef_rect_t* rect);
|
||||
int (CEF_CALLBACK *get_screen_rect)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser, cef_rect_t* rect);
|
||||
|
||||
// Called on the UI thread retrieve the translation from view coordinates to
|
||||
// actual screen coordinates. This function is only called if window rendering
|
||||
// has been disabled. Return RV_CONTINUE if the screen coordinates were
|
||||
// provided.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_get_screen_point)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser, int viewX,
|
||||
int viewY, int* screenX, int* screenY);
|
||||
// Called to retrieve the translation from view coordinates to actual screen
|
||||
// coordinates. Return true (1) if the screen coordinates were provided.
|
||||
int (CEF_CALLBACK *get_screen_point)(struct _cef_render_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
|
||||
// move the popup. If |show| is true (1) and |rect| is zero size then the
|
||||
// popup should be shown. If |show| is true (1) and |rect| is non-zero size
|
||||
// then |rect| represents the popup location in view coordinates. If |show| is
|
||||
// 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.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_popup_change)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser, int show,
|
||||
const cef_rect_t* rect);
|
||||
// Called when the browser wants to show or hide the popup widget. The popup
|
||||
// should be shown if |show| is true (1) and hidden if |show| is false (0).
|
||||
void (CEF_CALLBACK *on_popup_show)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser, int show);
|
||||
|
||||
// Called when the browser wants to move or resize the popup widget. |rect|
|
||||
// contains the new location and size.
|
||||
void (CEF_CALLBACK *on_popup_size)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser, const cef_rect_t* rect);
|
||||
|
||||
// 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
|
||||
// whole image. |dirtyRect| indicates the portion of the image that has been
|
||||
// repainted. On Windows |buffer| will be width*height*4 bytes in size and
|
||||
// represents a BGRA image with an upper-left origin. This function is only
|
||||
// called if window rendering has been disabled. The return value is currently
|
||||
// ignored.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_paint)(struct _cef_handler_t* self,
|
||||
// element is the view or the popup widget. |buffer| contains the pixel data
|
||||
// for the whole image. |dirtyRect| indicates the portion of the image that
|
||||
// has been repainted. On Windows |buffer| will be width*height*4 bytes in
|
||||
// size and represents a BGRA image with an upper-left origin.
|
||||
void (CEF_CALLBACK *on_paint)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser, enum cef_paint_element_type_t type,
|
||||
const cef_rect_t* dirtyRect, const void* buffer);
|
||||
|
||||
// Called when the browser window's cursor has changed. This function is only
|
||||
// called if window rendering has been disabled. The return value is currently
|
||||
// ignored.
|
||||
enum cef_retval_t (CEF_CALLBACK *handle_cursor_change)(
|
||||
struct _cef_handler_t* self, struct _cef_browser_t* browser,
|
||||
cef_cursor_handle_t cursor);
|
||||
// Called when the browser window's cursor has changed.
|
||||
void (CEF_CALLBACK *on_cursor_change)(struct _cef_render_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
|
||||
|
@ -1447,7 +1588,7 @@ typedef struct _cef_download_handler_t
|
|||
|
||||
|
||||
// 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.
|
||||
typedef struct _cef_web_urlrequest_t
|
||||
{
|
||||
|
|
|
@ -28,18 +28,22 @@
|
|||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#if defined(_WIN32)
|
||||
#ifdef _MSC_VER // MSVC
|
||||
#include "cef_build.h"
|
||||
|
||||
#if defined(COMPILER_MSVC)
|
||||
|
||||
#ifdef BUILDING_CEF_SHARED
|
||||
#define CEF_EXPORT __declspec(dllexport)
|
||||
#elif USING_CEF_SHARED
|
||||
#define CEF_EXPORT __declspec(dllimport)
|
||||
#else
|
||||
#define CEF_EXPORT
|
||||
#endif // BUILDING_CEF_SHARED
|
||||
#endif
|
||||
#define CEF_CALLBACK __stdcall
|
||||
#endif // MSVC
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#elif defined(COMPILER_GCC)
|
||||
|
||||
#define CEF_EXPORT __attribute__ ((visibility("default")))
|
||||
#define CEF_CALLBACK
|
||||
#endif // defined(__GNUC__)
|
||||
|
||||
#endif // COMPILER_GCC
|
||||
|
|
|
@ -130,7 +130,7 @@ struct CefRunnableMethodTraits {
|
|||
// CefRunnableMethod and NewCefRunnableMethod implementation ------------------
|
||||
|
||||
template <class T, class Method, class Params>
|
||||
class CefRunnableMethod : public CefThreadSafeBase<CefTask> {
|
||||
class CefRunnableMethod : public CefTask {
|
||||
public:
|
||||
CefRunnableMethod(T* obj, Method meth, const Params& params)
|
||||
: obj_(obj), meth_(meth), params_(params) {
|
||||
|
@ -154,6 +154,8 @@ class CefRunnableMethod : public CefThreadSafeBase<CefTask> {
|
|||
Method meth_;
|
||||
Params params_;
|
||||
CefRunnableMethodTraits<T> traits_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefRunnableMethod);
|
||||
};
|
||||
|
||||
template <class T, class Method>
|
||||
|
@ -241,7 +243,7 @@ inline CefRefPtr<CefTask> NewCefRunnableMethod(T* object, Method method,
|
|||
// CefRunnableFunction and NewCefRunnableFunction implementation --------------
|
||||
|
||||
template <class Function, class Params>
|
||||
class CefRunnableFunction : public CefThreadSafeBase<CefTask> {
|
||||
class CefRunnableFunction : public CefTask {
|
||||
public:
|
||||
CefRunnableFunction(Function function, const Params& params)
|
||||
: function_(function), params_(params) {
|
||||
|
@ -258,6 +260,8 @@ class CefRunnableFunction : public CefThreadSafeBase<CefTask> {
|
|||
private:
|
||||
Function function_;
|
||||
Params params_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefRunnableFunction);
|
||||
};
|
||||
|
||||
template <class Function>
|
||||
|
|
|
@ -39,20 +39,21 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "cef_build.h"
|
||||
#include "cef_export.h"
|
||||
#include <stddef.h>
|
||||
|
||||
// CEF character type definitions. wchat_t is 2 bytes on Windows and 4 bytes on
|
||||
// most other platforms.
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(OS_WIN)
|
||||
typedef wchar_t char16_t;
|
||||
#else // _WIN32
|
||||
#else // !OS_WIN
|
||||
typedef unsigned short char16_t;
|
||||
#ifndef WCHAR_T_IS_UTF32
|
||||
#define WCHAR_T_IS_UTF32
|
||||
#endif // WCHAR_T_IS_UTF32
|
||||
#endif // _WIN32
|
||||
#endif // !OS_WIN
|
||||
|
||||
|
||||
// CEF string type definitions. Whomever allocates |str| is responsible for
|
||||
|
|
|
@ -31,14 +31,16 @@
|
|||
#ifndef _CEF_TYPES_H
|
||||
#define _CEF_TYPES_H
|
||||
|
||||
#include "cef_build.h"
|
||||
#include "cef_string.h"
|
||||
#include "cef_string_list.h"
|
||||
|
||||
// Bring in platform-specific definitions.
|
||||
#if defined(_WIN32)
|
||||
#if defined(OS_WIN)
|
||||
#include "cef_types_win.h"
|
||||
#elif defined(__APPLE__)
|
||||
#elif defined(OS_MACOSX)
|
||||
#include "cef_types_mac.h"
|
||||
#elif defined(__linux__)
|
||||
#elif defined(OS_LINUX)
|
||||
#include "cef_types_linux.h"
|
||||
#endif
|
||||
|
||||
|
@ -336,17 +338,6 @@ enum cef_key_type_t
|
|||
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.
|
||||
enum cef_handler_navtype_t
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#ifndef _CEF_TYPES_LINUX_H
|
||||
#define _CEF_TYPES_LINUX_H
|
||||
|
||||
#if defined(__linux__)
|
||||
#if defined(OS_LINUX)
|
||||
#include <gtk/gtk.h>
|
||||
#include "cef_string.h"
|
||||
|
||||
|
@ -63,6 +63,6 @@ typedef struct _cef_print_info_t
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // defined(__linux__)
|
||||
#endif // OS_LINUX
|
||||
|
||||
#endif // _CEF_TYPES_LINUX_H
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#ifndef _CEF_TYPES_MAC_H
|
||||
#define _CEF_TYPES_MAC_H
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#if defined(OS_MACOSX)
|
||||
#include "cef_string.h"
|
||||
|
||||
// Window handle.
|
||||
|
@ -78,6 +78,6 @@ typedef struct _cef_print_info_t
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // defined(__APPLE__)
|
||||
#endif // OS_MACOSX
|
||||
|
||||
#endif // _CEF_TYPES_MAC_H
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#ifndef _CEF_TYPES_WIN_H
|
||||
#define _CEF_TYPES_WIN_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
#include "cef_string.h"
|
||||
|
||||
|
@ -78,6 +78,6 @@ typedef struct _cef_print_info_t
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif // _WIN32
|
||||
#endif // OS_WIN
|
||||
|
||||
#endif // _CEF_TYPES_WIN_H
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
// (b) Entity reference nodes are resolved to the corresponding entity
|
||||
// value.
|
||||
// (c) Element nodes are represented by their outer XML string.
|
||||
class CefXmlObject : public CefThreadSafeBase<CefBase>
|
||||
class CefXmlObject : public CefBase
|
||||
{
|
||||
public:
|
||||
typedef std::vector<CefRefPtr<CefXmlObject> > ObjectVector;
|
||||
|
@ -148,12 +148,15 @@ private:
|
|||
CefString value_;
|
||||
AttributeMap attributes_;
|
||||
ObjectVector children_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefXmlObject);
|
||||
IMPLEMENT_LOCKING(CefXmlObject);
|
||||
};
|
||||
|
||||
|
||||
// Thread safe implementation of the CefReadHandler class for reading an
|
||||
// in-memory array of bytes.
|
||||
class CefByteReadHandler : public CefThreadSafeBase<CefReadHandler>
|
||||
class CefByteReadHandler : public CefReadHandler
|
||||
{
|
||||
public:
|
||||
// Create a new object for reading an array of bytes. An optional |source|
|
||||
|
@ -180,6 +183,9 @@ private:
|
|||
size_t size_;
|
||||
size_t offset_;
|
||||
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
|
||||
// means that files from the same folder may not be located together in the
|
||||
// file content map.
|
||||
class CefZipArchive : public CefThreadSafeBase<CefBase>
|
||||
class CefZipArchive : public CefBase
|
||||
{
|
||||
public:
|
||||
// Class representing a file in the archive. Accessing the file data from
|
||||
|
@ -241,6 +247,9 @@ public:
|
|||
|
||||
private:
|
||||
FileMap contents_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefZipArchive);
|
||||
IMPLEMENT_LOCKING(CefZipArchive);
|
||||
};
|
||||
|
||||
#endif // _CEF_WRAPPER_H
|
||||
|
|
|
@ -50,21 +50,25 @@ namespace {
|
|||
class CreateBrowserHelper
|
||||
{
|
||||
public:
|
||||
CreateBrowserHelper(CefWindowInfo& windowInfo, bool popup,
|
||||
CefRefPtr<CefHandler> handler, const CefString& url)
|
||||
: window_info_(windowInfo), popup_(popup),
|
||||
handler_(handler), url_(url) {}
|
||||
CreateBrowserHelper(CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefString& url,
|
||||
const CefBrowserSettings& settings)
|
||||
: window_info_(windowInfo),
|
||||
client_(client),
|
||||
url_(url),
|
||||
settings_(settings) {}
|
||||
|
||||
CefWindowInfo window_info_;
|
||||
bool popup_;
|
||||
CefRefPtr<CefHandler> handler_;
|
||||
CefRefPtr<CefClient> client_;
|
||||
CefString url_;
|
||||
CefBrowserSettings settings_;
|
||||
};
|
||||
|
||||
void UIT_CreateBrowserWithHelper(CreateBrowserHelper* helper)
|
||||
{
|
||||
CefBrowser::CreateBrowserSync(helper->window_info_, helper->popup_,
|
||||
helper->handler_, helper->url_);
|
||||
CefBrowser::CreateBrowserSync(helper->window_info_, helper->client_,
|
||||
helper->url_, helper->settings_);
|
||||
delete helper;
|
||||
}
|
||||
|
||||
|
@ -83,20 +87,24 @@ void CefBrowserImpl::PaintDelegate::Paint(bool popup,
|
|||
const gfx::Rect& dirtyRect,
|
||||
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())
|
||||
return;
|
||||
|
||||
CefRect rect(dirtyRect.x(), dirtyRect.y(), dirtyRect.width(),
|
||||
dirtyRect.height());
|
||||
handler->HandlePaint(browser_, (popup?PET_POPUP:PET_VIEW), rect, buffer);
|
||||
handler->OnPaint(browser_, (popup?PET_POPUP:PET_VIEW), rect, buffer);
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
bool CefBrowser::CreateBrowser(CefWindowInfo& windowInfo, bool popup,
|
||||
CefRefPtr<CefHandler> handler,
|
||||
const CefString& url)
|
||||
bool CefBrowser::CreateBrowser(CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefString& url,
|
||||
const CefBrowserSettings& settings)
|
||||
{
|
||||
// Verify that the context is in a valid state.
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
|
@ -104,17 +112,24 @@ bool CefBrowser::CreateBrowser(CefWindowInfo& windowInfo, bool popup,
|
|||
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.
|
||||
CreateBrowserHelper* helper =
|
||||
new CreateBrowserHelper(windowInfo, popup, handler, url);
|
||||
new CreateBrowserHelper(windowInfo, client, url, settings);
|
||||
CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableFunction(
|
||||
UIT_CreateBrowserWithHelper, helper));
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefBrowser> CefBrowser::CreateBrowserSync(CefWindowInfo& windowInfo,
|
||||
bool popup, CefRefPtr<CefHandler> handler, const CefString& url)
|
||||
CefRefPtr<CefBrowser> CefBrowser::CreateBrowserSync(
|
||||
CefWindowInfo& windowInfo, CefRefPtr<CefClient> client,
|
||||
const CefString& url, const CefBrowserSettings& settings)
|
||||
{
|
||||
// Verify that the context is in a valid state.
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
|
@ -122,27 +137,20 @@ CefRefPtr<CefBrowser> CefBrowser::CreateBrowserSync(CefWindowInfo& windowInfo,
|
|||
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.
|
||||
if (!CefThread::CurrentlyOn(CefThread::UI)) {
|
||||
NOTREACHED();
|
||||
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(
|
||||
new CefBrowserImpl(windowInfo, settings, popup, handler));
|
||||
new CefBrowserImpl(windowInfo, settings, false, client));
|
||||
static_cast<CefBrowserImpl*>(browser.get())->UIT_CreateBrowser(url);
|
||||
|
||||
return browser;
|
||||
|
@ -151,9 +159,9 @@ CefRefPtr<CefBrowser> CefBrowser::CreateBrowserSync(CefWindowInfo& windowInfo,
|
|||
|
||||
CefBrowserImpl::CefBrowserImpl(const CefWindowInfo& windowInfo,
|
||||
const CefBrowserSettings& settings, bool popup,
|
||||
CefRefPtr<CefHandler> handler)
|
||||
CefRefPtr<CefClient> client)
|
||||
: 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),
|
||||
main_frame_(NULL), unique_id_(0)
|
||||
{
|
||||
|
@ -666,9 +674,12 @@ WebFrame* CefBrowserImpl::UIT_GetWebFrame(CefRefPtr<CefFrame> frame)
|
|||
|
||||
void CefBrowserImpl::UIT_DestroyBrowser()
|
||||
{
|
||||
if(handler_.get()) {
|
||||
// Notify the handler that the window is about to be closed.
|
||||
handler_->HandleBeforeWindowClose(this);
|
||||
if(client_.get()) {
|
||||
CefRefPtr<CefLifeSpanHandler> handler = client_->GetLifeSpanHandler();
|
||||
if (handler.get()) {
|
||||
// Notify the handler that the window is about to be closed.
|
||||
handler->OnBeforeClose(this);
|
||||
}
|
||||
}
|
||||
UIT_GetWebViewDelegate()->RevokeDragDrop();
|
||||
|
||||
|
@ -915,22 +926,25 @@ bool CefBrowserImpl::UIT_Navigate(const BrowserNavigationEntry& entry,
|
|||
// In case LoadRequest failed before DidCreateDataSource was called.
|
||||
delegate_->set_pending_extra_data(NULL);
|
||||
|
||||
if (handler_.get() && handler_->HandleSetFocus(this, false) == RV_CONTINUE) {
|
||||
// Restore focus to the main frame prior to loading new request.
|
||||
// This makes sure that we don't have a focused iframe. Otherwise, that
|
||||
// iframe would keep focus when the SetFocus called immediately after
|
||||
// LoadRequest, thus making some tests fail (see http://b/issue?id=845337
|
||||
// for more details).
|
||||
// TODO(cef): The above comment may be wrong, or the below call to
|
||||
// setFocusedFrame() may be unnecessary or in the wrong place. See this
|
||||
// thread for additional details:
|
||||
// http://groups.google.com/group/chromium-dev/browse_thread/thread/42bcd31b59e3a168
|
||||
view->setFocusedFrame(frame);
|
||||
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.
|
||||
// This makes sure that we don't have a focused iframe. Otherwise, that
|
||||
// iframe would keep focus when the SetFocus called immediately after
|
||||
// LoadRequest, thus making some tests fail (see http://b/issue?id=845337
|
||||
// for more details).
|
||||
// TODO(cef): The above comment may be wrong, or the below call to
|
||||
// setFocusedFrame() may be unnecessary or in the wrong place. See this
|
||||
// thread for additional details:
|
||||
// http://groups.google.com/group/chromium-dev/browse_thread/thread/42bcd31b59e3a168
|
||||
view->setFocusedFrame(frame);
|
||||
|
||||
// Give focus to the window if it is currently visible.
|
||||
if (!IsWindowRenderingDisabled() &&
|
||||
UIT_IsViewVisible(UIT_GetMainWndHandle()))
|
||||
UIT_SetFocus(UIT_GetWebViewHost(), true);
|
||||
// Give focus to the window if it is currently visible.
|
||||
if (!IsWindowRenderingDisabled() &&
|
||||
UIT_IsViewVisible(UIT_GetMainWndHandle()))
|
||||
UIT_SetFocus(UIT_GetWebViewHost(), true);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -1052,23 +1066,23 @@ CefRefPtr<CefBrowserImpl> CefBrowserImpl::UIT_CreatePopupWindow(
|
|||
if(features.heightSet)
|
||||
info.m_nHeight = features.height;
|
||||
|
||||
CefRefPtr<CefHandler> handler = handler_;
|
||||
CefRefPtr<CefClient> client = client_;
|
||||
|
||||
// Start with the current browser window's 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,
|
||||
// or cancel the window creation.
|
||||
CefHandler::RetVal rv = handler_->HandleBeforeCreated(this, info, true,
|
||||
features, handler, url, settings);
|
||||
if(rv == RV_HANDLED)
|
||||
if (handler.get() &&
|
||||
handler->OnBeforePopup(this, features, info, url, client, settings)) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
// be loaded twice.
|
||||
browser->UIT_CreateBrowser(CefString());
|
||||
|
@ -1104,9 +1118,12 @@ void CefBrowserImpl::UIT_ClosePopupWidget()
|
|||
popuphost_ = NULL;
|
||||
popup_rect_ = gfx::Rect();
|
||||
|
||||
if (IsWindowRenderingDisabled() && handler_.get()) {
|
||||
// Notify the handler of popup visibility change.
|
||||
handler_->HandlePopupChange(this, false, CefRect());
|
||||
if (IsWindowRenderingDisabled() && client_.get()) {
|
||||
CefRefPtr<CefRenderHandler> handler = client_->GetRenderHandler();
|
||||
if (handler.get()) {
|
||||
// Notify the handler of popup visibility change.
|
||||
handler->OnPopupShow(this, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1116,12 +1133,12 @@ void CefBrowserImpl::UIT_Show(WebKit::WebNavigationPolicy 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);
|
||||
}
|
||||
|
||||
void CefBrowserImpl::UIT_HandleAction(CefHandler::MenuId menuId,
|
||||
void CefBrowserImpl::UIT_HandleAction(cef_handler_menuid_t menuId,
|
||||
CefRefPtr<CefFrame> frame)
|
||||
{
|
||||
REQUIRE_UIT();
|
||||
|
@ -1342,11 +1359,14 @@ void CefBrowserImpl::UIT_NotifyFindStatus(int identifier, int count,
|
|||
int active_match_ordinal,
|
||||
bool final_update)
|
||||
{
|
||||
if(handler_.get()) {
|
||||
CefRect rect(selection_rect.x, selection_rect.y, selection_rect.width,
|
||||
selection_rect.height);
|
||||
handler_->HandleFindResult(this, identifier, count, rect,
|
||||
active_match_ordinal, final_update);
|
||||
if(client_.get()) {
|
||||
CefRefPtr<CefFindHandler> handler = client_->GetFindHandler();
|
||||
if (handler.get()) {
|
||||
CefRect rect(selection_rect.x, selection_rect.y, selection_rect.width,
|
||||
selection_rect.height);
|
||||
handler->OnFindResult(this, identifier, count, rect, active_match_ordinal,
|
||||
final_update);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class WebView;
|
|||
|
||||
|
||||
// Implementation of CefBrowser.
|
||||
class CefBrowserImpl : public CefThreadSafeBase<CefBrowser>
|
||||
class CefBrowserImpl : public CefBrowser
|
||||
{
|
||||
public:
|
||||
class PaintDelegate : public WebWidgetHost::PaintDelegate
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
|
||||
CefBrowserImpl(const CefWindowInfo& windowInfo,
|
||||
const CefBrowserSettings& settings, bool popup,
|
||||
CefRefPtr<CefHandler> handler);
|
||||
CefRefPtr<CefClient> client);
|
||||
virtual ~CefBrowserImpl() {}
|
||||
|
||||
#if defined(OS_WIN)
|
||||
|
@ -61,45 +61,46 @@ public:
|
|||
#endif
|
||||
|
||||
// CefBrowser methods
|
||||
virtual void CloseBrowser();
|
||||
virtual bool CanGoBack() { return can_go_back(); }
|
||||
virtual void GoBack();
|
||||
virtual bool CanGoForward() { return can_go_forward(); }
|
||||
virtual void GoForward();
|
||||
virtual void Reload();
|
||||
virtual void ReloadIgnoreCache();
|
||||
virtual void StopLoad();
|
||||
virtual void SetFocus(bool enable);
|
||||
virtual CefWindowHandle GetWindowHandle();
|
||||
virtual bool IsPopup() { return is_popup(); }
|
||||
virtual CefRefPtr<CefHandler> GetHandler() { return handler_; }
|
||||
virtual CefRefPtr<CefFrame> GetMainFrame() { return GetMainCefFrame(); }
|
||||
virtual CefRefPtr<CefFrame> GetFocusedFrame();
|
||||
virtual CefRefPtr<CefFrame> GetFrame(const CefString& name);
|
||||
virtual void GetFrameNames(std::vector<CefString>& names);
|
||||
virtual void CloseBrowser() OVERRIDE;
|
||||
virtual bool CanGoBack() OVERRIDE { return can_go_back(); }
|
||||
virtual void GoBack() OVERRIDE;
|
||||
virtual bool CanGoForward() OVERRIDE { return can_go_forward(); }
|
||||
virtual void GoForward() OVERRIDE;
|
||||
virtual void Reload() OVERRIDE;
|
||||
virtual void ReloadIgnoreCache() OVERRIDE;
|
||||
virtual void StopLoad() OVERRIDE;
|
||||
virtual void SetFocus(bool enable) OVERRIDE;
|
||||
virtual CefWindowHandle GetWindowHandle() OVERRIDE;
|
||||
virtual bool IsPopup() OVERRIDE { return is_popup(); }
|
||||
virtual CefRefPtr<CefClient> GetClient() OVERRIDE { return client_; }
|
||||
virtual CefRefPtr<CefFrame> GetMainFrame() OVERRIDE
|
||||
{ return GetMainCefFrame(); }
|
||||
virtual CefRefPtr<CefFrame> GetFocusedFrame() OVERRIDE;
|
||||
virtual CefRefPtr<CefFrame> GetFrame(const CefString& name) OVERRIDE;
|
||||
virtual void GetFrameNames(std::vector<CefString>& names) OVERRIDE;
|
||||
virtual void Find(int identifier, const CefString& searchText,
|
||||
bool forward, bool matchCase, bool findNext);
|
||||
virtual void StopFinding(bool clearSelection);
|
||||
virtual double GetZoomLevel() { return zoom_level(); }
|
||||
virtual void SetZoomLevel(double zoomLevel);
|
||||
virtual void ShowDevTools();
|
||||
virtual void CloseDevTools();
|
||||
virtual bool IsWindowRenderingDisabled();
|
||||
virtual bool GetSize(PaintElementType type, int& width, int& height);
|
||||
virtual void SetSize(PaintElementType type, int width, int height);
|
||||
virtual bool IsPopupVisible();
|
||||
virtual void HidePopup();
|
||||
virtual void Invalidate(const CefRect& dirtyRect);
|
||||
bool forward, bool matchCase, bool findNext) OVERRIDE;
|
||||
virtual void StopFinding(bool clearSelection) OVERRIDE;
|
||||
virtual double GetZoomLevel() OVERRIDE { return zoom_level(); }
|
||||
virtual void SetZoomLevel(double zoomLevel) OVERRIDE;
|
||||
virtual void ShowDevTools() OVERRIDE;
|
||||
virtual void CloseDevTools() OVERRIDE;
|
||||
virtual bool IsWindowRenderingDisabled() OVERRIDE;
|
||||
virtual bool GetSize(PaintElementType type, int& width, int& height) OVERRIDE;
|
||||
virtual void SetSize(PaintElementType type, int width, int height) OVERRIDE;
|
||||
virtual bool IsPopupVisible() OVERRIDE;
|
||||
virtual void HidePopup() OVERRIDE;
|
||||
virtual void Invalidate(const CefRect& dirtyRect) OVERRIDE;
|
||||
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,
|
||||
bool imeChar);
|
||||
bool imeChar) OVERRIDE;
|
||||
virtual void SendMouseClickEvent(int x, int y, MouseButtonType type,
|
||||
bool mouseUp, int clickCount);
|
||||
virtual void SendMouseMoveEvent(int x, int y, bool mouseLeave);
|
||||
virtual void SendMouseWheelEvent(int x, int y, int delta);
|
||||
virtual void SendFocusEvent(bool setFocus);
|
||||
virtual void SendCaptureLostEvent();
|
||||
bool mouseUp, int clickCount) OVERRIDE;
|
||||
virtual void SendMouseMoveEvent(int x, int y, bool mouseLeave) OVERRIDE;
|
||||
virtual void SendMouseWheelEvent(int x, int y, int delta) OVERRIDE;
|
||||
virtual void SendFocusEvent(bool setFocus) OVERRIDE;
|
||||
virtual void SendCaptureLostEvent() OVERRIDE;
|
||||
|
||||
// Frame-related methods
|
||||
void Undo(CefRefPtr<CefFrame> frame);
|
||||
|
@ -268,8 +269,8 @@ public:
|
|||
void UIT_Show(WebKit::WebNavigationPolicy policy);
|
||||
|
||||
// Handles most simple browser actions
|
||||
void UIT_HandleActionView(CefHandler::MenuId menuId);
|
||||
void UIT_HandleAction(CefHandler::MenuId menuId, CefRefPtr<CefFrame> frame);
|
||||
void UIT_HandleActionView(cef_handler_menuid_t menuId);
|
||||
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
|
||||
// application
|
||||
|
@ -333,7 +334,7 @@ protected:
|
|||
CefBrowserSettings settings_;
|
||||
bool is_popup_;
|
||||
bool is_modal_;
|
||||
CefRefPtr<CefHandler> handler_;
|
||||
CefRefPtr<CefClient> client_;
|
||||
scoped_ptr<WebViewHost> webviewhost_;
|
||||
WebWidgetHost* popuphost_;
|
||||
gfx::Rect popup_rect_;
|
||||
|
@ -369,52 +370,57 @@ protected:
|
|||
|
||||
// A temporary directory for FileSystem API.
|
||||
ScopedTempDir file_system_root_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefBrowserImpl);
|
||||
IMPLEMENT_LOCKING(CefBrowserImpl);
|
||||
};
|
||||
|
||||
|
||||
// Implementation of CefFrame.
|
||||
class CefFrameImpl : public CefThreadSafeBase<CefFrame>
|
||||
class CefFrameImpl : public CefFrame
|
||||
{
|
||||
public:
|
||||
CefFrameImpl(CefBrowserImpl* browser, const CefString& name);
|
||||
virtual ~CefFrameImpl();
|
||||
|
||||
// CefFrame methods
|
||||
virtual void Undo() { browser_->Undo(this); }
|
||||
virtual void Redo() { browser_->Redo(this); }
|
||||
virtual void Cut() { browser_->Cut(this); }
|
||||
virtual void Copy() { browser_->Copy(this); }
|
||||
virtual void Paste() { browser_->Paste(this); }
|
||||
virtual void Delete() { browser_->Delete(this); }
|
||||
virtual void SelectAll() { browser_->SelectAll(this); }
|
||||
virtual void Print() { browser_->Print(this); }
|
||||
virtual void ViewSource() { browser_->ViewSource(this); }
|
||||
virtual CefString GetSource() { return browser_->GetSource(this); }
|
||||
virtual CefString GetText() { return browser_->GetText(this); }
|
||||
virtual void LoadRequest(CefRefPtr<CefRequest> request)
|
||||
virtual void Undo() OVERRIDE { browser_->Undo(this); }
|
||||
virtual void Redo() OVERRIDE { browser_->Redo(this); }
|
||||
virtual void Cut() OVERRIDE { browser_->Cut(this); }
|
||||
virtual void Copy() OVERRIDE { browser_->Copy(this); }
|
||||
virtual void Paste() OVERRIDE { browser_->Paste(this); }
|
||||
virtual void Delete() OVERRIDE { browser_->Delete(this); }
|
||||
virtual void SelectAll() OVERRIDE { browser_->SelectAll(this); }
|
||||
virtual void Print() OVERRIDE { browser_->Print(this); }
|
||||
virtual void ViewSource() OVERRIDE { browser_->ViewSource(this); }
|
||||
virtual CefString GetSource() OVERRIDE { return browser_->GetSource(this); }
|
||||
virtual CefString GetText() OVERRIDE { return browser_->GetText(this); }
|
||||
virtual void LoadRequest(CefRefPtr<CefRequest> request) OVERRIDE
|
||||
{ return browser_->LoadRequest(this, request); }
|
||||
virtual void LoadURL(const CefString& url)
|
||||
virtual void LoadURL(const CefString& url) OVERRIDE
|
||||
{ return browser_->LoadURL(this, url); }
|
||||
virtual void LoadString(const CefString& string,
|
||||
const CefString& url)
|
||||
const CefString& url) OVERRIDE
|
||||
{ return browser_->LoadString(this, string, url); }
|
||||
virtual void LoadStream(CefRefPtr<CefStreamReader> stream,
|
||||
const CefString& url)
|
||||
const CefString& url) OVERRIDE
|
||||
{ return browser_->LoadStream(this, stream, url); }
|
||||
virtual void ExecuteJavaScript(const CefString& jsCode,
|
||||
const CefString& scriptUrl,
|
||||
int startLine)
|
||||
int startLine) OVERRIDE
|
||||
{ return browser_->ExecuteJavaScript(this, jsCode, scriptUrl, startLine); }
|
||||
virtual bool IsMain() { return name_.empty(); }
|
||||
virtual bool IsFocused();
|
||||
virtual CefString GetName() { return name_; }
|
||||
virtual CefString GetURL() { return browser_->GetURL(this); }
|
||||
virtual CefRefPtr<CefBrowser> GetBrowser() { return browser_.get(); }
|
||||
virtual void VisitDOM(CefRefPtr<CefDOMVisitor> visitor);
|
||||
virtual bool IsMain() OVERRIDE { return name_.empty(); }
|
||||
virtual bool IsFocused() OVERRIDE;
|
||||
virtual CefString GetName() OVERRIDE { return name_; }
|
||||
virtual CefString GetURL() OVERRIDE { return browser_->GetURL(this); }
|
||||
virtual CefRefPtr<CefBrowser> GetBrowser() OVERRIDE { return browser_.get(); }
|
||||
virtual void VisitDOM(CefRefPtr<CefDOMVisitor> visitor) OVERRIDE;
|
||||
|
||||
private:
|
||||
CefRefPtr<CefBrowserImpl> browser_;
|
||||
CefString name_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefFrameImpl);
|
||||
};
|
||||
|
||||
#endif // _BROWSER_IMPL_H
|
||||
|
|
|
@ -167,9 +167,12 @@ void CefBrowserImpl::UIT_CreateBrowser(const CefString& url)
|
|||
cr.bottom, flags);
|
||||
}
|
||||
|
||||
if(handler_.get()) {
|
||||
// Notify the handler that we're done creating the new window
|
||||
handler_->HandleAfterCreated(this);
|
||||
if(client_.get()) {
|
||||
CefRefPtr<CefLifeSpanHandler> handler = client_->GetLifeSpanHandler();
|
||||
if (handler.get()) {
|
||||
// Notify the handler that we're done creating the new window
|
||||
handler->OnAfterCreated(this);
|
||||
}
|
||||
}
|
||||
|
||||
if(url.length() > 0)
|
||||
|
@ -303,7 +306,11 @@ void CefBrowserImpl::UIT_PrintPage(int page_number, int total_pages,
|
|||
res = RestoreDC(hDC, saved_state);
|
||||
DCHECK_NE(res, 0);
|
||||
|
||||
if(handler_.get()) {
|
||||
CefRefPtr<CefPrintHandler> handler;
|
||||
if (client_.get())
|
||||
handler = client_->GetPrintHandler();
|
||||
|
||||
if(handler.get()) {
|
||||
saved_state = SaveDC(hDC);
|
||||
DCHECK_NE(saved_state, 0);
|
||||
|
||||
|
@ -334,12 +341,12 @@ void CefBrowserImpl::UIT_PrintPage(int page_number, int total_pages,
|
|||
CefString topLeft, topCenter, topRight;
|
||||
CefString bottomLeft, bottomCenter, bottomRight;
|
||||
|
||||
// allow the handler to format print header and/or footer
|
||||
CefHandler::RetVal rv = handler_->HandlePrintHeaderFooter(this,
|
||||
UIT_GetCefFrame(frame), printInfo, url, title, page_number+1, total_pages,
|
||||
topLeft, topCenter, topRight, bottomLeft, bottomCenter, bottomRight);
|
||||
// Allow the handler to format print header and/or footer.
|
||||
bool handled = handler->GetPrintHeaderFooter(this, UIT_GetCefFrame(frame),
|
||||
printInfo, url, title, page_number+1, total_pages, topLeft, topCenter,
|
||||
topRight, bottomLeft, bottomCenter, bottomRight);
|
||||
|
||||
if(rv != RV_HANDLED) {
|
||||
if (!handled) {
|
||||
// Draw handler-defined headers and/or footers.
|
||||
LOGFONT lf;
|
||||
memset(&lf, 0, sizeof(lf));
|
||||
|
@ -414,9 +421,12 @@ void CefBrowserImpl::UIT_PrintPages(WebKit::WebFrame* frame) {
|
|||
memset(&print_options, 0, sizeof(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.
|
||||
if (handler_.get() && RV_HANDLED ==
|
||||
handler_->HandlePrintOptions(this, print_options)) {
|
||||
if (handler.get() && handler->GetPrintOptions(this, print_options)) {
|
||||
settings.UpdateFromPrintOptions(print_options);
|
||||
print_context_.InitWithSettings(settings);
|
||||
}
|
||||
|
|
|
@ -195,7 +195,11 @@ class RequestProxy : public net::URLRequest::Delegate,
|
|||
const GURL& url, bool allow_download) {
|
||||
|
||||
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()) {
|
||||
std::string content_disposition;
|
||||
info.headers->GetNormalizedHeader("Content-Disposition",
|
||||
|
@ -206,9 +210,9 @@ class RequestProxy : public net::URLRequest::Delegate,
|
|||
string16 filename = net::GetSuggestedFilename(url,
|
||||
content_disposition, info.charset, ASCIIToUTF16("download"));
|
||||
CefRefPtr<CefDownloadHandler> dl_handler;
|
||||
if (handler->HandleDownloadResponse(browser_, info.mime_type,
|
||||
filename, info.content_length, dl_handler) ==
|
||||
RV_CONTINUE) {
|
||||
if (handler->GetDownloadHandler(browser_, info.mime_type,
|
||||
filename, info.content_length,
|
||||
dl_handler)) {
|
||||
download_handler_ = dl_handler;
|
||||
}
|
||||
}
|
||||
|
@ -285,7 +289,11 @@ class RequestProxy : public net::URLRequest::Delegate,
|
|||
bool handled = false;
|
||||
|
||||
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()) {
|
||||
// Build the request object for passing to the handler
|
||||
CefRefPtr<CefRequest> request(new CefRequestImpl());
|
||||
|
@ -317,53 +325,54 @@ class RequestProxy : public net::URLRequest::Delegate,
|
|||
CefRefPtr<CefStreamReader> resourceStream;
|
||||
CefRefPtr<CefResponse> response(new CefResponseImpl());
|
||||
|
||||
CefHandler::RetVal rv = handler->HandleBeforeResourceLoad(
|
||||
browser_, request, redirectUrl, resourceStream, response,
|
||||
loadFlags);
|
||||
handled = handler->OnBeforeResourceLoad(browser_, request, redirectUrl,
|
||||
resourceStream, response, loadFlags);
|
||||
if (!handled) {
|
||||
// Observe URL from request.
|
||||
const std::string requestUrl(request->GetURL());
|
||||
if(requestUrl != originalUrl) {
|
||||
params->url = GURL(requestUrl);
|
||||
redirectUrl.clear(); // Request URL trumps redirect URL
|
||||
}
|
||||
|
||||
// Observe URL from request.
|
||||
const std::string requestUrl(request->GetURL());
|
||||
if(requestUrl != originalUrl) {
|
||||
params->url = GURL(requestUrl);
|
||||
redirectUrl.clear(); // Request URL trumps redirect URL
|
||||
// Observe method from request.
|
||||
params->method = request->GetMethod();
|
||||
|
||||
// Observe headers from request.
|
||||
request->GetHeaderMap(headerMap);
|
||||
CefString referrerStr;
|
||||
referrerStr.FromASCII("Referrer");
|
||||
CefRequest::HeaderMap::iterator referrer = headerMap.find(referrerStr);
|
||||
if(referrer == headerMap.end()) {
|
||||
params->referrer = GURL();
|
||||
} else {
|
||||
params->referrer = GURL(std::string(referrer->second));
|
||||
headerMap.erase(referrer);
|
||||
}
|
||||
params->headers = HttpHeaderUtils::GenerateHeaders(headerMap);
|
||||
|
||||
// Observe post data from request.
|
||||
CefRefPtr<CefPostData> postData = request->GetPostData();
|
||||
if(postData.get()) {
|
||||
params->upload = new net::UploadData();
|
||||
static_cast<CefPostDataImpl*>(postData.get())->Get(*params->upload);
|
||||
}
|
||||
}
|
||||
|
||||
// Observe method from request.
|
||||
params->method = request->GetMethod();
|
||||
|
||||
// Observe headers from request.
|
||||
request->GetHeaderMap(headerMap);
|
||||
CefString referrerStr;
|
||||
referrerStr.FromASCII("Referrer");
|
||||
CefRequest::HeaderMap::iterator referrer = headerMap.find(referrerStr);
|
||||
if(referrer == headerMap.end()) {
|
||||
params->referrer = GURL();
|
||||
} else {
|
||||
params->referrer = GURL(std::string(referrer->second));
|
||||
headerMap.erase(referrer);
|
||||
}
|
||||
params->headers = HttpHeaderUtils::GenerateHeaders(headerMap);
|
||||
|
||||
// Observe post data from request.
|
||||
CefRefPtr<CefPostData> postData = request->GetPostData();
|
||||
if(postData.get()) {
|
||||
params->upload = new net::UploadData();
|
||||
static_cast<CefPostDataImpl*>(postData.get())->Get(*params->upload);
|
||||
}
|
||||
|
||||
if(rv == RV_HANDLED) {
|
||||
if (handled) {
|
||||
// cancel the resource load
|
||||
handled = true;
|
||||
OnCompletedRequest(
|
||||
URLRequestStatus(URLRequestStatus::CANCELED, net::ERR_ABORTED),
|
||||
std::string(), base::Time());
|
||||
} else if(!redirectUrl.empty()) {
|
||||
} else if (!redirectUrl.empty()) {
|
||||
// redirect to the specified URL
|
||||
handled = true;
|
||||
|
||||
params->url = GURL(std::string(redirectUrl));
|
||||
ResourceResponseInfo info;
|
||||
bool defer_redirect;
|
||||
OnReceivedRedirect(params->url, info, &defer_redirect);
|
||||
} else if(resourceStream.get()) {
|
||||
} else if (resourceStream.get()) {
|
||||
// load from the provided resource stream
|
||||
handled = true;
|
||||
|
||||
|
@ -403,16 +412,14 @@ class RequestProxy : public net::URLRequest::Delegate,
|
|||
AsyncReadData();
|
||||
}
|
||||
|
||||
if(!handled && ResourceType::IsFrame(params->request_type) &&
|
||||
!net::URLRequest::IsHandledProtocol(params->url.scheme())) {
|
||||
if (!handled && ResourceType::IsFrame(params->request_type) &&
|
||||
!net::URLRequest::IsHandledProtocol(params->url.scheme())) {
|
||||
bool allow_os_execution = false;
|
||||
CefHandler::RetVal rv = handler->HandleProtocolExecution(browser_,
|
||||
params->url.spec(), allow_os_execution);
|
||||
if (rv == RV_CONTINUE && allow_os_execution &&
|
||||
handled = handler->OnProtocolExecution(browser_, params->url.spec(),
|
||||
allow_os_execution);
|
||||
if (!handled && allow_os_execution &&
|
||||
ExternalProtocolHandler::HandleExternalProtocol(params->url)) {
|
||||
handled = true;
|
||||
} else if(rv == RV_HANDLED) {
|
||||
handled = true;
|
||||
}
|
||||
|
||||
if (handled) {
|
||||
|
@ -599,16 +606,18 @@ class RequestProxy : public net::URLRequest::Delegate,
|
|||
virtual void OnAuthRequired(net::URLRequest* request,
|
||||
net::AuthChallengeInfo* auth_info) {
|
||||
if (browser_.get()) {
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
CefString username, password;
|
||||
CefHandler::RetVal rv = handler->HandleAuthenticationRequest(
|
||||
browser_, auth_info->is_proxy,
|
||||
auth_info->host_and_port, auth_info->realm,
|
||||
auth_info->scheme, username, password);
|
||||
if (rv == RV_HANDLED) {
|
||||
request->SetAuth(username, password);
|
||||
return;
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
|
||||
if(handler.get()) {
|
||||
CefString username, password;
|
||||
if (handler->GetAuthCredentials(browser_, auth_info->is_proxy,
|
||||
auth_info->host_and_port,
|
||||
auth_info->realm, auth_info->scheme,
|
||||
username, password)) {
|
||||
request->SetAuth(username, password);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,78 +95,78 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||
WebKit::shutdown();
|
||||
}
|
||||
|
||||
virtual WebKit::WebMimeRegistry* mimeRegistry() {
|
||||
virtual WebKit::WebMimeRegistry* mimeRegistry() OVERRIDE {
|
||||
return &mime_registry_;
|
||||
}
|
||||
|
||||
WebKit::WebClipboard* clipboard() {
|
||||
virtual WebKit::WebClipboard* clipboard() OVERRIDE {
|
||||
return &clipboard_;
|
||||
}
|
||||
|
||||
virtual WebKit::WebFileUtilities* fileUtilities() {
|
||||
virtual WebKit::WebFileUtilities* fileUtilities() OVERRIDE {
|
||||
return &file_utilities_;
|
||||
}
|
||||
|
||||
virtual WebKit::WebSandboxSupport* sandboxSupport() {
|
||||
virtual WebKit::WebSandboxSupport* sandboxSupport() OVERRIDE {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
virtual WebKit::WebBlobRegistry* blobRegistry() {
|
||||
virtual WebKit::WebBlobRegistry* blobRegistry() OVERRIDE {
|
||||
return blob_registry_.get();
|
||||
}
|
||||
|
||||
virtual WebKit::WebCookieJar* cookieJar() {
|
||||
virtual WebKit::WebCookieJar* cookieJar() OVERRIDE {
|
||||
return &cookie_jar_;
|
||||
}
|
||||
|
||||
virtual WebKit::WebFileSystem* fileSystem() {
|
||||
virtual WebKit::WebFileSystem* fileSystem() OVERRIDE {
|
||||
return &file_system_;
|
||||
}
|
||||
|
||||
virtual bool sandboxEnabled() {
|
||||
virtual bool sandboxEnabled() OVERRIDE {
|
||||
return true;
|
||||
}
|
||||
|
||||
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(
|
||||
vfs_file_name, desired_flags);
|
||||
}
|
||||
|
||||
virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name,
|
||||
bool sync_dir) {
|
||||
bool sync_dir) OVERRIDE {
|
||||
return BrowserDatabaseSystem::GetInstance()->DeleteFile(
|
||||
vfs_file_name, sync_dir);
|
||||
}
|
||||
|
||||
virtual long databaseGetFileAttributes(
|
||||
const WebKit::WebString& vfs_file_name) {
|
||||
const WebKit::WebString& vfs_file_name) OVERRIDE {
|
||||
return BrowserDatabaseSystem::GetInstance()->GetFileAttributes(
|
||||
vfs_file_name);
|
||||
}
|
||||
|
||||
virtual long long databaseGetFileSize(
|
||||
const WebKit::WebString& vfs_file_name) {
|
||||
const WebKit::WebString& vfs_file_name) OVERRIDE {
|
||||
return BrowserDatabaseSystem::GetInstance()->GetFileSize(vfs_file_name);
|
||||
}
|
||||
|
||||
virtual unsigned long long visitedLinkHash(const char* canonicalURL,
|
||||
size_t length) {
|
||||
size_t length) OVERRIDE {
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual bool isLinkVisited(unsigned long long linkHash) {
|
||||
virtual bool isLinkVisited(unsigned long long linkHash) OVERRIDE {
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual WebKit::WebMessagePortChannel* createMessagePortChannel() {
|
||||
virtual WebKit::WebMessagePortChannel* createMessagePortChannel() OVERRIDE {
|
||||
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")) {
|
||||
// Create a red 30x30 square.
|
||||
const char red_square[] =
|
||||
|
@ -186,12 +186,12 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||
return webkit_glue::WebKitClientImpl::loadResource(name);
|
||||
}
|
||||
|
||||
virtual WebKit::WebString defaultLocale() {
|
||||
virtual WebKit::WebString defaultLocale() OVERRIDE {
|
||||
return ASCIIToUTF16("en-US");
|
||||
}
|
||||
|
||||
virtual WebKit::WebStorageNamespace* createLocalStorageNamespace(
|
||||
const WebKit::WebString& path, unsigned quota) {
|
||||
const WebKit::WebString& path, unsigned quota) OVERRIDE {
|
||||
if (BrowserWebStorageNamespaceImpl::IsStorageActive()) {
|
||||
// Use the localStorage implementation that writes data to disk.
|
||||
return new BrowserWebStorageNamespaceImpl(DOM_STORAGE_LOCAL);
|
||||
|
@ -205,18 +205,18 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||
void dispatchStorageEvent(const WebKit::WebString& key,
|
||||
const WebKit::WebString& old_value, const WebKit::WebString& new_value,
|
||||
const WebKit::WebString& origin, const WebKit::WebURL& url,
|
||||
bool is_local_storage) {
|
||||
bool is_local_storage) OVERRIDE {
|
||||
// The event is dispatched by the proxy.
|
||||
}
|
||||
|
||||
virtual WebKit::WebIDBFactory* idbFactory() {
|
||||
virtual WebKit::WebIDBFactory* idbFactory() OVERRIDE {
|
||||
return WebKit::WebIDBFactory::create();
|
||||
}
|
||||
|
||||
virtual void createIDBKeysFromSerializedValuesAndKeyPath(
|
||||
const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values,
|
||||
const WebKit::WebString& keyPath,
|
||||
WebKit::WebVector<WebKit::WebIDBKey>& keys_out) {
|
||||
WebKit::WebVector<WebKit::WebIDBKey>& keys_out) OVERRIDE {
|
||||
WebKit::WebVector<WebKit::WebIDBKey> keys(values.size());
|
||||
for (size_t i = 0; i < values.size(); ++i) {
|
||||
keys[i] = WebKit::WebIDBKey::createFromValueAndKeyPath(
|
||||
|
@ -228,18 +228,18 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||
virtual WebKit::WebSerializedScriptValue injectIDBKeyIntoSerializedValue(
|
||||
const WebKit::WebIDBKey& key,
|
||||
const WebKit::WebSerializedScriptValue& value,
|
||||
const WebKit::WebString& keyPath) {
|
||||
const WebKit::WebString& keyPath) OVERRIDE {
|
||||
return WebKit::WebIDBKey::injectIDBKeyIntoSerializedValue(
|
||||
key, value, WebKit::WebIDBKeyPath::create(keyPath));
|
||||
}
|
||||
|
||||
virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D() {
|
||||
virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D() OVERRIDE {
|
||||
gfx::BindSkiaToInProcessGL();
|
||||
return new webkit::gpu::WebGraphicsContext3DInProcessImpl();
|
||||
}
|
||||
|
||||
WebKit::WebString queryLocalizedString(
|
||||
WebKit::WebLocalizedString::Name name) {
|
||||
WebKit::WebLocalizedString::Name name) OVERRIDE {
|
||||
switch (name) {
|
||||
case WebKit::WebLocalizedString::ValidationValueMissing:
|
||||
case WebKit::WebLocalizedString::ValidationValueMissingForCheckbox:
|
||||
|
@ -269,7 +269,8 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||
}
|
||||
|
||||
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)
|
||||
return ASCIIToUTF16("range underflow");
|
||||
if (name == WebKit::WebLocalizedString::ValidationRangeOverflow)
|
||||
|
@ -280,7 +281,7 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
|||
WebKit::WebString queryLocalizedString(
|
||||
WebKit::WebLocalizedString::Name name,
|
||||
const WebKit::WebString& value1,
|
||||
const WebKit::WebString& value2) {
|
||||
const WebKit::WebString& value2) OVERRIDE {
|
||||
if (name == WebKit::WebLocalizedString::ValidationTooLong)
|
||||
return ASCIIToUTF16("too long");
|
||||
if (name == WebKit::WebLocalizedString::ValidationStepMismatch)
|
||||
|
|
|
@ -197,14 +197,17 @@ void BrowserWebViewDelegate::didAddMessageToConsole(
|
|||
std::string messageStr = message.text.utf8();
|
||||
std::string sourceStr = source_name.utf8();
|
||||
|
||||
CefHandler::RetVal rv = RV_CONTINUE;
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
rv = handler->HandleConsoleMessage(browser_, messageStr, sourceStr,
|
||||
source_line);
|
||||
bool handled = false;
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefDisplayHandler> handler = client->GetDisplayHandler();
|
||||
if (handler.get()) {
|
||||
handled = handler->OnConsoleMessage(browser_, messageStr, sourceStr,
|
||||
source_line);
|
||||
}
|
||||
}
|
||||
|
||||
if(rv == RV_CONTINUE) {
|
||||
if(!handled) {
|
||||
logging::LogMessage("CONSOLE", 0).stream() << "\""
|
||||
<< messageStr
|
||||
<< ",\" source: "
|
||||
|
@ -269,8 +272,13 @@ bool BrowserWebViewDelegate::isSelectTrailingWhitespaceEnabled() {
|
|||
}
|
||||
|
||||
bool BrowserWebViewDelegate::handleCurrentKeyboardEvent() {
|
||||
CefHandler::RetVal rv = RV_CONTINUE;
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
bool handled = false;
|
||||
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
CefRefPtr<CefKeyboardHandler> handler;
|
||||
if (client.get())
|
||||
handler = client->GetKeyboardHandler();
|
||||
|
||||
if (handler.get()) {
|
||||
WebWidgetHost* host = GetWidgetHost();
|
||||
if (host) {
|
||||
|
@ -278,17 +286,17 @@ bool BrowserWebViewDelegate::handleCurrentKeyboardEvent() {
|
|||
switch (event.type)
|
||||
{
|
||||
case WebKeyboardEvent::RawKeyDown:
|
||||
rv = handler->HandleKeyEvent(browser_,
|
||||
handled = handler->OnKeyEvent(browser_,
|
||||
KEYEVENT_RAWKEYDOWN, event.windowsKeyCode,
|
||||
event.modifiers, event.isSystemKey?true:false);
|
||||
break;
|
||||
case WebKeyboardEvent::KeyUp:
|
||||
rv = handler->HandleKeyEvent(browser_,
|
||||
handled = handler->OnKeyEvent(browser_,
|
||||
KEYEVENT_KEYUP, event.windowsKeyCode,
|
||||
event.modifiers, event.isSystemKey?true:false);
|
||||
break;
|
||||
case WebKeyboardEvent::Char:
|
||||
rv = handler->HandleKeyEvent(browser_,
|
||||
handled = handler->OnKeyEvent(browser_,
|
||||
KEYEVENT_CHAR, event.windowsKeyCode,
|
||||
event.modifiers, event.isSystemKey?true:false);
|
||||
break;
|
||||
|
@ -297,7 +305,7 @@ bool BrowserWebViewDelegate::handleCurrentKeyboardEvent() {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (rv == RV_HANDLED)
|
||||
if (handled)
|
||||
return true;
|
||||
|
||||
if (edit_command_name_.empty())
|
||||
|
@ -337,28 +345,38 @@ bool BrowserWebViewDelegate::runFileChooser(
|
|||
|
||||
void BrowserWebViewDelegate::runModalAlertDialog(
|
||||
WebFrame* frame, const WebString& message) {
|
||||
CefHandler::RetVal rv = RV_CONTINUE;
|
||||
CefString messageStr = string16(message);
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
rv = handler->HandleJSAlert(browser_, browser_->UIT_GetCefFrame(frame),
|
||||
bool handled = false;
|
||||
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
CefRefPtr<CefJSDialogHandler> handler;
|
||||
if (client.get())
|
||||
handler = client->GetJSDialogHandler();
|
||||
|
||||
if (handler.get()) {
|
||||
handled = handler->OnJSAlert(browser_, browser_->UIT_GetCefFrame(frame),
|
||||
messageStr);
|
||||
}
|
||||
if(rv != RV_HANDLED)
|
||||
if (!handled)
|
||||
ShowJavaScriptAlert(frame, messageStr);
|
||||
}
|
||||
|
||||
bool BrowserWebViewDelegate::runModalConfirmDialog(
|
||||
WebFrame* frame, const WebString& message) {
|
||||
CefHandler::RetVal rv = RV_CONTINUE;
|
||||
CefString messageStr = string16(message);
|
||||
bool retval = false;
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
rv = handler->HandleJSConfirm(browser_, browser_->UIT_GetCefFrame(frame),
|
||||
bool handled = false;
|
||||
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
CefRefPtr<CefJSDialogHandler> handler;
|
||||
if (client.get())
|
||||
handler = client->GetJSDialogHandler();
|
||||
|
||||
if (handler.get()) {
|
||||
handled = handler->OnJSConfirm(browser_, browser_->UIT_GetCefFrame(frame),
|
||||
messageStr, retval);
|
||||
}
|
||||
if(rv != RV_HANDLED)
|
||||
if (!handled)
|
||||
retval = ShowJavaScriptConfirm(frame, messageStr);
|
||||
return retval;
|
||||
}
|
||||
|
@ -372,14 +390,19 @@ bool BrowserWebViewDelegate::runModalPromptDialog(
|
|||
if(actual_value)
|
||||
actualValueStr = string16(*actual_value);
|
||||
|
||||
CefHandler::RetVal rv = RV_CONTINUE;
|
||||
bool retval = false;
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
rv = handler->HandleJSPrompt(browser_, browser_->UIT_GetCefFrame(frame),
|
||||
bool handled = false;
|
||||
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
CefRefPtr<CefJSDialogHandler> handler;
|
||||
if (client.get())
|
||||
handler = client->GetJSDialogHandler();
|
||||
|
||||
if (handler.get()) {
|
||||
handled = handler->OnJSPrompt(browser_, browser_->UIT_GetCefFrame(frame),
|
||||
messageStr, defaultValueStr, retval, actualValueStr);
|
||||
}
|
||||
if(rv != RV_HANDLED) {
|
||||
if (!handled) {
|
||||
retval = ShowJavaScriptPrompt(frame, messageStr, defaultValueStr,
|
||||
&actualValueStr);
|
||||
}
|
||||
|
@ -410,11 +433,16 @@ void BrowserWebViewDelegate::setToolTipText(
|
|||
const WebString& text, WebTextDirection hint)
|
||||
{
|
||||
CefString tooltipStr = string16(text);
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get() && handler->HandleTooltip(browser_, tooltipStr)
|
||||
== RV_CONTINUE){
|
||||
GetWidgetHost()->SetTooltipText(tooltipStr);
|
||||
bool handled = false;
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefDisplayHandler> handler = client->GetDisplayHandler();
|
||||
if (handler.get())
|
||||
handled = handler->OnTooltip(browser_, tooltipStr);
|
||||
}
|
||||
|
||||
if (!handled)
|
||||
GetWidgetHost()->SetTooltipText(tooltipStr);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::startDragging(
|
||||
|
@ -439,18 +467,24 @@ void BrowserWebViewDelegate::startDragging(
|
|||
}
|
||||
|
||||
void BrowserWebViewDelegate::focusNext() {
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
// Notify the handler that it should take a focus
|
||||
handler->HandleTakeFocus(browser_, false);
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefFocusHandler> handler = client->GetFocusHandler();
|
||||
if (handler.get()) {
|
||||
// Notify the handler that it should take a focus
|
||||
handler->OnTakeFocus(browser_, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::focusPrevious() {
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
// Notify the handler that it should take a focus
|
||||
handler->HandleTakeFocus(browser_, true);
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefFocusHandler> handler = client->GetFocusHandler();
|
||||
if (handler.get()) {
|
||||
// Notify the handler that it should take a focus
|
||||
handler->OnTakeFocus(browser_, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -502,8 +536,15 @@ void BrowserWebViewDelegate::scheduleAnimation() {
|
|||
|
||||
void BrowserWebViewDelegate::didFocus() {
|
||||
if (WebWidgetHost* host = GetWidgetHost()) {
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if (handler.get() && handler->HandleSetFocus(browser_, true) == RV_CONTINUE)
|
||||
bool handled = false;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -527,13 +568,16 @@ WebScreenInfo BrowserWebViewDelegate::screenInfo() {
|
|||
|
||||
if (browser_->IsWindowRenderingDisabled()) {
|
||||
// Retrieve the screen rectangle from the handler.
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if (handler.get()) {
|
||||
CefRect rect(info.rect.x, info.rect.y, info.rect.width,
|
||||
info.rect.height);
|
||||
if (handler->HandleGetRect(browser_, true, rect) == RV_CONTINUE) {
|
||||
info.rect = WebRect(rect.x, rect.y, rect.width, rect.height);
|
||||
info.availableRect = info.rect;
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefRenderHandler> handler = client->GetRenderHandler();
|
||||
if (handler.get()) {
|
||||
CefRect rect(info.rect.x, info.rect.y, info.rect.width,
|
||||
info.rect.height);
|
||||
if (handler->GetScreenRect(browser_, rect)) {
|
||||
info.rect = WebRect(rect.x, rect.y, rect.width, rect.height);
|
||||
info.availableRect = info.rect;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -639,7 +683,7 @@ void BrowserWebViewDelegate::loadURLExternally(
|
|||
WebNavigationPolicy policy) {
|
||||
DCHECK_NE(policy, WebKit::WebNavigationPolicyCurrentTab);
|
||||
std::string url = request.url().spec().data();
|
||||
CefRefPtr<CefBrowser> newBrowser =
|
||||
CefRefPtr<CefBrowserImpl> newBrowser =
|
||||
browser_->UIT_CreatePopupWindow(url, CefPopupFeatures());
|
||||
if (newBrowser.get() && !url.empty())
|
||||
newBrowser->GetMainFrame()->LoadURL(url);
|
||||
|
@ -649,37 +693,40 @@ WebNavigationPolicy BrowserWebViewDelegate::decidePolicyForNavigation(
|
|||
WebFrame* frame, const WebURLRequest& request,
|
||||
WebNavigationType type, const WebNode& originating_node,
|
||||
WebNavigationPolicy default_policy, bool is_redirect) {
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
// Gather browse request information
|
||||
CefRefPtr<CefRequest> req(CefRequest::CreateRequest());
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
|
||||
if (handler.get()) {
|
||||
// Gather browse request information
|
||||
CefRefPtr<CefRequest> req(CefRequest::CreateRequest());
|
||||
|
||||
GURL request_url = request.url();
|
||||
if (!request_url.is_valid())
|
||||
return WebKit::WebNavigationPolicyIgnore;
|
||||
GURL request_url = request.url();
|
||||
if (!request_url.is_valid())
|
||||
return WebKit::WebNavigationPolicyIgnore;
|
||||
|
||||
req->SetURL(request_url.spec());
|
||||
req->SetMethod(string16(request.httpMethod()));
|
||||
req->SetURL(request_url.spec());
|
||||
req->SetMethod(string16(request.httpMethod()));
|
||||
|
||||
const WebKit::WebHTTPBody& httpBody = request.httpBody();
|
||||
if(!httpBody.isNull()) {
|
||||
CefRefPtr<CefPostData> postdata(CefPostData::CreatePostData());
|
||||
static_cast<CefPostDataImpl*>(postdata.get())->Set(httpBody);
|
||||
req->SetPostData(postdata);
|
||||
}
|
||||
|
||||
CefRequest::HeaderMap map;
|
||||
CefRequestImpl::GetHeaderMap(request, map);
|
||||
if(map.size() > 0)
|
||||
static_cast<CefRequestImpl*>(req.get())->SetHeaderMap(map);
|
||||
|
||||
// Notify the handler of a browse request
|
||||
CefHandler::RetVal rv = handler->HandleBeforeBrowse(browser_,
|
||||
browser_->UIT_GetCefFrame(frame), req, (CefHandler::NavType)type,
|
||||
is_redirect);
|
||||
if(rv == RV_HANDLED)
|
||||
return WebKit::WebNavigationPolicyIgnore;
|
||||
const WebKit::WebHTTPBody& httpBody = request.httpBody();
|
||||
if(!httpBody.isNull()) {
|
||||
CefRefPtr<CefPostData> postdata(CefPostData::CreatePostData());
|
||||
static_cast<CefPostDataImpl*>(postdata.get())->Set(httpBody);
|
||||
req->SetPostData(postdata);
|
||||
}
|
||||
|
||||
CefRequest::HeaderMap map;
|
||||
CefRequestImpl::GetHeaderMap(request, map);
|
||||
if(map.size() > 0)
|
||||
static_cast<CefRequestImpl*>(req.get())->SetHeaderMap(map);
|
||||
|
||||
// Notify the handler of a browse request
|
||||
bool handled = handler->OnBeforeBrowse(browser_,
|
||||
browser_->UIT_GetCefFrame(frame), req, (cef_handler_navtype_t)type,
|
||||
is_redirect);
|
||||
if(handled)
|
||||
return WebKit::WebNavigationPolicyIgnore;
|
||||
}
|
||||
}
|
||||
|
||||
WebNavigationPolicy result;
|
||||
if (policy_delegate_enabled_) {
|
||||
|
@ -748,17 +795,21 @@ void BrowserWebViewDelegate::didFailProvisionalLoad(
|
|||
std::string error_text;
|
||||
CefString errorStr;
|
||||
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
CefHandler::RetVal rv = RV_CONTINUE;
|
||||
if(handler.get()) {
|
||||
// give the handler an opportunity to generate a custom error message
|
||||
rv = handler->HandleLoadError(browser_,
|
||||
browser_->UIT_GetCefFrame(frame),
|
||||
static_cast<CefHandler::ErrorCode>(error.reason),
|
||||
std::string(failed_ds->request().url().spec().data()), errorStr);
|
||||
bool handled = false;
|
||||
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefLoadHandler> handler = client->GetLoadHandler();
|
||||
if (handler.get()) {
|
||||
// give the handler an opportunity to generate a custom error message
|
||||
handled = handler->OnLoadError(browser_,
|
||||
browser_->UIT_GetCefFrame(frame),
|
||||
static_cast<cef_handler_errorcode_t>(error.reason),
|
||||
std::string(failed_ds->request().url().spec().data()), errorStr);
|
||||
}
|
||||
}
|
||||
|
||||
if(rv == RV_HANDLED && !errorStr.empty()) {
|
||||
if(handled && !errorStr.empty()) {
|
||||
error_text = errorStr;
|
||||
} else {
|
||||
error_text = StringPrintf("Error %d when loading url %s",
|
||||
|
@ -785,14 +836,17 @@ void BrowserWebViewDelegate::didCommitProvisionalLoad(
|
|||
|
||||
UpdateForCommittedLoad(frame, is_new_navigation);
|
||||
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
// Notify the handler that loading has started.
|
||||
handler->HandleLoadStart(browser_, browser_->UIT_GetCefFrame(frame));
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefLoadHandler> handler = client->GetLoadHandler();
|
||||
if (handler.get()) {
|
||||
// Notify the handler that loading has started.
|
||||
handler->OnLoadStart(browser_, browser_->UIT_GetCefFrame(frame));
|
||||
}
|
||||
}
|
||||
|
||||
// Apply zoom settings only on top-level frames.
|
||||
if(is_main_frame) {
|
||||
if (is_main_frame) {
|
||||
// Restore the zoom value that we have for this URL, if any.
|
||||
double zoomLevel = 0.0;
|
||||
ZoomMap::GetInstance()->get(frame->url(), zoomLevel);
|
||||
|
@ -802,18 +856,21 @@ void BrowserWebViewDelegate::didCommitProvisionalLoad(
|
|||
}
|
||||
|
||||
void BrowserWebViewDelegate::didClearWindowObject(WebFrame* frame) {
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
v8::HandleScope handle_scope;
|
||||
v8::Handle<v8::Context> context = webkit_glue::GetV8Context(frame);
|
||||
if(context.IsEmpty())
|
||||
return;
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefJSBindingHandler> handler = client->GetJSBindingHandler();
|
||||
if (handler.get()) {
|
||||
v8::HandleScope handle_scope;
|
||||
v8::Handle<v8::Context> context = webkit_glue::GetV8Context(frame);
|
||||
if(context.IsEmpty())
|
||||
return;
|
||||
|
||||
v8::Context::Scope scope(context);
|
||||
v8::Context::Scope scope(context);
|
||||
|
||||
CefRefPtr<CefFrame> cframe(browser_->UIT_GetCefFrame(frame));
|
||||
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(context->Global());
|
||||
handler->HandleJSBinding(browser_, cframe, object);
|
||||
CefRefPtr<CefFrame> cframe(browser_->UIT_GetCefFrame(frame));
|
||||
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(context->Global());
|
||||
handler->OnJSBinding(browser_, cframe, object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -823,10 +880,13 @@ void BrowserWebViewDelegate::didReceiveTitle(
|
|||
if (is_main_frame) {
|
||||
CefString titleStr = string16(title);
|
||||
browser_->UIT_SetTitle(titleStr);
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
// Notify the handler of a page title change
|
||||
handler->HandleTitleChange(browser_, titleStr);
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefDisplayHandler> handler = client->GetDisplayHandler();
|
||||
if (handler.get()) {
|
||||
// Notify the handler of a page title change
|
||||
handler->OnTitleChange(browser_, titleStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -955,34 +1015,42 @@ void BrowserWebViewDelegate::WaitForPolicyDelegate() {
|
|||
// Private methods -----------------------------------------------------------
|
||||
|
||||
void BrowserWebViewDelegate::ShowStatus(const WebString& text,
|
||||
CefHandler::StatusType type)
|
||||
cef_handler_statustype_t type)
|
||||
{
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
CefString textStr = string16(text);
|
||||
handler->HandleStatus(browser_, textStr, type);
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefDisplayHandler> handler = client->GetDisplayHandler();
|
||||
if (handler.get()) {
|
||||
CefString textStr = string16(text);
|
||||
handler->OnStatusMessage(browser_, textStr, type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::LocationChangeDone(WebFrame* frame) {
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if (!handler.get())
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
if (!client.get())
|
||||
return;
|
||||
|
||||
|
||||
bool is_main_frame = (frame->parent() == 0);
|
||||
if (is_main_frame) {
|
||||
CefString title = browser_->UIT_GetTitle();
|
||||
if (title.empty()) {
|
||||
// No title was provided by the page, so send a blank string to the
|
||||
// client.
|
||||
handler->HandleTitleChange(browser_, title);
|
||||
CefRefPtr<CefDisplayHandler> handler = client->GetDisplayHandler();
|
||||
if (handler.get())
|
||||
handler->OnTitleChange(browser_, title);
|
||||
}
|
||||
}
|
||||
|
||||
// Notify the handler that loading has ended.
|
||||
int httpStatusCode = frame->dataSource()->response().httpStatusCode();
|
||||
handler->HandleLoadEnd(browser_, browser_->UIT_GetCefFrame(frame),
|
||||
httpStatusCode);
|
||||
CefRefPtr<CefLoadHandler> handler = client->GetLoadHandler();
|
||||
if (handler.get()) {
|
||||
// Notify the handler that loading has ended.
|
||||
int httpStatusCode = frame->dataSource()->response().httpStatusCode();
|
||||
handler->OnLoadEnd(browser_, browser_->UIT_GetCefFrame(frame),
|
||||
httpStatusCode);
|
||||
}
|
||||
}
|
||||
|
||||
WebWidgetHost* BrowserWebViewDelegate::GetWidgetHost() {
|
||||
|
@ -1043,13 +1111,15 @@ void BrowserWebViewDelegate::UpdateURL(WebFrame* frame) {
|
|||
}
|
||||
|
||||
bool is_main_frame = (frame->parent() == 0);
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
|
||||
if (is_main_frame && handler.get()) {
|
||||
// Notify the handler of an address change
|
||||
std::string url = std::string(entry->GetURL().spec().c_str());
|
||||
handler->HandleAddressChange(browser_, browser_->UIT_GetCefFrame(frame),
|
||||
url);
|
||||
if (is_main_frame && client.get()) {
|
||||
CefRefPtr<CefDisplayHandler> handler = client->GetDisplayHandler();
|
||||
if (handler.get()) {
|
||||
// Notify the handler of an address change
|
||||
std::string url = std::string(entry->GetURL().spec().c_str());
|
||||
handler->OnAddressChange(browser_, browser_->UIT_GetCefFrame(frame), url);
|
||||
}
|
||||
}
|
||||
|
||||
const WebHistoryItem& history_item = frame->currentHistoryItem();
|
||||
|
@ -1070,10 +1140,10 @@ void BrowserWebViewDelegate::UpdateURL(WebFrame* frame) {
|
|||
if (old_can_go_back != new_can_go_back ||
|
||||
old_can_go_forward != new_can_go_forward) {
|
||||
browser_->set_nav_state(new_can_go_back, new_can_go_forward);
|
||||
CefRefPtr<CefDisplayHandler> handler = client->GetDisplayHandler();
|
||||
if (handler.get()) {
|
||||
// Notify the handler of a navigation state change
|
||||
handler->HandleNavStateChange(browser_, new_can_go_back,
|
||||
new_can_go_forward);
|
||||
handler->OnNavStateChange(browser_, new_can_go_back, new_can_go_forward);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,155 +54,156 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
|||
// WebKit::WebViewClient
|
||||
virtual WebKit::WebView* createView(
|
||||
WebKit::WebFrame* creator, const WebKit::WebURLRequest& request,
|
||||
const WebKit::WebWindowFeatures& features, const WebKit::WebString& name);
|
||||
virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type);
|
||||
const WebKit::WebWindowFeatures& features, const WebKit::WebString& name)
|
||||
OVERRIDE;
|
||||
virtual WebKit::WebWidget* createPopupMenu(WebKit::WebPopupType popup_type)
|
||||
OVERRIDE;
|
||||
virtual WebKit::WebExternalPopupMenu* createExternalPopupMenu(
|
||||
const WebKit::WebPopupMenuInfo& info,
|
||||
WebKit::WebExternalPopupMenuClient* client);
|
||||
WebKit::WebExternalPopupMenuClient* client) OVERRIDE;
|
||||
virtual WebKit::WebStorageNamespace* createSessionStorageNamespace(
|
||||
unsigned quota);
|
||||
unsigned quota) OVERRIDE;
|
||||
virtual void didAddMessageToConsole(
|
||||
const WebKit::WebConsoleMessage& message,
|
||||
const WebKit::WebString& source_name, unsigned source_line);
|
||||
virtual void printPage(WebKit::WebFrame* frame);
|
||||
virtual bool shouldBeginEditing(const WebKit::WebRange& range);
|
||||
virtual bool shouldEndEditing(const WebKit::WebRange& range);
|
||||
const WebKit::WebString& source_name, unsigned source_line) OVERRIDE;
|
||||
virtual void printPage(WebKit::WebFrame* frame) OVERRIDE;
|
||||
virtual bool shouldBeginEditing(const WebKit::WebRange& range) OVERRIDE;
|
||||
virtual bool shouldEndEditing(const WebKit::WebRange& range) OVERRIDE;
|
||||
virtual bool shouldInsertNode(
|
||||
const WebKit::WebNode& node, const WebKit::WebRange& range,
|
||||
WebKit::WebEditingAction action);
|
||||
WebKit::WebEditingAction action) OVERRIDE;
|
||||
virtual bool shouldInsertText(
|
||||
const WebKit::WebString& text, const WebKit::WebRange& range,
|
||||
WebKit::WebEditingAction action);
|
||||
WebKit::WebEditingAction action) OVERRIDE;
|
||||
virtual bool shouldChangeSelectedRange(
|
||||
const WebKit::WebRange& from, const WebKit::WebRange& to,
|
||||
WebKit::WebTextAffinity affinity, bool still_selecting);
|
||||
virtual bool shouldDeleteRange(const WebKit::WebRange& range);
|
||||
WebKit::WebTextAffinity affinity, bool still_selecting) OVERRIDE;
|
||||
virtual bool shouldDeleteRange(const WebKit::WebRange& range) OVERRIDE;
|
||||
virtual bool shouldApplyStyle(
|
||||
const WebKit::WebString& style, const WebKit::WebRange& range);
|
||||
virtual bool isSmartInsertDeleteEnabled();
|
||||
virtual bool isSelectTrailingWhitespaceEnabled();
|
||||
virtual bool handleCurrentKeyboardEvent();
|
||||
const WebKit::WebString& style, const WebKit::WebRange& range) OVERRIDE;
|
||||
virtual bool isSmartInsertDeleteEnabled() OVERRIDE;
|
||||
virtual bool isSelectTrailingWhitespaceEnabled() OVERRIDE;
|
||||
virtual bool handleCurrentKeyboardEvent() OVERRIDE;
|
||||
virtual bool runFileChooser(
|
||||
const WebKit::WebFileChooserParams& params,
|
||||
WebKit::WebFileChooserCompletion* chooser_completion);
|
||||
WebKit::WebFileChooserCompletion* chooser_completion) OVERRIDE;
|
||||
virtual void runModalAlertDialog(
|
||||
WebKit::WebFrame* frame, const WebKit::WebString& message);
|
||||
WebKit::WebFrame* frame, const WebKit::WebString& message) OVERRIDE;
|
||||
virtual bool runModalConfirmDialog(
|
||||
WebKit::WebFrame* frame, const WebKit::WebString& message);
|
||||
WebKit::WebFrame* frame, const WebKit::WebString& message) OVERRIDE;
|
||||
virtual bool runModalPromptDialog(
|
||||
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(
|
||||
WebKit::WebFrame* frame, const WebKit::WebString& message);
|
||||
WebKit::WebFrame* frame, const WebKit::WebString& message) OVERRIDE;
|
||||
virtual void showContextMenu(
|
||||
WebKit::WebFrame* frame, const WebKit::WebContextMenuData& data);
|
||||
virtual void setStatusText(const WebKit::WebString& text);
|
||||
virtual void setMouseOverURL(const WebKit::WebURL& url);
|
||||
virtual void setKeyboardFocusURL(const WebKit::WebURL& url);
|
||||
WebKit::WebFrame* frame, const WebKit::WebContextMenuData& data) OVERRIDE;
|
||||
virtual void setStatusText(const WebKit::WebString& text) OVERRIDE;
|
||||
virtual void setMouseOverURL(const WebKit::WebURL& url) OVERRIDE;
|
||||
virtual void setKeyboardFocusURL(const WebKit::WebURL& url) OVERRIDE;
|
||||
virtual void setToolTipText(
|
||||
const WebKit::WebString& text, WebKit::WebTextDirection hint);
|
||||
const WebKit::WebString& text, WebKit::WebTextDirection hint) OVERRIDE;
|
||||
virtual void startDragging(
|
||||
const WebKit::WebDragData& data,
|
||||
WebKit::WebDragOperationsMask mask,
|
||||
const WebKit::WebImage& image,
|
||||
const WebKit::WebPoint& image_offset);
|
||||
virtual bool acceptsLoadDrops() { return true; }
|
||||
virtual void focusNext();
|
||||
virtual void focusPrevious();
|
||||
virtual void navigateBackForwardSoon(int offset);
|
||||
virtual int historyBackListCount();
|
||||
virtual int historyForwardListCount();
|
||||
const WebKit::WebPoint& image_offset) OVERRIDE;
|
||||
virtual bool acceptsLoadDrops() OVERRIDE { return true; }
|
||||
virtual void focusNext() OVERRIDE;
|
||||
virtual void focusPrevious() OVERRIDE;
|
||||
virtual void navigateBackForwardSoon(int offset) OVERRIDE;
|
||||
virtual int historyBackListCount() OVERRIDE;
|
||||
virtual int historyForwardListCount() OVERRIDE;
|
||||
|
||||
// WebKit::WebWidgetClient
|
||||
virtual void didInvalidateRect(const WebKit::WebRect& rect);
|
||||
virtual void didInvalidateRect(const WebKit::WebRect& rect) OVERRIDE;
|
||||
virtual void didScrollRect(int dx, int dy,
|
||||
const WebKit::WebRect& clip_rect);
|
||||
virtual void scheduleComposite();
|
||||
virtual void scheduleAnimation();
|
||||
virtual void didFocus();
|
||||
virtual void didBlur();
|
||||
virtual void didChangeCursor(const WebKit::WebCursorInfo& cursor);
|
||||
virtual void closeWidgetSoon();
|
||||
virtual void show(WebKit::WebNavigationPolicy policy);
|
||||
virtual void runModal();
|
||||
virtual WebKit::WebRect windowRect();
|
||||
virtual void setWindowRect(const WebKit::WebRect& rect);
|
||||
virtual WebKit::WebRect rootWindowRect();
|
||||
virtual WebKit::WebRect windowResizerRect();
|
||||
virtual WebKit::WebScreenInfo screenInfo();
|
||||
const WebKit::WebRect& clip_rect) OVERRIDE;
|
||||
virtual void scheduleComposite() OVERRIDE;
|
||||
virtual void scheduleAnimation() OVERRIDE;
|
||||
virtual void didFocus() OVERRIDE;
|
||||
virtual void didBlur() OVERRIDE;
|
||||
virtual void didChangeCursor(const WebKit::WebCursorInfo& cursor) OVERRIDE;
|
||||
virtual void closeWidgetSoon() OVERRIDE;
|
||||
virtual void show(WebKit::WebNavigationPolicy policy) OVERRIDE;
|
||||
virtual void runModal() OVERRIDE;
|
||||
virtual WebKit::WebRect windowRect() OVERRIDE;
|
||||
virtual void setWindowRect(const WebKit::WebRect& rect) OVERRIDE;
|
||||
virtual WebKit::WebRect rootWindowRect() OVERRIDE;
|
||||
virtual WebKit::WebRect windowResizerRect() OVERRIDE;
|
||||
virtual WebKit::WebScreenInfo screenInfo() OVERRIDE;
|
||||
|
||||
// WebKit::WebFrameClient
|
||||
virtual WebKit::WebPlugin* createPlugin(
|
||||
WebKit::WebFrame*, const WebKit::WebPluginParams&);
|
||||
WebKit::WebFrame*, const WebKit::WebPluginParams&) OVERRIDE;
|
||||
virtual WebKit::WebWorker* createWorker(
|
||||
WebKit::WebFrame*, WebKit::WebWorkerClient*);
|
||||
WebKit::WebFrame*, WebKit::WebWorkerClient*) OVERRIDE;
|
||||
virtual WebKit::WebMediaPlayer* createMediaPlayer(
|
||||
WebKit::WebFrame*, WebKit::WebMediaPlayerClient*);
|
||||
WebKit::WebFrame*, WebKit::WebMediaPlayerClient*) OVERRIDE;
|
||||
virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
|
||||
WebKit::WebFrame* frame, WebKit::WebApplicationCacheHostClient* client);
|
||||
virtual void willClose(WebKit::WebFrame*);
|
||||
WebKit::WebFrame* frame, WebKit::WebApplicationCacheHostClient* client)
|
||||
OVERRIDE;
|
||||
virtual void willClose(WebKit::WebFrame*) OVERRIDE;
|
||||
virtual void loadURLExternally(
|
||||
WebKit::WebFrame*, const WebKit::WebURLRequest&,
|
||||
WebKit::WebNavigationPolicy);
|
||||
WebKit::WebNavigationPolicy) OVERRIDE;
|
||||
virtual WebKit::WebNavigationPolicy decidePolicyForNavigation(
|
||||
WebKit::WebFrame*, const WebKit::WebURLRequest&,
|
||||
WebKit::WebNavigationType, const WebKit::WebNode&,
|
||||
WebKit::WebNavigationPolicy default_policy, bool isRedirect);
|
||||
WebKit::WebNavigationPolicy default_policy, bool isRedirect) OVERRIDE;
|
||||
virtual bool canHandleRequest(
|
||||
WebKit::WebFrame*, const WebKit::WebURLRequest&) { return true; }
|
||||
WebKit::WebFrame*, const WebKit::WebURLRequest&) OVERRIDE { return true; }
|
||||
virtual WebKit::WebURLError cannotHandleRequestError(
|
||||
WebKit::WebFrame*, const WebKit::WebURLRequest& request);
|
||||
WebKit::WebFrame*, const WebKit::WebURLRequest& request) OVERRIDE;
|
||||
virtual WebKit::WebURLError cancelledError(
|
||||
WebKit::WebFrame*, const WebKit::WebURLRequest& request);
|
||||
WebKit::WebFrame*, const WebKit::WebURLRequest& request) OVERRIDE;
|
||||
virtual void didCreateDataSource(
|
||||
WebKit::WebFrame*, WebKit::WebDataSource*);
|
||||
virtual void didStartProvisionalLoad(WebKit::WebFrame*);
|
||||
virtual void didReceiveServerRedirectForProvisionalLoad(WebKit::WebFrame*);
|
||||
WebKit::WebFrame*, WebKit::WebDataSource*) OVERRIDE;
|
||||
virtual void didStartProvisionalLoad(WebKit::WebFrame*) OVERRIDE;
|
||||
virtual void didReceiveServerRedirectForProvisionalLoad(WebKit::WebFrame*)
|
||||
OVERRIDE;
|
||||
virtual void didFailProvisionalLoad(
|
||||
WebKit::WebFrame*, const WebKit::WebURLError&);
|
||||
WebKit::WebFrame*, const WebKit::WebURLError&) OVERRIDE;
|
||||
virtual void didCommitProvisionalLoad(
|
||||
WebKit::WebFrame*, bool is_new_navigation);
|
||||
virtual void didClearWindowObject(WebKit::WebFrame*);
|
||||
WebKit::WebFrame*, bool is_new_navigation) OVERRIDE;
|
||||
virtual void didClearWindowObject(WebKit::WebFrame*) OVERRIDE;
|
||||
virtual void didReceiveTitle(
|
||||
WebKit::WebFrame*, const WebKit::WebString& title,
|
||||
WebKit::WebTextDirection direction);
|
||||
WebKit::WebTextDirection direction) OVERRIDE;
|
||||
virtual void didFailLoad(
|
||||
WebKit::WebFrame*, const WebKit::WebURLError&);
|
||||
virtual void didFinishLoad(WebKit::WebFrame*);
|
||||
WebKit::WebFrame*, const WebKit::WebURLError&) OVERRIDE;
|
||||
virtual void didFinishLoad(WebKit::WebFrame*) OVERRIDE;
|
||||
virtual void didNavigateWithinPage(
|
||||
WebKit::WebFrame*, bool isNewNavigation);
|
||||
WebKit::WebFrame*, bool isNewNavigation) OVERRIDE;
|
||||
virtual void willSendRequest(
|
||||
WebKit::WebFrame*, unsigned identifier, WebKit::WebURLRequest&,
|
||||
const WebKit::WebURLResponse& redirectResponse);
|
||||
const WebKit::WebURLResponse& redirectResponse) OVERRIDE;
|
||||
virtual void reportFindInPageMatchCount(
|
||||
int request_id, int count, bool final_update);
|
||||
int request_id, int count, bool final_update) OVERRIDE;
|
||||
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(
|
||||
WebKit::WebFrame* frame,
|
||||
WebKit::WebFileSystem::Type type,
|
||||
long long size,
|
||||
bool create,
|
||||
WebKit::WebFileSystemCallbacks* callbacks);
|
||||
WebKit::WebFileSystemCallbacks* callbacks) OVERRIDE;
|
||||
|
||||
// webkit_glue::WebPluginPageDelegate
|
||||
virtual webkit::npapi::WebPluginDelegate* CreatePluginDelegate(
|
||||
const FilePath& file_path,
|
||||
const std::string& mime_type);
|
||||
const std::string& mime_type) OVERRIDE;
|
||||
virtual void CreatedPluginWindow(
|
||||
gfx::PluginWindowHandle handle);
|
||||
gfx::PluginWindowHandle handle) OVERRIDE;
|
||||
virtual void WillDestroyPluginWindow(
|
||||
gfx::PluginWindowHandle handle);
|
||||
gfx::PluginWindowHandle handle) OVERRIDE;
|
||||
virtual void DidMovePlugin(
|
||||
const webkit::npapi::WebPluginGeometry& move);
|
||||
virtual void DidStartLoadingForPlugin() {}
|
||||
virtual void DidStopLoadingForPlugin() {}
|
||||
virtual void ShowModalHTMLDialogForPlugin(
|
||||
const GURL& url,
|
||||
const gfx::Size& size,
|
||||
const std::string& json_arguments,
|
||||
std::string* json_retval) {}
|
||||
virtual WebKit::WebCookieJar* GetCookieJar();
|
||||
const webkit::npapi::WebPluginGeometry& move) OVERRIDE;
|
||||
virtual void DidStartLoadingForPlugin() OVERRIDE {}
|
||||
virtual void DidStopLoadingForPlugin() OVERRIDE {}
|
||||
virtual WebKit::WebCookieJar* GetCookieJar() OVERRIDE;
|
||||
|
||||
BrowserWebViewDelegate(CefBrowserImpl* browser);
|
||||
~BrowserWebViewDelegate();
|
||||
|
@ -275,7 +276,7 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
|||
const FilePath& default_file);
|
||||
|
||||
// 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
|
||||
// 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);
|
||||
} else {
|
||||
// Notify the handler of popup visibility change.
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if (handler.get())
|
||||
handler->HandlePopupChange(browser_, true, CefRect());
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefRenderHandler> handler = client->GetRenderHandler();
|
||||
if (handler.get())
|
||||
handler->OnPopupShow(browser_, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,9 +98,12 @@ void BrowserWebViewDelegate::didChangeCursor(const WebCursorInfo& cursor_info) {
|
|||
host->SetCursor(hCursor);
|
||||
} else {
|
||||
// Notify the handler of cursor change.
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if (handler.get())
|
||||
handler->HandleCursorChange(browser_, hCursor);
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefRenderHandler> handler = client->GetRenderHandler();
|
||||
if (handler.get())
|
||||
handler->OnCursorChange(browser_, hCursor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -110,11 +116,14 @@ WebRect BrowserWebViewDelegate::windowRect() {
|
|||
return gfx::Rect(rect);
|
||||
} else {
|
||||
// Retrieve the view rectangle from the handler.
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if (handler.get()) {
|
||||
CefRect rect(0, 0, 0, 0);
|
||||
if (handler->HandleGetRect(browser_, false, rect) == RV_CONTINUE)
|
||||
return WebRect(rect.x, rect.y, rect.width, rect.height);
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefRenderHandler> handler = client->GetRenderHandler();
|
||||
if (handler.get()) {
|
||||
CefRect rect(0, 0, 0, 0);
|
||||
if (handler->GetViewRect(browser_, rect))
|
||||
return WebRect(rect.x, rect.y, rect.width, rect.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -133,10 +142,13 @@ void BrowserWebViewDelegate::setWindowRect(const WebRect& rect) {
|
|||
browser_->UIT_GetPopupHost()->SetSize(rect.width, rect.height);
|
||||
|
||||
// Notify the handler of popup size change.
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if (handler.get()) {
|
||||
handler->HandlePopupChange(browser_, true,
|
||||
CefRect(rect.x, rect.y, rect.width, rect.height));
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefRenderHandler> handler = client->GetRenderHandler();
|
||||
if (handler.get()) {
|
||||
handler->OnPopupSize(browser_,
|
||||
CefRect(rect.x, rect.y, rect.width, rect.height));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -278,14 +290,17 @@ void BrowserWebViewDelegate::DidMovePlugin(
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
CefString actual_label(label);
|
||||
CefRefPtr<CefHandler> handler = browser->GetHandler();
|
||||
if(handler.get()) {
|
||||
// Let the handler change the label if desired
|
||||
handler->HandleGetMenuLabel(browser, id, actual_label);
|
||||
CefRefPtr<CefClient> client = browser->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefMenuHandler> handler = client->GetMenuHandler();
|
||||
if(handler.get()) {
|
||||
// Let the handler change the label if desired
|
||||
handler->GetMenuLabel(browser, id, actual_label);
|
||||
}
|
||||
}
|
||||
|
||||
// store the label in a list to simplify memory management
|
||||
|
@ -364,10 +379,14 @@ void BrowserWebViewDelegate::showContextMenu(
|
|||
if(data.mediaType == WebContextMenuData::MediaTypeAudio)
|
||||
type_flags |= MENUTYPE_AUDIO;
|
||||
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
CefRefPtr<CefMenuHandler> handler;
|
||||
if (client.get())
|
||||
handler = client->GetMenuHandler();
|
||||
|
||||
if (handler.get()) {
|
||||
// Gather menu information
|
||||
CefHandler::MenuInfo menuInfo;
|
||||
cef_handler_menuinfo_t menuInfo;
|
||||
memset(&menuInfo, 0, sizeof(menuInfo));
|
||||
|
||||
CefString linkStr(std::string(data.linkURL.spec()));
|
||||
|
@ -396,15 +415,16 @@ void BrowserWebViewDelegate::showContextMenu(
|
|||
&menuInfo.securityInfo, false);
|
||||
|
||||
// Notify the handler that a context menu is requested
|
||||
CefHandler::RetVal rv = handler->HandleBeforeMenu(browser_, menuInfo);
|
||||
if(rv == RV_HANDLED)
|
||||
if (handler->OnBeforeMenu(browser_, menuInfo))
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (browser_->IsWindowRenderingDisabled()) {
|
||||
rv = handler->HandleGetScreenPoint(browser_, mouse_pt.x, mouse_pt.y,
|
||||
screenX, screenY);
|
||||
if(rv != RV_CONTINUE)
|
||||
goto end;
|
||||
if (client.get() && browser_->IsWindowRenderingDisabled()) {
|
||||
CefRefPtr<CefRenderHandler> render_handler = client->GetRenderHandler();
|
||||
if (render_handler.get() &&
|
||||
!render_handler->GetScreenPoint(browser_, mouse_pt.x, mouse_pt.y,
|
||||
screenX, screenY)) {
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -444,20 +464,20 @@ void BrowserWebViewDelegate::showContextMenu(
|
|||
true, label_list);
|
||||
}
|
||||
|
||||
if(menu) {
|
||||
if (menu) {
|
||||
// show the context menu
|
||||
int selected_id = TrackPopupMenu(menu,
|
||||
TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_RECURSE,
|
||||
screenX, screenY, 0, browser_->UIT_GetMainWndHandle(), NULL);
|
||||
|
||||
if(selected_id != 0) {
|
||||
if (selected_id != 0) {
|
||||
// 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;
|
||||
if(handler.get()) {
|
||||
if (handler.get()) {
|
||||
// Ask the handler if it wants to handle the action
|
||||
CefHandler::RetVal rv = handler->HandleMenuAction(browser_, menuId);
|
||||
handled = (rv == RV_HANDLED);
|
||||
handled = handler->OnMenuAction(browser_, menuId);
|
||||
}
|
||||
|
||||
if(!handled) {
|
||||
|
|
|
@ -158,15 +158,13 @@ void IOT_VisitUrlCookies(const GURL& url, bool includeHttpOnly,
|
|||
|
||||
} // anonymous
|
||||
|
||||
bool CefInitialize(const CefSettings& settings,
|
||||
const CefBrowserSettings& browser_defaults)
|
||||
bool CefInitialize(const CefSettings& settings)
|
||||
{
|
||||
// Return true if the global context already exists.
|
||||
if(_Context.get())
|
||||
return true;
|
||||
|
||||
if(settings.size != sizeof(cef_settings_t) ||
|
||||
browser_defaults.size != sizeof(cef_browser_settings_t)) {
|
||||
if(settings.size != sizeof(cef_settings_t)) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
|
@ -175,7 +173,7 @@ bool CefInitialize(const CefSettings& settings,
|
|||
_Context = new CefContext();
|
||||
|
||||
// Initialize the global context.
|
||||
return _Context->Initialize(settings, browser_defaults);
|
||||
return _Context->Initialize(settings);
|
||||
}
|
||||
|
||||
void CefShutdown()
|
||||
|
@ -477,11 +475,9 @@ CefContext::~CefContext()
|
|||
Shutdown();
|
||||
}
|
||||
|
||||
bool CefContext::Initialize(const CefSettings& settings,
|
||||
const CefBrowserSettings& browser_defaults)
|
||||
bool CefContext::Initialize(const CefSettings& settings)
|
||||
{
|
||||
settings_ = settings;
|
||||
browser_defaults_ = browser_defaults;
|
||||
|
||||
cache_path_ = FilePath(CefString(&settings.cache_path));
|
||||
|
||||
|
@ -529,7 +525,7 @@ bool CefContext::AddBrowser(CefRefPtr<CefBrowserImpl> browser)
|
|||
{
|
||||
bool found = false;
|
||||
|
||||
Lock();
|
||||
AutoLock lock_scope(this);
|
||||
|
||||
// check that the browser isn't already in the list before adding
|
||||
BrowserList::const_iterator it = browserlist_.begin();
|
||||
|
@ -545,8 +541,7 @@ bool CefContext::AddBrowser(CefRefPtr<CefBrowserImpl> browser)
|
|||
browser->UIT_SetUniqueID(next_browser_id_++);
|
||||
browserlist_.push_back(browser);
|
||||
}
|
||||
|
||||
Unlock();
|
||||
|
||||
return !found;
|
||||
}
|
||||
|
||||
|
@ -555,24 +550,24 @@ bool CefContext::RemoveBrowser(CefRefPtr<CefBrowserImpl> browser)
|
|||
bool deleted = false;
|
||||
bool empty = false;
|
||||
|
||||
Lock();
|
||||
{
|
||||
AutoLock lock_scope(this);
|
||||
|
||||
BrowserList::iterator it = browserlist_.begin();
|
||||
for(; it != browserlist_.end(); ++it) {
|
||||
if(it->get() == browser.get()) {
|
||||
browserlist_.erase(it);
|
||||
deleted = true;
|
||||
break;
|
||||
BrowserList::iterator it = browserlist_.begin();
|
||||
for(; it != browserlist_.end(); ++it) {
|
||||
if(it->get() == browser.get()) {
|
||||
browserlist_.erase(it);
|
||||
deleted = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (browserlist_.empty()) {
|
||||
next_browser_id_ = kNextBrowserIdReset;
|
||||
empty = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (browserlist_.empty()) {
|
||||
next_browser_id_ = kNextBrowserIdReset;
|
||||
empty = true;
|
||||
}
|
||||
|
||||
Unlock();
|
||||
|
||||
if (empty) {
|
||||
CefThread::PostTask(CefThread::UI, FROM_HERE,
|
||||
NewRunnableFunction(webkit_glue::ClearCache));
|
||||
|
@ -583,20 +578,15 @@ bool CefContext::RemoveBrowser(CefRefPtr<CefBrowserImpl> browser)
|
|||
|
||||
CefRefPtr<CefBrowserImpl> CefContext::GetBrowserByID(int id)
|
||||
{
|
||||
CefRefPtr<CefBrowserImpl> browser;
|
||||
Lock();
|
||||
AutoLock lock_scope(this);
|
||||
|
||||
BrowserList::const_iterator it = browserlist_.begin();
|
||||
for(; it != browserlist_.end(); ++it) {
|
||||
if(it->get()->UIT_GetUniqueID() == id) {
|
||||
browser = it->get();
|
||||
break;
|
||||
}
|
||||
if(it->get()->UIT_GetUniqueID() == id)
|
||||
return it->get();
|
||||
}
|
||||
|
||||
Unlock();
|
||||
|
||||
return browser;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CefContext::UIT_FinishShutdown(base::WaitableEvent* event)
|
||||
|
@ -605,12 +595,13 @@ void CefContext::UIT_FinishShutdown(base::WaitableEvent* event)
|
|||
|
||||
BrowserList list;
|
||||
|
||||
Lock();
|
||||
if (!browserlist_.empty()) {
|
||||
list = browserlist_;
|
||||
browserlist_.clear();
|
||||
{
|
||||
AutoLock lock_scope(this);
|
||||
if (!browserlist_.empty()) {
|
||||
list = browserlist_;
|
||||
browserlist_.clear();
|
||||
}
|
||||
}
|
||||
Unlock();
|
||||
|
||||
// Destroy any remaining browser windows.
|
||||
if (!list.empty()) {
|
||||
|
|
|
@ -21,7 +21,7 @@ class BrowserRequestContext;
|
|||
class CefBrowserImpl;
|
||||
class WebViewHost;
|
||||
|
||||
class CefContext : public CefThreadSafeBase<CefBase>
|
||||
class CefContext : public CefBase
|
||||
{
|
||||
public:
|
||||
typedef std::list<CefRefPtr<CefBrowserImpl> > BrowserList;
|
||||
|
@ -30,8 +30,7 @@ public:
|
|||
~CefContext();
|
||||
|
||||
// These methods will be called on the main application thread.
|
||||
bool Initialize(const CefSettings& settings,
|
||||
const CefBrowserSettings& browser_defaults);
|
||||
bool Initialize(const CefSettings& settings);
|
||||
void Shutdown();
|
||||
|
||||
// Returns true if the context is initialized.
|
||||
|
@ -52,8 +51,6 @@ public:
|
|||
const FilePath& cache_path() const { return cache_path_; }
|
||||
|
||||
const CefSettings& settings() const { return settings_; }
|
||||
const CefBrowserSettings& browser_defaults() const
|
||||
{ return browser_defaults_; }
|
||||
|
||||
// The BrowserRequestContext object is managed by CefProcessIOThread.
|
||||
void set_request_context(BrowserRequestContext* request_context)
|
||||
|
@ -92,7 +89,6 @@ private:
|
|||
base::AtExitManager at_exit_manager_;
|
||||
|
||||
CefSettings settings_;
|
||||
CefBrowserSettings browser_defaults_;
|
||||
FilePath cache_path_;
|
||||
scoped_refptr<BrowserRequestContext> request_context_;
|
||||
scoped_ptr<DOMStorageContext> storage_context_;
|
||||
|
@ -104,6 +100,9 @@ private:
|
|||
int next_browser_id_;
|
||||
|
||||
WebViewHost* current_webviewhost_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefContext);
|
||||
IMPLEMENT_LOCKING(CefContext);
|
||||
};
|
||||
|
||||
// Global context object pointer.
|
||||
|
|
|
@ -15,29 +15,29 @@ class WebNode;
|
|||
|
||||
class CefBrowserImpl;
|
||||
|
||||
class CefDOMDocumentImpl : public CefThreadSafeBase<CefDOMDocument>
|
||||
class CefDOMDocumentImpl : public CefDOMDocument
|
||||
{
|
||||
public:
|
||||
CefDOMDocumentImpl(CefBrowserImpl* browser,
|
||||
WebKit::WebFrame* frame);
|
||||
virtual ~CefDOMDocumentImpl();
|
||||
|
||||
virtual Type GetType();
|
||||
virtual CefRefPtr<CefDOMNode> GetDocument();
|
||||
virtual CefRefPtr<CefDOMNode> GetBody();
|
||||
virtual CefRefPtr<CefDOMNode> GetHead();
|
||||
virtual CefString GetTitle();
|
||||
virtual CefRefPtr<CefDOMNode> GetElementById(const CefString& id);
|
||||
virtual CefRefPtr<CefDOMNode> GetFocusedNode();
|
||||
virtual bool HasSelection();
|
||||
virtual CefRefPtr<CefDOMNode> GetSelectionStartNode();
|
||||
virtual int GetSelectionStartOffset();
|
||||
virtual CefRefPtr<CefDOMNode> GetSelectionEndNode();
|
||||
virtual int GetSelectionEndOffset();
|
||||
virtual CefString GetSelectionAsMarkup();
|
||||
virtual CefString GetSelectionAsText();
|
||||
virtual CefString GetBaseURL();
|
||||
virtual CefString GetCompleteURL(const CefString& partialURL);
|
||||
virtual Type GetType() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMNode> GetDocument() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMNode> GetBody() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMNode> GetHead() OVERRIDE;
|
||||
virtual CefString GetTitle() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMNode> GetElementById(const CefString& id) OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMNode> GetFocusedNode() OVERRIDE;
|
||||
virtual bool HasSelection() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMNode> GetSelectionStartNode() OVERRIDE;
|
||||
virtual int GetSelectionStartOffset() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMNode> GetSelectionEndNode() OVERRIDE;
|
||||
virtual int GetSelectionEndOffset() OVERRIDE;
|
||||
virtual CefString GetSelectionAsMarkup() OVERRIDE;
|
||||
virtual CefString GetSelectionAsText() OVERRIDE;
|
||||
virtual CefString GetBaseURL() OVERRIDE;
|
||||
virtual CefString GetCompleteURL(const CefString& partialURL) OVERRIDE;
|
||||
|
||||
CefBrowserImpl* GetBrowser() { return browser_; }
|
||||
WebKit::WebFrame* GetFrame() { return frame_; }
|
||||
|
@ -58,6 +58,8 @@ protected:
|
|||
|
||||
typedef std::map<WebKit::WebNode,CefDOMNode*> NodeMap;
|
||||
NodeMap node_map_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefDOMDocumentImpl);
|
||||
};
|
||||
|
||||
#endif // _DOM_DOCUMENT_IMPL_H
|
||||
|
|
|
@ -10,21 +10,21 @@
|
|||
|
||||
class CefDOMDocumentImpl;
|
||||
|
||||
class CefDOMEventImpl : public CefThreadSafeBase<CefDOMEvent>
|
||||
class CefDOMEventImpl : public CefDOMEvent
|
||||
{
|
||||
public:
|
||||
CefDOMEventImpl(CefRefPtr<CefDOMDocumentImpl> document,
|
||||
const WebKit::WebDOMEvent& event);
|
||||
virtual ~CefDOMEventImpl();
|
||||
|
||||
virtual CefString GetType();
|
||||
virtual Category GetCategory();
|
||||
virtual Phase GetPhase();
|
||||
virtual bool CanBubble();
|
||||
virtual bool CanCancel();
|
||||
virtual CefRefPtr<CefDOMDocument> GetDocument();
|
||||
virtual CefRefPtr<CefDOMNode> GetTarget();
|
||||
virtual CefRefPtr<CefDOMNode> GetCurrentTarget();
|
||||
virtual CefString GetType() OVERRIDE;
|
||||
virtual Category GetCategory() OVERRIDE;
|
||||
virtual Phase GetPhase() OVERRIDE;
|
||||
virtual bool CanBubble() OVERRIDE;
|
||||
virtual bool CanCancel() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMDocument> GetDocument() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMNode> GetTarget() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMNode> GetCurrentTarget() OVERRIDE;
|
||||
|
||||
// Will be called from CefDOMEventListenerWrapper::handleEvent().
|
||||
void Detach();
|
||||
|
@ -35,6 +35,8 @@ public:
|
|||
protected:
|
||||
CefRefPtr<CefDOMDocumentImpl> document_;
|
||||
WebKit::WebDOMEvent event_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefDOMEventImpl);
|
||||
};
|
||||
|
||||
#endif // _DOM_EVENT_IMPL_H
|
||||
|
|
|
@ -10,39 +10,39 @@
|
|||
|
||||
class CefDOMDocumentImpl;
|
||||
|
||||
class CefDOMNodeImpl : public CefThreadSafeBase<CefDOMNode>
|
||||
class CefDOMNodeImpl : public CefDOMNode
|
||||
{
|
||||
public:
|
||||
CefDOMNodeImpl(CefRefPtr<CefDOMDocumentImpl> document,
|
||||
const WebKit::WebNode& node);
|
||||
virtual ~CefDOMNodeImpl();
|
||||
|
||||
virtual Type GetType();
|
||||
virtual bool IsText();
|
||||
virtual bool IsElement();
|
||||
virtual bool IsSame(CefRefPtr<CefDOMNode> that);
|
||||
virtual CefString GetName();
|
||||
virtual CefString GetValue();
|
||||
virtual bool SetValue(const CefString& value);
|
||||
virtual CefString GetAsMarkup();
|
||||
virtual CefRefPtr<CefDOMDocument> GetDocument();
|
||||
virtual CefRefPtr<CefDOMNode> GetParent();
|
||||
virtual CefRefPtr<CefDOMNode> GetPreviousSibling();
|
||||
virtual CefRefPtr<CefDOMNode> GetNextSibling();
|
||||
virtual bool HasChildren();
|
||||
virtual CefRefPtr<CefDOMNode> GetFirstChild();
|
||||
virtual CefRefPtr<CefDOMNode> GetLastChild();
|
||||
virtual Type GetType() OVERRIDE;
|
||||
virtual bool IsText() OVERRIDE;
|
||||
virtual bool IsElement() OVERRIDE;
|
||||
virtual bool IsSame(CefRefPtr<CefDOMNode> that) OVERRIDE;
|
||||
virtual CefString GetName() OVERRIDE;
|
||||
virtual CefString GetValue() OVERRIDE;
|
||||
virtual bool SetValue(const CefString& value) OVERRIDE;
|
||||
virtual CefString GetAsMarkup() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMDocument> GetDocument() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMNode> GetParent() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMNode> GetPreviousSibling() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMNode> GetNextSibling() OVERRIDE;
|
||||
virtual bool HasChildren() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMNode> GetFirstChild() OVERRIDE;
|
||||
virtual CefRefPtr<CefDOMNode> GetLastChild() OVERRIDE;
|
||||
virtual void AddEventListener(const CefString& eventType,
|
||||
CefRefPtr<CefDOMEventListener> listener,
|
||||
bool useCapture);
|
||||
virtual CefString GetElementTagName();
|
||||
virtual bool HasElementAttributes();
|
||||
virtual bool HasElementAttribute(const CefString& attrName);
|
||||
virtual CefString GetElementAttribute(const CefString& attrName);
|
||||
virtual void GetElementAttributes(AttributeMap& attrMap);
|
||||
bool useCapture) OVERRIDE;
|
||||
virtual CefString GetElementTagName() OVERRIDE;
|
||||
virtual bool HasElementAttributes() OVERRIDE;
|
||||
virtual bool HasElementAttribute(const CefString& attrName) OVERRIDE;
|
||||
virtual CefString GetElementAttribute(const CefString& attrName) OVERRIDE;
|
||||
virtual void GetElementAttributes(AttributeMap& attrMap) OVERRIDE;
|
||||
virtual bool SetElementAttribute(const CefString& attrName,
|
||||
const CefString& value);
|
||||
virtual CefString GetElementInnerText();
|
||||
const CefString& value) OVERRIDE;
|
||||
virtual CefString GetElementInnerText() OVERRIDE;
|
||||
|
||||
// Will be called from CefDOMDocumentImpl::Detach().
|
||||
void Detach();
|
||||
|
@ -53,6 +53,8 @@ public:
|
|||
protected:
|
||||
CefRefPtr<CefDOMDocumentImpl> document_;
|
||||
WebKit::WebNode node_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefDOMNodeImpl);
|
||||
};
|
||||
|
||||
#endif // _DOM_NODE_IMPL_H
|
||||
|
|
|
@ -16,28 +16,28 @@ class URLRequest;
|
|||
};
|
||||
|
||||
// Implementation of CefRequest
|
||||
class CefRequestImpl : public CefThreadSafeBase<CefRequest>
|
||||
class CefRequestImpl : public CefRequest
|
||||
{
|
||||
public:
|
||||
CefRequestImpl();
|
||||
~CefRequestImpl() {}
|
||||
|
||||
virtual CefString GetURL();
|
||||
virtual void SetURL(const CefString& url);
|
||||
virtual CefString GetMethod();
|
||||
virtual void SetMethod(const CefString& method);
|
||||
virtual CefRefPtr<CefPostData> GetPostData();
|
||||
virtual void SetPostData(CefRefPtr<CefPostData> postData);
|
||||
virtual void GetHeaderMap(HeaderMap& headerMap);
|
||||
virtual void SetHeaderMap(const HeaderMap& headerMap);
|
||||
virtual CefString GetURL() OVERRIDE;
|
||||
virtual void SetURL(const CefString& url) OVERRIDE;
|
||||
virtual CefString GetMethod() OVERRIDE;
|
||||
virtual void SetMethod(const CefString& method) OVERRIDE;
|
||||
virtual CefRefPtr<CefPostData> GetPostData() OVERRIDE;
|
||||
virtual void SetPostData(CefRefPtr<CefPostData> postData) OVERRIDE;
|
||||
virtual void GetHeaderMap(HeaderMap& headerMap) OVERRIDE;
|
||||
virtual void SetHeaderMap(const HeaderMap& headerMap) OVERRIDE;
|
||||
virtual void Set(const CefString& url,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefPostData> postData,
|
||||
const HeaderMap& headerMap);
|
||||
virtual RequestFlags GetFlags();
|
||||
virtual void SetFlags(RequestFlags flags);
|
||||
virtual CefString GetFirstPartyForCookies();
|
||||
virtual void SetFirstPartyForCookies(const CefString& url);
|
||||
const HeaderMap& headerMap) OVERRIDE;
|
||||
virtual RequestFlags GetFlags() OVERRIDE;
|
||||
virtual void SetFlags(RequestFlags flags) OVERRIDE;
|
||||
virtual CefString GetFirstPartyForCookies() OVERRIDE;
|
||||
virtual void SetFirstPartyForCookies(const CefString& url) OVERRIDE;
|
||||
|
||||
void Set(net::URLRequest* request);
|
||||
void Set(const WebKit::WebURLRequest& request);
|
||||
|
@ -59,19 +59,22 @@ protected:
|
|||
// The below methods are used by WebURLRequest.
|
||||
RequestFlags flags_;
|
||||
CefString first_party_for_cookies_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefRequestImpl);
|
||||
IMPLEMENT_LOCKING(CefRequestImpl);
|
||||
};
|
||||
|
||||
// Implementation of CefPostData
|
||||
class CefPostDataImpl : public CefThreadSafeBase<CefPostData>
|
||||
class CefPostDataImpl : public CefPostData
|
||||
{
|
||||
public:
|
||||
CefPostDataImpl();
|
||||
~CefPostDataImpl() {}
|
||||
|
||||
virtual size_t GetElementCount();
|
||||
virtual void GetElements(ElementVector& elements);
|
||||
virtual bool RemoveElement(CefRefPtr<CefPostDataElement> element);
|
||||
virtual bool AddElement(CefRefPtr<CefPostDataElement> element);
|
||||
virtual size_t GetElementCount() OVERRIDE;
|
||||
virtual void GetElements(ElementVector& elements) OVERRIDE;
|
||||
virtual bool RemoveElement(CefRefPtr<CefPostDataElement> element) OVERRIDE;
|
||||
virtual bool AddElement(CefRefPtr<CefPostDataElement> element) OVERRIDE;
|
||||
virtual void RemoveElements();
|
||||
|
||||
void Set(net::UploadData& data);
|
||||
|
@ -81,22 +84,25 @@ public:
|
|||
|
||||
protected:
|
||||
ElementVector elements_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefPostDataImpl);
|
||||
IMPLEMENT_LOCKING(CefPostDataImpl);
|
||||
};
|
||||
|
||||
// Implementation of CefPostDataElement
|
||||
class CefPostDataElementImpl : public CefThreadSafeBase<CefPostDataElement>
|
||||
class CefPostDataElementImpl : public CefPostDataElement
|
||||
{
|
||||
public:
|
||||
CefPostDataElementImpl();
|
||||
~CefPostDataElementImpl();
|
||||
|
||||
virtual void SetToEmpty();
|
||||
virtual void SetToFile(const CefString& fileName);
|
||||
virtual void SetToBytes(size_t size, const void* bytes);
|
||||
virtual Type GetType();
|
||||
virtual CefString GetFile();
|
||||
virtual size_t GetBytesCount();
|
||||
virtual size_t GetBytes(size_t size, void* bytes);
|
||||
virtual void SetToEmpty() OVERRIDE;
|
||||
virtual void SetToFile(const CefString& fileName) OVERRIDE;
|
||||
virtual void SetToBytes(size_t size, const void* bytes) OVERRIDE;
|
||||
virtual Type GetType() OVERRIDE;
|
||||
virtual CefString GetFile() OVERRIDE;
|
||||
virtual size_t GetBytesCount() OVERRIDE;
|
||||
virtual size_t GetBytes(size_t size, void* bytes) OVERRIDE;
|
||||
|
||||
void* GetBytes() { return data_.bytes.bytes; }
|
||||
|
||||
|
@ -114,6 +120,9 @@ protected:
|
|||
} bytes;
|
||||
cef_string_t filename;
|
||||
} data_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefPostDataElementImpl);
|
||||
IMPLEMENT_LOCKING(CefPostDataElementImpl);
|
||||
};
|
||||
|
||||
#endif // _REQUEST_IMPL_H
|
||||
|
|
|
@ -12,7 +12,7 @@ class WebURLResponse;
|
|||
};
|
||||
|
||||
// Implementation of CefResponse.
|
||||
class CefResponseImpl : public CefThreadSafeBase<CefResponse>
|
||||
class CefResponseImpl : public CefResponse
|
||||
{
|
||||
public:
|
||||
CefResponseImpl();
|
||||
|
@ -37,6 +37,9 @@ protected:
|
|||
CefString status_text_;
|
||||
CefString mime_type_;
|
||||
HeaderMap header_map_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefResponseImpl);
|
||||
IMPLEMENT_LOCKING(CefResponseImpl);
|
||||
};
|
||||
|
||||
#endif // _RESPONSE_IMPL_H
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
|
||||
virtual ~CefUrlRequestJob(){}
|
||||
|
||||
virtual void Start()
|
||||
virtual void Start() OVERRIDE
|
||||
{
|
||||
handler_->Cancel();
|
||||
// Continue asynchronously.
|
||||
|
@ -70,7 +70,7 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
virtual void Kill()
|
||||
virtual void Kill() OVERRIDE
|
||||
{
|
||||
if (async_resolver_) {
|
||||
async_resolver_->Cancel();
|
||||
|
@ -81,6 +81,7 @@ public:
|
|||
}
|
||||
|
||||
virtual bool ReadRawData(net::IOBuffer* dest, int dest_size, int *bytes_read)
|
||||
OVERRIDE
|
||||
{
|
||||
DCHECK_NE(dest_size, 0);
|
||||
DCHECK(bytes_read);
|
||||
|
@ -119,7 +120,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual void GetResponseInfo(net::HttpResponseInfo* info) {
|
||||
virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE {
|
||||
CefResponseImpl* responseImpl =
|
||||
static_cast<CefResponseImpl*>(response_.get());
|
||||
scoped_refptr<net::HttpResponseHeaders> headers(
|
||||
|
@ -128,6 +129,7 @@ public:
|
|||
}
|
||||
|
||||
virtual bool IsRedirectResponse(GURL* location, int* http_status_code)
|
||||
OVERRIDE
|
||||
{
|
||||
if (redirect_url_.is_valid()) {
|
||||
// Redirect to the new URL.
|
||||
|
@ -138,7 +140,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
virtual bool GetMimeType(std::string* mime_type) const
|
||||
virtual bool GetMimeType(std::string* mime_type) const OVERRIDE
|
||||
{
|
||||
DCHECK(request_);
|
||||
// call handler to get mime type
|
||||
|
@ -146,10 +148,6 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
virtual void SetExtraRequestHeaders(const std::string& headers)
|
||||
{
|
||||
}
|
||||
|
||||
CefRefPtr<CefSchemeHandler> handler_;
|
||||
CefRefPtr<CefResponse> response_;
|
||||
int response_length_;
|
||||
|
@ -376,7 +374,7 @@ private:
|
|||
CefUrlRequestFilter* CefUrlRequestFilter::shared_instance_ = NULL;
|
||||
|
||||
|
||||
class SchemeRequestJobWrapper : public CefThreadSafeBase<CefBase> {
|
||||
class SchemeRequestJobWrapper : public CefBase {
|
||||
public:
|
||||
SchemeRequestJobWrapper(const std::string& scheme_name,
|
||||
const std::string& host_name,
|
||||
|
@ -411,6 +409,8 @@ private:
|
|||
std::string host_name_;
|
||||
bool is_standard_;
|
||||
CefSchemeHandlerFactory* factory_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(SchemeRequestJobWrapper);
|
||||
};
|
||||
|
||||
bool CefRegisterScheme(const CefString& scheme_name,
|
||||
|
|
|
@ -72,42 +72,33 @@ CefFileReader::CefFileReader(FILE* file, bool close)
|
|||
|
||||
CefFileReader::~CefFileReader()
|
||||
{
|
||||
Lock();
|
||||
AutoLock lock_scope(this);
|
||||
if(close_)
|
||||
fclose(file_);
|
||||
Unlock();
|
||||
}
|
||||
|
||||
size_t CefFileReader::Read(void* ptr, size_t size, size_t n)
|
||||
{
|
||||
Lock();
|
||||
size_t rv = fread(ptr, size, n, file_);
|
||||
Unlock();
|
||||
return rv;
|
||||
AutoLock lock_scope(this);
|
||||
return fread(ptr, size, n, file_);
|
||||
}
|
||||
|
||||
int CefFileReader::Seek(long offset, int whence)
|
||||
{
|
||||
Lock();
|
||||
int rv = fseek(file_, offset, whence);
|
||||
Unlock();
|
||||
return rv;
|
||||
AutoLock lock_scope(this);
|
||||
return fseek(file_, offset, whence);
|
||||
}
|
||||
|
||||
long CefFileReader::Tell()
|
||||
{
|
||||
Lock();
|
||||
long rv = ftell(file_);
|
||||
Unlock();
|
||||
return rv;
|
||||
AutoLock lock_scope(this);
|
||||
return ftell(file_);
|
||||
}
|
||||
|
||||
int CefFileReader::Eof()
|
||||
{
|
||||
Lock();
|
||||
int rv = feof(file_);
|
||||
Unlock();
|
||||
return rv;
|
||||
AutoLock lock_scope(this);
|
||||
return feof(file_);
|
||||
}
|
||||
|
||||
|
||||
|
@ -120,42 +111,33 @@ CefFileWriter::CefFileWriter(FILE* file, bool close)
|
|||
|
||||
CefFileWriter::~CefFileWriter()
|
||||
{
|
||||
Lock();
|
||||
AutoLock lock_scope(this);
|
||||
if(close_)
|
||||
fclose(file_);
|
||||
Unlock();
|
||||
}
|
||||
|
||||
size_t CefFileWriter::Write(const void* ptr, size_t size, size_t n)
|
||||
{
|
||||
Lock();
|
||||
size_t rv = (size_t)fwrite(ptr, size, n, file_);
|
||||
Unlock();
|
||||
return rv;
|
||||
AutoLock lock_scope(this);
|
||||
return (size_t)fwrite(ptr, size, n, file_);
|
||||
}
|
||||
|
||||
int CefFileWriter::Seek(long offset, int whence)
|
||||
{
|
||||
Lock();
|
||||
int rv = fseek(file_, offset, whence);
|
||||
Unlock();
|
||||
return rv;
|
||||
AutoLock lock_scope(this);
|
||||
return fseek(file_, offset, whence);
|
||||
}
|
||||
|
||||
long CefFileWriter::Tell()
|
||||
{
|
||||
Lock();
|
||||
long rv = ftell(file_);
|
||||
Unlock();
|
||||
return rv;
|
||||
AutoLock lock_scope(this);
|
||||
return ftell(file_);
|
||||
}
|
||||
|
||||
int CefFileWriter::Flush()
|
||||
{
|
||||
Lock();
|
||||
int rv = fflush(file_);
|
||||
Unlock();
|
||||
return rv;
|
||||
AutoLock lock_scope(this);
|
||||
return fflush(file_);
|
||||
}
|
||||
|
||||
|
||||
|
@ -174,19 +156,18 @@ CefBytesReader::~CefBytesReader()
|
|||
|
||||
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 ret = (n < s ? n : s);
|
||||
memcpy(ptr, ((char*)data_) + offset_, ret * size);
|
||||
offset_ += ret * size;
|
||||
Unlock();
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int CefBytesReader::Seek(long offset, int whence)
|
||||
{
|
||||
int rv = -1L;
|
||||
Lock();
|
||||
AutoLock lock_scope(this);
|
||||
switch(whence) {
|
||||
case SEEK_CUR:
|
||||
if(offset_ + offset > datasize_) {
|
||||
|
@ -210,30 +191,25 @@ int CefBytesReader::Seek(long offset, int whence)
|
|||
rv = 0;
|
||||
break;
|
||||
}
|
||||
Unlock();
|
||||
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
long CefBytesReader::Tell()
|
||||
{
|
||||
Lock();
|
||||
long rv = offset_;
|
||||
Unlock();
|
||||
return rv;
|
||||
AutoLock lock_scope(this);
|
||||
return offset_;
|
||||
}
|
||||
|
||||
int CefBytesReader::Eof()
|
||||
{
|
||||
Lock();
|
||||
int rv = (offset_ >= datasize_);
|
||||
Unlock();
|
||||
return rv;
|
||||
AutoLock lock_scope(this);
|
||||
return (offset_ >= datasize_);
|
||||
}
|
||||
|
||||
void CefBytesReader::SetData(void* data, long datasize, bool copy)
|
||||
{
|
||||
Lock();
|
||||
AutoLock lock_scope(this);
|
||||
if(copy_)
|
||||
free(data_);
|
||||
|
||||
|
@ -249,7 +225,6 @@ void CefBytesReader::SetData(void* data, long datasize, bool copy)
|
|||
} else {
|
||||
data_ = data;
|
||||
}
|
||||
Unlock();
|
||||
}
|
||||
|
||||
|
||||
|
@ -265,15 +240,14 @@ CefBytesWriter::CefBytesWriter(size_t grow)
|
|||
|
||||
CefBytesWriter::~CefBytesWriter()
|
||||
{
|
||||
Lock();
|
||||
AutoLock lock_scope(this);
|
||||
if(data_)
|
||||
free(data_);
|
||||
Unlock();
|
||||
}
|
||||
|
||||
size_t CefBytesWriter::Write(const void* ptr, size_t size, size_t n)
|
||||
{
|
||||
Lock();
|
||||
AutoLock lock_scope(this);
|
||||
size_t rv;
|
||||
if(offset_ + size * n >= datasize_ && Grow(size * n) == 0) {
|
||||
rv = 0;
|
||||
|
@ -282,14 +256,14 @@ size_t CefBytesWriter::Write(const void* ptr, size_t size, size_t n)
|
|||
offset_ += size * n;
|
||||
rv = n;
|
||||
}
|
||||
Unlock();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int CefBytesWriter::Seek(long offset, int whence)
|
||||
{
|
||||
int rv = -1L;
|
||||
Lock();
|
||||
AutoLock lock_scope(this);
|
||||
switch(whence) {
|
||||
case SEEK_CUR:
|
||||
if(offset_ + offset > datasize_) {
|
||||
|
@ -312,17 +286,14 @@ int CefBytesWriter::Seek(long offset, int whence)
|
|||
rv = offset_;
|
||||
break;
|
||||
}
|
||||
Unlock();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
long CefBytesWriter::Tell()
|
||||
{
|
||||
Lock();
|
||||
long rv = offset_;
|
||||
Unlock();
|
||||
return rv;
|
||||
AutoLock lock_scope(this);
|
||||
return offset_;
|
||||
}
|
||||
|
||||
int CefBytesWriter::Flush()
|
||||
|
@ -332,15 +303,14 @@ int CefBytesWriter::Flush()
|
|||
|
||||
std::string CefBytesWriter::GetDataString()
|
||||
{
|
||||
Lock();
|
||||
AutoLock lock_scope(this);
|
||||
std::string str((char*)data_, offset_);
|
||||
Unlock();
|
||||
return str;
|
||||
}
|
||||
|
||||
size_t CefBytesWriter::Grow(size_t size)
|
||||
{
|
||||
Lock();
|
||||
AutoLock lock_scope(this);
|
||||
size_t rv;
|
||||
size_t s = (size > grow_ ? size : grow_);
|
||||
void* tmp = realloc(data_, datasize_ + s);
|
||||
|
@ -352,6 +322,6 @@ size_t CefBytesWriter::Grow(size_t size)
|
|||
} else {
|
||||
rv = 0;
|
||||
}
|
||||
Unlock();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -9,50 +9,56 @@
|
|||
#include <stdio.h>
|
||||
|
||||
// Implementation of CefStreamReader for files.
|
||||
class CefFileReader : public CefThreadSafeBase<CefStreamReader>
|
||||
class CefFileReader : public CefStreamReader
|
||||
{
|
||||
public:
|
||||
CefFileReader(FILE* file, bool close);
|
||||
virtual ~CefFileReader();
|
||||
|
||||
virtual size_t Read(void* ptr, size_t size, size_t n);
|
||||
virtual int Seek(long offset, int whence);
|
||||
virtual long Tell();
|
||||
virtual int Eof();
|
||||
virtual size_t Read(void* ptr, size_t size, size_t n) OVERRIDE;
|
||||
virtual int Seek(long offset, int whence) OVERRIDE;
|
||||
virtual long Tell() OVERRIDE;
|
||||
virtual int Eof() OVERRIDE;
|
||||
|
||||
protected:
|
||||
bool close_;
|
||||
FILE *file_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefFileReader);
|
||||
IMPLEMENT_LOCKING(CefFileReader);
|
||||
};
|
||||
|
||||
// Implementation of CefStreamWriter for files.
|
||||
class CefFileWriter : public CefThreadSafeBase<CefStreamWriter>
|
||||
class CefFileWriter : public CefStreamWriter
|
||||
{
|
||||
public:
|
||||
CefFileWriter(FILE* file, bool close);
|
||||
virtual ~CefFileWriter();
|
||||
|
||||
virtual size_t Write(const void* ptr, size_t size, size_t n);
|
||||
virtual int Seek(long offset, int whence);
|
||||
virtual long Tell();
|
||||
virtual int Flush();
|
||||
virtual size_t Write(const void* ptr, size_t size, size_t n) OVERRIDE;
|
||||
virtual int Seek(long offset, int whence) OVERRIDE;
|
||||
virtual long Tell() OVERRIDE;
|
||||
virtual int Flush() OVERRIDE;
|
||||
|
||||
protected:
|
||||
FILE *file_;
|
||||
bool close_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefFileWriter);
|
||||
IMPLEMENT_LOCKING(CefFileWriter);
|
||||
};
|
||||
|
||||
// Implementation of CefStreamReader for byte buffers.
|
||||
class CefBytesReader : public CefThreadSafeBase<CefStreamReader>
|
||||
class CefBytesReader : public CefStreamReader
|
||||
{
|
||||
public:
|
||||
CefBytesReader(void* data, long datasize, bool copy);
|
||||
virtual ~CefBytesReader();
|
||||
|
||||
virtual size_t Read(void* ptr, size_t size, size_t n);
|
||||
virtual int Seek(long offset, int whence);
|
||||
virtual long Tell();
|
||||
virtual int Eof();
|
||||
virtual size_t Read(void* ptr, size_t size, size_t n) OVERRIDE;
|
||||
virtual int Seek(long offset, int whence) OVERRIDE;
|
||||
virtual long Tell() OVERRIDE;
|
||||
virtual int Eof() OVERRIDE;
|
||||
|
||||
void SetData(void* data, long datasize, bool copy);
|
||||
|
||||
|
@ -64,19 +70,22 @@ protected:
|
|||
size_t datasize_;
|
||||
bool copy_;
|
||||
size_t offset_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefBytesReader);
|
||||
IMPLEMENT_LOCKING(CefBytesReader);
|
||||
};
|
||||
|
||||
// Implementation of CefStreamWriter for byte buffers.
|
||||
class CefBytesWriter : public CefThreadSafeBase<CefStreamWriter>
|
||||
class CefBytesWriter : public CefStreamWriter
|
||||
{
|
||||
public:
|
||||
CefBytesWriter(size_t grow);
|
||||
virtual ~CefBytesWriter();
|
||||
|
||||
virtual size_t Write(const void* ptr, size_t size, size_t n);
|
||||
virtual int Seek(long offset, int whence);
|
||||
virtual long Tell();
|
||||
virtual int Flush();
|
||||
virtual size_t Write(const void* ptr, size_t size, size_t n) OVERRIDE;
|
||||
virtual int Seek(long offset, int whence) OVERRIDE;
|
||||
virtual long Tell() OVERRIDE;
|
||||
virtual int Flush() OVERRIDE;
|
||||
|
||||
void* GetData() { return data_; }
|
||||
size_t GetDataSize() { return offset_; }
|
||||
|
@ -85,65 +94,71 @@ public:
|
|||
protected:
|
||||
size_t Grow(size_t size);
|
||||
|
||||
protected:
|
||||
size_t grow_;
|
||||
void* data_;
|
||||
size_t datasize_;
|
||||
size_t offset_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefBytesWriter);
|
||||
IMPLEMENT_LOCKING(CefBytesWriter);
|
||||
};
|
||||
|
||||
// Implementation of CefStreamReader for handlers.
|
||||
class CefHandlerReader : public CefThreadSafeBase<CefStreamReader>
|
||||
class CefHandlerReader : public CefStreamReader
|
||||
{
|
||||
public:
|
||||
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);
|
||||
}
|
||||
virtual int Seek(long offset, int whence)
|
||||
virtual int Seek(long offset, int whence) OVERRIDE
|
||||
{
|
||||
return handler_->Seek(offset, whence);
|
||||
}
|
||||
virtual long Tell()
|
||||
virtual long Tell() OVERRIDE
|
||||
{
|
||||
return handler_->Tell();
|
||||
}
|
||||
virtual int Eof()
|
||||
virtual int Eof() OVERRIDE
|
||||
{
|
||||
return handler_->Eof();
|
||||
}
|
||||
|
||||
protected:
|
||||
CefRefPtr<CefReadHandler> handler_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefHandlerReader);
|
||||
};
|
||||
|
||||
// Implementation of CefStreamWriter for handlers.
|
||||
class CefHandlerWriter : public CefThreadSafeBase<CefStreamWriter>
|
||||
class CefHandlerWriter : public CefStreamWriter
|
||||
{
|
||||
public:
|
||||
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);
|
||||
}
|
||||
virtual int Seek(long offset, int whence)
|
||||
virtual int Seek(long offset, int whence) OVERRIDE
|
||||
{
|
||||
return handler_->Seek(offset, whence);
|
||||
}
|
||||
virtual long Tell()
|
||||
virtual long Tell() OVERRIDE
|
||||
{
|
||||
return handler_->Tell();
|
||||
}
|
||||
virtual int Flush()
|
||||
virtual int Flush() OVERRIDE
|
||||
{
|
||||
return handler_->Flush();
|
||||
}
|
||||
|
||||
protected:
|
||||
CefRefPtr<CefWriteHandler> handler_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefHandlerWriter);
|
||||
};
|
||||
|
||||
#endif // _STREAM_IMPL_H
|
||||
|
|
|
@ -74,7 +74,7 @@ private:
|
|||
// manager object is destroyed. A manager object can be created as either a
|
||||
// member variable of another class or by using lazy initialization:
|
||||
// base::LazyInstance<CefTrackManager> g_singleton(base::LINKER_INITIALIZED);
|
||||
class CefTrackManager : public CefThreadSafeBase<CefBase>
|
||||
class CefTrackManager : public CefBase
|
||||
{
|
||||
public:
|
||||
CefTrackManager() : object_count_(0) {}
|
||||
|
@ -131,6 +131,9 @@ public:
|
|||
private:
|
||||
CefTrackObject tracker_;
|
||||
long object_count_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefTrackManager);
|
||||
IMPLEMENT_LOCKING(CefTrackManager);
|
||||
};
|
||||
|
||||
#endif // _TRACKER_H
|
||||
|
|
|
@ -83,22 +83,18 @@ void TrackDestructor(v8::Persistent<v8::Value> object, void* parameter)
|
|||
// Return the browser associated with the specified WebFrame.
|
||||
CefRefPtr<CefBrowserImpl> FindBrowserForFrame(WebKit::WebFrame *frame)
|
||||
{
|
||||
CefRefPtr<CefBrowserImpl> browser;
|
||||
|
||||
CefContext::BrowserList *list;
|
||||
CefContext::AutoLock lock_scope(_Context);
|
||||
|
||||
CefContext::BrowserList *list = _Context->GetBrowserList();
|
||||
CefContext::BrowserList::const_iterator i;
|
||||
_Context->Lock();
|
||||
list = _Context->GetBrowserList();
|
||||
i = list->begin();
|
||||
for (; i != list->end(); ++i) {
|
||||
WebKit::WebFrame* thisframe = i->get()->UIT_GetMainWebFrame();
|
||||
if (thisframe == frame) {
|
||||
browser = i->get();
|
||||
break;
|
||||
}
|
||||
if (thisframe == frame)
|
||||
return i->get();
|
||||
}
|
||||
_Context->Unlock();
|
||||
return browser;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Convert a wide string to a V8 string.
|
||||
|
@ -293,7 +289,7 @@ CefRefPtr<CefV8Context> CefV8Context::GetEnteredContext()
|
|||
// CefV8ContextImpl
|
||||
|
||||
CefV8ContextImpl::CefV8ContextImpl(v8::Handle<v8::Context> context)
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
: enter_count_(0)
|
||||
#endif
|
||||
{
|
||||
|
@ -346,7 +342,7 @@ bool CefV8ContextImpl::Enter()
|
|||
{
|
||||
CEF_REQUIRE_UI_THREAD(false);
|
||||
v8_context_->GetHandle()->Enter();
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
++enter_count_;
|
||||
#endif
|
||||
return true;
|
||||
|
@ -357,7 +353,7 @@ bool CefV8ContextImpl::Exit()
|
|||
CEF_REQUIRE_UI_THREAD(false);
|
||||
DLOG_ASSERT(enter_count_ > 0);
|
||||
v8_context_->GetHandle()->Exit();
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
--enter_count_;
|
||||
#endif
|
||||
return true;
|
||||
|
|
|
@ -59,17 +59,17 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class CefV8ContextImpl : public CefThreadSafeBase<CefV8Context>
|
||||
class CefV8ContextImpl : public CefV8Context
|
||||
{
|
||||
public:
|
||||
CefV8ContextImpl(v8::Handle<v8::Context> context);
|
||||
virtual ~CefV8ContextImpl();
|
||||
|
||||
virtual CefRefPtr<CefBrowser> GetBrowser();
|
||||
virtual CefRefPtr<CefFrame> GetFrame();
|
||||
virtual CefRefPtr<CefV8Value> GetGlobal();
|
||||
virtual bool Enter();
|
||||
virtual bool Exit();
|
||||
virtual CefRefPtr<CefBrowser> GetBrowser() OVERRIDE;
|
||||
virtual CefRefPtr<CefFrame> GetFrame() OVERRIDE;
|
||||
virtual CefRefPtr<CefV8Value> GetGlobal() OVERRIDE;
|
||||
virtual bool Enter() OVERRIDE;
|
||||
virtual bool Exit() OVERRIDE;
|
||||
|
||||
v8::Local<v8::Context> GetContext();
|
||||
WebKit::WebFrame* GetWebFrame();
|
||||
|
@ -77,10 +77,12 @@ public:
|
|||
protected:
|
||||
scoped_refptr<CefV8ContextHandle> v8_context_;
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
// Used in debug builds to catch missing Exits in destructor.
|
||||
int enter_count_;
|
||||
#endif
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefV8ContextImpl);
|
||||
};
|
||||
|
||||
// Special class for a v8::Value to ensure that it is deleted from the UI
|
||||
|
@ -101,51 +103,52 @@ private:
|
|||
CefTrackObject *tracker_;
|
||||
};
|
||||
|
||||
class CefV8ValueImpl : public CefThreadSafeBase<CefV8Value>
|
||||
class CefV8ValueImpl : public CefV8Value
|
||||
{
|
||||
public:
|
||||
CefV8ValueImpl(v8::Handle<v8::Value> value, CefTrackObject* tracker = NULL);
|
||||
virtual ~CefV8ValueImpl();
|
||||
|
||||
virtual bool IsUndefined();
|
||||
virtual bool IsNull();
|
||||
virtual bool IsBool();
|
||||
virtual bool IsInt();
|
||||
virtual bool IsDouble();
|
||||
virtual bool IsString();
|
||||
virtual bool IsObject();
|
||||
virtual bool IsArray();
|
||||
virtual bool IsFunction();
|
||||
virtual bool IsSame(CefRefPtr<CefV8Value> value);
|
||||
virtual bool GetBoolValue();
|
||||
virtual int GetIntValue();
|
||||
virtual double GetDoubleValue();
|
||||
virtual CefString GetStringValue();
|
||||
virtual bool HasValue(const CefString& key);
|
||||
virtual bool HasValue(int index);
|
||||
virtual bool DeleteValue(const CefString& key);
|
||||
virtual bool DeleteValue(int index);
|
||||
virtual CefRefPtr<CefV8Value> GetValue(const CefString& key);
|
||||
virtual CefRefPtr<CefV8Value> GetValue(int index);
|
||||
virtual bool SetValue(const CefString& key, CefRefPtr<CefV8Value> value);
|
||||
virtual bool SetValue(int index, CefRefPtr<CefV8Value> value);
|
||||
virtual bool IsUndefined() OVERRIDE;
|
||||
virtual bool IsNull() OVERRIDE;
|
||||
virtual bool IsBool() OVERRIDE;
|
||||
virtual bool IsInt() OVERRIDE;
|
||||
virtual bool IsDouble() OVERRIDE;
|
||||
virtual bool IsString() OVERRIDE;
|
||||
virtual bool IsObject() OVERRIDE;
|
||||
virtual bool IsArray() OVERRIDE;
|
||||
virtual bool IsFunction() OVERRIDE;
|
||||
virtual bool IsSame(CefRefPtr<CefV8Value> value) OVERRIDE;
|
||||
virtual bool GetBoolValue() OVERRIDE;
|
||||
virtual int GetIntValue() OVERRIDE;
|
||||
virtual double GetDoubleValue() OVERRIDE;
|
||||
virtual CefString GetStringValue() OVERRIDE;
|
||||
virtual bool HasValue(const CefString& key) OVERRIDE;
|
||||
virtual bool HasValue(int index) OVERRIDE;
|
||||
virtual bool DeleteValue(const CefString& key) OVERRIDE;
|
||||
virtual bool DeleteValue(int index) OVERRIDE;
|
||||
virtual CefRefPtr<CefV8Value> GetValue(const CefString& key) OVERRIDE;
|
||||
virtual CefRefPtr<CefV8Value> GetValue(int index) OVERRIDE;
|
||||
virtual bool SetValue(const CefString& key, CefRefPtr<CefV8Value> value)
|
||||
OVERRIDE;
|
||||
virtual bool SetValue(int index, CefRefPtr<CefV8Value> value) OVERRIDE;
|
||||
virtual bool SetValue(const CefString& key, AccessControl settings,
|
||||
PropertyAttribute attribute);
|
||||
virtual bool GetKeys(std::vector<CefString>& keys);
|
||||
virtual CefRefPtr<CefBase> GetUserData();
|
||||
virtual int GetArrayLength();
|
||||
virtual CefString GetFunctionName();
|
||||
virtual CefRefPtr<CefV8Handler> GetFunctionHandler();
|
||||
PropertyAttribute attribute) OVERRIDE;
|
||||
virtual bool GetKeys(std::vector<CefString>& keys) OVERRIDE;
|
||||
virtual CefRefPtr<CefBase> GetUserData() OVERRIDE;
|
||||
virtual int GetArrayLength() OVERRIDE;
|
||||
virtual CefString GetFunctionName() OVERRIDE;
|
||||
virtual CefRefPtr<CefV8Handler> GetFunctionHandler() OVERRIDE;
|
||||
virtual bool ExecuteFunction(CefRefPtr<CefV8Value> object,
|
||||
const CefV8ValueList& arguments,
|
||||
CefRefPtr<CefV8Value>& retval,
|
||||
CefString& exception);
|
||||
CefString& exception) OVERRIDE;
|
||||
virtual bool ExecuteFunctionWithContext(
|
||||
CefRefPtr<CefV8Context> context,
|
||||
CefRefPtr<CefV8Value> object,
|
||||
const CefV8ValueList& arguments,
|
||||
CefRefPtr<CefV8Value>& retval,
|
||||
CefString& exception);
|
||||
CefString& exception) OVERRIDE;
|
||||
|
||||
inline v8::Handle<v8::Value> GetHandle()
|
||||
{
|
||||
|
@ -157,6 +160,8 @@ public:
|
|||
|
||||
protected:
|
||||
scoped_refptr<CefV8ValueHandle> v8_value_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefV8ValueImpl);
|
||||
};
|
||||
|
||||
#endif //_V8_IMPL_H
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
#include "include/cef.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
|
||||
class CefWebURLRequestImpl :
|
||||
public CefThreadSafeBase<CefWebURLRequest>
|
||||
class CefWebURLRequestImpl : public CefWebURLRequest
|
||||
{
|
||||
public:
|
||||
class Context;
|
||||
|
@ -19,8 +18,8 @@ public:
|
|||
virtual ~CefWebURLRequestImpl();
|
||||
|
||||
// Can be called on any thread.
|
||||
virtual RequestState GetState();
|
||||
virtual void Cancel();
|
||||
virtual RequestState GetState() OVERRIDE;
|
||||
virtual void Cancel() OVERRIDE;
|
||||
|
||||
// Can only be called on the UI thread.
|
||||
void DoSend(CefRefPtr<CefRequest> request);
|
||||
|
@ -37,6 +36,9 @@ protected:
|
|||
// The below parameters are only modified on the UI thread.
|
||||
RequestState state_;
|
||||
scoped_refptr<Context> context_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefWebURLRequestImpl);
|
||||
IMPLEMENT_LOCKING(CefWebURLRequestImpl);
|
||||
};
|
||||
|
||||
#endif // _WEB_URL_REQUEST_CLIENT_IMPL_H
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <sstream>
|
||||
|
||||
// Implementation of CefXmlReader
|
||||
class CefXmlReaderImpl : public CefThreadSafeBase<CefXmlReader>
|
||||
class CefXmlReaderImpl : public CefXmlReader
|
||||
{
|
||||
public:
|
||||
CefXmlReaderImpl();
|
||||
|
@ -65,6 +65,8 @@ protected:
|
|||
CefRefPtr<CefStreamReader> stream_;
|
||||
xmlTextReaderPtr reader_;
|
||||
std::stringstream error_buf_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefXMLReaderImpl);
|
||||
};
|
||||
|
||||
#endif // _XML_READER_IMPL_H
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <sstream>
|
||||
|
||||
// Implementation of CefZipReader
|
||||
class CefZipReaderImpl : public CefThreadSafeBase<CefZipReader>
|
||||
class CefZipReaderImpl : public CefZipReader
|
||||
{
|
||||
public:
|
||||
CefZipReaderImpl();
|
||||
|
@ -47,6 +47,8 @@ protected:
|
|||
CefString filename_;
|
||||
long filesize_;
|
||||
time_t filemodified_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefZipReaderImpl);
|
||||
};
|
||||
|
||||
#endif // _ZIP_READER_IMPL_H
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
|
||||
// CefCppToC implementation for CefBase.
|
||||
class CefBaseCppToC : public CefThreadSafeBase<CefBase>
|
||||
class CefBaseCppToC : public CefBase
|
||||
{
|
||||
public:
|
||||
// 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
|
||||
// and the underlying wrapper class.
|
||||
virtual int AddRef()
|
||||
int AddRef()
|
||||
{
|
||||
UnderlyingAddRef();
|
||||
return CefThreadSafeBase<CefBase>::AddRef();
|
||||
return refct_.AddRef();
|
||||
}
|
||||
virtual int Release()
|
||||
int Release()
|
||||
{
|
||||
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.
|
||||
int UnderlyingAddRef() { return class_->AddRef(); }
|
||||
|
@ -136,6 +140,7 @@ private:
|
|||
}
|
||||
|
||||
protected:
|
||||
CefRefCount refct_;
|
||||
Struct struct_;
|
||||
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
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
|
@ -12,41 +12,55 @@
|
|||
|
||||
#include "libcef_dll/cpptoc/browser_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"
|
||||
|
||||
|
||||
// GLOBAL FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
CEF_EXPORT int cef_browser_create(cef_window_info_t* windowInfo, int popup,
|
||||
struct _cef_handler_t* handler, const cef_string_t* url)
|
||||
CEF_EXPORT int cef_browser_create(cef_window_info_t* windowInfo,
|
||||
struct _cef_client_t* client, const cef_string_t* url,
|
||||
const struct _cef_browser_settings_t* settings)
|
||||
{
|
||||
DCHECK(windowInfo);
|
||||
if (!windowInfo)
|
||||
return 0;
|
||||
|
||||
CefRefPtr<CefHandler> handlerPtr;
|
||||
CefWindowInfo wi = *windowInfo;
|
||||
CefRefPtr<CefClient> clientPtr;
|
||||
CefWindowInfo windowInfoObj;
|
||||
CefBrowserSettings browserSettingsObj;
|
||||
|
||||
if(handler)
|
||||
handlerPtr = CefHandlerCToCpp::Wrap(handler);
|
||||
|
||||
return CefBrowser::CreateBrowser(wi, popup?true:false, handlerPtr,
|
||||
CefString(url));
|
||||
windowInfoObj.Set(*windowInfo, false);
|
||||
if(client)
|
||||
clientPtr = CefClientCToCpp::Wrap(client);
|
||||
if (settings)
|
||||
browserSettingsObj.Set(*settings, false);
|
||||
|
||||
return CefBrowser::CreateBrowser(windowInfoObj, clientPtr, CefString(url),
|
||||
browserSettingsObj);
|
||||
}
|
||||
|
||||
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);
|
||||
if (!windowInfo)
|
||||
return NULL;
|
||||
|
||||
CefRefPtr<CefHandler> handlerPtr;
|
||||
CefWindowInfo wi = *windowInfo;
|
||||
CefRefPtr<CefClient> clientPtr;
|
||||
CefWindowInfo windowInfoObj;
|
||||
CefBrowserSettings browserSettingsObj;
|
||||
|
||||
if(handler)
|
||||
handlerPtr = CefHandlerCToCpp::Wrap(handler);
|
||||
windowInfoObj.Set(*windowInfo, false);
|
||||
if(client)
|
||||
clientPtr = CefClientCToCpp::Wrap(client);
|
||||
if (settings)
|
||||
browserSettingsObj.Set(*settings, false);
|
||||
|
||||
CefRefPtr<CefBrowser> browserPtr(
|
||||
CefBrowser::CreateBrowserSync(wi, popup?true:false, handlerPtr,
|
||||
CefString(url)));
|
||||
CefBrowser::CreateBrowserSync(windowInfoObj, clientPtr, CefString(url),
|
||||
browserSettingsObj));
|
||||
if(browserPtr.get())
|
||||
return CefBrowserCppToC::Wrap(browserPtr);
|
||||
return NULL;
|
||||
|
@ -155,17 +169,16 @@ int CEF_CALLBACK browser_is_popup(struct _cef_browser_t* self)
|
|||
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)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
if (!self)
|
||||
return NULL;
|
||||
|
||||
CefRefPtr<CefBrowser> browserPtr = CefBrowserCppToC::Get(self);
|
||||
CefRefPtr<CefHandler> handlerPtr = browserPtr->GetHandler();
|
||||
if(handlerPtr.get())
|
||||
return CefHandlerCToCpp::Unwrap(handlerPtr);
|
||||
CefRefPtr<CefClient> clientPtr = CefBrowserCppToC::Get(self)->GetClient();
|
||||
if(clientPtr.get())
|
||||
return CefClientCToCpp::Unwrap(clientPtr);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -438,7 +451,7 @@ CefBrowserCppToC::CefBrowserCppToC(CefBrowser* cls)
|
|||
struct_.struct_.set_focus = browser_set_focus;
|
||||
struct_.struct_.get_window_handle = browser_get_window_handle;
|
||||
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_focused_frame = browser_get_focused_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;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefBrowserCppToC, CefBrowser,
|
||||
cef_browser_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
|
||||
// can be found in the LICENSE 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
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
|
@ -8,8 +8,8 @@
|
|||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
#ifndef _HANDLER_CPPTOC_H
|
||||
#define _HANDLER_CPPTOC_H
|
||||
#ifndef _CLIENT_CPPTOC_H
|
||||
#define _CLIENT_CPPTOC_H
|
||||
|
||||
#ifndef USING_CEF_SHARED
|
||||
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||
|
@ -21,14 +21,14 @@
|
|||
|
||||
// Wrap a C++ class with a C structure.
|
||||
// This class may be instantiated and accessed wrapper-side only.
|
||||
class CefHandlerCppToC
|
||||
: public CefCppToC<CefHandlerCppToC, CefHandler, cef_handler_t>
|
||||
class CefClientCppToC
|
||||
: public CefCppToC<CefClientCppToC, CefClient, cef_client_t>
|
||||
{
|
||||
public:
|
||||
CefHandlerCppToC(CefHandler* cls);
|
||||
virtual ~CefHandlerCppToC() {}
|
||||
CefClientCppToC(CefClient* cls);
|
||||
virtual ~CefClientCppToC() {}
|
||||
};
|
||||
|
||||
#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
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
|
@ -46,7 +46,7 @@ CefCookieVisitorCppToC::CefCookieVisitorCppToC(CefCookieVisitor* cls)
|
|||
struct_.struct_.visit = cookie_visitor_visit;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefCookieVisitorCppToC, CefCookieVisitor,
|
||||
cef_cookie_visitor_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
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// implementation exists on this side of the DLL boundary but will have methods
|
||||
// called from the other side of the DLL boundary.
|
||||
template <class ClassName, class BaseName, class StructName>
|
||||
class CefCppToC : public CefThreadSafeBase<CefBase>
|
||||
class CefCppToC : public CefBase
|
||||
{
|
||||
public:
|
||||
// Structure representation with pointer to the C++ class.
|
||||
|
@ -78,13 +78,13 @@ public:
|
|||
struct_.struct_.base.release = struct_release;
|
||||
struct_.struct_.base.get_refct = struct_get_refct;
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
CefAtomicIncrement(&DebugObjCt);
|
||||
#endif
|
||||
}
|
||||
virtual ~CefCppToC()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
CefAtomicDecrement(&DebugObjCt);
|
||||
#endif
|
||||
}
|
||||
|
@ -98,23 +98,27 @@ public:
|
|||
|
||||
// CefBase methods increment/decrement reference counts on both this object
|
||||
// and the underlying wrapper class.
|
||||
virtual int AddRef()
|
||||
int AddRef()
|
||||
{
|
||||
UnderlyingAddRef();
|
||||
return CefThreadSafeBase<CefBase>::AddRef();
|
||||
return refct_.AddRef();
|
||||
}
|
||||
virtual int Release()
|
||||
int Release()
|
||||
{
|
||||
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.
|
||||
int UnderlyingAddRef() { return class_->AddRef(); }
|
||||
int UnderlyingRelease() { return class_->Release(); }
|
||||
int UnderlyingGetRefCt() { return class_->GetRefCt(); }
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
// Simple tracking of allocated objects.
|
||||
static long DebugObjCt;
|
||||
#endif
|
||||
|
@ -151,6 +155,7 @@ private:
|
|||
}
|
||||
|
||||
protected:
|
||||
CefRefCount refct_;
|
||||
Struct struct_;
|
||||
BaseName* class_;
|
||||
};
|
||||
|
|
|
@ -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
|
||||
|
|
@ -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
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
|
@ -235,7 +235,7 @@ CefDOMDocumentCppToC::CefDOMDocumentCppToC(CefDOMDocument* cls)
|
|||
struct_.struct_.get_complete_url = domdocument_get_complete_url;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefDOMDocumentCppToC, CefDOMDocument,
|
||||
cef_domdocument_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
|
||||
// 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
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
|
@ -122,7 +122,7 @@ CefDOMEventCppToC::CefDOMEventCppToC(CefDOMEvent* cls)
|
|||
struct_.struct_.get_current_target = domevent_get_current_target;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefDOMEventCppToC, CefDOMEvent,
|
||||
cef_domevent_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
|
||||
// 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
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
|
@ -40,7 +40,7 @@ CefDOMEventListenerCppToC::CefDOMEventListenerCppToC(CefDOMEventListener* cls)
|
|||
struct_.struct_.handle_event = domevent_listener_handle_event;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefDOMEventListenerCppToC, CefDOMEventListener,
|
||||
cef_domevent_listener_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
|
||||
// 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
|
||||
// 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;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefDOMNodeCppToC, CefDOMNode,
|
||||
cef_domnode_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
|
||||
// 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
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
|
@ -39,7 +39,7 @@ CefDOMVisitorCppToC::CefDOMVisitorCppToC(CefDOMVisitor* cls)
|
|||
struct_.struct_.visit = domvisitor_visit;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefDOMVisitorCppToC, CefDOMVisitor,
|
||||
cef_domvisitor_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
|
||||
// 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
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
|
@ -46,7 +46,7 @@ CefDownloadHandlerCppToC::CefDownloadHandlerCppToC(CefDownloadHandler* cls)
|
|||
struct_.struct_.complete = download_handler_complete;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefDownloadHandlerCppToC, CefDownloadHandler,
|
||||
cef_download_handler_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
|
||||
// can be found in the LICENSE 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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
|
@ -267,7 +267,7 @@ CefFrameCppToC::CefFrameCppToC(CefFrame* cls)
|
|||
struct_.struct_.visit_dom = frame_visit_dom;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefFrameCppToC, CefFrame, cef_frame_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
|
||||
// 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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
|
@ -100,7 +100,7 @@ CefPostDataCppToC::CefPostDataCppToC(CefPostData* cls)
|
|||
struct_.struct_.remove_elements = post_data_remove_elements;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefPostDataCppToC, CefPostData,
|
||||
cef_post_data_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
|
||||
// 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
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
|
@ -114,7 +114,7 @@ CefPostDataElementCppToC::CefPostDataElementCppToC(CefPostDataElement* cls)
|
|||
struct_.struct_.get_bytes = post_data_element_get_bytes;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefPostDataElementCppToC, CefPostDataElement,
|
||||
cef_post_data_element_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
|
||||
// can be found in the LICENSE 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
|
||||
|
|
@ -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
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
|
@ -65,7 +65,7 @@ CefReadHandlerCppToC::CefReadHandlerCppToC(CefReadHandler* cls)
|
|||
struct_.struct_.eof = read_handler_eof;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefReadHandlerCppToC, CefReadHandler,
|
||||
cef_read_handler_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
|
||||
// can be found in the LICENSE 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
|
||||
|
|
@ -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
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
|
@ -208,7 +208,7 @@ CefRequestCppToC::CefRequestCppToC(CefRequest* cls)
|
|||
request_set_first_party_for_cookies;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefRequestCppToC, CefRequest,
|
||||
cef_request_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
|
||||
// can be found in the LICENSE 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
|
||||
|
|
@ -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
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
|
@ -130,7 +130,7 @@ CefResponseCppToC::CefResponseCppToC(CefResponse* cls)
|
|||
struct_.struct_.set_header_map = response_set_header_map;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefResponseCppToC, CefResponse,
|
||||
cef_response_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
|
||||
// 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
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
|
@ -72,7 +72,7 @@ CefSchemeHandlerCppToC::CefSchemeHandlerCppToC(CefSchemeHandler* cls)
|
|||
struct_.struct_.read_response = scheme_handler_read_response;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefSchemeHandlerCppToC, CefSchemeHandler,
|
||||
cef_scheme_handler_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
|
||||
// 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
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
|
@ -36,7 +36,7 @@ CefSchemeHandlerFactoryCppToC::CefSchemeHandlerFactoryCppToC(
|
|||
struct_.struct_.create = scheme_handler_factory_create;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefSchemeHandlerFactoryCppToC,
|
||||
CefSchemeHandlerFactory, cef_scheme_handler_factory_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
|
||||
// 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
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
|
@ -99,7 +99,7 @@ CefStreamReaderCppToC::CefStreamReaderCppToC(CefStreamReader* cls)
|
|||
struct_.struct_.eof = stream_reader_eof;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefStreamReaderCppToC, CefStreamReader,
|
||||
cef_stream_reader_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
|
||||
// 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
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
|
@ -98,7 +98,7 @@ CefStreamWriterCppToC::CefStreamWriterCppToC(CefStreamWriter* cls)
|
|||
struct_.struct_.flush = stream_writer_flush;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefStreamWriterCppToC, CefStreamWriter,
|
||||
cef_stream_writer_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue