mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-02 20:26:59 +01:00
Replace JSBindingHandler with a new V8ContextHandler interface that contains callbacks for V8 context creation and release (issue #359).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@392 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
ead9b4508c
commit
605753c3b8
4
cef.gyp
4
cef.gyp
@ -451,8 +451,6 @@
|
||||
'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',
|
||||
@ -481,6 +479,8 @@
|
||||
'libcef_dll/ctocpp/task_ctocpp.h',
|
||||
'libcef_dll/ctocpp/v8accessor_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/v8accessor_ctocpp.h',
|
||||
'libcef_dll/ctocpp/v8context_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/v8context_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/v8handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/v8handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/web_urlrequest_client_ctocpp.cc',
|
||||
|
@ -147,8 +147,6 @@
|
||||
'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',
|
||||
@ -177,6 +175,8 @@
|
||||
'libcef_dll/cpptoc/task_cpptoc.h',
|
||||
'libcef_dll/cpptoc/v8accessor_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/v8accessor_cpptoc.h',
|
||||
'libcef_dll/cpptoc/v8context_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/v8context_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/v8handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/v8handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/web_urlrequest_client_cpptoc.cc',
|
||||
|
@ -1588,20 +1588,31 @@ public:
|
||||
|
||||
|
||||
///
|
||||
// Implement this interface to handle JavaScript binding. The methods of this
|
||||
// Implement this interface to handle V8 context events. The methods of this
|
||||
// class will be called on the UI thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefJSBindingHandler : public virtual CefBase
|
||||
class CefV8ContextHandler : public virtual CefBase
|
||||
{
|
||||
public:
|
||||
///
|
||||
// Called for adding values to a frame's JavaScript 'window' object.
|
||||
// Called immediately after the V8 context for a frame has been created. To
|
||||
// retrieve the JavaScript 'window' object use the CefV8Context::GetGlobal()
|
||||
// method.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnJSBinding(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Value> object) {}
|
||||
virtual void OnContextCreated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) {}
|
||||
|
||||
///
|
||||
// Called immediately before the V8 context for a frame is released. No
|
||||
// references to the context should be kept after this method is called.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnContextReleased(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) {}
|
||||
};
|
||||
|
||||
|
||||
@ -1783,10 +1794,10 @@ public:
|
||||
virtual CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() { return NULL; }
|
||||
|
||||
///
|
||||
// Return the handler for JavaScript binding events.
|
||||
// Return the handler for V8 context events.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefJSBindingHandler> GetJSBindingHandler() { return NULL; }
|
||||
virtual CefRefPtr<CefV8ContextHandler> GetV8ContextHandler() { return NULL; }
|
||||
|
||||
///
|
||||
// Return the handler for off-screen rendering events.
|
||||
@ -2304,6 +2315,13 @@ public:
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool Exit() =0;
|
||||
|
||||
///
|
||||
// Returns true if this object is pointing to the same handle as |that|
|
||||
// object.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsSame(CefRefPtr<CefV8Context> that) =0;
|
||||
};
|
||||
|
||||
|
||||
@ -2478,7 +2496,7 @@ public:
|
||||
static CefRefPtr<CefV8Value> CreateString(const CefString& value);
|
||||
///
|
||||
// Create a new CefV8Value object of type object. This method should only be
|
||||
// called from within the scope of a CefJSBindingHandler, CefV8Handler or
|
||||
// called from within the scope of a CefV8ContextHandler, CefV8Handler or
|
||||
// CefV8Accessor callback, or in combination with calling Enter() and Exit()
|
||||
// on a stored CefV8Context reference.
|
||||
///
|
||||
@ -2486,7 +2504,7 @@ public:
|
||||
static CefRefPtr<CefV8Value> CreateObject(CefRefPtr<CefBase> user_data);
|
||||
///
|
||||
// Create a new CefV8Value object of type object with accessors. This method
|
||||
// should only be called from within the scope of a CefJSBindingHandler,
|
||||
// should only be called from within the scope of a CefV8ContextHandler,
|
||||
// CefV8Handler or CefV8Accessor callback, or in combination with calling
|
||||
// Enter() and Exit() on a stored CefV8Context reference.
|
||||
///
|
||||
@ -2495,7 +2513,7 @@ public:
|
||||
CefRefPtr<CefV8Accessor> accessor);
|
||||
///
|
||||
// Create a new CefV8Value object of type array. This method should only be
|
||||
// called from within the scope of a CefJSBindingHandler, CefV8Handler or
|
||||
// called from within the scope of a CefV8ContextHandler, CefV8Handler or
|
||||
// CefV8Accessor callback, or in combination with calling Enter() and Exit()
|
||||
// on a stored CefV8Context reference.
|
||||
///
|
||||
@ -2503,7 +2521,7 @@ public:
|
||||
static CefRefPtr<CefV8Value> CreateArray();
|
||||
///
|
||||
// Create a new CefV8Value object of type function. This method should only be
|
||||
// called from within the scope of a CefJSBindingHandler, CefV8Handler or
|
||||
// called from within the scope of a CefV8ContextHandler, CefV8Handler or
|
||||
// CefV8Accessor callback, or in combination with calling Enter() and Exit()
|
||||
// on a stored CefV8Context reference.
|
||||
///
|
||||
|
@ -1375,22 +1375,32 @@ typedef struct _cef_jsdialog_handler_t
|
||||
|
||||
|
||||
///
|
||||
// Implement this structure to handle JavaScript binding. The functions of this
|
||||
// Implement this structure to handle V8 context events. The functions of this
|
||||
// structure will be called on the UI thread.
|
||||
///
|
||||
typedef struct _cef_jsbinding_handler_t
|
||||
typedef struct _cef_v8context_handler_t
|
||||
{
|
||||
// Base structure.
|
||||
cef_base_t base;
|
||||
|
||||
///
|
||||
// Called for adding values to a frame's JavaScript 'window' object.
|
||||
// Called immediately after the V8 context for a frame has been created. To
|
||||
// retrieve the JavaScript 'window' object use the
|
||||
// cef_v8context_t::get_global() function.
|
||||
///
|
||||
void (CEF_CALLBACK *on_jsbinding)(struct _cef_jsbinding_handler_t* self,
|
||||
void (CEF_CALLBACK *on_context_created)(struct _cef_v8context_handler_t* self,
|
||||
struct _cef_browser_t* browser, struct _cef_frame_t* frame,
|
||||
struct _cef_v8value_t* object);
|
||||
struct _cef_v8context_t* context);
|
||||
|
||||
} cef_jsbinding_handler_t;
|
||||
///
|
||||
// Called immediately before the V8 context for a frame is released. No
|
||||
// references to the context should be kept after this function is called.
|
||||
///
|
||||
void (CEF_CALLBACK *on_context_released)(
|
||||
struct _cef_v8context_handler_t* self, struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame, struct _cef_v8context_t* context);
|
||||
|
||||
} cef_v8context_handler_t;
|
||||
|
||||
|
||||
///
|
||||
@ -1560,9 +1570,9 @@ typedef struct _cef_client_t
|
||||
struct _cef_client_t* self);
|
||||
|
||||
///
|
||||
// Return the handler for JavaScript binding events.
|
||||
// Return the handler for V8 context events.
|
||||
///
|
||||
struct _cef_jsbinding_handler_t* (CEF_CALLBACK *get_jsbinding_handler)(
|
||||
struct _cef_v8context_handler_t* (CEF_CALLBACK *get_v8context_handler)(
|
||||
struct _cef_client_t* self);
|
||||
|
||||
///
|
||||
@ -2068,6 +2078,13 @@ typedef struct _cef_v8context_t
|
||||
///
|
||||
int (CEF_CALLBACK *exit)(struct _cef_v8context_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if this object is pointing to the same handle as |that|
|
||||
// object.
|
||||
///
|
||||
int (CEF_CALLBACK *is_same)(struct _cef_v8context_t* self,
|
||||
struct _cef_v8context_t* that);
|
||||
|
||||
} cef_v8context_t;
|
||||
|
||||
|
||||
@ -2478,7 +2495,7 @@ CEF_EXPORT cef_v8value_t* cef_v8value_create_string(const cef_string_t* value);
|
||||
|
||||
///
|
||||
// Create a new cef_v8value_t object of type object. This function should only
|
||||
// be called from within the scope of a cef_jsbinding_handler_t, cef_v8handler_t
|
||||
// be called from within the scope of a cef_v8context_tHandler, cef_v8handler_t
|
||||
// or cef_v8accessor_t callback, or in combination with calling enter() and
|
||||
// exit() on a stored cef_v8context_t reference.
|
||||
///
|
||||
@ -2487,7 +2504,7 @@ CEF_EXPORT cef_v8value_t* cef_v8value_create_object(cef_base_t* user_data);
|
||||
///
|
||||
// Create a new cef_v8value_t object of type object with accessors. This
|
||||
// function should only be called from within the scope of a
|
||||
// cef_jsbinding_handler_t, cef_v8handler_t or cef_v8accessor_t callback, or in
|
||||
// cef_v8context_tHandler, cef_v8handler_t or cef_v8accessor_t callback, or in
|
||||
// combination with calling enter() and exit() on a stored cef_v8context_t
|
||||
// reference.
|
||||
///
|
||||
@ -2496,7 +2513,7 @@ CEF_EXPORT cef_v8value_t* cef_v8value_create_object_with_accessor(
|
||||
|
||||
///
|
||||
// Create a new cef_v8value_t object of type array. This function should only be
|
||||
// called from within the scope of a cef_jsbinding_handler_t, cef_v8handler_t or
|
||||
// called from within the scope of a cef_v8context_tHandler, cef_v8handler_t or
|
||||
// cef_v8accessor_t callback, or in combination with calling enter() and exit()
|
||||
// on a stored cef_v8context_t reference.
|
||||
///
|
||||
@ -2504,7 +2521,7 @@ CEF_EXPORT cef_v8value_t* cef_v8value_create_array();
|
||||
|
||||
///
|
||||
// Create a new cef_v8value_t object of type function. This function should only
|
||||
// be called from within the scope of a cef_jsbinding_handler_t, cef_v8handler_t
|
||||
// be called from within the scope of a cef_v8context_tHandler, cef_v8handler_t
|
||||
// or cef_v8accessor_t callback, or in combination with calling enter() and
|
||||
// exit() on a stored cef_v8context_t reference.
|
||||
///
|
||||
|
@ -844,23 +844,42 @@ void BrowserWebViewDelegate::didCommitProvisionalLoad(
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::didClearWindowObject(WebFrame* frame) {
|
||||
void BrowserWebViewDelegate::didCreateScriptContext(
|
||||
WebFrame* frame, v8::Handle<v8::Context> context, int worldId) {
|
||||
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;
|
||||
if (!client.get())
|
||||
return;
|
||||
|
||||
v8::Context::Scope scope(context);
|
||||
CefRefPtr<CefV8ContextHandler> handler = client->GetV8ContextHandler();
|
||||
if (!handler.get())
|
||||
return;
|
||||
|
||||
CefRefPtr<CefFrame> cframe(browser_->UIT_GetCefFrame(frame));
|
||||
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(context->Global());
|
||||
handler->OnJSBinding(browser_, cframe, object);
|
||||
}
|
||||
}
|
||||
v8::HandleScope handle_scope;
|
||||
v8::Context::Scope scope(context);
|
||||
|
||||
CefRefPtr<CefFrame> framePtr(browser_->UIT_GetCefFrame(frame));
|
||||
CefRefPtr<CefV8Context> contextPtr(new CefV8ContextImpl(context));
|
||||
|
||||
handler->OnContextCreated(browser_, framePtr, contextPtr);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::willReleaseScriptContext(
|
||||
WebFrame* frame, v8::Handle<v8::Context> context, int worldId) {
|
||||
CefRefPtr<CefClient> client = browser_->GetClient();
|
||||
if (!client.get())
|
||||
return;
|
||||
|
||||
CefRefPtr<CefV8ContextHandler> handler = client->GetV8ContextHandler();
|
||||
if (!handler.get())
|
||||
return;
|
||||
|
||||
v8::HandleScope handle_scope;
|
||||
v8::Context::Scope scope(context);
|
||||
|
||||
CefRefPtr<CefFrame> framePtr(browser_->UIT_GetCefFrame(frame));
|
||||
CefRefPtr<CefV8Context> contextPtr(new CefV8ContextImpl(context));
|
||||
|
||||
handler->OnContextReleased(browser_, framePtr, contextPtr);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::didReceiveTitle(
|
||||
|
@ -166,7 +166,10 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
||||
WebKit::WebFrame*, const WebKit::WebURLError&) OVERRIDE;
|
||||
virtual void didCommitProvisionalLoad(
|
||||
WebKit::WebFrame*, bool is_new_navigation) OVERRIDE;
|
||||
virtual void didClearWindowObject(WebKit::WebFrame*) OVERRIDE;
|
||||
virtual void didCreateScriptContext(
|
||||
WebKit::WebFrame*, v8::Handle<v8::Context>, int worldId) OVERRIDE;
|
||||
virtual void willReleaseScriptContext(
|
||||
WebKit::WebFrame*, v8::Handle<v8::Context>, int worldId) OVERRIDE;
|
||||
virtual void didReceiveTitle(
|
||||
WebKit::WebFrame*, const WebKit::WebString& title,
|
||||
WebKit::WebTextDirection direction) OVERRIDE;
|
||||
|
@ -470,6 +470,22 @@ bool CefV8ContextImpl::Exit()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefV8ContextImpl::IsSame(CefRefPtr<CefV8Context> that)
|
||||
{
|
||||
CEF_REQUIRE_UI_THREAD(false);
|
||||
|
||||
v8::HandleScope handle_scope;
|
||||
|
||||
v8::Local<v8::Context> thatHandle;
|
||||
v8::Local<v8::Context> thisHandle = GetContext();
|
||||
|
||||
CefV8ContextImpl *impl = static_cast<CefV8ContextImpl*>(that.get());
|
||||
if (impl)
|
||||
thatHandle = impl->GetContext();
|
||||
|
||||
return (thisHandle == thatHandle);
|
||||
}
|
||||
|
||||
v8::Local<v8::Context> CefV8ContextImpl::GetContext()
|
||||
{
|
||||
return v8::Local<v8::Context>::New(v8_context_->GetHandle());
|
||||
|
@ -70,6 +70,7 @@ public:
|
||||
virtual CefRefPtr<CefV8Value> GetGlobal() OVERRIDE;
|
||||
virtual bool Enter() OVERRIDE;
|
||||
virtual bool Exit() OVERRIDE;
|
||||
virtual bool IsSame(CefRefPtr<CefV8Context> that) OVERRIDE;
|
||||
|
||||
v8::Local<v8::Context> GetContext();
|
||||
WebKit::WebFrame* GetWebFrame();
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "libcef_dll/cpptoc/drag_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"
|
||||
@ -24,6 +23,7 @@
|
||||
#include "libcef_dll/cpptoc/print_handler_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/render_handler_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/request_handler_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/v8context_handler_cpptoc.h"
|
||||
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
@ -178,17 +178,17 @@ cef_jsdialog_handler_t* CEF_CALLBACK client_get_jsdialog_handler(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cef_jsbinding_handler_t* CEF_CALLBACK client_get_jsbinding_handler(
|
||||
cef_v8context_handler_t* CEF_CALLBACK client_get_v8context_handler(
|
||||
struct _cef_client_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return NULL;
|
||||
|
||||
CefRefPtr<CefJSBindingHandler> handlerPtr =
|
||||
CefClientCppToC::Get(self)->GetJSBindingHandler();
|
||||
CefRefPtr<CefV8ContextHandler> handlerPtr =
|
||||
CefClientCppToC::Get(self)->GetV8ContextHandler();
|
||||
if(handlerPtr.get())
|
||||
return CefJSBindingHandlerCppToC::Wrap(handlerPtr);
|
||||
return CefV8ContextHandlerCppToC::Wrap(handlerPtr);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -239,7 +239,7 @@ CefClientCppToC::CefClientCppToC(CefClient* cls)
|
||||
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_v8context_handler = client_get_v8context_handler;
|
||||
struct_.struct_.get_render_handler = client_get_render_handler;
|
||||
struct_.struct_.get_drag_handler = client_get_drag_handler;
|
||||
}
|
||||
|
@ -1,51 +0,0 @@
|
||||
// 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
|
||||
|
@ -104,6 +104,18 @@ int CEF_CALLBACK v8context_exit(struct _cef_v8context_t* self)
|
||||
return contextPtr->Exit();
|
||||
}
|
||||
|
||||
int CEF_CALLBACK v8context_is_same(struct _cef_v8context_t* self,
|
||||
struct _cef_v8context_t* that)
|
||||
{
|
||||
DCHECK(self);
|
||||
DCHECK(that);
|
||||
if (!self || !that)
|
||||
return false;
|
||||
|
||||
return CefV8ContextCppToC::Get(self)->IsSame(
|
||||
CefV8ContextCppToC::Unwrap(that));
|
||||
}
|
||||
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
@ -115,6 +127,7 @@ CefV8ContextCppToC::CefV8ContextCppToC(CefV8Context* cls)
|
||||
struct_.struct_.get_global = v8context_get_global;
|
||||
struct_.struct_.enter = v8context_enter;
|
||||
struct_.struct_.exit = v8context_exit;
|
||||
struct_.struct_.is_same = v8context_is_same;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
68
libcef_dll/cpptoc/v8context_handler_cpptoc.cc
Normal file
68
libcef_dll/cpptoc/v8context_handler_cpptoc.cc
Normal file
@ -0,0 +1,68 @@
|
||||
// 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/v8context_handler_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/v8context_ctocpp.h"
|
||||
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
void CEF_CALLBACK v8context_handler_on_context_created(
|
||||
struct _cef_v8context_handler_t* self, cef_browser_t* browser,
|
||||
cef_frame_t* frame, struct _cef_v8context_t* context)
|
||||
{
|
||||
DCHECK(self);
|
||||
DCHECK(browser);
|
||||
DCHECK(frame);
|
||||
DCHECK(context);
|
||||
if (!self || !browser || !frame || !context)
|
||||
return;
|
||||
|
||||
CefV8ContextHandlerCppToC::Get(self)->OnContextCreated(
|
||||
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
||||
CefV8ContextCToCpp::Wrap(context));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK v8context_handler_on_context_released(
|
||||
struct _cef_v8context_handler_t* self, cef_browser_t* browser,
|
||||
cef_frame_t* frame, struct _cef_v8context_t* context)
|
||||
{
|
||||
DCHECK(self);
|
||||
DCHECK(browser);
|
||||
DCHECK(frame);
|
||||
DCHECK(context);
|
||||
if (!self || !browser || !frame || !context)
|
||||
return;
|
||||
|
||||
CefV8ContextHandlerCppToC::Get(self)->OnContextReleased(
|
||||
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
||||
CefV8ContextCToCpp::Wrap(context));
|
||||
}
|
||||
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefV8ContextHandlerCppToC::CefV8ContextHandlerCppToC(CefV8ContextHandler* cls)
|
||||
: CefCppToC<CefV8ContextHandlerCppToC, CefV8ContextHandler,
|
||||
cef_v8context_handler_t>(cls)
|
||||
{
|
||||
struct_.struct_.on_context_created = v8context_handler_on_context_created;
|
||||
struct_.struct_.on_context_released = v8context_handler_on_context_released;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefV8ContextHandlerCppToC, CefV8ContextHandler,
|
||||
cef_v8context_handler_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
@ -8,8 +8,8 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
#ifndef _JSBINDINGHANDLER_CPPTOC_H
|
||||
#define _JSBINDINGHANDLER_CPPTOC_H
|
||||
#ifndef _V8CONTEXTHANDLER_CPPTOC_H
|
||||
#define _V8CONTEXTHANDLER_CPPTOC_H
|
||||
|
||||
#ifndef USING_CEF_SHARED
|
||||
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||
@ -21,15 +21,15 @@
|
||||
|
||||
// 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>
|
||||
class CefV8ContextHandlerCppToC
|
||||
: public CefCppToC<CefV8ContextHandlerCppToC, CefV8ContextHandler,
|
||||
cef_v8context_handler_t>
|
||||
{
|
||||
public:
|
||||
CefJSBindingHandlerCppToC(CefJSBindingHandler* cls);
|
||||
virtual ~CefJSBindingHandlerCppToC() {}
|
||||
CefV8ContextHandlerCppToC(CefV8ContextHandler* cls);
|
||||
virtual ~CefV8ContextHandlerCppToC() {}
|
||||
};
|
||||
|
||||
#endif // USING_CEF_SHARED
|
||||
#endif // _JSBINDINGHANDLER_CPPTOC_H
|
||||
#endif // _V8CONTEXTHANDLER_CPPTOC_H
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "libcef_dll/ctocpp/drag_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/find_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/focus_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/jsbinding_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/jsdialog_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/keyboard_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/life_span_handler_ctocpp.h"
|
||||
@ -24,6 +23,7 @@
|
||||
#include "libcef_dll/ctocpp/print_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/render_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/request_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/v8context_handler_ctocpp.h"
|
||||
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
@ -151,15 +151,15 @@ CefRefPtr<CefJSDialogHandler> CefClientCToCpp::GetJSDialogHandler()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefJSBindingHandler> CefClientCToCpp::GetJSBindingHandler()
|
||||
CefRefPtr<CefV8ContextHandler> CefClientCToCpp::GetV8ContextHandler()
|
||||
{
|
||||
if (CEF_MEMBER_MISSING(struct_, get_jsbinding_handler))
|
||||
if (CEF_MEMBER_MISSING(struct_, get_v8context_handler))
|
||||
return NULL;
|
||||
|
||||
cef_jsbinding_handler_t* handlerStruct =
|
||||
struct_->get_jsbinding_handler(struct_);
|
||||
cef_v8context_handler_t* handlerStruct =
|
||||
struct_->get_v8context_handler(struct_);
|
||||
if(handlerStruct)
|
||||
return CefJSBindingHandlerCToCpp::Wrap(handlerStruct);
|
||||
return CefV8ContextHandlerCToCpp::Wrap(handlerStruct);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
virtual CefRefPtr<CefPrintHandler> GetPrintHandler() OVERRIDE;
|
||||
virtual CefRefPtr<CefFindHandler> GetFindHandler() OVERRIDE;
|
||||
virtual CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() OVERRIDE;
|
||||
virtual CefRefPtr<CefJSBindingHandler> GetJSBindingHandler() OVERRIDE;
|
||||
virtual CefRefPtr<CefV8ContextHandler> GetV8ContextHandler() OVERRIDE;
|
||||
virtual CefRefPtr<CefRenderHandler> GetRenderHandler() OVERRIDE;
|
||||
virtual CefRefPtr<CefDragHandler> GetDragHandler() OVERRIDE;
|
||||
};
|
||||
|
@ -1,36 +0,0 @@
|
||||
// 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 static and
|
||||
// virtual method implementations. See the translator.README.txt file in the
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/browser_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/frame_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/v8value_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/jsbinding_handler_ctocpp.h"
|
||||
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
void CefJSBindingHandlerCToCpp::OnJSBinding(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Value> object)
|
||||
{
|
||||
if (CEF_MEMBER_MISSING(struct_, on_jsbinding))
|
||||
return;
|
||||
|
||||
struct_->on_jsbinding(struct_, CefBrowserCppToC::Wrap(browser),
|
||||
CefFrameCppToC::Wrap(frame), CefV8ValueCppToC::Wrap(object));
|
||||
}
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCToCpp<CefJSBindingHandlerCToCpp, CefJSBindingHandler,
|
||||
cef_jsbinding_handler_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
@ -94,6 +94,14 @@ bool CefV8ContextCToCpp::Exit()
|
||||
return struct_->exit(struct_)?true:false;
|
||||
}
|
||||
|
||||
bool CefV8ContextCToCpp::IsSame(CefRefPtr<CefV8Context> that)
|
||||
{
|
||||
if (CEF_MEMBER_MISSING(struct_, is_same))
|
||||
return false;
|
||||
|
||||
return struct_->is_same(struct_, CefV8ContextCToCpp::Unwrap(that))?true:false;
|
||||
}
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCToCpp<CefV8ContextCToCpp, CefV8Context,
|
||||
|
@ -36,6 +36,7 @@ public:
|
||||
virtual CefRefPtr<CefV8Value> GetGlobal() OVERRIDE;
|
||||
virtual bool Enter() OVERRIDE;
|
||||
virtual bool Exit() OVERRIDE;
|
||||
virtual bool IsSame(CefRefPtr<CefV8Context> that) OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // USING_CEF_SHARED
|
||||
|
46
libcef_dll/ctocpp/v8context_handler_ctocpp.cc
Normal file
46
libcef_dll/ctocpp/v8context_handler_ctocpp.cc
Normal file
@ -0,0 +1,46 @@
|
||||
// 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 static and
|
||||
// virtual method implementations. See the translator.README.txt file in the
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/browser_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/frame_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/v8context_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/v8context_handler_ctocpp.h"
|
||||
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
void CefV8ContextHandlerCToCpp::OnContextCreated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context)
|
||||
{
|
||||
if (CEF_MEMBER_MISSING(struct_, on_context_created))
|
||||
return;
|
||||
|
||||
struct_->on_context_created(struct_, CefBrowserCppToC::Wrap(browser),
|
||||
CefFrameCppToC::Wrap(frame), CefV8ContextCppToC::Wrap(context));
|
||||
}
|
||||
|
||||
void CefV8ContextHandlerCToCpp::OnContextReleased(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context)
|
||||
{
|
||||
if (CEF_MEMBER_MISSING(struct_, on_context_released))
|
||||
return;
|
||||
|
||||
struct_->on_context_released(struct_, CefBrowserCppToC::Wrap(browser),
|
||||
CefFrameCppToC::Wrap(frame), CefV8ContextCppToC::Wrap(context));
|
||||
}
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCToCpp<CefV8ContextHandlerCToCpp, CefV8ContextHandler,
|
||||
cef_v8context_handler_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
@ -9,8 +9,8 @@
|
||||
// more information.
|
||||
//
|
||||
|
||||
#ifndef _JSBINDINGHANDLER_CTOCPP_H
|
||||
#define _JSBINDINGHANDLER_CTOCPP_H
|
||||
#ifndef _V8CONTEXTHANDLER_CTOCPP_H
|
||||
#define _V8CONTEXTHANDLER_CTOCPP_H
|
||||
|
||||
#ifndef BUILDING_CEF_SHARED
|
||||
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
|
||||
@ -22,21 +22,23 @@
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed DLL-side only.
|
||||
class CefJSBindingHandlerCToCpp
|
||||
: public CefCToCpp<CefJSBindingHandlerCToCpp, CefJSBindingHandler,
|
||||
cef_jsbinding_handler_t>
|
||||
class CefV8ContextHandlerCToCpp
|
||||
: public CefCToCpp<CefV8ContextHandlerCToCpp, CefV8ContextHandler,
|
||||
cef_v8context_handler_t>
|
||||
{
|
||||
public:
|
||||
CefJSBindingHandlerCToCpp(cef_jsbinding_handler_t* str)
|
||||
: CefCToCpp<CefJSBindingHandlerCToCpp, CefJSBindingHandler,
|
||||
cef_jsbinding_handler_t>(str) {}
|
||||
virtual ~CefJSBindingHandlerCToCpp() {}
|
||||
CefV8ContextHandlerCToCpp(cef_v8context_handler_t* str)
|
||||
: CefCToCpp<CefV8ContextHandlerCToCpp, CefV8ContextHandler,
|
||||
cef_v8context_handler_t>(str) {}
|
||||
virtual ~CefV8ContextHandlerCToCpp() {}
|
||||
|
||||
// CefJSBindingHandler methods
|
||||
virtual void OnJSBinding(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Value> object) OVERRIDE;
|
||||
// CefV8ContextHandler methods
|
||||
virtual void OnContextCreated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context) OVERRIDE;
|
||||
virtual void OnContextReleased(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context) OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // BUILDING_CEF_SHARED
|
||||
#endif // _JSBINDINGHANDLER_CTOCPP_H
|
||||
#endif // _V8CONTEXTHANDLER_CTOCPP_H
|
||||
|
@ -263,14 +263,14 @@ bool ClientHandler::GetPrintHeaderFooter(CefRefPtr<CefBrowser> browser,
|
||||
return false;
|
||||
}
|
||||
|
||||
void ClientHandler::OnJSBinding(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Value> object)
|
||||
void ClientHandler::OnContextCreated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context)
|
||||
{
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
// Add the V8 bindings.
|
||||
InitBindingTest(browser, frame, object);
|
||||
InitBindingTest(browser, frame, context->GetGlobal());
|
||||
}
|
||||
|
||||
bool ClientHandler::OnDragStart(CefRefPtr<CefBrowser> browser,
|
||||
|
@ -24,7 +24,7 @@ class ClientHandler : public CefClient,
|
||||
public CefFocusHandler,
|
||||
public CefKeyboardHandler,
|
||||
public CefPrintHandler,
|
||||
public CefJSBindingHandler,
|
||||
public CefV8ContextHandler,
|
||||
public CefDragHandler,
|
||||
public DownloadListener
|
||||
{
|
||||
@ -47,7 +47,7 @@ public:
|
||||
{ return this; }
|
||||
virtual CefRefPtr<CefPrintHandler> GetPrintHandler() OVERRIDE
|
||||
{ return this; }
|
||||
virtual CefRefPtr<CefJSBindingHandler> GetJSBindingHandler() OVERRIDE
|
||||
virtual CefRefPtr<CefV8ContextHandler> GetV8ContextHandler() OVERRIDE
|
||||
{ return this; }
|
||||
virtual CefRefPtr<CefDragHandler> GetDragHandler() OVERRIDE
|
||||
{ return this; }
|
||||
@ -131,10 +131,10 @@ public:
|
||||
CefString& bottomCenter,
|
||||
CefString& bottomRight) OVERRIDE;
|
||||
|
||||
// CefJSBindingHandler methods
|
||||
virtual void OnJSBinding(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Value> object) OVERRIDE;
|
||||
// CefV8ContextHandler methods
|
||||
virtual void OnContextCreated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) OVERRIDE;
|
||||
|
||||
// CefDragHandler methods.
|
||||
virtual bool OnDragStart(CefRefPtr<CefBrowser> browser,
|
||||
|
@ -323,10 +323,13 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnJSBinding(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Value> object) OVERRIDE
|
||||
virtual void OnContextCreated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) OVERRIDE
|
||||
{
|
||||
// Retrieve the 'window' object.
|
||||
CefRefPtr<CefV8Value> object = context->GetGlobal();
|
||||
|
||||
CefRefPtr<CefV8Handler> handler = new V8Handler(this);
|
||||
CefRefPtr<CefV8Value> testObj = CefV8Value::CreateObject(NULL, NULL);
|
||||
testObj->SetValue("result", CefV8Value::CreateFunction("result", handler),
|
||||
|
@ -28,7 +28,7 @@ class TestHandler : public CefClient,
|
||||
public CefLifeSpanHandler,
|
||||
public CefLoadHandler,
|
||||
public CefRequestHandler,
|
||||
public CefJSBindingHandler
|
||||
public CefV8ContextHandler
|
||||
{
|
||||
public:
|
||||
TestHandler() : browser_hwnd_(NULL), completion_event_(true, false)
|
||||
@ -51,7 +51,7 @@ public:
|
||||
{ return this; }
|
||||
virtual CefRefPtr<CefRequestHandler> GetRequestHandler() OVERRIDE
|
||||
{ return this; }
|
||||
virtual CefRefPtr<CefJSBindingHandler> GetJSBindingHandler() OVERRIDE
|
||||
virtual CefRefPtr<CefV8ContextHandler> GetV8ContextHandler() OVERRIDE
|
||||
{ return this; }
|
||||
|
||||
// CefLifeSpanHandler methods
|
||||
|
@ -286,12 +286,12 @@ public:
|
||||
DestroyTest();
|
||||
}
|
||||
|
||||
virtual void OnJSBinding(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Value> object) OVERRIDE
|
||||
virtual void OnContextCreated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) OVERRIDE
|
||||
{
|
||||
if(binding_test_)
|
||||
TestHandleJSBinding(browser, frame, object);
|
||||
TestHandleJSBinding(browser, frame, context->GetGlobal());
|
||||
}
|
||||
|
||||
void TestHandleJSBinding(CefRefPtr<CefBrowser> browser,
|
||||
@ -453,10 +453,13 @@ public:
|
||||
DestroyTest();
|
||||
}
|
||||
|
||||
virtual void OnJSBinding(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Value> object) OVERRIDE
|
||||
virtual void OnContextCreated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) OVERRIDE
|
||||
{
|
||||
// Retrieve the 'window' object.
|
||||
CefRefPtr<CefV8Value> object = context->GetGlobal();
|
||||
|
||||
// Create the functions that will be used during the test.
|
||||
CefRefPtr<CefV8Value> obj = CefV8Value::CreateObject(NULL, NULL);
|
||||
CefRefPtr<CefV8Handler> handler = new TestHandler(this);
|
||||
@ -683,10 +686,13 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
virtual void OnJSBinding(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Value> object) OVERRIDE
|
||||
virtual void OnContextCreated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) OVERRIDE
|
||||
{
|
||||
// Retrieve the 'window' object.
|
||||
CefRefPtr<CefV8Value> object = context->GetGlobal();
|
||||
|
||||
CefRefPtr<CefV8Context> cc = CefV8Context::GetCurrentContext();
|
||||
CefRefPtr<CefBrowser> currentBrowser = cc->GetBrowser();
|
||||
CefRefPtr<CefFrame> currentFrame = cc->GetFrame();
|
||||
@ -1374,10 +1380,13 @@ public:
|
||||
nav_++;
|
||||
}
|
||||
|
||||
virtual void OnJSBinding(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Value> object) OVERRIDE
|
||||
virtual void OnContextCreated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) OVERRIDE
|
||||
{
|
||||
// Retrieve the 'window' object.
|
||||
CefRefPtr<CefV8Value> object = context->GetGlobal();
|
||||
|
||||
if (nav_ == 0) {
|
||||
// Create an object without any internal values.
|
||||
CefRefPtr<CefV8Value> obj1 = CefV8Value::CreateObject(NULL, NULL);
|
||||
@ -1669,10 +1678,13 @@ public:
|
||||
3, false));
|
||||
}
|
||||
|
||||
virtual void OnJSBinding(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Value> object) OVERRIDE
|
||||
virtual void OnContextCreated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) OVERRIDE
|
||||
{
|
||||
// Retrieve the 'window' object.
|
||||
CefRefPtr<CefV8Value> object = context->GetGlobal();
|
||||
|
||||
// Create the functions that will be used during the test.
|
||||
CefRefPtr<CefV8Value> obj = CefV8Value::CreateObject(NULL, NULL);
|
||||
CefRefPtr<CefV8Handler> handler = new TestHandler(this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user