libcef: Update due to underlying chromium changes.
- WebKit API changes. - Add WebSocketStreamHandleBridge implementation. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@60 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
faabcb28c5
commit
5186e4a223
|
@ -43,3 +43,4 @@ Date | CEF Revision | Chromium Revision
|
||||||
2009-10-02 | /trunk@51 | /trunk@27900
|
2009-10-02 | /trunk@51 | /trunk@27900
|
||||||
2009-10-12 | /trunk@53 | /trunk@28713
|
2009-10-12 | /trunk@53 | /trunk@28713
|
||||||
2009-10-18 | /trunk@58 | /trunk@29378
|
2009-10-18 | /trunk@58 | /trunk@29378
|
||||||
|
2009-10-21 | /trunk@60 | /trunk@29687
|
||||||
|
|
2
cef.gyp
2
cef.gyp
|
@ -344,6 +344,8 @@
|
||||||
'libcef/browser_request_context.h',
|
'libcef/browser_request_context.h',
|
||||||
'libcef/browser_resource_loader_bridge.cc',
|
'libcef/browser_resource_loader_bridge.cc',
|
||||||
'libcef/browser_resource_loader_bridge.h',
|
'libcef/browser_resource_loader_bridge.h',
|
||||||
|
'libcef/browser_socket_stream_bridge.cc',
|
||||||
|
'libcef/browser_socket_stream_bridge.h',
|
||||||
'libcef/browser_webkit_glue.cc',
|
'libcef/browser_webkit_glue.cc',
|
||||||
'libcef/browser_webkit_glue.h',
|
'libcef/browser_webkit_glue.h',
|
||||||
'libcef/browser_webkit_glue_win.cc',
|
'libcef/browser_webkit_glue_win.cc',
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
#include "browser_drag_delegate.h"
|
#include "browser_drag_delegate.h"
|
||||||
|
|
||||||
#include "webkit/api/public/WebPoint.h"
|
#include "webkit/api/public/WebPoint.h"
|
||||||
#include "webkit/glue/webview.h"
|
#include "webkit/api/public/WebView.h"
|
||||||
|
|
||||||
using WebKit::WebPoint;
|
using WebKit::WebPoint;
|
||||||
|
using WebKit::WebView;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,13 @@
|
||||||
|
|
||||||
#include "base/base_drag_source.h"
|
#include "base/base_drag_source.h"
|
||||||
|
|
||||||
|
namespace WebKit {
|
||||||
class WebView;
|
class WebView;
|
||||||
|
}
|
||||||
|
|
||||||
class BrowserDragDelegate : public BaseDragSource {
|
class BrowserDragDelegate : public BaseDragSource {
|
||||||
public:
|
public:
|
||||||
BrowserDragDelegate(HWND source_hwnd, WebView* webview)
|
BrowserDragDelegate(HWND source_hwnd, WebKit::WebView* webview)
|
||||||
: BaseDragSource(),
|
: BaseDragSource(),
|
||||||
source_hwnd_(source_hwnd),
|
source_hwnd_(source_hwnd),
|
||||||
webview_(webview) { }
|
webview_(webview) { }
|
||||||
|
@ -26,7 +28,7 @@ class BrowserDragDelegate : public BaseDragSource {
|
||||||
virtual void OnDragSourceMove();
|
virtual void OnDragSourceMove();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WebView* webview_;
|
WebKit::WebView* webview_;
|
||||||
|
|
||||||
// A HWND for the source we are associated with, used for translating
|
// A HWND for the source we are associated with, used for translating
|
||||||
// mouse coordinates from screen to client coordinates.
|
// mouse coordinates from screen to client coordinates.
|
||||||
|
|
|
@ -7,12 +7,13 @@
|
||||||
|
|
||||||
#include "webkit/api/public/WebDragData.h"
|
#include "webkit/api/public/WebDragData.h"
|
||||||
#include "webkit/api/public/WebPoint.h"
|
#include "webkit/api/public/WebPoint.h"
|
||||||
|
#include "webkit/api/public/WebView.h"
|
||||||
#include "webkit/glue/webdropdata.h"
|
#include "webkit/glue/webdropdata.h"
|
||||||
#include "webkit/glue/webview.h"
|
|
||||||
|
|
||||||
using WebKit::WebDragOperation;
|
using WebKit::WebDragOperation;
|
||||||
using WebKit::WebDragOperationCopy;
|
using WebKit::WebDragOperationCopy;
|
||||||
using WebKit::WebPoint;
|
using WebKit::WebPoint;
|
||||||
|
using WebKit::WebView;
|
||||||
|
|
||||||
// BaseDropTarget methods ----------------------------------------------------
|
// BaseDropTarget methods ----------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -10,11 +10,13 @@
|
||||||
|
|
||||||
#include "base/base_drop_target.h"
|
#include "base/base_drop_target.h"
|
||||||
|
|
||||||
|
namespace WebKit {
|
||||||
class WebView;
|
class WebView;
|
||||||
|
}
|
||||||
|
|
||||||
class BrowserDropDelegate : public BaseDropTarget {
|
class BrowserDropDelegate : public BaseDropTarget {
|
||||||
public:
|
public:
|
||||||
BrowserDropDelegate(HWND source_hwnd, WebView* webview)
|
BrowserDropDelegate(HWND source_hwnd, WebKit::WebView* webview)
|
||||||
: BaseDropTarget(source_hwnd),
|
: BaseDropTarget(source_hwnd),
|
||||||
webview_(webview) { }
|
webview_(webview) { }
|
||||||
|
|
||||||
|
@ -36,7 +38,7 @@ class BrowserDropDelegate : public BaseDropTarget {
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WebView* webview_;
|
WebKit::WebView* webview_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _BROWSER_DROP_DELEGATE_H
|
#endif // _BROWSER_DROP_DELEGATE_H
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "webkit/api/public/WebString.h"
|
#include "webkit/api/public/WebString.h"
|
||||||
#include "webkit/api/public/WebURL.h"
|
#include "webkit/api/public/WebURL.h"
|
||||||
#include "webkit/api/public/WebURLRequest.h"
|
#include "webkit/api/public/WebURLRequest.h"
|
||||||
|
#include "webkit/api/public/WebView.h"
|
||||||
#include "webkit/glue/glue_serialize.h"
|
#include "webkit/glue/glue_serialize.h"
|
||||||
#include "webkit/glue/glue_util.h"
|
#include "webkit/glue/glue_util.h"
|
||||||
|
|
||||||
|
@ -23,6 +24,7 @@ using WebKit::WebScriptSource;
|
||||||
using WebKit::WebString;
|
using WebKit::WebString;
|
||||||
using WebKit::WebURL;
|
using WebKit::WebURL;
|
||||||
using WebKit::WebURLRequest;
|
using WebKit::WebURLRequest;
|
||||||
|
using WebKit::WebView;
|
||||||
using webkit_glue::StdStringToWebString;
|
using webkit_glue::StdStringToWebString;
|
||||||
using webkit_glue::WebStringToStdString;
|
using webkit_glue::WebStringToStdString;
|
||||||
|
|
||||||
|
@ -673,3 +675,12 @@ void CefBrowserImpl::UIT_HandleAction(CefHandler::MenuId menuId,
|
||||||
if(frame)
|
if(frame)
|
||||||
frame->Release();
|
frame->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CefFrameImpl
|
||||||
|
|
||||||
|
bool CefFrameImpl::IsFocused()
|
||||||
|
{
|
||||||
|
return (browser_->GetWebFrame(this) ==
|
||||||
|
browser_->GetWebView()->focusedFrame());
|
||||||
|
}
|
||||||
|
|
|
@ -16,7 +16,9 @@
|
||||||
#include "printing/win_printing_context.h"
|
#include "printing/win_printing_context.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "webkit/glue/webview.h"
|
namespace WebKit {
|
||||||
|
class WebView;
|
||||||
|
}
|
||||||
|
|
||||||
#define BUFFER_SIZE 32768
|
#define BUFFER_SIZE 32768
|
||||||
|
|
||||||
|
@ -91,7 +93,7 @@ public:
|
||||||
int startLine);
|
int startLine);
|
||||||
virtual std::wstring GetURL(CefRefPtr<CefFrame> frame);
|
virtual std::wstring GetURL(CefRefPtr<CefFrame> frame);
|
||||||
|
|
||||||
WebView* GetWebView() const {
|
WebKit::WebView* GetWebView() const {
|
||||||
return webviewhost_.get() ? webviewhost_->webview() : NULL;
|
return webviewhost_.get() ? webviewhost_->webview() : NULL;
|
||||||
}
|
}
|
||||||
WebViewHost* GetWebViewHost() const {
|
WebViewHost* GetWebViewHost() const {
|
||||||
|
@ -272,9 +274,7 @@ public:
|
||||||
int startLine)
|
int startLine)
|
||||||
{ return browser_->ExecuteJavaScript(this, jsCode, scriptUrl, startLine); }
|
{ return browser_->ExecuteJavaScript(this, jsCode, scriptUrl, startLine); }
|
||||||
virtual bool IsMain() { return name_.empty(); }
|
virtual bool IsMain() { return name_.empty(); }
|
||||||
virtual bool IsFocused()
|
virtual bool IsFocused();
|
||||||
{ return (browser_->GetWebFrame(this) ==
|
|
||||||
browser_->GetWebView()->focusedFrame()); }
|
|
||||||
virtual std::wstring GetName() { return name_; }
|
virtual std::wstring GetName() { return name_; }
|
||||||
virtual std::wstring GetURL() { return browser_->GetURL(this); }
|
virtual std::wstring GetURL() { return browser_->GetURL(this); }
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "webkit/api/public/WebFrame.h"
|
#include "webkit/api/public/WebFrame.h"
|
||||||
#include "webkit/api/public/WebRect.h"
|
#include "webkit/api/public/WebRect.h"
|
||||||
#include "webkit/api/public/WebSize.h"
|
#include "webkit/api/public/WebSize.h"
|
||||||
|
#include "webkit/api/public/WebView.h"
|
||||||
#include "webkit/glue/webkit_glue.h"
|
#include "webkit/glue/webkit_glue.h"
|
||||||
|
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "browser_appcache_system.h"
|
#include "browser_appcache_system.h"
|
||||||
#include "browser_resource_loader_bridge.h"
|
#include "browser_resource_loader_bridge.h"
|
||||||
#include "browser_request_context.h"
|
#include "browser_request_context.h"
|
||||||
|
#include "browser_socket_stream_bridge.h"
|
||||||
#include "browser_impl.h"
|
#include "browser_impl.h"
|
||||||
#include "request_impl.h"
|
#include "request_impl.h"
|
||||||
|
|
||||||
|
@ -55,9 +56,9 @@
|
||||||
#include "net/proxy/proxy_service.h"
|
#include "net/proxy/proxy_service.h"
|
||||||
#include "net/url_request/url_request.h"
|
#include "net/url_request/url_request.h"
|
||||||
#include "webkit/api/public/WebFrame.h"
|
#include "webkit/api/public/WebFrame.h"
|
||||||
|
#include "webkit/api/public/WebView.h"
|
||||||
#include "webkit/appcache/appcache_interfaces.h"
|
#include "webkit/appcache/appcache_interfaces.h"
|
||||||
#include "webkit/glue/resource_loader_bridge.h"
|
#include "webkit/glue/resource_loader_bridge.h"
|
||||||
#include "webkit/glue/webview.h"
|
|
||||||
|
|
||||||
using webkit_glue::ResourceLoaderBridge;
|
using webkit_glue::ResourceLoaderBridge;
|
||||||
using net::CookiePolicy;
|
using net::CookiePolicy;
|
||||||
|
@ -83,9 +84,11 @@ class IOThread : public base::Thread {
|
||||||
|
|
||||||
virtual void Init() {
|
virtual void Init() {
|
||||||
BrowserAppCacheSystem::InitializeOnIOThread(request_context);
|
BrowserAppCacheSystem::InitializeOnIOThread(request_context);
|
||||||
|
BrowserSocketStreamBridge::InitializeOnIOThread(request_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void CleanUp() {
|
virtual void CleanUp() {
|
||||||
|
BrowserSocketStreamBridge::Cleanup();
|
||||||
if (request_context) {
|
if (request_context) {
|
||||||
request_context->Release();
|
request_context->Release();
|
||||||
request_context = NULL;
|
request_context = NULL;
|
||||||
|
|
|
@ -0,0 +1,227 @@
|
||||||
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "browser_socket_stream_bridge.h"
|
||||||
|
|
||||||
|
#include "base/message_loop.h"
|
||||||
|
#include "base/ref_counted.h"
|
||||||
|
#include "googleurl/src/gurl.h"
|
||||||
|
#include "net/socket_stream/socket_stream.h"
|
||||||
|
#include "net/url_request/url_request_context.h"
|
||||||
|
#include "webkit/api/public/WebSocketStreamHandle.h"
|
||||||
|
#include "webkit/glue/websocketstreamhandle_bridge.h"
|
||||||
|
#include "webkit/glue/websocketstreamhandle_delegate.h"
|
||||||
|
|
||||||
|
using webkit_glue::WebSocketStreamHandleBridge;
|
||||||
|
|
||||||
|
static const int kNoSocketId = 0;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
MessageLoop* g_io_thread;
|
||||||
|
scoped_refptr<URLRequestContext> g_request_context;
|
||||||
|
|
||||||
|
class WebSocketStreamHandleBridgeImpl
|
||||||
|
: public base::RefCountedThreadSafe<WebSocketStreamHandleBridgeImpl>,
|
||||||
|
public WebSocketStreamHandleBridge,
|
||||||
|
public net::SocketStream::Delegate {
|
||||||
|
public:
|
||||||
|
WebSocketStreamHandleBridgeImpl(
|
||||||
|
WebKit::WebSocketStreamHandle* handle,
|
||||||
|
webkit_glue::WebSocketStreamHandleDelegate* delegate);
|
||||||
|
virtual ~WebSocketStreamHandleBridgeImpl();
|
||||||
|
|
||||||
|
// WebSocketStreamHandleBridge methods.
|
||||||
|
virtual void Connect(const GURL& url);
|
||||||
|
virtual bool Send(const std::vector<char>& data);
|
||||||
|
virtual void Close();
|
||||||
|
|
||||||
|
// net::SocketStream::Delegate methods.
|
||||||
|
virtual void OnConnected(net::SocketStream* req,
|
||||||
|
int max_pending_send_allowed);
|
||||||
|
virtual void OnSentData(net::SocketStream* req,
|
||||||
|
int amount_sent);
|
||||||
|
virtual void OnReceivedData(net::SocketStream* req,
|
||||||
|
const char* data, int len);
|
||||||
|
virtual void OnClose(net::SocketStream* req);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Runs on |g_io_thread|;
|
||||||
|
void DoConnect(const GURL& url);
|
||||||
|
void DoSend(std::vector<char>* data);
|
||||||
|
void DoClose();
|
||||||
|
|
||||||
|
// Runs on |message_loop_|;
|
||||||
|
void DoOnConnected(int max_amount_send_allowed);
|
||||||
|
void DoOnSentData(int amount_sent);
|
||||||
|
void DoOnReceivedData(std::vector<char>* data);
|
||||||
|
void DoOnClose(webkit_glue::WebSocketStreamHandleDelegate* delegate);
|
||||||
|
|
||||||
|
int socket_id_;
|
||||||
|
MessageLoop* message_loop_;
|
||||||
|
WebKit::WebSocketStreamHandle* handle_;
|
||||||
|
webkit_glue::WebSocketStreamHandleDelegate* delegate_;
|
||||||
|
|
||||||
|
scoped_refptr<net::SocketStream> socket_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(WebSocketStreamHandleBridgeImpl);
|
||||||
|
};
|
||||||
|
|
||||||
|
WebSocketStreamHandleBridgeImpl::WebSocketStreamHandleBridgeImpl(
|
||||||
|
WebKit::WebSocketStreamHandle* handle,
|
||||||
|
webkit_glue::WebSocketStreamHandleDelegate* delegate)
|
||||||
|
: socket_id_(kNoSocketId),
|
||||||
|
message_loop_(MessageLoop::current()),
|
||||||
|
handle_(handle),
|
||||||
|
delegate_(delegate) {
|
||||||
|
}
|
||||||
|
|
||||||
|
WebSocketStreamHandleBridgeImpl::~WebSocketStreamHandleBridgeImpl() {
|
||||||
|
CHECK(socket_id_ == kNoSocketId);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebSocketStreamHandleBridgeImpl::Connect(const GURL& url) {
|
||||||
|
CHECK(g_io_thread);
|
||||||
|
AddRef(); // Released in DoOnClose().
|
||||||
|
g_io_thread->PostTask(
|
||||||
|
FROM_HERE,
|
||||||
|
NewRunnableMethod(this, &WebSocketStreamHandleBridgeImpl::DoConnect,
|
||||||
|
url));
|
||||||
|
if (delegate_)
|
||||||
|
delegate_->WillOpenStream(handle_, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WebSocketStreamHandleBridgeImpl::Send(
|
||||||
|
const std::vector<char>& data) {
|
||||||
|
CHECK(g_io_thread);
|
||||||
|
g_io_thread->PostTask(
|
||||||
|
FROM_HERE,
|
||||||
|
NewRunnableMethod(this, &WebSocketStreamHandleBridgeImpl::DoSend,
|
||||||
|
new std::vector<char>(data)));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebSocketStreamHandleBridgeImpl::Close() {
|
||||||
|
CHECK(g_io_thread);
|
||||||
|
g_io_thread->PostTask(
|
||||||
|
FROM_HERE,
|
||||||
|
NewRunnableMethod(this, &WebSocketStreamHandleBridgeImpl::DoClose));
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebSocketStreamHandleBridgeImpl::OnConnected(
|
||||||
|
net::SocketStream* socket, int max_pending_send_allowed) {
|
||||||
|
message_loop_->PostTask(
|
||||||
|
FROM_HERE,
|
||||||
|
NewRunnableMethod(this, &WebSocketStreamHandleBridgeImpl::DoOnConnected,
|
||||||
|
max_pending_send_allowed));
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebSocketStreamHandleBridgeImpl::OnSentData(
|
||||||
|
net::SocketStream* socket, int amount_sent) {
|
||||||
|
message_loop_->PostTask(
|
||||||
|
FROM_HERE,
|
||||||
|
NewRunnableMethod(this, &WebSocketStreamHandleBridgeImpl::DoOnSentData,
|
||||||
|
amount_sent));
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebSocketStreamHandleBridgeImpl::OnReceivedData(
|
||||||
|
net::SocketStream* socket, const char* data, int len) {
|
||||||
|
message_loop_->PostTask(
|
||||||
|
FROM_HERE,
|
||||||
|
NewRunnableMethod(this,
|
||||||
|
&WebSocketStreamHandleBridgeImpl::DoOnReceivedData,
|
||||||
|
new std::vector<char>(data, data + len)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebSocketStreamHandleBridgeImpl::OnClose(net::SocketStream* socket) {
|
||||||
|
webkit_glue::WebSocketStreamHandleDelegate* delegate = delegate_;
|
||||||
|
delegate_ = NULL;
|
||||||
|
socket_ = 0;
|
||||||
|
socket_id_ = kNoSocketId;
|
||||||
|
message_loop_->PostTask(
|
||||||
|
FROM_HERE,
|
||||||
|
NewRunnableMethod(this, &WebSocketStreamHandleBridgeImpl::DoOnClose,
|
||||||
|
delegate));
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebSocketStreamHandleBridgeImpl::DoConnect(const GURL& url) {
|
||||||
|
CHECK(MessageLoop::current() == g_io_thread);
|
||||||
|
socket_ = new net::SocketStream(url, this);
|
||||||
|
socket_->set_context(g_request_context);
|
||||||
|
socket_->Connect();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebSocketStreamHandleBridgeImpl::DoSend(std::vector<char>* data) {
|
||||||
|
CHECK(MessageLoop::current() == g_io_thread);
|
||||||
|
scoped_ptr<std::vector<char> > scoped_data(data);
|
||||||
|
if (!socket_)
|
||||||
|
return;
|
||||||
|
if (!socket_->SendData(&(data->at(0)), data->size()))
|
||||||
|
socket_->Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebSocketStreamHandleBridgeImpl::DoClose() {
|
||||||
|
CHECK(MessageLoop::current() == g_io_thread);
|
||||||
|
if (!socket_)
|
||||||
|
return;
|
||||||
|
socket_->Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebSocketStreamHandleBridgeImpl::DoOnConnected(
|
||||||
|
int max_pending_send_allowed) {
|
||||||
|
CHECK(MessageLoop::current() == message_loop_);
|
||||||
|
if (delegate_)
|
||||||
|
delegate_->DidOpenStream(handle_, max_pending_send_allowed);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebSocketStreamHandleBridgeImpl::DoOnSentData(int amount_sent) {
|
||||||
|
CHECK(MessageLoop::current() == message_loop_);
|
||||||
|
if (delegate_)
|
||||||
|
delegate_->DidSendData(handle_, amount_sent);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebSocketStreamHandleBridgeImpl::DoOnReceivedData(
|
||||||
|
std::vector<char>* data) {
|
||||||
|
CHECK(MessageLoop::current() == message_loop_);
|
||||||
|
scoped_ptr<std::vector<char> > scoped_data(data);
|
||||||
|
if (delegate_)
|
||||||
|
delegate_->DidReceiveData(handle_, &(data->at(0)), data->size());
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebSocketStreamHandleBridgeImpl::DoOnClose(
|
||||||
|
webkit_glue::WebSocketStreamHandleDelegate* delegate) {
|
||||||
|
CHECK(MessageLoop::current() == message_loop_);
|
||||||
|
CHECK(!socket_);
|
||||||
|
if (delegate)
|
||||||
|
delegate->DidClose(handle_);
|
||||||
|
Release();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
void BrowserSocketStreamBridge::InitializeOnIOThread(
|
||||||
|
URLRequestContext* request_context) {
|
||||||
|
g_io_thread = MessageLoop::current();
|
||||||
|
g_request_context = request_context;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BrowserSocketStreamBridge::Cleanup() {
|
||||||
|
g_io_thread = NULL;
|
||||||
|
g_request_context = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace webkit_glue {
|
||||||
|
|
||||||
|
/* static */
|
||||||
|
WebSocketStreamHandleBridge* WebSocketStreamHandleBridge::Create(
|
||||||
|
WebKit::WebSocketStreamHandle* handle,
|
||||||
|
WebSocketStreamHandleDelegate* delegate) {
|
||||||
|
return new WebSocketStreamHandleBridgeImpl(handle, delegate);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace webkit_glue
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#ifndef _BROWSER_SOCKET_STREAM_BRIDGE_H
|
||||||
|
#define _BROWSER_SOCKET_STREAM_BRIDGE_H
|
||||||
|
|
||||||
|
class URLRequestContext;
|
||||||
|
|
||||||
|
class BrowserSocketStreamBridge {
|
||||||
|
public:
|
||||||
|
static void InitializeOnIOThread(URLRequestContext* request_context);
|
||||||
|
static void Cleanup();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _BROWSER_SOCKET_STREAM_BRIDGE_H
|
|
@ -12,15 +12,15 @@
|
||||||
|
|
||||||
namespace WebKit {
|
namespace WebKit {
|
||||||
class WebFrame;
|
class WebFrame;
|
||||||
}
|
|
||||||
class WebView;
|
class WebView;
|
||||||
|
}
|
||||||
|
|
||||||
namespace webkit_glue {
|
namespace webkit_glue {
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
// Capture a bitmap of the web view.
|
// Capture a bitmap of the web view.
|
||||||
void CaptureWebViewBitmap(HWND mainWnd, WebView* webview, HBITMAP& bitmap,
|
void CaptureWebViewBitmap(HWND mainWnd, WebKit::WebView* webview,
|
||||||
SIZE& size);
|
HBITMAP& bitmap, SIZE& size);
|
||||||
|
|
||||||
// Save a bitmap image to file, providing optional alternative data in |lpBits|
|
// Save a bitmap image to file, providing optional alternative data in |lpBits|
|
||||||
BOOL SaveBitmapToFile(HBITMAP hBmp, HDC hDC, LPCTSTR file, LPBYTE lpBits);
|
BOOL SaveBitmapToFile(HBITMAP hBmp, HDC hDC, LPCTSTR file, LPBYTE lpBits);
|
||||||
|
|
|
@ -22,12 +22,13 @@ MSVC_POP_WARNING();
|
||||||
#include "skia/ext/platform_canvas.h"
|
#include "skia/ext/platform_canvas.h"
|
||||||
#include "webkit/api/public/WebRect.h"
|
#include "webkit/api/public/WebRect.h"
|
||||||
#include "webkit/api/public/WebSize.h"
|
#include "webkit/api/public/WebSize.h"
|
||||||
|
#include "webkit/api/public/WebView.h"
|
||||||
#include "webkit/glue/webkit_glue.h"
|
#include "webkit/glue/webkit_glue.h"
|
||||||
#include "webkit/glue/webview.h"
|
|
||||||
#include "webkit/glue/plugins/plugin_list.h"
|
#include "webkit/glue/plugins/plugin_list.h"
|
||||||
|
|
||||||
using WebKit::WebRect;
|
using WebKit::WebRect;
|
||||||
using WebKit::WebSize;
|
using WebKit::WebSize;
|
||||||
|
using WebKit::WebView;
|
||||||
|
|
||||||
namespace webkit_glue {
|
namespace webkit_glue {
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
||||||
ASCIIToUTF16(webkit_glue::GetUIResourceProtocol()));
|
ASCIIToUTF16(webkit_glue::GetUIResourceProtocol()));
|
||||||
WebKit::registerExtension(extensions_v8::GearsExtension::Get());
|
WebKit::registerExtension(extensions_v8::GearsExtension::Get());
|
||||||
WebKit::registerExtension(extensions_v8::IntervalExtension::Get());
|
WebKit::registerExtension(extensions_v8::IntervalExtension::Get());
|
||||||
|
WebKit::enableWebSockets();
|
||||||
|
|
||||||
// Load libraries for media and enable the media player.
|
// Load libraries for media and enable the media player.
|
||||||
FilePath module_path;
|
FilePath module_path;
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "webkit/api/public/WebURLError.h"
|
#include "webkit/api/public/WebURLError.h"
|
||||||
#include "webkit/api/public/WebURLRequest.h"
|
#include "webkit/api/public/WebURLRequest.h"
|
||||||
#include "webkit/api/public/WebURLResponse.h"
|
#include "webkit/api/public/WebURLResponse.h"
|
||||||
|
#include "webkit/api/public/WebView.h"
|
||||||
#include "webkit/glue/glue_serialize.h"
|
#include "webkit/glue/glue_serialize.h"
|
||||||
#include "webkit/glue/glue_util.h"
|
#include "webkit/glue/glue_util.h"
|
||||||
#include "webkit/glue/media/buffered_data_source.h"
|
#include "webkit/glue/media/buffered_data_source.h"
|
||||||
|
@ -54,7 +55,6 @@
|
||||||
#include "webkit/glue/webplugin_impl.h"
|
#include "webkit/glue/webplugin_impl.h"
|
||||||
#include "webkit/glue/webpreferences.h"
|
#include "webkit/glue/webpreferences.h"
|
||||||
#include "webkit/glue/webkit_glue.h"
|
#include "webkit/glue/webkit_glue.h"
|
||||||
#include "webkit/glue/webview.h"
|
|
||||||
#include "webkit/glue/plugins/plugin_list.h"
|
#include "webkit/glue/plugins/plugin_list.h"
|
||||||
#include "webkit/glue/plugins/webplugin_delegate_impl.h"
|
#include "webkit/glue/plugins/webplugin_delegate_impl.h"
|
||||||
#include "webkit/glue/webmediaplayer_impl.h"
|
#include "webkit/glue/webmediaplayer_impl.h"
|
||||||
|
@ -98,6 +98,7 @@ using WebKit::WebURL;
|
||||||
using WebKit::WebURLError;
|
using WebKit::WebURLError;
|
||||||
using WebKit::WebURLRequest;
|
using WebKit::WebURLRequest;
|
||||||
using WebKit::WebURLResponse;
|
using WebKit::WebURLResponse;
|
||||||
|
using WebKit::WebView;
|
||||||
using WebKit::WebWidget;
|
using WebKit::WebWidget;
|
||||||
using WebKit::WebWorker;
|
using WebKit::WebWorker;
|
||||||
using WebKit::WebWorkerClient;
|
using WebKit::WebWorkerClient;
|
||||||
|
@ -543,6 +544,33 @@ WebNavigationPolicy BrowserWebViewDelegate::decidePolicyForNavigation(
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BrowserWebViewDelegate::canHandleRequest(
|
||||||
|
WebFrame* frame, const WebURLRequest& request) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
WebURLError BrowserWebViewDelegate::cannotHandleRequestError(
|
||||||
|
WebFrame* frame, const WebURLRequest& request) {
|
||||||
|
WebURLError error;
|
||||||
|
error.domain = WebString::fromUTF8(net::kErrorDomain);
|
||||||
|
error.reason = net::ERR_ABORTED;
|
||||||
|
error.unreachableURL = request.url();
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
WebURLError BrowserWebViewDelegate::cancelledError(
|
||||||
|
WebFrame* frame, const WebURLRequest& request) {
|
||||||
|
WebURLError error;
|
||||||
|
error.domain = WebString::fromUTF8(net::kErrorDomain);
|
||||||
|
error.reason = net::ERR_ABORTED;
|
||||||
|
error.unreachableURL = request.url();
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BrowserWebViewDelegate::unableToImplementPolicyWithError(
|
||||||
|
WebFrame* frame, const WebURLError& error) {
|
||||||
|
}
|
||||||
|
|
||||||
void BrowserWebViewDelegate::willSubmitForm(WebFrame* frame, const WebForm&) {
|
void BrowserWebViewDelegate::willSubmitForm(WebFrame* frame, const WebForm&) {
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,9 @@
|
||||||
#include "webkit/api/public/WebContextMenuData.h"
|
#include "webkit/api/public/WebContextMenuData.h"
|
||||||
#include "webkit/api/public/WebFrameClient.h"
|
#include "webkit/api/public/WebFrameClient.h"
|
||||||
#include "webkit/api/public/WebRect.h"
|
#include "webkit/api/public/WebRect.h"
|
||||||
|
#include "webkit/api/public/WebViewClient.h"
|
||||||
#include "webkit/glue/webcursor.h"
|
#include "webkit/glue/webcursor.h"
|
||||||
#include "webkit/glue/webplugin_page_delegate.h"
|
#include "webkit/glue/webplugin_page_delegate.h"
|
||||||
#include "webkit/glue/webview_delegate.h"
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include "browser_drag_delegate.h"
|
#include "browser_drag_delegate.h"
|
||||||
#include "browser_drop_delegate.h"
|
#include "browser_drop_delegate.h"
|
||||||
|
@ -38,13 +38,13 @@ struct WebPreferences;
|
||||||
class GURL;
|
class GURL;
|
||||||
class WebWidgetHost;
|
class WebWidgetHost;
|
||||||
|
|
||||||
class BrowserWebViewDelegate : public WebViewDelegate,
|
class BrowserWebViewDelegate : public WebKit::WebViewClient,
|
||||||
public WebKit::WebFrameClient,
|
public WebKit::WebFrameClient,
|
||||||
public webkit_glue::WebPluginPageDelegate,
|
public webkit_glue::WebPluginPageDelegate,
|
||||||
public base::SupportsWeakPtr<BrowserWebViewDelegate> {
|
public base::SupportsWeakPtr<BrowserWebViewDelegate> {
|
||||||
public:
|
public:
|
||||||
// WebKit::WebViewClient
|
// WebKit::WebViewClient
|
||||||
virtual WebView* createView(WebKit::WebFrame* creator);
|
virtual WebKit::WebView* createView(WebKit::WebFrame* creator);
|
||||||
virtual WebKit::WebWidget* createPopupMenu(bool activatable);
|
virtual WebKit::WebWidget* createPopupMenu(bool activatable);
|
||||||
virtual WebKit::WebWidget* createPopupMenu(
|
virtual WebKit::WebWidget* createPopupMenu(
|
||||||
const WebKit::WebPopupMenuInfo& info);
|
const WebKit::WebPopupMenuInfo& info);
|
||||||
|
@ -156,6 +156,14 @@ class BrowserWebViewDelegate : public WebViewDelegate,
|
||||||
WebKit::WebFrame*, const WebKit::WebURLRequest&,
|
WebKit::WebFrame*, const WebKit::WebURLRequest&,
|
||||||
WebKit::WebNavigationType, const WebKit::WebNode&,
|
WebKit::WebNavigationType, const WebKit::WebNode&,
|
||||||
WebKit::WebNavigationPolicy default_policy, bool isRedirect);
|
WebKit::WebNavigationPolicy default_policy, bool isRedirect);
|
||||||
|
virtual bool canHandleRequest(
|
||||||
|
WebKit::WebFrame*, const WebKit::WebURLRequest&);
|
||||||
|
virtual WebKit::WebURLError cannotHandleRequestError(
|
||||||
|
WebKit::WebFrame*, const WebKit::WebURLRequest& request);
|
||||||
|
virtual WebKit::WebURLError cancelledError(
|
||||||
|
WebKit::WebFrame*, const WebKit::WebURLRequest& request);
|
||||||
|
virtual void unableToImplementPolicyWithError(
|
||||||
|
WebKit::WebFrame*, const WebKit::WebURLError&);
|
||||||
virtual void willSubmitForm(WebKit::WebFrame*, const WebKit::WebForm&);
|
virtual void willSubmitForm(WebKit::WebFrame*, const WebKit::WebForm&);
|
||||||
virtual void willPerformClientRedirect(
|
virtual void willPerformClientRedirect(
|
||||||
WebKit::WebFrame*, const WebKit::WebURL& from, const WebKit::WebURL& to,
|
WebKit::WebFrame*, const WebKit::WebURL& from, const WebKit::WebURL& to,
|
||||||
|
@ -275,7 +283,7 @@ class BrowserWebViewDelegate : public WebViewDelegate,
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Called when the URL of the page changes.
|
// Called when the URL of the page changes.
|
||||||
void UpdateAddressBar(WebView* webView);
|
void UpdateAddressBar(WebKit::WebView* webView);
|
||||||
|
|
||||||
// Default handling of JavaScript messages.
|
// Default handling of JavaScript messages.
|
||||||
void ShowJavaScriptAlert(WebKit::WebFrame* webframe,
|
void ShowJavaScriptAlert(WebKit::WebFrame* webframe,
|
||||||
|
|
|
@ -29,11 +29,11 @@
|
||||||
#include "webkit/api/public/WebCursorInfo.h"
|
#include "webkit/api/public/WebCursorInfo.h"
|
||||||
#include "webkit/api/public/WebFrame.h"
|
#include "webkit/api/public/WebFrame.h"
|
||||||
#include "webkit/api/public/WebRect.h"
|
#include "webkit/api/public/WebRect.h"
|
||||||
|
#include "webkit/api/public/WebView.h"
|
||||||
#include "webkit/glue/webdropdata.h"
|
#include "webkit/glue/webdropdata.h"
|
||||||
#include "webkit/glue/webpreferences.h"
|
#include "webkit/glue/webpreferences.h"
|
||||||
#include "webkit/glue/webplugin.h"
|
#include "webkit/glue/webplugin.h"
|
||||||
#include "webkit/glue/webkit_glue.h"
|
#include "webkit/glue/webkit_glue.h"
|
||||||
#include "webkit/glue/webview.h"
|
|
||||||
#include "webkit/glue/plugins/plugin_list.h"
|
#include "webkit/glue/plugins/plugin_list.h"
|
||||||
#include "webkit/glue/plugins/webplugin_delegate_impl.h"
|
#include "webkit/glue/plugins/webplugin_delegate_impl.h"
|
||||||
#include "webkit/glue/window_open_disposition.h"
|
#include "webkit/glue/window_open_disposition.h"
|
||||||
|
|
|
@ -8,8 +8,10 @@
|
||||||
#include "base/gfx/rect.h"
|
#include "base/gfx/rect.h"
|
||||||
#include "base/gfx/size.h"
|
#include "base/gfx/size.h"
|
||||||
#include "base/win_util.h"
|
#include "base/win_util.h"
|
||||||
|
#include "webkit/api/public/WebView.h"
|
||||||
#include "webkit/glue/webpreferences.h"
|
#include "webkit/glue/webpreferences.h"
|
||||||
#include "webkit/glue/webview.h"
|
|
||||||
|
using namespace WebKit;
|
||||||
|
|
||||||
static const wchar_t kWindowClassName[] = L"WebViewHost";
|
static const wchar_t kWindowClassName[] = L"WebViewHost";
|
||||||
|
|
||||||
|
@ -38,7 +40,7 @@ WebViewHost* WebViewHost::Create(HWND parent_view,
|
||||||
GetModuleHandle(NULL), NULL);
|
GetModuleHandle(NULL), NULL);
|
||||||
win_util::SetWindowUserData(host->view_, host);
|
win_util::SetWindowUserData(host->view_, host);
|
||||||
|
|
||||||
host->webwidget_ = WebView::Create(delegate);
|
host->webwidget_ = WebView::create(delegate);
|
||||||
prefs.Apply(host->webview());
|
prefs.Apply(host->webview());
|
||||||
host->webview()->initializeMainFrame(delegate);
|
host->webview()->initializeMainFrame(delegate);
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,12 @@
|
||||||
#include "webwidget_host.h"
|
#include "webwidget_host.h"
|
||||||
|
|
||||||
struct WebPreferences;
|
struct WebPreferences;
|
||||||
class WebView;
|
|
||||||
class BrowserWebViewDelegate;
|
class BrowserWebViewDelegate;
|
||||||
|
|
||||||
|
namespace WebKit {
|
||||||
|
class WebView;
|
||||||
|
}
|
||||||
|
|
||||||
// This class is a simple ViewHandle-based host for a WebView
|
// This class is a simple ViewHandle-based host for a WebView
|
||||||
class WebViewHost : public WebWidgetHost {
|
class WebViewHost : public WebWidgetHost {
|
||||||
public:
|
public:
|
||||||
|
@ -24,7 +27,7 @@ class WebViewHost : public WebWidgetHost {
|
||||||
BrowserWebViewDelegate* delegate,
|
BrowserWebViewDelegate* delegate,
|
||||||
const WebPreferences& prefs);
|
const WebPreferences& prefs);
|
||||||
|
|
||||||
WebView* webview() const;
|
WebKit::WebView* webview() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
|
|
Loading…
Reference in New Issue