libcef: Update due to underlying chromium changes.

- security_info attribute added to OnCompletedRequest() in ResourceLoaderBridge.
- More functions moved into webkit_glue::WebKitClientImpl.
- First parameter of WebViewDelegate::RunJavaScript*() methods changed from WebView pointer to WebFrame pointer.
- np_v8object.h renamed to NPV8Object.h and other related naming changes.
- Add support for v8 gears and interval extensions.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@21 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2009-03-09 19:38:59 +00:00
parent 74bb6d6e74
commit d942863661
8 changed files with 82 additions and 64 deletions

View File

@ -21,3 +21,4 @@ Date | CEF Revision | Chromium Revision
2009-02-04 | /trunk@14 | /trunk@9172
2009-02-12 | /trunk@15 | /trunk@9652
2009-03-05 | /trunk@17 | /trunk@10987
2009-03-09 | /trunk@21 | /trunk@11252

View File

@ -182,9 +182,10 @@ class RequestProxy : public URLRequest::Delegate,
peer_->OnReceivedData(buf_copy.get(), bytes_read);
}
void NotifyCompletedRequest(const URLRequestStatus& status) {
void NotifyCompletedRequest(const URLRequestStatus& status,
const std::string& security_info) {
if (peer_) {
peer_->OnCompletedRequest(status);
peer_->OnCompletedRequest(status, security_info);
DropPeer(); // ensure no further notifications
}
}
@ -235,7 +236,8 @@ class RequestProxy : public URLRequest::Delegate,
if(rv == RV_HANDLED) {
// cancel the resource load
handled = true;
OnCompletedRequest(URLRequestStatus(URLRequestStatus::CANCELED, 0));
OnCompletedRequest(URLRequestStatus(URLRequestStatus::CANCELED, 0),
std::string());
} else if(!redirectUrl.empty()) {
// redirect to the specified URL
params->url = GURL(WideToUTF8(redirectUrl));
@ -334,9 +336,10 @@ class RequestProxy : public URLRequest::Delegate,
this, &RequestProxy::NotifyReceivedData, bytes_read));
}
virtual void OnCompletedRequest(const URLRequestStatus& status) {
virtual void OnCompletedRequest(const URLRequestStatus& status,
const std::string& security_info) {
owner_loop_->PostTask(FROM_HERE, NewRunnableMethod(
this, &RequestProxy::NotifyCompletedRequest, status));
this, &RequestProxy::NotifyCompletedRequest, status, security_info));
}
// --------------------------------------------------------------------------
@ -377,11 +380,12 @@ class RequestProxy : public URLRequest::Delegate,
void Done() {
if(resource_stream_.get()) {
// Resource stream reads always complete successfully
OnCompletedRequest(URLRequestStatus(URLRequestStatus::SUCCESS, 0));
OnCompletedRequest(URLRequestStatus(URLRequestStatus::SUCCESS, 0),
std::string());
resource_stream_ = NULL;
} else {
DCHECK(request_.get());
OnCompletedRequest(request_->status());
OnCompletedRequest(request_->status(), std::string());
request_.reset(); // destroy on the io thread
}
}
@ -437,7 +441,8 @@ class SyncRequestProxy : public RequestProxy {
AsyncReadData(); // read more (may recurse)
}
virtual void OnCompletedRequest(const URLRequestStatus& status) {
virtual void OnCompletedRequest(const URLRequestStatus& status,
const std::string& security_info) {
result_->status = status;
event_.Signal();
}
@ -620,15 +625,6 @@ bool FindProxyForUrl(const GURL& url, std::string* proxy_list) {
return rv == net::OK;
}
void SetCookie(const GURL& url, const GURL& policy_url,
const std::string& cookie) {
BrowserResourceLoaderBridge::SetCookie(url, policy_url, cookie);
}
std::string GetCookies(const GURL& url, const GURL& policy_url) {
return BrowserResourceLoaderBridge::GetCookies(url, policy_url);
}
} // namespace webkit_glue
//-----------------------------------------------------------------------------

View File

@ -90,15 +90,6 @@ std::string GetDataResource(int resource_id) {
}
}
#if defined(OS_MACOSX)
SkBitmap*
#else
GlueBitmap*
#endif
GetBitmapResource(int resource_id) {
return NULL;
}
bool GetApplicationDirectory(std::wstring *path) {
return PathService::Get(base::DIR_EXE, path);
}
@ -150,14 +141,6 @@ std::string GetDocumentString(WebFrame* frame) {
return StringToStdString(WebCore::createMarkup(core_frame->document()));
}
uint64 VisitedLinkHash(const char* canonical_url, size_t length) {
return 0;
}
bool IsLinkVisited(uint64 link_hash) {
return false;
}
ScreenInfo GetScreenInfo(gfx::NativeViewId window) {
return GetScreenInfoHelper(gfx::NativeViewFromId(window));
}

View File

@ -10,8 +10,11 @@
#include "webkit/glue/simple_webmimeregistry_impl.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/webkitclient_impl.h"
#include "webkit/extensions/v8/gears_extension.h"
#include "webkit/extensions/v8/interval_extension.h"
#include "browser_resource_loader_bridge.h"
#include "WebCString.h"
#include "WebKit.h"
#include "WebString.h"
#include "WebURL.h"
@ -23,6 +26,8 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
WebKit::setLayoutTestMode(false);
WebKit::registerURLSchemeAsLocal(
ASCIIToUTF16(webkit_glue::GetUIResourceProtocol()));
WebKit::registerExtension(extensions_v8::GearsExtension::Get());
WebKit::registerExtension(extensions_v8::IntervalExtension::Get());
}
~BrowserWebKitInit() {
@ -33,6 +38,14 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
return &mime_registry_;
}
virtual uint64_t visitedLinkHash(const char* canonicalURL, size_t length) {
return 0;
}
virtual bool isLinkVisited(uint64_t linkHash) {
return false;
}
virtual void setCookies(
const WebKit::WebURL& url, const WebKit::WebURL& policy_url,
const WebKit::WebString& value) {
@ -47,10 +60,35 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
virtual void prefetchHostName(const WebKit::WebString&) {
}
virtual WebKit::WebCString loadResource(const char* name) {
if (!strcmp(name, "deleteButton")) {
// Create a red 30x30 square.
const char red_square[] =
"\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52"
"\x00\x00\x00\x1e\x00\x00\x00\x1e\x04\x03\x00\x00\x00\xc9\x1e\xb3"
"\x91\x00\x00\x00\x30\x50\x4c\x54\x45\x00\x00\x00\x80\x00\x00\x00"
"\x80\x00\x80\x80\x00\x00\x00\x80\x80\x00\x80\x00\x80\x80\x80\x80"
"\x80\xc0\xc0\xc0\xff\x00\x00\x00\xff\x00\xff\xff\x00\x00\x00\xff"
"\xff\x00\xff\x00\xff\xff\xff\xff\xff\x7b\x1f\xb1\xc4\x00\x00\x00"
"\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a"
"\x9c\x18\x00\x00\x00\x17\x49\x44\x41\x54\x78\x01\x63\x98\x89\x0a"
"\x18\x50\xb9\x33\x47\xf9\xa8\x01\x32\xd4\xc2\x03\x00\x33\x84\x0d"
"\x02\x3a\x91\xeb\xa5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60"
"\x82";
return WebKit::WebCString(red_square, arraysize(red_square));
}
return webkit_glue::WebKitClientImpl::loadResource(name);
}
virtual WebKit::WebString defaultLocale() {
return ASCIIToUTF16("en-US");
}
virtual void decrementStatsCounter(const char* name) {}
virtual void incrementStatsCounter(const char* name) {}
virtual void traceEventBegin(const char* name, void* id, const char* extra) {}
virtual void traceEventEnd(const char* name, void* id, const char* extra) {}
private:
webkit_glue::SimpleWebMimeRegistryImpl mime_registry_;
};

View File

@ -311,17 +311,17 @@ void BrowserWebViewDelegate::AddMessageToConsole(WebView* webview,
<< ")";
}
void BrowserWebViewDelegate::RunJavaScriptAlert(WebView* webview,
void BrowserWebViewDelegate::RunJavaScriptAlert(WebFrame* webframe,
const std::wstring& message) {
CefHandler::RetVal rv = RV_CONTINUE;
CefRefPtr<CefHandler> handler = browser_->GetHandler();
if(handler.get())
rv = handler->HandleJSAlert(browser_, message);
if(rv != RV_HANDLED)
ShowJavaScriptAlert(webview, message);
ShowJavaScriptAlert(webframe, message);
}
bool BrowserWebViewDelegate::RunJavaScriptConfirm(WebView* webview,
bool BrowserWebViewDelegate::RunJavaScriptConfirm(WebFrame* webframe,
const std::wstring& message) {
CefHandler::RetVal rv = RV_CONTINUE;
bool retval = false;
@ -329,11 +329,11 @@ bool BrowserWebViewDelegate::RunJavaScriptConfirm(WebView* webview,
if(handler.get())
rv = handler->HandleJSConfirm(browser_, message, retval);
if(rv != RV_HANDLED)
retval = ShowJavaScriptConfirm(webview, message);
retval = ShowJavaScriptConfirm(webframe, message);
return retval;
}
bool BrowserWebViewDelegate::RunJavaScriptPrompt(WebView* webview,
bool BrowserWebViewDelegate::RunJavaScriptPrompt(WebFrame* webframe,
const std::wstring& message, const std::wstring& default_value,
std::wstring* result) {
CefHandler::RetVal rv = RV_CONTINUE;
@ -344,7 +344,7 @@ bool BrowserWebViewDelegate::RunJavaScriptPrompt(WebView* webview,
retval, *result);
}
if(rv != RV_HANDLED)
retval = ShowJavaScriptPrompt(webview, message, default_value, result);
retval = ShowJavaScriptPrompt(webframe, message, default_value, result);
return retval;
}

View File

@ -63,11 +63,11 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
const GURL& url,
const GURL& referrer,
WindowOpenDisposition disposition);
virtual void RunJavaScriptAlert(WebView* webview,
virtual void RunJavaScriptAlert(WebFrame* webframe,
const std::wstring& message);
virtual bool RunJavaScriptConfirm(WebView* webview,
virtual bool RunJavaScriptConfirm(WebFrame* webframe,
const std::wstring& message);
virtual bool RunJavaScriptPrompt(WebView* webview,
virtual bool RunJavaScriptPrompt(WebFrame* webframe,
const std::wstring& message,
const std::wstring& default_value,
std::wstring* result);
@ -226,9 +226,9 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
void UpdateAddressBar(WebView* webView);
// Default handling of JavaScript messages.
void ShowJavaScriptAlert(WebView* webview, const std::wstring& message);
bool ShowJavaScriptConfirm(WebView* webview, const std::wstring& message);
bool ShowJavaScriptPrompt(WebView* webview, const std::wstring& message,
void ShowJavaScriptAlert(WebFrame* webframe, const std::wstring& message);
bool ShowJavaScriptConfirm(WebFrame* webframe, const std::wstring& message);
bool ShowJavaScriptPrompt(WebFrame* webframe, const std::wstring& message,
const std::wstring& default_value, std::wstring* result);
// In the Mac code, this is called to trigger the end of a test after the

View File

@ -352,7 +352,7 @@ end:
// Private methods -----------------------------------------------------------
void BrowserWebViewDelegate::ShowJavaScriptAlert(WebView* webview,
void BrowserWebViewDelegate::ShowJavaScriptAlert(WebFrame* webframe,
const std::wstring& message)
{
// TODO(cef): Think about what we should be showing as the prompt caption
@ -360,7 +360,7 @@ void BrowserWebViewDelegate::ShowJavaScriptAlert(WebView* webview,
browser_->UIT_GetTitle().c_str(), MB_OK | MB_ICONWARNING);
}
bool BrowserWebViewDelegate::ShowJavaScriptConfirm(WebView* webview,
bool BrowserWebViewDelegate::ShowJavaScriptConfirm(WebFrame* webframe,
const std::wstring& message)
{
// TODO(cef): Think about what we should be showing as the prompt caption
@ -370,7 +370,7 @@ bool BrowserWebViewDelegate::ShowJavaScriptConfirm(WebView* webview,
return (rv == IDYES);
}
bool BrowserWebViewDelegate::ShowJavaScriptPrompt(WebView* webview,
bool BrowserWebViewDelegate::ShowJavaScriptPrompt(WebFrame* webframe,
const std::wstring& message,
const std::wstring& default_value,
std::wstring* result)

View File

@ -8,7 +8,7 @@
#include "config.h"
#include <v8.h>
#include "np_v8object.h"
#include "NPV8Object.h"
#include "v8_proxy.h"
#undef LOG
@ -16,8 +16,8 @@
#include "bindings/npruntime.h"
// NPScriptObjectClass defined in webkit\port\bindings\v8\np_v8object.cpp
extern NPClass* NPScriptObjectClass;
// npScriptObjectClass defined in webkit\port\bindings\v8\NPV8Object.cpp
extern NPClass* npScriptObjectClass;
NPObject* _NPN_StringVectorToArrayObject(WebCore::DOMWindow* domwindow,
@ -28,7 +28,7 @@ NPObject* _NPN_StringVectorToArrayObject(WebCore::DOMWindow* domwindow,
v8::String::New(vec[index].c_str(), vec[index].length()));
}
return NPN_CreateScriptObject(0, array, domwindow);
return npCreateV8ScriptObject(0, array, domwindow);
}
NPObject* _NPN_WStringVectorToArrayObject(WebCore::DOMWindow* domwindow,
@ -40,7 +40,7 @@ NPObject* _NPN_WStringVectorToArrayObject(WebCore::DOMWindow* domwindow,
v8::String::New(str.c_str(), str.length()));
}
return NPN_CreateScriptObject(0, array, domwindow);
return npCreateV8ScriptObject(0, array, domwindow);
}
NPObject* _NPN_IntVectorToArrayObject(WebCore::DOMWindow* domwindow,
@ -50,7 +50,7 @@ NPObject* _NPN_IntVectorToArrayObject(WebCore::DOMWindow* domwindow,
array->Set(v8::Integer::New(index), v8::Int32::New(vec[index]));
}
return NPN_CreateScriptObject(0, array, domwindow);
return npCreateV8ScriptObject(0, array, domwindow);
}
NPObject* _NPN_DoubleVectorToArrayObject(WebCore::DOMWindow* domwindow,
@ -60,7 +60,7 @@ NPObject* _NPN_DoubleVectorToArrayObject(WebCore::DOMWindow* domwindow,
array->Set(v8::Integer::New(index), v8::Number::New(vec[index]));
}
return NPN_CreateScriptObject(0, array, domwindow);
return npCreateV8ScriptObject(0, array, domwindow);
}
NPObject* _NPN_BooleanVectorToArrayObject(WebCore::DOMWindow* domwindow,
@ -70,12 +70,12 @@ NPObject* _NPN_BooleanVectorToArrayObject(WebCore::DOMWindow* domwindow,
array->Set(v8::Integer::New(index), v8::Boolean::New(vec[index]));
}
return NPN_CreateScriptObject(0, array, domwindow);
return npCreateV8ScriptObject(0, array, domwindow);
}
bool _NPN_ArrayObjectToStringVector(NPObject* npobject,
std::vector<std::string>& vec) {
if (npobject == NULL || npobject->_class != NPScriptObjectClass)
if (npobject == NULL || npobject->_class != npScriptObjectClass)
return false;
V8NPObject *object = reinterpret_cast<V8NPObject*>(npobject);
@ -98,7 +98,7 @@ bool _NPN_ArrayObjectToStringVector(NPObject* npobject,
bool _NPN_ArrayObjectToWStringVector(NPObject* npobject,
std::vector<std::wstring>& vec) {
if (npobject == NULL || npobject->_class != NPScriptObjectClass)
if (npobject == NULL || npobject->_class != npScriptObjectClass)
return false;
V8NPObject *object = reinterpret_cast<V8NPObject*>(npobject);
@ -121,7 +121,7 @@ bool _NPN_ArrayObjectToWStringVector(NPObject* npobject,
bool _NPN_ArrayObjectToIntVector(NPObject* npobject,
std::vector<int>& vec) {
if (npobject == NULL || npobject->_class != NPScriptObjectClass)
if (npobject == NULL || npobject->_class != npScriptObjectClass)
return false;
V8NPObject *object = reinterpret_cast<V8NPObject*>(npobject);
@ -140,7 +140,7 @@ bool _NPN_ArrayObjectToIntVector(NPObject* npobject,
bool _NPN_ArrayObjectToDoubleVector(NPObject* npobject,
std::vector<double>& vec) {
if (npobject == NULL || npobject->_class != NPScriptObjectClass)
if (npobject == NULL || npobject->_class != npScriptObjectClass)
return false;
V8NPObject *object = reinterpret_cast<V8NPObject*>(npobject);
@ -159,7 +159,7 @@ bool _NPN_ArrayObjectToDoubleVector(NPObject* npobject,
bool _NPN_ArrayObjectToBooleanVector(NPObject* npobject,
std::vector<bool>& vec) {
if (npobject == NULL || npobject->_class != NPScriptObjectClass)
if (npobject == NULL || npobject->_class != npScriptObjectClass)
return false;
V8NPObject *object = reinterpret_cast<V8NPObject*>(npobject);
@ -178,7 +178,7 @@ bool _NPN_ArrayObjectToBooleanVector(NPObject* npobject,
int _NPN_ArrayObjectGetVectorSize(NPObject* npobject)
{
if (npobject == NULL || npobject->_class != NPScriptObjectClass)
if (npobject == NULL || npobject->_class != npScriptObjectClass)
return -1;
V8NPObject *object = reinterpret_cast<V8NPObject*>(npobject);
@ -192,7 +192,7 @@ int _NPN_ArrayObjectGetVectorSize(NPObject* npobject)
bool _NPN_ArrayObjectToVectorTypeHint(NPObject* npobject,
NPVariantType &typehint)
{
if (npobject == NULL || npobject->_class != NPScriptObjectClass)
if (npobject == NULL || npobject->_class != npScriptObjectClass)
return false;
V8NPObject *object = reinterpret_cast<V8NPObject*>(npobject);