mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add new CefRenderProcessHandler::OnBeforeNavigation callback (issue #722).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@904 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include "libcef_dll/ctocpp/domnode_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/process_message_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/request_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/v8context_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/v8exception_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/v8stack_trace_ctocpp.h"
|
||||
@@ -80,6 +81,40 @@ void CEF_CALLBACK render_process_handler_on_browser_destroyed(
|
||||
CefBrowserCToCpp::Wrap(browser));
|
||||
}
|
||||
|
||||
int CEF_CALLBACK render_process_handler_on_before_navigation(
|
||||
struct _cef_render_process_handler_t* self, cef_browser_t* browser,
|
||||
cef_frame_t* frame, struct _cef_request_t* request,
|
||||
enum cef_navigation_type_t navigation_type, int is_redirect) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return 0;
|
||||
// Verify param: frame; type: refptr_diff
|
||||
DCHECK(frame);
|
||||
if (!frame)
|
||||
return 0;
|
||||
// Verify param: request; type: refptr_diff
|
||||
DCHECK(request);
|
||||
if (!request)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefRenderProcessHandlerCppToC::Get(self)->OnBeforeNavigation(
|
||||
CefBrowserCToCpp::Wrap(browser),
|
||||
CefFrameCToCpp::Wrap(frame),
|
||||
CefRequestCToCpp::Wrap(request),
|
||||
navigation_type,
|
||||
is_redirect?true:false);
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK render_process_handler_on_context_created(
|
||||
struct _cef_render_process_handler_t* self, cef_browser_t* browser,
|
||||
cef_frame_t* frame, struct _cef_v8context_t* context) {
|
||||
@@ -240,6 +275,8 @@ CefRenderProcessHandlerCppToC::CefRenderProcessHandlerCppToC(
|
||||
render_process_handler_on_browser_created;
|
||||
struct_.struct_.on_browser_destroyed =
|
||||
render_process_handler_on_browser_destroyed;
|
||||
struct_.struct_.on_before_navigation =
|
||||
render_process_handler_on_before_navigation;
|
||||
struct_.struct_.on_context_created =
|
||||
render_process_handler_on_context_created;
|
||||
struct_.struct_.on_context_released =
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include "libcef_dll/cpptoc/domnode_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/frame_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/process_message_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/request_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/v8context_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/v8exception_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/v8stack_trace_cpptoc.h"
|
||||
@@ -76,6 +77,40 @@ void CefRenderProcessHandlerCToCpp::OnBrowserDestroyed(
|
||||
CefBrowserCppToC::Wrap(browser));
|
||||
}
|
||||
|
||||
bool CefRenderProcessHandlerCToCpp::OnBeforeNavigation(
|
||||
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request, NavigationType navigation_type,
|
||||
bool is_redirect) {
|
||||
if (CEF_MEMBER_MISSING(struct_, on_before_navigation))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return false;
|
||||
// Verify param: frame; type: refptr_diff
|
||||
DCHECK(frame.get());
|
||||
if (!frame.get())
|
||||
return false;
|
||||
// Verify param: request; type: refptr_diff
|
||||
DCHECK(request.get());
|
||||
if (!request.get())
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = struct_->on_before_navigation(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
CefFrameCppToC::Wrap(frame),
|
||||
CefRequestCppToC::Wrap(request),
|
||||
navigation_type,
|
||||
is_redirect);
|
||||
|
||||
// Return type: bool
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
void CefRenderProcessHandlerCToCpp::OnContextCreated(
|
||||
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) {
|
||||
|
@@ -38,6 +38,9 @@ class CefRenderProcessHandlerCToCpp
|
||||
virtual void OnWebKitInitialized() OVERRIDE;
|
||||
virtual void OnBrowserCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||
virtual void OnBrowserDestroyed(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||
virtual bool OnBeforeNavigation(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, CefRefPtr<CefRequest> request,
|
||||
NavigationType navigation_type, bool is_redirect) OVERRIDE;
|
||||
virtual void OnContextCreated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context) OVERRIDE;
|
||||
virtual void OnContextReleased(CefRefPtr<CefBrowser> browser,
|
||||
|
Reference in New Issue
Block a user