mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-02 20:26:59 +01:00
libcef: Update due to underlying chromium changes.
- Modifications due to WebFrame moving from webkit/glue to webkit/api - Remove the ATL dependency from browser_drag_delegate.cc - Use scoped_refptr instead of scoped_ptr for BrowserWebViewDelegate pointers in CefBrowserImpl. - Allow cancellation of redirects before they're sent in browser_resource_loader_bridge.cc - Enable remote fonts, local storage and session storage in context.cc - Add vsprops files to the libcef project that used to exist in the webkit/build directory git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@34 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
ea3a49abe1
commit
cbb3124475
@ -33,3 +33,4 @@ Date | CEF Revision | Chromium Revision
|
||||
2009-05-15 | /trunk@24 | /trunk@16080
|
||||
2009-06-02 | /trunk@28 | /trunk@17397
|
||||
2009-07-24 | /trunk@32 | /trunk@21529
|
||||
2009-08-13 | /trunk@34 | /trunk@23266
|
||||
|
@ -6,8 +6,6 @@
|
||||
#include "precompiled_libcef.h"
|
||||
#include "browser_drag_delegate.h"
|
||||
|
||||
#include <atltypes.h>
|
||||
|
||||
#include "webkit/api/public/WebPoint.h"
|
||||
#include "webkit/glue/webview.h"
|
||||
|
||||
@ -16,14 +14,18 @@ using WebKit::WebPoint;
|
||||
|
||||
namespace {
|
||||
|
||||
void GetCursorPositions(HWND hwnd, CPoint* client, CPoint* screen) {
|
||||
void GetCursorPositions(HWND hwnd, gfx::Point* client, gfx::Point* screen) {
|
||||
// GetCursorPos will fail if the input desktop isn't the current desktop.
|
||||
// See http://b/1173534. (0,0) is wrong, but better than uninitialized.
|
||||
if (!GetCursorPos(screen))
|
||||
screen->SetPoint(0, 0);
|
||||
POINT pos;
|
||||
if (!GetCursorPos(&pos)) {
|
||||
pos.x = 0;
|
||||
pos.y = 0;
|
||||
}
|
||||
|
||||
*client = *screen;
|
||||
ScreenToClient(hwnd, client);
|
||||
*screen = gfx::Point(pos);
|
||||
ScreenToClient(hwnd, &pos);
|
||||
*client = gfx::Point(pos);
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
@ -33,17 +35,15 @@ void BrowserDragDelegate::OnDragSourceCancel() {
|
||||
}
|
||||
|
||||
void BrowserDragDelegate::OnDragSourceDrop() {
|
||||
CPoint client;
|
||||
CPoint screen;
|
||||
gfx::Point client;
|
||||
gfx::Point screen;
|
||||
GetCursorPositions(source_hwnd_, &client, &screen);
|
||||
webview_->DragSourceEndedAt(WebPoint(client.x, client.y),
|
||||
WebPoint(screen.x, screen.y));
|
||||
webview_->DragSourceEndedAt(client, screen);
|
||||
}
|
||||
|
||||
void BrowserDragDelegate::OnDragSourceMove() {
|
||||
CPoint client;
|
||||
CPoint screen;
|
||||
gfx::Point client;
|
||||
gfx::Point screen;
|
||||
GetCursorPositions(source_hwnd_, &client, &screen);
|
||||
webview_->DragSourceMovedTo(WebPoint(client.x, client.y),
|
||||
WebPoint(screen.x, screen.y));
|
||||
webview_->DragSourceMovedTo(client, screen);
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "request_impl.h"
|
||||
|
||||
#include "base/string_util.h"
|
||||
#include "webkit/api/public/WebFrame.h"
|
||||
#include "webkit/api/public/WebHTTPBody.h"
|
||||
#include "webkit/api/public/WebScriptSource.h"
|
||||
#include "webkit/api/public/WebString.h"
|
||||
@ -16,8 +17,8 @@
|
||||
#include "webkit/api/public/WebURLRequest.h"
|
||||
#include "webkit/glue/glue_serialize.h"
|
||||
#include "webkit/glue/glue_util.h"
|
||||
#include "webkit/glue/webframe.h"
|
||||
|
||||
using WebKit::WebFrame;
|
||||
using WebKit::WebHTTPBody;
|
||||
using WebKit::WebScriptSource;
|
||||
using WebKit::WebString;
|
||||
@ -33,8 +34,8 @@ CefBrowserImpl::CefBrowserImpl(CefWindowInfo& windowInfo, bool popup,
|
||||
handler_(handler), webviewhost_(NULL), popuphost_(NULL), unique_id_(0),
|
||||
frame_main_(NULL)
|
||||
{
|
||||
delegate_ = new BrowserWebViewDelegate(this);
|
||||
popup_delegate_ = new BrowserWebViewDelegate(this);
|
||||
delegate_.reset(new BrowserWebViewDelegate(this));
|
||||
popup_delegate_.reset(new BrowserWebViewDelegate(this));
|
||||
nav_controller_.reset(new BrowserNavigationController(this));
|
||||
}
|
||||
|
||||
@ -114,7 +115,7 @@ void CefBrowserImpl::GetFrameNames(std::vector<std::wstring>& names)
|
||||
WebFrame* it = main_frame;
|
||||
do {
|
||||
if(it != main_frame)
|
||||
names.push_back(it->GetName());
|
||||
names.push_back(UTF16ToWideHack(it->name()));
|
||||
it = view->GetNextFrameAfter(it, true);
|
||||
} while (it != main_frame);
|
||||
}
|
||||
@ -133,7 +134,7 @@ CefRefPtr<CefFrame> CefBrowserImpl::GetCefFrame(WebFrame* frame)
|
||||
cef_frame = frame_main_;
|
||||
} else {
|
||||
// Locate or create the appropriate named reference.
|
||||
std::wstring name = frame->GetName();
|
||||
std::wstring name = UTF16ToWideHack(frame->name());
|
||||
DCHECK(!name.empty());
|
||||
FrameMap::const_iterator it = frames_.find(name);
|
||||
if(it != frames_.end())
|
||||
@ -289,8 +290,10 @@ void CefBrowserImpl::ExecuteJavaScript(CefRefPtr<CefFrame> frame,
|
||||
std::wstring CefBrowserImpl::GetURL(CefRefPtr<CefFrame> frame)
|
||||
{
|
||||
WebFrame* web_frame = GetWebFrame(frame);
|
||||
if(web_frame)
|
||||
return UTF8ToWide(web_frame->GetURL().spec());
|
||||
if(web_frame) {
|
||||
std::string spec = web_frame->url().spec();
|
||||
return UTF8ToWide(spec);
|
||||
}
|
||||
return std::wstring();
|
||||
}
|
||||
|
||||
@ -421,7 +424,7 @@ void CefBrowserImpl::UIT_LoadHTML(CefFrame* frame,
|
||||
|
||||
WebFrame* web_frame = GetWebFrame(frame);
|
||||
if(web_frame)
|
||||
web_frame->LoadHTMLString(WideToUTF8(html), gurl);
|
||||
web_frame->loadHTMLString(WideToUTF8(html), gurl);
|
||||
|
||||
frame->Release();
|
||||
}
|
||||
@ -456,7 +459,7 @@ void CefBrowserImpl::UIT_LoadHTMLForStreamRef(CefFrame* frame,
|
||||
|
||||
WebFrame* web_frame = GetWebFrame(frame);
|
||||
if(web_frame)
|
||||
web_frame->LoadHTMLString(ss.str(), gurl);
|
||||
web_frame->loadHTMLString(ss.str(), gurl);
|
||||
|
||||
stream->Release();
|
||||
frame->Release();
|
||||
@ -471,7 +474,7 @@ void CefBrowserImpl::UIT_ExecuteJavaScript(CefFrame* frame,
|
||||
|
||||
WebFrame* web_frame = GetWebFrame(frame);
|
||||
if(web_frame) {
|
||||
web_frame->ExecuteScript(
|
||||
web_frame->executeScript(
|
||||
WebScriptSource(WebString(js_code), WebURL(GURL(script_url)),
|
||||
start_line));
|
||||
}
|
||||
@ -516,10 +519,10 @@ bool CefBrowserImpl::UIT_Navigate(const BrowserNavigationEntry& entry,
|
||||
// If we are reloading, then WebKit will use the state of the current page.
|
||||
// Otherwise, we give it the state to navigate to.
|
||||
if (reload) {
|
||||
frame->Reload();
|
||||
frame->reload();
|
||||
} else if (!entry.GetContentState().empty()) {
|
||||
DCHECK(entry.GetPageID() != -1);
|
||||
frame->LoadHistoryItem(
|
||||
frame->loadHistoryItem(
|
||||
webkit_glue::HistoryItemFromString(entry.GetContentState()));
|
||||
} else {
|
||||
DCHECK(entry.GetPageID() == -1);
|
||||
@ -548,7 +551,7 @@ bool CefBrowserImpl::UIT_Navigate(const BrowserNavigationEntry& entry,
|
||||
request.setHTTPBody(entry.GetUploadData());
|
||||
}
|
||||
|
||||
frame->LoadRequest(request);
|
||||
frame->loadRequest(request);
|
||||
}
|
||||
|
||||
// In case LoadRequest failed before DidCreateDataSource was called.
|
||||
@ -632,31 +635,31 @@ void CefBrowserImpl::UIT_HandleAction(CefHandler::MenuId menuId,
|
||||
break;
|
||||
case MENU_ID_UNDO:
|
||||
if(web_frame)
|
||||
web_frame->Undo();
|
||||
web_frame->executeCommand(WebString::fromUTF8("Undo"));
|
||||
break;
|
||||
case MENU_ID_REDO:
|
||||
if(web_frame)
|
||||
web_frame->Redo();
|
||||
web_frame->executeCommand(WebString::fromUTF8("Redo"));
|
||||
break;
|
||||
case MENU_ID_CUT:
|
||||
if(web_frame)
|
||||
web_frame->Cut();
|
||||
web_frame->executeCommand(WebString::fromUTF8("Cut"));
|
||||
break;
|
||||
case MENU_ID_COPY:
|
||||
if(web_frame)
|
||||
web_frame->Copy();
|
||||
web_frame->executeCommand(WebString::fromUTF8("Copy"));
|
||||
break;
|
||||
case MENU_ID_PASTE:
|
||||
if(web_frame)
|
||||
web_frame->Paste();
|
||||
web_frame->executeCommand(WebString::fromUTF8("Paste"));
|
||||
break;
|
||||
case MENU_ID_DELETE:
|
||||
if(web_frame)
|
||||
web_frame->Delete();
|
||||
web_frame->executeCommand(WebString::fromUTF8("Delete"));
|
||||
break;
|
||||
case MENU_ID_SELECTALL:
|
||||
if(web_frame)
|
||||
web_frame->SelectAll();
|
||||
web_frame->executeCommand(WebString::fromUTF8("SelectAll"));
|
||||
break;
|
||||
case MENU_ID_PRINT:
|
||||
if(web_frame)
|
||||
|
@ -56,12 +56,12 @@ public:
|
||||
// already exist for the specified WebFrame one will be created. There is no
|
||||
// guarantee that the same CefFrame object will be returned across different
|
||||
// calls to this function.
|
||||
CefRefPtr<CefFrame> GetCefFrame(WebFrame* frame);
|
||||
CefRefPtr<CefFrame> GetCefFrame(WebKit::WebFrame* frame);
|
||||
void RemoveCefFrame(const std::wstring& name);
|
||||
|
||||
// Return the WebFrame object associated with the specified CefFrame. This
|
||||
// may return NULL if no WebFrame with the CefFrame's name exists.
|
||||
WebFrame* GetWebFrame(CefRefPtr<CefFrame> frame);
|
||||
WebKit::WebFrame* GetWebFrame(CefRefPtr<CefFrame> frame);
|
||||
|
||||
// Frame-related methods
|
||||
void Undo(CefRefPtr<CefFrame> frame);
|
||||
@ -188,7 +188,7 @@ public:
|
||||
|
||||
// Save the document HTML to a temporary file and open in the default viewing
|
||||
// application
|
||||
bool UIT_ViewDocumentString(WebFrame *frame);
|
||||
bool UIT_ViewDocumentString(WebKit::WebFrame *frame);
|
||||
#if defined(OS_WIN)
|
||||
void UIT_GetDocumentStringNotify(CefFrame* frame,
|
||||
CefStreamWriter* writer, HANDLE hEvent);
|
||||
@ -202,10 +202,10 @@ public:
|
||||
bool UIT_CanGoForward() { return !nav_controller_->IsAtEnd(); }
|
||||
|
||||
// Printing support
|
||||
void UIT_PrintPages(WebFrame* frame);
|
||||
void UIT_PrintPages(WebKit::WebFrame* frame);
|
||||
void UIT_PrintPage(int page_number, int total_pages,
|
||||
const gfx::Size& canvas_size, WebFrame* frame);
|
||||
int UIT_GetPagesCount(WebFrame* frame);
|
||||
const gfx::Size& canvas_size, WebKit::WebFrame* frame);
|
||||
int UIT_GetPagesCount(WebKit::WebFrame* frame);
|
||||
|
||||
void UIT_SetUniqueID(int id) { unique_id_ = id; }
|
||||
int UIT_GetUniqueID() { return unique_id_; }
|
||||
@ -217,8 +217,8 @@ protected:
|
||||
CefRefPtr<CefHandler> handler_;
|
||||
scoped_ptr<WebViewHost> webviewhost_;
|
||||
WebWidgetHost* popuphost_;
|
||||
scoped_refptr<BrowserWebViewDelegate> delegate_;
|
||||
scoped_refptr<BrowserWebViewDelegate> popup_delegate_;
|
||||
scoped_ptr<BrowserWebViewDelegate> delegate_;
|
||||
scoped_ptr<BrowserWebViewDelegate> popup_delegate_;
|
||||
scoped_ptr<BrowserNavigationController> nav_controller_;
|
||||
|
||||
std::wstring title_;
|
||||
|
@ -14,9 +14,9 @@
|
||||
#include "base/string_util.h"
|
||||
#include "base/win_util.h"
|
||||
#include "skia/ext/vector_canvas.h"
|
||||
#include "webkit/api/public/WebFrame.h"
|
||||
#include "webkit/api/public/WebRect.h"
|
||||
#include "webkit/api/public/WebSize.h"
|
||||
#include "webkit/glue/webframe.h"
|
||||
#include "webkit/glue/webkit_glue.h"
|
||||
|
||||
#include <shellapi.h>
|
||||
@ -56,11 +56,11 @@ LRESULT CALLBACK CefBrowserImpl::WndProc(HWND hwnd, UINT message,
|
||||
// Notify the handler that the window is about to be closed
|
||||
handler->HandleBeforeWindowClose(browser);
|
||||
}
|
||||
RevokeDragDrop(browser->GetWebViewWndHandle());
|
||||
browser->GetWebViewDelegate()->RevokeDragDrop();
|
||||
|
||||
// Call GC twice to clean up garbage.
|
||||
browser->GetWebView()->GetMainFrame()->CallJSGC();
|
||||
browser->GetWebView()->GetMainFrame()->CallJSGC();
|
||||
browser->GetWebView()->GetMainFrame()->collectGarbage();
|
||||
browser->GetWebView()->GetMainFrame()->collectGarbage();
|
||||
|
||||
// Clean up anything associated with the WebViewHost widget.
|
||||
browser->GetWebViewHost()->webwidget()->close();
|
||||
@ -135,9 +135,11 @@ std::wstring CefBrowserImpl::GetSource(CefRefPtr<CefFrame> frame)
|
||||
else
|
||||
{
|
||||
// Retrieve the document string directly
|
||||
WebFrame* web_frame = GetWebFrame(frame);
|
||||
if(web_frame)
|
||||
return UTF8ToWide(web_frame->GetFullPageHtml());
|
||||
WebKit::WebFrame* web_frame = GetWebFrame(frame);
|
||||
if(web_frame) {
|
||||
std::string markup = web_frame->contentAsMarkup().utf8();
|
||||
return UTF8ToWide(markup);
|
||||
}
|
||||
return std::wstring();
|
||||
}
|
||||
}
|
||||
@ -172,7 +174,7 @@ std::wstring CefBrowserImpl::GetText(CefRefPtr<CefFrame> frame)
|
||||
else
|
||||
{
|
||||
// Retrieve the document text directly
|
||||
WebFrame* web_frame = GetWebFrame(frame);
|
||||
WebKit::WebFrame* web_frame = GetWebFrame(frame);
|
||||
if(web_frame)
|
||||
webkit_glue::DumpDocumentText(web_frame);
|
||||
return std::wstring();
|
||||
@ -324,15 +326,15 @@ static void WriteTextToFile(const std::string& data,
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
bool CefBrowserImpl::UIT_ViewDocumentString(WebFrame *frame)
|
||||
bool CefBrowserImpl::UIT_ViewDocumentString(WebKit::WebFrame *frame)
|
||||
{
|
||||
REQUIRE_UIT();
|
||||
|
||||
DWORD dwRetVal;
|
||||
DWORD dwBufSize = 512;
|
||||
TCHAR lpPathBuffer[512];
|
||||
UINT uRetVal;
|
||||
TCHAR szTempName[512];
|
||||
UINT uRetVal;
|
||||
TCHAR szTempName[512];
|
||||
|
||||
dwRetVal = GetTempPath(dwBufSize, // length of the buffer
|
||||
lpPathBuffer); // buffer for path
|
||||
@ -347,9 +349,10 @@ bool CefBrowserImpl::UIT_ViewDocumentString(WebFrame *frame)
|
||||
if (uRetVal == 0)
|
||||
return false;
|
||||
|
||||
size_t len = wcslen(szTempName);
|
||||
wcscpy(szTempName + len - 3, L"txt");
|
||||
WriteTextToFile(frame->GetFullPageHtml(), szTempName);
|
||||
size_t len = wcslen(szTempName);
|
||||
wcscpy(szTempName + len - 3, L"txt");
|
||||
std::string markup = frame->contentAsMarkup().utf8();
|
||||
WriteTextToFile(markup, szTempName);
|
||||
|
||||
int errorCode = (int)ShellExecute(GetMainWndHandle(), L"open", szTempName,
|
||||
NULL, NULL, SW_SHOWNORMAL);
|
||||
@ -365,12 +368,12 @@ void CefBrowserImpl::UIT_GetDocumentStringNotify(CefFrame* frame,
|
||||
{
|
||||
REQUIRE_UIT();
|
||||
|
||||
WebFrame* web_frame = GetWebFrame(frame);
|
||||
WebKit::WebFrame* web_frame = GetWebFrame(frame);
|
||||
if(web_frame) {
|
||||
// Retrieve the document string
|
||||
std::string str = web_frame->GetFullPageHtml();
|
||||
std::string markup = web_frame->contentAsMarkup().utf8();
|
||||
// Write the document string to the stream
|
||||
writer->Write(str.c_str(), str.size(), 1);
|
||||
writer->Write(markup.c_str(), markup.size(), 1);
|
||||
}
|
||||
|
||||
// Notify the calling thread that the data is now available
|
||||
@ -386,7 +389,7 @@ void CefBrowserImpl::UIT_GetDocumentTextNotify(CefFrame* frame,
|
||||
{
|
||||
REQUIRE_UIT();
|
||||
|
||||
WebFrame* web_frame = GetWebFrame(frame);
|
||||
WebKit::WebFrame* web_frame = GetWebFrame(frame);
|
||||
if(web_frame) {
|
||||
// Retrieve the document string
|
||||
std::wstring str = webkit_glue::DumpDocumentText(web_frame);
|
||||
@ -424,7 +427,7 @@ void CefBrowserImpl::UIT_CanGoForwardNotify(bool *retVal, HANDLE hEvent)
|
||||
|
||||
void CefBrowserImpl::UIT_PrintPage(int page_number, int total_pages,
|
||||
const gfx::Size& canvas_size,
|
||||
WebFrame* frame) {
|
||||
WebKit::WebFrame* frame) {
|
||||
#if !CEF_PATCHES_APPLIED
|
||||
NOTREACHED() << "CEF patches must be applied to support printing.";
|
||||
return;
|
||||
@ -472,14 +475,14 @@ void CefBrowserImpl::UIT_PrintPage(int page_number, int total_pages,
|
||||
// Apply the WebKit scaling factor.
|
||||
float webkit_scale = 0;
|
||||
#if CEF_PATCHES_APPLIED
|
||||
webkit_scale = frame->GetPrintPageShrink(page_number);
|
||||
webkit_scale = frame->getPrintPageShrink(page_number);
|
||||
#endif // CEF_PATCHES_APPLIED
|
||||
if (webkit_scale <= 0) {
|
||||
NOTREACHED() << "Printing page " << page_number << " failed.";
|
||||
}
|
||||
canvas.scale(webkit_scale, webkit_scale);
|
||||
|
||||
frame->PrintPage(page_number, &canvas);
|
||||
frame->printPage(page_number, &canvas);
|
||||
|
||||
res = RestoreDC(hDC, saved_state);
|
||||
DCHECK_NE(res, 0);
|
||||
@ -503,7 +506,8 @@ void CefBrowserImpl::UIT_PrintPage(int page_number, int total_pages,
|
||||
printInfo.m_Rect = rect;
|
||||
printInfo.m_Scale = scale;
|
||||
|
||||
std::wstring url = UTF8ToWide(frame->GetURL().spec());
|
||||
std::string spec = frame->url().spec();
|
||||
std::wstring url = UTF8ToWide(spec);
|
||||
std::wstring title = title_;
|
||||
|
||||
std::wstring topLeft, topCenter, topRight;
|
||||
@ -572,7 +576,7 @@ void CefBrowserImpl::UIT_PrintPage(int page_number, int total_pages,
|
||||
print_context_.PageDone();
|
||||
}
|
||||
|
||||
void CefBrowserImpl::UIT_PrintPages(WebFrame* frame) {
|
||||
void CefBrowserImpl::UIT_PrintPages(WebKit::WebFrame* frame) {
|
||||
#if !CEF_PATCHES_APPLIED
|
||||
NOTREACHED() << "CEF patches must be applied to support printing.";
|
||||
return;
|
||||
@ -612,7 +616,7 @@ void CefBrowserImpl::UIT_PrintPages(WebFrame* frame) {
|
||||
settings.page_setup_pixels().physical_size().height(),
|
||||
static_cast<int>(params.dpi),
|
||||
params.desired_dpi));
|
||||
page_count = frame->PrintBegin(WebSize(canvas_size));
|
||||
page_count = frame->printBegin(WebSize(canvas_size));
|
||||
|
||||
if (page_count) {
|
||||
bool old_state = MessageLoop::current()->NestableTasksAllowed();
|
||||
@ -635,10 +639,10 @@ void CefBrowserImpl::UIT_PrintPages(WebFrame* frame) {
|
||||
MessageLoop::current()->SetNestableTasksAllowed(old_state);
|
||||
}
|
||||
|
||||
frame->PrintEnd();
|
||||
frame->printEnd();
|
||||
}
|
||||
|
||||
int CefBrowserImpl::UIT_GetPagesCount(WebFrame* frame)
|
||||
int CefBrowserImpl::UIT_GetPagesCount(WebKit::WebFrame* frame)
|
||||
{
|
||||
REQUIRE_UIT();
|
||||
|
||||
@ -664,8 +668,8 @@ int CefBrowserImpl::UIT_GetPagesCount(WebFrame* frame)
|
||||
settings.page_setup_pixels().physical_size().height(),
|
||||
static_cast<int>(params.dpi),
|
||||
params.desired_dpi));
|
||||
page_count = frame->PrintBegin(WebSize(canvas_size));
|
||||
frame->PrintEnd();
|
||||
page_count = frame->printBegin(WebSize(canvas_size));
|
||||
frame->printEnd();
|
||||
|
||||
return page_count;
|
||||
}
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include "base/timer.h"
|
||||
#include "base/thread.h"
|
||||
#include "base/waitable_event.h"
|
||||
#include "net/base/cookie_monster.h"
|
||||
#include "net/base/io_buffer.h"
|
||||
#include "net/base/load_flags.h"
|
||||
#include "net/base/net_errors.h"
|
||||
@ -54,9 +53,9 @@
|
||||
#include "net/http/http_util.h"
|
||||
#include "net/proxy/proxy_service.h"
|
||||
#include "net/url_request/url_request.h"
|
||||
#include "webkit/api/public/WebFrame.h"
|
||||
#include "webkit/glue/resource_loader_bridge.h"
|
||||
#include "webkit/glue/webappcachecontext.h"
|
||||
#include "webkit/glue/webframe.h"
|
||||
#include "webkit/glue/webview.h"
|
||||
|
||||
using webkit_glue::ResourceLoaderBridge;
|
||||
@ -167,9 +166,14 @@ class RequestProxy : public URLRequest::Delegate,
|
||||
peer_->OnUploadProgress(position, size);
|
||||
}
|
||||
|
||||
void NotifyReceivedRedirect(const GURL& new_url) {
|
||||
if (peer_)
|
||||
peer_->OnReceivedRedirect(new_url);
|
||||
void NotifyReceivedRedirect(const GURL& new_url,
|
||||
const ResourceLoaderBridge::ResponseInfo& info) {
|
||||
if (peer_ && peer_->OnReceivedRedirect(new_url, info)) {
|
||||
io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
this, &RequestProxy::AsyncFollowDeferredRedirect));
|
||||
} else {
|
||||
Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
void NotifyReceivedResponse(const ResourceLoaderBridge::ResponseInfo& info,
|
||||
@ -268,7 +272,9 @@ class RequestProxy : public URLRequest::Delegate,
|
||||
} else if(!redirectUrl.empty()) {
|
||||
// redirect to the specified URL
|
||||
params->url = GURL(WideToUTF8(redirectUrl));
|
||||
OnReceivedRedirect(params->url);
|
||||
ResourceLoaderBridge::ResponseInfo info;
|
||||
bool defer_redirect;
|
||||
OnReceivedRedirect(params->url, info, &defer_redirect);
|
||||
} else if(resourceStream.get()) {
|
||||
// load from the provided resource stream
|
||||
handled = true;
|
||||
@ -320,6 +326,14 @@ class RequestProxy : public URLRequest::Delegate,
|
||||
Done();
|
||||
}
|
||||
|
||||
void AsyncFollowDeferredRedirect() {
|
||||
// This can be null in cases where the request is already done.
|
||||
if (!request_.get())
|
||||
return;
|
||||
|
||||
request_->FollowDeferredRedirect();
|
||||
}
|
||||
|
||||
void AsyncReadData() {
|
||||
if(resource_stream_.get()) {
|
||||
// Read from the handler-provided resource stream
|
||||
@ -353,9 +367,13 @@ class RequestProxy : public URLRequest::Delegate,
|
||||
// callbacks) that run on the IO thread. They are designed to be overridden
|
||||
// by the SyncRequestProxy subclass.
|
||||
|
||||
virtual void OnReceivedRedirect(const GURL& new_url) {
|
||||
virtual void OnReceivedRedirect(
|
||||
const GURL& new_url,
|
||||
const ResourceLoaderBridge::ResponseInfo& info,
|
||||
bool* defer_redirect) {
|
||||
*defer_redirect = true; // See AsyncFollowDeferredRedirect
|
||||
owner_loop_->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
this, &RequestProxy::NotifyReceivedRedirect, new_url));
|
||||
this, &RequestProxy::NotifyReceivedRedirect, new_url, info));
|
||||
}
|
||||
|
||||
virtual void OnReceivedResponse(
|
||||
@ -383,18 +401,15 @@ class RequestProxy : public URLRequest::Delegate,
|
||||
const GURL& new_url,
|
||||
bool* defer_redirect) {
|
||||
DCHECK(request->status().is_success());
|
||||
OnReceivedRedirect(new_url);
|
||||
ResourceLoaderBridge::ResponseInfo info;
|
||||
PopulateResponseInfo(request, &info);
|
||||
OnReceivedRedirect(new_url, info, defer_redirect);
|
||||
}
|
||||
|
||||
virtual void OnResponseStarted(URLRequest* request) {
|
||||
if (request->status().is_success()) {
|
||||
ResourceLoaderBridge::ResponseInfo info;
|
||||
info.request_time = request->request_time();
|
||||
info.response_time = request->response_time();
|
||||
info.headers = request->response_headers();
|
||||
info.app_cache_id = WebAppCacheContext::kNoAppCacheId;
|
||||
request->GetMimeType(&info.mime_type);
|
||||
request->GetCharset(&info.charset);
|
||||
PopulateResponseInfo(request, &info);
|
||||
OnReceivedResponse(info, false);
|
||||
AsyncReadData(); // start reading
|
||||
} else {
|
||||
@ -466,6 +481,17 @@ class RequestProxy : public URLRequest::Delegate,
|
||||
}
|
||||
}
|
||||
|
||||
void PopulateResponseInfo(URLRequest* request,
|
||||
ResourceLoaderBridge::ResponseInfo* info) const {
|
||||
info->request_time = request->request_time();
|
||||
info->response_time = request->response_time();
|
||||
info->headers = request->response_headers();
|
||||
info->app_cache_id = WebAppCacheContext::kNoAppCacheId;
|
||||
request->GetMimeType(&info->mime_type);
|
||||
request->GetCharset(&info->charset);
|
||||
info->content_length = request->GetExpectedContentSize();
|
||||
}
|
||||
|
||||
scoped_ptr<URLRequest> request_;
|
||||
CefRefPtr<CefStreamReader> resource_stream_;
|
||||
|
||||
@ -509,7 +535,18 @@ class SyncRequestProxy : public RequestProxy {
|
||||
// --------------------------------------------------------------------------
|
||||
// Event hooks that run on the IO thread:
|
||||
|
||||
virtual void OnReceivedRedirect(const GURL& new_url) {
|
||||
virtual void OnReceivedRedirect(
|
||||
const GURL& new_url,
|
||||
const ResourceLoaderBridge::ResponseInfo& info,
|
||||
bool* defer_redirect) {
|
||||
// TODO(darin): It would be much better if this could live in WebCore, but
|
||||
// doing so requires API changes at all levels. Similar code exists in
|
||||
// WebCore/platform/network/cf/ResourceHandleCFNet.cpp :-(
|
||||
if (new_url.GetOrigin() != result_->url.GetOrigin()) {
|
||||
DLOG(WARNING) << "Cross origin redirect denied";
|
||||
Cancel();
|
||||
return;
|
||||
}
|
||||
result_->url = new_url;
|
||||
}
|
||||
|
||||
@ -711,7 +748,7 @@ bool FindProxyForUrl(const GURL& url, std::string* proxy_list) {
|
||||
request_context->proxy_service()));
|
||||
|
||||
net::ProxyInfo proxy_info;
|
||||
int rv = sync_proxy_service->ResolveProxy(url, &proxy_info);
|
||||
int rv = sync_proxy_service->ResolveProxy(NULL, url, &proxy_info);
|
||||
if (rv == net::OK) {
|
||||
*proxy_list = proxy_info.ToPacString();
|
||||
}
|
||||
|
@ -23,8 +23,8 @@ MSVC_POP_WARNING();
|
||||
#include "base/string16.h"
|
||||
#include "base/win_util.h"
|
||||
#include "net/base/mime_util.h"
|
||||
#include "webkit/api/public/WebFrame.h"
|
||||
#include "webkit/glue/glue_util.h"
|
||||
#include "webkit/glue/webframe.h"
|
||||
#include "webkit/glue/webkit_glue.h"
|
||||
|
||||
// Generated by GRIT
|
||||
@ -134,6 +134,7 @@ StringPiece GetDataResource(int resource_id) {
|
||||
case IDR_MEDIA_PLAY_BUTTON:
|
||||
case IDR_MEDIA_SOUND_FULL_BUTTON:
|
||||
case IDR_MEDIA_SOUND_NONE_BUTTON:
|
||||
case IDR_MEDIA_SLIDER_THUMB:
|
||||
return NetResourceProvider(resource_id);
|
||||
default:
|
||||
break;
|
||||
@ -186,7 +187,7 @@ void InitializeTextEncoding() {
|
||||
WebCore::UTF8Encoding();
|
||||
}
|
||||
|
||||
v8::Handle<v8::Context> GetV8Context(WebFrame* frame)
|
||||
v8::Handle<v8::Context> GetV8Context(WebKit::WebFrame* frame)
|
||||
{
|
||||
WebFrameImpl* webFrameImpl = static_cast<WebFrameImpl*>(frame);
|
||||
WebCore::Frame* core_frame = webFrameImpl->frame();
|
||||
|
@ -10,7 +10,9 @@
|
||||
#include "base/string_piece.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
||||
namespace WebKit {
|
||||
class WebFrame;
|
||||
}
|
||||
class WebView;
|
||||
|
||||
namespace webkit_glue {
|
||||
@ -31,6 +33,6 @@ void InitializeTextEncoding();
|
||||
StringPiece NetResourceProvider(int key);
|
||||
|
||||
// Retrieve the V8 context associated with the frame.
|
||||
v8::Handle<v8::Context> GetV8Context(WebFrame* frame);
|
||||
v8::Handle<v8::Context> GetV8Context(WebKit::WebFrame* frame);
|
||||
|
||||
} // namespace webkit_glue
|
||||
|
@ -33,17 +33,17 @@ using WebKit::WebSize;
|
||||
|
||||
namespace webkit_glue {
|
||||
|
||||
#define MAX_LOADSTRING 100
|
||||
|
||||
string16 GetLocalizedString(int message_id) {
|
||||
// Localized resources are provided via webkit_resources.rc and
|
||||
// webkit_strings_en-US.rc.
|
||||
const ATLSTRINGRESOURCEIMAGE* image =
|
||||
AtlGetStringResourceImage(_AtlBaseModule.GetModuleInstance(),
|
||||
message_id);
|
||||
if (!image) {
|
||||
wchar_t localized[MAX_LOADSTRING];
|
||||
int length = LoadString(GetModuleHandle(NULL), message_id,
|
||||
localized, MAX_LOADSTRING);
|
||||
if (!length && GetLastError() == ERROR_RESOURCE_NAME_NOT_FOUND) {
|
||||
NOTREACHED();
|
||||
return L"No string for this identifier!";
|
||||
}
|
||||
return string16(image->achString, image->nLength);
|
||||
return string16(localized, length);
|
||||
}
|
||||
|
||||
HCURSOR LoadCursor(int cursor_id) {
|
||||
|
@ -58,19 +58,21 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
||||
}
|
||||
|
||||
WebKit::WebClipboard* clipboard() {
|
||||
if (!clipboard_.get()) {
|
||||
clipboard_.reset(new webkit_glue::WebClipboardImpl());
|
||||
}
|
||||
return clipboard_.get();
|
||||
return &clipboard_;
|
||||
}
|
||||
|
||||
virtual WebKit::WebSandboxSupport* sandboxSupport() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
virtual bool getFileSize(const WebKit::WebString& path, long long& result) {
|
||||
virtual bool sandboxEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool getFileSize(const WebKit::WebString& path, long long& result) {
|
||||
return file_util::GetFileSize(
|
||||
FilePath(webkit_glue::WebStringToFilePathString(path)), &result);
|
||||
FilePath(webkit_glue::WebStringToFilePathString(path)),
|
||||
reinterpret_cast<int64*>(&result));
|
||||
}
|
||||
|
||||
virtual unsigned long long visitedLinkHash(const char* canonicalURL, size_t length) {
|
||||
@ -81,17 +83,21 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual WebKit::WebMessagePortChannel* createMessagePortChannel() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
virtual void setCookies(const WebKit::WebURL& url,
|
||||
const WebKit::WebURL& first_party_for_cookies,
|
||||
const WebKit::WebString& value) {
|
||||
BrowserResourceLoaderBridge::SetCookie(
|
||||
url, first_party_for_cookies, UTF16ToUTF8(value));
|
||||
url, first_party_for_cookies, value.utf8());
|
||||
}
|
||||
|
||||
virtual WebKit::WebString cookies(
|
||||
const WebKit::WebURL& url,
|
||||
const WebKit::WebURL& first_party_for_cookies) {
|
||||
return UTF8ToUTF16(BrowserResourceLoaderBridge::GetCookies(
|
||||
return WebKit::WebString::fromUTF8(BrowserResourceLoaderBridge::GetCookies(
|
||||
url, first_party_for_cookies));
|
||||
}
|
||||
|
||||
@ -134,7 +140,7 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
|
||||
|
||||
private:
|
||||
webkit_glue::SimpleWebMimeRegistryImpl mime_registry_;
|
||||
scoped_ptr<WebKit::WebClipboard> clipboard_;
|
||||
webkit_glue::WebClipboardImpl clipboard_;
|
||||
};
|
||||
|
||||
#endif // _BROWSER_WEBKIT_INIT_H
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "webkit/api/public/WebData.h"
|
||||
#include "webkit/api/public/WebDataSource.h"
|
||||
#include "webkit/api/public/WebDragData.h"
|
||||
#include "webkit/api/public/WebFrame.h"
|
||||
#include "webkit/api/public/WebHistoryItem.h"
|
||||
#include "webkit/api/public/WebKit.h"
|
||||
#include "webkit/api/public/WebScreenInfo.h"
|
||||
@ -35,6 +36,7 @@
|
||||
#include "webkit/api/public/WebURL.h"
|
||||
#include "webkit/api/public/WebURLError.h"
|
||||
#include "webkit/api/public/WebURLRequest.h"
|
||||
#include "webkit/api/public/WebURLResponse.h"
|
||||
#include "webkit/glue/glue_serialize.h"
|
||||
#include "webkit/glue/glue_util.h"
|
||||
#include "webkit/glue/media/buffered_data_source.h"
|
||||
@ -42,7 +44,6 @@
|
||||
#include "webkit/glue/media/simple_data_source.h"
|
||||
#include "webkit/glue/webappcachecontext.h"
|
||||
#include "webkit/glue/webdropdata.h"
|
||||
#include "webkit/glue/webframe.h"
|
||||
#include "webkit/glue/webpreferences.h"
|
||||
#include "webkit/glue/webkit_glue.h"
|
||||
#include "webkit/glue/webview.h"
|
||||
@ -70,6 +71,7 @@ using WebKit::WebString;
|
||||
using WebKit::WebURL;
|
||||
using WebKit::WebURLError;
|
||||
using WebKit::WebURLRequest;
|
||||
using WebKit::WebURLResponse;
|
||||
using WebKit::WebWidget;
|
||||
using WebKit::WebWorker;
|
||||
using WebKit::WebWorkerClient;
|
||||
@ -159,7 +161,7 @@ void BrowserWebViewDelegate::DidStopLoading(WebView* webview) {
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::WindowObjectCleared(WebFrame* webframe) {
|
||||
void BrowserWebViewDelegate::WindowObjectCleared(WebKit::WebFrame* webframe) {
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
v8::HandleScope handle_scope;
|
||||
@ -177,7 +179,7 @@ void BrowserWebViewDelegate::WindowObjectCleared(WebFrame* webframe) {
|
||||
|
||||
WebNavigationPolicy BrowserWebViewDelegate::PolicyForNavigationAction(
|
||||
WebView* webview,
|
||||
WebFrame* frame,
|
||||
WebKit::WebFrame* frame,
|
||||
const WebKit::WebURLRequest& request,
|
||||
WebKit::WebNavigationType type,
|
||||
WebNavigationPolicy default_policy,
|
||||
@ -215,14 +217,6 @@ WebNavigationPolicy BrowserWebViewDelegate::PolicyForNavigationAction(
|
||||
|
||||
WebNavigationPolicy result;
|
||||
if (policy_delegate_enabled_) {
|
||||
std::wstring frame_name = frame->GetName();
|
||||
std::string url_description;
|
||||
GURL request_url = request.url();
|
||||
if (request_url.SchemeIs("file")) {
|
||||
url_description = request_url.ExtractFileName();
|
||||
} else {
|
||||
url_description = request_url.spec();
|
||||
}
|
||||
if (policy_delegate_is_permissive_) {
|
||||
result = WebKit::WebNavigationPolicyCurrentTab;
|
||||
} else {
|
||||
@ -234,38 +228,54 @@ WebNavigationPolicy BrowserWebViewDelegate::PolicyForNavigationAction(
|
||||
return result;
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::AssignIdentifierToRequest(WebView* webview,
|
||||
uint32 identifier,
|
||||
const WebURLRequest& request) {
|
||||
void BrowserWebViewDelegate::AssignIdentifierToRequest(
|
||||
WebKit::WebFrame* webframe,
|
||||
uint32 identifier,
|
||||
const WebURLRequest& request) {
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::WillSendRequest(WebView* webview,
|
||||
uint32 identifier,
|
||||
WebURLRequest* request) {
|
||||
void BrowserWebViewDelegate::WillSendRequest(
|
||||
WebKit::WebFrame* webframe,
|
||||
uint32 identifier,
|
||||
WebURLRequest* request,
|
||||
const WebURLResponse& redirect_response) {
|
||||
if (!redirect_response.isNull() && block_redirects_) {
|
||||
// To block the request, we set its URL to an empty one.
|
||||
request->setURL(WebURL());
|
||||
return;
|
||||
}
|
||||
|
||||
// The requestor ID is used by the resource loader bridge to locate the
|
||||
// browser that originated the request.
|
||||
request->setRequestorID(browser_->UIT_GetUniqueID());
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidFinishLoading(WebView* webview,
|
||||
uint32 identifier) {
|
||||
void BrowserWebViewDelegate::DidReceiveResponse(
|
||||
WebKit::WebFrame* webframe,
|
||||
uint32 identifier,
|
||||
const WebURLResponse& response) {
|
||||
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidFailLoadingWithError(WebView* webview,
|
||||
uint32 identifier,
|
||||
const WebURLError& error) {
|
||||
void BrowserWebViewDelegate::DidFinishLoading(WebKit::WebFrame* webframe,
|
||||
uint32 identifier) {
|
||||
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidCreateDataSource(WebFrame* frame,
|
||||
void BrowserWebViewDelegate::DidFailLoadingWithError(WebKit::WebFrame* webframe,
|
||||
uint32 identifier,
|
||||
const WebURLError& error) {
|
||||
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidCreateDataSource(WebKit::WebFrame* frame,
|
||||
WebDataSource* ds) {
|
||||
ds->setExtraData(pending_extra_data_.release());
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidStartProvisionalLoadForFrame(
|
||||
WebView* webview,
|
||||
WebFrame* frame,
|
||||
WebKit::WebFrame* frame,
|
||||
NavigationGesture gesture) {
|
||||
if (!top_loading_frame_) {
|
||||
top_loading_frame_ = frame;
|
||||
@ -273,16 +283,16 @@ void BrowserWebViewDelegate::DidStartProvisionalLoadForFrame(
|
||||
UpdateAddressBar(webview);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidReceiveServerRedirectForProvisionalLoadForFrame(
|
||||
void BrowserWebViewDelegate::DidReceiveProvisionalLoadServerRedirect(
|
||||
WebView* webview,
|
||||
WebFrame* frame) {
|
||||
WebKit::WebFrame* frame) {
|
||||
UpdateAddressBar(webview);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidFailProvisionalLoadWithError(
|
||||
WebView* webview,
|
||||
const WebURLError& error,
|
||||
WebFrame* frame) {
|
||||
WebKit::WebFrame* frame) {
|
||||
LocationChangeDone(frame);
|
||||
|
||||
// error codes are defined in net\base\net_error_list.h
|
||||
@ -292,7 +302,7 @@ void BrowserWebViewDelegate::DidFailProvisionalLoadWithError(
|
||||
if (error.reason == net::ERR_ABORTED)
|
||||
return;
|
||||
|
||||
const WebDataSource* failed_ds = frame->GetProvisionalDataSource();
|
||||
const WebDataSource* failed_ds = frame->provisionalDataSource();
|
||||
BrowserExtraData* extra_data =
|
||||
static_cast<BrowserExtraData*>(failed_ds->extraData());
|
||||
bool replace = extra_data && extra_data->pending_page_id != -1;
|
||||
@ -315,14 +325,14 @@ void BrowserWebViewDelegate::DidFailProvisionalLoadWithError(
|
||||
}
|
||||
|
||||
// Make sure we never show errors in view source mode.
|
||||
frame->SetInViewSourceMode(false);
|
||||
frame->enableViewSourceMode(false);
|
||||
|
||||
frame->LoadHTMLString(
|
||||
frame->loadHTMLString(
|
||||
error_text, GURL("testshell-error:"), error.unreachableURL, replace);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidCommitLoadForFrame(WebView* webview,
|
||||
WebFrame* frame,
|
||||
WebKit::WebFrame* frame,
|
||||
bool is_new_navigation) {
|
||||
UpdateForCommittedLoad(frame, is_new_navigation);
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
@ -334,7 +344,7 @@ void BrowserWebViewDelegate::DidCommitLoadForFrame(WebView* webview,
|
||||
|
||||
void BrowserWebViewDelegate::DidReceiveTitle(WebView* webview,
|
||||
const std::wstring& title,
|
||||
WebFrame* frame) {
|
||||
WebKit::WebFrame* frame) {
|
||||
browser_->UIT_SetTitle(title);
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
if(handler.get()) {
|
||||
@ -344,7 +354,7 @@ void BrowserWebViewDelegate::DidReceiveTitle(WebView* webview,
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidFinishLoadForFrame(WebView* webview,
|
||||
WebFrame* frame) {
|
||||
WebKit::WebFrame* frame) {
|
||||
UpdateAddressBar(webview);
|
||||
LocationChangeDone(frame);
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
@ -356,48 +366,53 @@ void BrowserWebViewDelegate::DidFinishLoadForFrame(WebView* webview,
|
||||
|
||||
void BrowserWebViewDelegate::DidFailLoadWithError(WebView* webview,
|
||||
const WebURLError& error,
|
||||
WebFrame* frame) {
|
||||
WebKit::WebFrame* frame) {
|
||||
LocationChangeDone(frame);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidFinishDocumentLoadForFrame(WebView* webview,
|
||||
WebFrame* frame) {
|
||||
void BrowserWebViewDelegate::DidFinishDocumentLoadForFrame(
|
||||
WebView* webview,
|
||||
WebKit::WebFrame* frame) {
|
||||
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidHandleOnloadEventsForFrame(WebView* webview,
|
||||
WebFrame* frame) {
|
||||
void BrowserWebViewDelegate::DidHandleOnloadEventsForFrame(
|
||||
WebView* webview,
|
||||
WebKit::WebFrame* frame) {
|
||||
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidChangeLocationWithinPageForFrame(
|
||||
WebView* webview, WebFrame* frame, bool is_new_navigation) {
|
||||
frame->GetDataSource()->setExtraData(pending_extra_data_.release());
|
||||
WebView* webview, WebKit::WebFrame* frame, bool is_new_navigation) {
|
||||
frame->dataSource()->setExtraData(pending_extra_data_.release());
|
||||
UpdateForCommittedLoad(frame, is_new_navigation);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidReceiveIconForFrame(WebView* webview,
|
||||
WebFrame* frame) {
|
||||
WebKit::WebFrame* frame) {
|
||||
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::WillPerformClientRedirect(WebView* webview,
|
||||
WebFrame* frame,
|
||||
const std::wstring& dest_url,
|
||||
unsigned int delay_seconds,
|
||||
unsigned int fire_date) {
|
||||
void BrowserWebViewDelegate::WillPerformClientRedirect(
|
||||
WebView* webview,
|
||||
WebKit::WebFrame* frame,
|
||||
const GURL& src_url,
|
||||
const GURL& dest_url,
|
||||
unsigned int delay_seconds,
|
||||
unsigned int fire_date) {
|
||||
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::DidCancelClientRedirect(WebView* webview,
|
||||
WebFrame* frame) {
|
||||
WebKit::WebFrame* frame) {
|
||||
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::AddMessageToConsole(WebView* webview,
|
||||
const std::wstring& message,
|
||||
unsigned int line_no,
|
||||
const std::wstring& source_id) {
|
||||
void BrowserWebViewDelegate::AddMessageToConsole(
|
||||
WebView* webview,
|
||||
const std::wstring& message,
|
||||
unsigned int line_no,
|
||||
const std::wstring& source_id) {
|
||||
logging::LogMessage("CONSOLE", 0).stream() << "\""
|
||||
<< message.c_str()
|
||||
<< ",\" source: "
|
||||
@ -407,7 +422,7 @@ void BrowserWebViewDelegate::AddMessageToConsole(WebView* webview,
|
||||
<< ")";
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::RunJavaScriptAlert(WebFrame* webframe,
|
||||
void BrowserWebViewDelegate::RunJavaScriptAlert(WebKit::WebFrame* webframe,
|
||||
const std::wstring& message) {
|
||||
CefHandler::RetVal rv = RV_CONTINUE;
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
@ -419,8 +434,8 @@ void BrowserWebViewDelegate::RunJavaScriptAlert(WebFrame* webframe,
|
||||
ShowJavaScriptAlert(webframe, message);
|
||||
}
|
||||
|
||||
bool BrowserWebViewDelegate::RunJavaScriptConfirm(WebFrame* webframe,
|
||||
const std::wstring& message) {
|
||||
bool BrowserWebViewDelegate::RunJavaScriptConfirm(WebKit::WebFrame* webframe,
|
||||
const std::wstring& message) {
|
||||
CefHandler::RetVal rv = RV_CONTINUE;
|
||||
bool retval = false;
|
||||
CefRefPtr<CefHandler> handler = browser_->GetHandler();
|
||||
@ -433,8 +448,10 @@ bool BrowserWebViewDelegate::RunJavaScriptConfirm(WebFrame* webframe,
|
||||
return retval;
|
||||
}
|
||||
|
||||
bool BrowserWebViewDelegate::RunJavaScriptPrompt(WebFrame* webframe,
|
||||
const std::wstring& message, const std::wstring& default_value,
|
||||
bool BrowserWebViewDelegate::RunJavaScriptPrompt(
|
||||
WebKit::WebFrame* webframe,
|
||||
const std::wstring& message,
|
||||
const std::wstring& default_value,
|
||||
std::wstring* result) {
|
||||
CefHandler::RetVal rv = RV_CONTINUE;
|
||||
bool retval = false;
|
||||
@ -454,7 +471,7 @@ void BrowserWebViewDelegate::SetStatusbarText(WebView* webview,
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::StartDragging(WebView* webview,
|
||||
const WebDragData& drag_data) {
|
||||
const WebDragData& drag_data) {
|
||||
#if defined(OS_WIN)
|
||||
// TODO(port): make this work on all platforms.
|
||||
if (!drag_delegate_) {
|
||||
@ -476,45 +493,45 @@ void BrowserWebViewDelegate::StartDragging(WebView* webview,
|
||||
// The output from these methods in non-interactive mode should match that
|
||||
// expected by the layout tests. See EditingDelegate.m in DumpRenderTree.
|
||||
bool BrowserWebViewDelegate::ShouldBeginEditing(WebView* webview,
|
||||
std::wstring range) {
|
||||
std::wstring range) {
|
||||
return browser_->UIT_AllowEditing();
|
||||
}
|
||||
|
||||
bool BrowserWebViewDelegate::ShouldEndEditing(WebView* webview,
|
||||
std::wstring range) {
|
||||
std::wstring range) {
|
||||
return browser_->UIT_AllowEditing();
|
||||
}
|
||||
|
||||
bool BrowserWebViewDelegate::ShouldInsertNode(WebView* webview,
|
||||
std::wstring node,
|
||||
std::wstring range,
|
||||
std::wstring action) {
|
||||
std::wstring node,
|
||||
std::wstring range,
|
||||
std::wstring action) {
|
||||
return browser_->UIT_AllowEditing();
|
||||
}
|
||||
|
||||
bool BrowserWebViewDelegate::ShouldInsertText(WebView* webview,
|
||||
std::wstring text,
|
||||
std::wstring range,
|
||||
std::wstring action) {
|
||||
std::wstring text,
|
||||
std::wstring range,
|
||||
std::wstring action) {
|
||||
return browser_->UIT_AllowEditing();
|
||||
}
|
||||
|
||||
bool BrowserWebViewDelegate::ShouldChangeSelectedRange(WebView* webview,
|
||||
std::wstring fromRange,
|
||||
std::wstring toRange,
|
||||
std::wstring affinity,
|
||||
bool stillSelecting) {
|
||||
std::wstring fromRange,
|
||||
std::wstring toRange,
|
||||
std::wstring affinity,
|
||||
bool stillSelecting) {
|
||||
return browser_->UIT_AllowEditing();
|
||||
}
|
||||
|
||||
bool BrowserWebViewDelegate::ShouldDeleteRange(WebView* webview,
|
||||
std::wstring range) {
|
||||
std::wstring range) {
|
||||
return browser_->UIT_AllowEditing();
|
||||
}
|
||||
|
||||
bool BrowserWebViewDelegate::ShouldApplyStyle(WebView* webview,
|
||||
std::wstring style,
|
||||
std::wstring range) {
|
||||
std::wstring style,
|
||||
std::wstring range) {
|
||||
return browser_->UIT_AllowEditing();
|
||||
}
|
||||
|
||||
@ -599,6 +616,12 @@ void BrowserWebViewDelegate::RegisterDragDrop() {
|
||||
#endif
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::RevokeDragDrop() {
|
||||
#if defined(OS_WIN)
|
||||
::RevokeDragDrop(browser_->GetWebViewWndHandle());
|
||||
#endif
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::SetCustomPolicyDelegate(bool is_custom,
|
||||
bool is_permissive) {
|
||||
policy_delegate_enabled_ = is_custom;
|
||||
@ -642,14 +665,40 @@ WebScreenInfo BrowserWebViewDelegate::screenInfo() {
|
||||
return WebScreenInfo();
|
||||
}
|
||||
|
||||
// Public methods -----------------------------------------------------------
|
||||
|
||||
BrowserWebViewDelegate::BrowserWebViewDelegate(CefBrowserImpl* browser)
|
||||
: policy_delegate_enabled_(false),
|
||||
policy_delegate_is_permissive_(false),
|
||||
browser_(browser),
|
||||
top_loading_frame_(NULL),
|
||||
page_id_(-1),
|
||||
last_page_id_updated_(-1),
|
||||
smart_insert_delete_enabled_(true)
|
||||
#if defined(OS_WIN)
|
||||
, select_trailing_whitespace_enabled_(true)
|
||||
#else
|
||||
, select_trailing_whitespace_enabled_(false)
|
||||
#endif
|
||||
#if defined(OS_LINUX)
|
||||
, cursor_type_(GDK_X_CURSOR)
|
||||
#endif
|
||||
, block_redirects_(false)
|
||||
{
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::Reset() {
|
||||
*this = BrowserWebViewDelegate(browser_);
|
||||
}
|
||||
|
||||
// Private methods -----------------------------------------------------------
|
||||
|
||||
void BrowserWebViewDelegate::UpdateAddressBar(WebView* webView) {
|
||||
/*
|
||||
WebFrame* mainFrame = webView->UIT_GetMainFrame();
|
||||
WebDataSource* dataSource = mainFrame->GetDataSource();
|
||||
WebKit::WebFrame* mainFrame = webView->UIT_GetMainFrame();
|
||||
WebDataSource* dataSource = mainFrame->dataSource();
|
||||
if (!dataSource)
|
||||
dataSource = mainFrame->GetProvisionalDataSource();
|
||||
dataSource = mainFrame->provisionalDataSource();
|
||||
if (!dataSource)
|
||||
return;
|
||||
|
||||
@ -657,7 +706,7 @@ void BrowserWebViewDelegate::UpdateAddressBar(WebView* webView) {
|
||||
*/
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::LocationChangeDone(WebFrame* frame) {
|
||||
void BrowserWebViewDelegate::LocationChangeDone(WebKit::WebFrame* frame) {
|
||||
if (frame == top_loading_frame_)
|
||||
top_loading_frame_ = NULL;
|
||||
}
|
||||
@ -670,13 +719,13 @@ WebWidgetHost* BrowserWebViewDelegate::GetWidgetHost() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::UpdateForCommittedLoad(WebFrame* frame,
|
||||
void BrowserWebViewDelegate::UpdateForCommittedLoad(WebKit::WebFrame* frame,
|
||||
bool is_new_navigation) {
|
||||
WebView* webview = browser_->GetWebView();
|
||||
|
||||
// Code duplicated from RenderView::DidCommitLoadForFrame.
|
||||
BrowserExtraData* extra_data = static_cast<BrowserExtraData*>(
|
||||
frame->GetDataSource()->extraData());
|
||||
frame->dataSource()->extraData());
|
||||
|
||||
if (is_new_navigation) {
|
||||
// New navigation.
|
||||
@ -696,8 +745,8 @@ void BrowserWebViewDelegate::UpdateForCommittedLoad(WebFrame* frame,
|
||||
UpdateURL(frame);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::UpdateURL(WebFrame* frame) {
|
||||
WebDataSource* ds = frame->GetDataSource();
|
||||
void BrowserWebViewDelegate::UpdateURL(WebKit::WebFrame* frame) {
|
||||
WebDataSource* ds = frame->dataSource();
|
||||
DCHECK(ds);
|
||||
|
||||
const WebURLRequest& request = ds->request();
|
||||
@ -722,7 +771,7 @@ void BrowserWebViewDelegate::UpdateURL(WebFrame* frame) {
|
||||
handler->HandleAddressChange(browser_, browser_->GetCefFrame(frame), url);
|
||||
}
|
||||
|
||||
const WebHistoryItem& history_item = frame->GetCurrentHistoryItem();
|
||||
const WebHistoryItem& history_item = frame->currentHistoryItem();
|
||||
if (!history_item.isNull())
|
||||
entry->SetContentState(webkit_glue::HistoryItemToString(history_item));
|
||||
|
||||
@ -731,7 +780,7 @@ void BrowserWebViewDelegate::UpdateURL(WebFrame* frame) {
|
||||
last_page_id_updated_ = std::max(last_page_id_updated_, page_id_);
|
||||
}
|
||||
|
||||
void BrowserWebViewDelegate::UpdateSessionHistory(WebFrame* frame) {
|
||||
void BrowserWebViewDelegate::UpdateSessionHistory(WebKit::WebFrame* frame) {
|
||||
// If we have a valid page ID at this point, then it corresponds to the page
|
||||
// we are navigating away from. Otherwise, this is the first navigation, so
|
||||
// there is no past session history to record.
|
||||
@ -744,25 +793,9 @@ void BrowserWebViewDelegate::UpdateSessionHistory(WebFrame* frame) {
|
||||
return;
|
||||
|
||||
const WebHistoryItem& history_item =
|
||||
browser_->GetWebView()->GetMainFrame()->GetPreviousHistoryItem();
|
||||
browser_->GetWebView()->GetMainFrame()->previousHistoryItem();
|
||||
if (history_item.isNull())
|
||||
return;
|
||||
|
||||
entry->SetContentState(webkit_glue::HistoryItemToString(history_item));
|
||||
}
|
||||
|
||||
std::wstring BrowserWebViewDelegate::GetFrameDescription(WebFrame* webframe) {
|
||||
std::wstring name = webframe->GetName();
|
||||
|
||||
if (webframe == browser_->GetWebView()->GetMainFrame()) {
|
||||
if (name.length())
|
||||
return L"main frame \"" + name + L"\"";
|
||||
else
|
||||
return L"main frame";
|
||||
} else {
|
||||
if (name.length())
|
||||
return L"frame \"" + name + L"\"";
|
||||
else
|
||||
return L"frame (anonymous)";
|
||||
}
|
||||
}
|
||||
|
@ -19,8 +19,7 @@
|
||||
#endif
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/ref_counted.h"
|
||||
#include "base/scoped_ptr.h"
|
||||
#include "base/linked_ptr.h"
|
||||
#include "webkit/glue/webcursor.h"
|
||||
#include "webkit/glue/webview_delegate.h"
|
||||
#if defined(OS_WIN)
|
||||
@ -35,29 +34,13 @@ struct WebPreferences;
|
||||
class GURL;
|
||||
class WebWidgetHost;
|
||||
|
||||
class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
|
||||
public WebViewDelegate {
|
||||
class BrowserWebViewDelegate : public WebViewDelegate {
|
||||
public:
|
||||
BrowserWebViewDelegate(CefBrowserImpl* browser)
|
||||
: policy_delegate_enabled_(false),
|
||||
policy_delegate_is_permissive_(false),
|
||||
browser_(browser),
|
||||
top_loading_frame_(NULL),
|
||||
page_id_(-1),
|
||||
last_page_id_updated_(-1),
|
||||
smart_insert_delete_enabled_(true)
|
||||
#if defined(OS_WIN)
|
||||
, select_trailing_whitespace_enabled_(true)
|
||||
#else
|
||||
, select_trailing_whitespace_enabled_(false)
|
||||
#endif
|
||||
#if defined(OS_LINUX)
|
||||
, cursor_type_(GDK_X_CURSOR)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
BrowserWebViewDelegate(CefBrowserImpl* browser);
|
||||
virtual ~BrowserWebViewDelegate() {}
|
||||
|
||||
void Reset();
|
||||
|
||||
// WebViewDelegate
|
||||
virtual WebView* CreateWebView(WebView* webview,
|
||||
bool user_gesture,
|
||||
@ -79,11 +62,11 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
|
||||
const GURL& referrer,
|
||||
WebKit::WebNavigationPolicy policy);
|
||||
virtual void DidMovePlugin(const WebPluginGeometry& move);
|
||||
virtual void RunJavaScriptAlert(WebFrame* webframe,
|
||||
virtual void RunJavaScriptAlert(WebKit::WebFrame* webframe,
|
||||
const std::wstring& message);
|
||||
virtual bool RunJavaScriptConfirm(WebFrame* webframe,
|
||||
virtual bool RunJavaScriptConfirm(WebKit::WebFrame* webframe,
|
||||
const std::wstring& message);
|
||||
virtual bool RunJavaScriptPrompt(WebFrame* webframe,
|
||||
virtual bool RunJavaScriptPrompt(WebKit::WebFrame* webframe,
|
||||
const std::wstring& message,
|
||||
const std::wstring& default_value,
|
||||
std::wstring* result);
|
||||
@ -109,55 +92,63 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
|
||||
int edit_flags,
|
||||
const std::string& security_info,
|
||||
const std::string& frame_charset);
|
||||
virtual void DidCreateDataSource(WebFrame* frame,
|
||||
virtual void DidCreateDataSource(WebKit::WebFrame* frame,
|
||||
WebKit::WebDataSource* ds);
|
||||
virtual void DidStartProvisionalLoadForFrame(
|
||||
WebView* webview,
|
||||
WebFrame* frame,
|
||||
WebKit::WebFrame* frame,
|
||||
NavigationGesture gesture);
|
||||
virtual void DidReceiveServerRedirectForProvisionalLoadForFrame(
|
||||
WebView* webview, WebFrame* frame);
|
||||
virtual void DidReceiveProvisionalLoadServerRedirect(
|
||||
WebView* webview, WebKit::WebFrame* frame);
|
||||
virtual void DidFailProvisionalLoadWithError(
|
||||
WebView* webview,
|
||||
const WebKit::WebURLError& error,
|
||||
WebFrame* frame);
|
||||
virtual void DidCommitLoadForFrame(WebView* webview, WebFrame* frame,
|
||||
bool is_new_navigation);
|
||||
WebKit::WebFrame* frame);
|
||||
virtual void DidCommitLoadForFrame(
|
||||
WebView* webview,
|
||||
WebKit::WebFrame* frame,
|
||||
bool is_new_navigation);
|
||||
virtual void DidReceiveTitle(WebView* webview,
|
||||
const std::wstring& title,
|
||||
WebFrame* frame);
|
||||
WebKit::WebFrame* frame);
|
||||
virtual void DidFinishDocumentLoadForFrame(WebView* webview,
|
||||
WebFrame* frame);
|
||||
WebKit::WebFrame* frame);
|
||||
virtual void DidHandleOnloadEventsForFrame(WebView* webview,
|
||||
WebFrame* frame);
|
||||
WebKit::WebFrame* frame);
|
||||
virtual void DidChangeLocationWithinPageForFrame(WebView* webview,
|
||||
WebFrame* frame,
|
||||
WebKit::WebFrame* frame,
|
||||
bool is_new_navigation);
|
||||
virtual void DidReceiveIconForFrame(WebView* webview, WebFrame* frame);
|
||||
virtual void DidReceiveIconForFrame(WebView* webview,
|
||||
WebKit::WebFrame* frame);
|
||||
|
||||
virtual void WillPerformClientRedirect(WebView* webview,
|
||||
WebFrame* frame,
|
||||
const std::wstring& dest_url,
|
||||
WebKit::WebFrame* frame,
|
||||
const GURL& src_url,
|
||||
const GURL& dest_url,
|
||||
unsigned int delay_seconds,
|
||||
unsigned int fire_date);
|
||||
virtual void DidCancelClientRedirect(WebView* webview,
|
||||
WebFrame* frame);
|
||||
WebKit::WebFrame* frame);
|
||||
|
||||
virtual void DidFinishLoadForFrame(WebView* webview, WebFrame* frame);
|
||||
virtual void DidFinishLoadForFrame(WebView* webview, WebKit::WebFrame* frame);
|
||||
virtual void DidFailLoadWithError(WebView* webview,
|
||||
const WebKit::WebURLError& error,
|
||||
WebFrame* for_frame);
|
||||
WebKit::WebFrame* for_frame);
|
||||
|
||||
virtual void AssignIdentifierToRequest(WebView* webview,
|
||||
virtual void AssignIdentifierToRequest(WebKit::WebFrame* webframe,
|
||||
uint32 identifier,
|
||||
const WebKit::WebURLRequest& request);
|
||||
virtual void WillSendRequest(WebView* webview,
|
||||
virtual void WillSendRequest(WebKit::WebFrame* webframe,
|
||||
uint32 identifier,
|
||||
WebKit::WebURLRequest* request);
|
||||
virtual void DidFinishLoading(WebView* webview, uint32 identifier);
|
||||
virtual void DidFailLoadingWithError(WebView* webview,
|
||||
WebKit::WebURLRequest* request,
|
||||
const WebKit::WebURLResponse& redirect_response);
|
||||
virtual void DidFinishLoading(WebKit::WebFrame* webframe, uint32 identifier);
|
||||
virtual void DidFailLoadingWithError(WebKit::WebFrame* webframe,
|
||||
uint32 identifier,
|
||||
const WebKit::WebURLError& error);
|
||||
virtual void DidReceiveResponse(WebKit::WebFrame* webframe,
|
||||
uint32 identifier,
|
||||
const WebKit::WebURLResponse& response);
|
||||
|
||||
virtual bool ShouldBeginEditing(WebView* webview, std::wstring range);
|
||||
virtual bool ShouldEndEditing(WebView* webview, std::wstring range);
|
||||
@ -187,10 +178,10 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
|
||||
virtual void DidStartLoading(WebView* webview);
|
||||
virtual void DidStopLoading(WebView* webview);
|
||||
|
||||
virtual void WindowObjectCleared(WebFrame* webframe);
|
||||
virtual void WindowObjectCleared(WebKit::WebFrame* webframe);
|
||||
virtual WebKit::WebNavigationPolicy PolicyForNavigationAction(
|
||||
WebView* webview,
|
||||
WebFrame* frame,
|
||||
WebKit::WebFrame* frame,
|
||||
const WebKit::WebURLRequest& request,
|
||||
WebKit::WebNavigationType type,
|
||||
WebKit::WebNavigationPolicy default_policy,
|
||||
@ -220,7 +211,7 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
|
||||
void SetSelectTrailingWhitespaceEnabled(bool enabled);
|
||||
|
||||
// Additional accessors
|
||||
WebFrame* top_loading_frame() { return top_loading_frame_; }
|
||||
WebKit::WebFrame* top_loading_frame() { return top_loading_frame_; }
|
||||
#if defined(OS_WIN)
|
||||
IDropTarget* drop_delegate() { return drop_delegate_.get(); }
|
||||
IDropSource* drag_delegate() { return drag_delegate_.get(); }
|
||||
@ -236,10 +227,20 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
|
||||
|
||||
// Sets the webview as a drop target.
|
||||
void RegisterDragDrop();
|
||||
void RevokeDragDrop();
|
||||
|
||||
void ResetDragDrop();
|
||||
|
||||
void SetCustomPolicyDelegate(bool is_custom, bool is_permissive);
|
||||
void WaitForPolicyDelegate();
|
||||
|
||||
void set_block_redirects(bool block_redirects) {
|
||||
block_redirects_ = block_redirects;
|
||||
}
|
||||
bool block_redirects() const {
|
||||
return block_redirects_;
|
||||
}
|
||||
|
||||
CefBrowserImpl* GetBrowser() { return browser_; }
|
||||
|
||||
protected:
|
||||
@ -247,24 +248,26 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
|
||||
void UpdateAddressBar(WebView* webView);
|
||||
|
||||
// Default handling of JavaScript messages.
|
||||
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);
|
||||
void ShowJavaScriptAlert(WebKit::WebFrame* webframe,
|
||||
const std::wstring& message);
|
||||
bool ShowJavaScriptConfirm(WebKit::WebFrame* webframe,
|
||||
const std::wstring& message);
|
||||
bool ShowJavaScriptPrompt(WebKit::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
|
||||
// page has finished loading. From here, we can generate the dump for the
|
||||
// test.
|
||||
void LocationChangeDone(WebFrame*);
|
||||
void LocationChangeDone(WebKit::WebFrame*);
|
||||
|
||||
WebWidgetHost* GetWidgetHost();
|
||||
|
||||
void UpdateForCommittedLoad(WebFrame* webframe, bool is_new_navigation);
|
||||
void UpdateURL(WebFrame* frame);
|
||||
void UpdateSessionHistory(WebFrame* frame);
|
||||
|
||||
// Get a string suitable for dumping a frame to the console.
|
||||
std::wstring GetFrameDescription(WebFrame* webframe);
|
||||
void UpdateForCommittedLoad(WebKit::WebFrame* webframe,
|
||||
bool is_new_navigation);
|
||||
void UpdateURL(WebKit::WebFrame* frame);
|
||||
void UpdateSessionHistory(WebKit::WebFrame* frame);
|
||||
|
||||
private:
|
||||
// Causes navigation actions just printout the intended navigation instead
|
||||
@ -280,19 +283,13 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
|
||||
CefBrowserImpl* browser_;
|
||||
|
||||
// This is non-NULL IFF a load is in progress.
|
||||
WebFrame* top_loading_frame_;
|
||||
WebKit::WebFrame* top_loading_frame_;
|
||||
|
||||
// For tracking session history. See RenderView.
|
||||
int page_id_;
|
||||
int last_page_id_updated_;
|
||||
|
||||
scoped_ptr<BrowserExtraData> pending_extra_data_;
|
||||
|
||||
// true if we want to enable smart insert/delete.
|
||||
bool smart_insert_delete_enabled_;
|
||||
|
||||
// true if we want to enable selection of trailing whitespaces
|
||||
bool select_trailing_whitespace_enabled_;
|
||||
linked_ptr<BrowserExtraData> pending_extra_data_;
|
||||
|
||||
WebCursor current_cursor_;
|
||||
#if defined(OS_WIN)
|
||||
@ -308,7 +305,14 @@ class BrowserWebViewDelegate : public base::RefCounted<BrowserWebViewDelegate>,
|
||||
GdkCursorType cursor_type_;
|
||||
#endif
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(BrowserWebViewDelegate);
|
||||
// true if we want to enable smart insert/delete.
|
||||
bool smart_insert_delete_enabled_;
|
||||
|
||||
// true if we want to enable selection of trailing whitespaces
|
||||
bool select_trailing_whitespace_enabled_;
|
||||
|
||||
// true if we should block any redirects
|
||||
bool block_redirects_;
|
||||
};
|
||||
|
||||
#endif // _BROWSER_WEBVIEW_DELEGATE_H
|
||||
|
@ -27,9 +27,9 @@
|
||||
#include "base/trace_event.h"
|
||||
#include "net/base/net_errors.h"
|
||||
#include "webkit/api/public/WebCursorInfo.h"
|
||||
#include "webkit/api/public/WebFrame.h"
|
||||
#include "webkit/api/public/WebRect.h"
|
||||
#include "webkit/glue/webdropdata.h"
|
||||
#include "webkit/glue/webframe.h"
|
||||
#include "webkit/glue/webpreferences.h"
|
||||
#include "webkit/glue/webplugin.h"
|
||||
#include "webkit/glue/webkit_glue.h"
|
||||
@ -39,6 +39,7 @@
|
||||
#include "webkit/glue/window_open_disposition.h"
|
||||
|
||||
using WebKit::WebCursorInfo;
|
||||
using WebKit::WebFrame;
|
||||
using WebKit::WebNavigationPolicy;
|
||||
using WebKit::WebRect;
|
||||
|
||||
@ -329,7 +330,7 @@ void BrowserWebViewDelegate::runModal() {
|
||||
if (!host)
|
||||
return;
|
||||
|
||||
show(WebNavigationPolicy() /*XXX NEW_WINDOW*/);
|
||||
show(WebKit::WebNavigationPolicyNewWindow);
|
||||
|
||||
CefContext::BrowserList *list;
|
||||
CefContext::BrowserList::const_iterator i;
|
||||
|
@ -347,6 +347,10 @@ bool CefContext::Initialize(bool multi_threaded_message_loop,
|
||||
webprefs_->java_enabled = true;
|
||||
webprefs_->allow_scripts_to_close_windows = false;
|
||||
webprefs_->xss_auditor_enabled = false;
|
||||
webprefs_->remote_fonts_enabled = true;
|
||||
webprefs_->local_storage_enabled = true;
|
||||
webprefs_->session_storage_enabled = true;
|
||||
webprefs_->application_cache_enabled = false;
|
||||
|
||||
if (multi_threaded_message_loop) {
|
||||
// Event that will be used to signal thread setup completion. Start
|
||||
|
@ -3,6 +3,6 @@
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="webkit_common"
|
||||
InheritedPropertySheets=".\libcef_webkit_includes.vsprops;$(SolutionDir)..\webkit\build\webkit_common_defines.vsprops;$(SolutionDir)..\webkit\build\js_engine$(JS_ENGINE_TYPE).vsprops;$(SolutionDir)..\third_party\npapi\using_npapi.vsprops;$(SolutionDir)..\skia\using_skia.vsprops;$(SolutionDir)..\build\external_code.vsprops;$(SolutionDir)..\third_party\icu38\build\using_icu.vsprops"
|
||||
InheritedPropertySheets=".\libcef_webkit_includes.vsprops;.\libcef_webkit_defines.vsprops;.\libcef_webkit_v8bindings.vsprops;$(SolutionDir)..\third_party\npapi\using_npapi.vsprops;$(SolutionDir)..\skia\using_skia.vsprops;$(SolutionDir)..\build\external_code.vsprops;$(SolutionDir)..\third_party\icu38\build\using_icu.vsprops"
|
||||
>
|
||||
</VisualStudioPropertySheet>
|
||||
|
11
libcef/libcef_webkit_defines.vsprops
Normal file
11
libcef/libcef_webkit_defines.vsprops
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioPropertySheet
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="libcef_webkit_defines"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
PreprocessorDefinitions="ENABLE_DATABASE=1;ENABLE_DASHBOARD_SUPPORT=0;ENABLE_JAVASCRIPT_DEBUGGER=0;ENABLE_JSC_MULTIPLE_THREADS=0;ENABLE_ICONDATABASE=0;ENABLE_XSLT=1;ENABLE_XPATH=1;ENABLE_SVG=1;ENABLE_SVG_ANIMATION=1;ENABLE_SVG_AS_IMAGE=1;ENABLE_SVG_USE=1;ENABLE_SVG_FOREIGN_OBJECT=1;ENABLE_SVG_FONTS=1;ENABLE_VIDEO=1;ENABLE_WORKERS=1;WEBCORE_NAVIGATOR_PLATFORM="\"Win32\"";USE_GOOGLE_URL_LIBRARY;USE_SYSTEM_MALLOC=1;CRASH=__debugbreak;BUILDING_CHROMIUM__=1"
|
||||
/>
|
||||
</VisualStudioPropertySheet>
|
12
libcef/libcef_webkit_v8bindings.vsprops
Normal file
12
libcef/libcef_webkit_v8bindings.vsprops
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioPropertySheet
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="libcef_webkit_v8bindings"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="$(SolutionDir)..\v8\include;$(IntDir)\..\V8Bindings\DerivedSources;$(IntDir)\..\V8Bindings\SharedSources;$(SolutionDir)..\webkit\port\bindings\v8;"
|
||||
PreprocessorDefinitions="_SCL_SECURE_NO_WARNINGS;CRASH=__debugbreak"
|
||||
/>
|
||||
</VisualStudioPropertySheet>
|
@ -3,6 +3,7 @@
|
||||
# file entry should be proceeded by the code review or bug report link that it
|
||||
# relates to.
|
||||
patches = {
|
||||
# http://codereview.chromium.org/160004
|
||||
# http://codereview.chromium.org/164482
|
||||
"webkit_api" : "../../webkit/api/",
|
||||
"webkit_glue" : "../../webkit/glue/"
|
||||
}
|
||||
|
16
patch/patches/webkit_api.patch
Normal file
16
patch/patches/webkit_api.patch
Normal file
@ -0,0 +1,16 @@
|
||||
Index: public/WebFrame.h
|
||||
===================================================================
|
||||
--- public/WebFrame.h (revision 23266)
|
||||
+++ public/WebFrame.h (working copy)
|
||||
@@ -332,6 +332,11 @@
|
||||
// given page size.
|
||||
virtual int printBegin(const WebSize& pageSize) = 0;
|
||||
|
||||
+ // Returns the page shrinking factor calculated by webkit (usually
|
||||
+ // between 1/1.25 and 1/2). Returns 0 if the page number is invalid or
|
||||
+ // not in printing mode.
|
||||
+ virtual float getPrintPageShrink(int page) = 0;
|
||||
+
|
||||
// Prints one page, and returns the calculated page shrinking factor
|
||||
// (usually between 1/1.25 and 1/2). Returns 0 if the page number is
|
||||
// invalid or not in printing mode.
|
@ -1,28 +1,12 @@
|
||||
Index: webframe.h
|
||||
===================================================================
|
||||
--- webframe.h (revision 21529)
|
||||
+++ webframe.h (working copy)
|
||||
@@ -404,6 +404,11 @@
|
||||
// size.
|
||||
virtual int PrintBegin(const WebKit::WebSize& page_size) = 0;
|
||||
|
||||
+ // Returns the page shrinking factor calculated by webkit (usually between
|
||||
+ // 1/1.25 and 1/2). Returns 0 if the page number is invalid or not in printing
|
||||
+ // mode.
|
||||
+ virtual float GetPrintPageShrink(int page) = 0;
|
||||
+
|
||||
// Prints one page, and returns the calculated page shrinking factor (usually
|
||||
// between 1/1.25 and 1/2). Returns 0 if the page number is invalid or not
|
||||
// in printing mode.
|
||||
Index: webframe_impl.cc
|
||||
===================================================================
|
||||
--- webframe_impl.cc (revision 21529)
|
||||
--- webframe_impl.cc (revision 23266)
|
||||
+++ webframe_impl.cc (working copy)
|
||||
@@ -1766,6 +1766,16 @@
|
||||
@@ -1045,6 +1045,16 @@
|
||||
return print_context_->pageCount();
|
||||
}
|
||||
|
||||
+float WebFrameImpl::GetPrintPageShrink(int page) {
|
||||
+float WebFrameImpl::getPrintPageShrink(int page) {
|
||||
+ // Ensure correct state.
|
||||
+ if (!print_context_.get() || page < 0) {
|
||||
+ NOTREACHED();
|
||||
@ -32,18 +16,18 @@ Index: webframe_impl.cc
|
||||
+ return print_context_->getPageShrink(page);
|
||||
+}
|
||||
+
|
||||
float WebFrameImpl::PrintPage(int page, WebCanvas* canvas) {
|
||||
float WebFrameImpl::printPage(int page, WebCanvas* canvas) {
|
||||
// Ensure correct state.
|
||||
if (!print_context_.get() || page < 0 || !frame() || !frame()->document()) {
|
||||
Index: webframe_impl.h
|
||||
===================================================================
|
||||
--- webframe_impl.h (revision 21529)
|
||||
--- webframe_impl.h (revision 23266)
|
||||
+++ webframe_impl.h (working copy)
|
||||
@@ -195,6 +195,7 @@
|
||||
virtual WebKit::WebSize ScrollOffset() const;
|
||||
|
||||
virtual int PrintBegin(const WebKit::WebSize& page_size);
|
||||
+ virtual float GetPrintPageShrink(int page);
|
||||
virtual float PrintPage(int page, WebKit::WebCanvas* canvas);
|
||||
virtual void PrintEnd();
|
||||
|
||||
@@ -147,6 +147,7 @@
|
||||
virtual WebKit::WebString selectionAsMarkup() const;
|
||||
virtual int printBegin(const WebKit::WebSize& page_size);
|
||||
virtual float printPage(int page_to_print, WebKit::WebCanvas* canvas);
|
||||
+ virtual float getPrintPageShrink(int page);
|
||||
virtual void printEnd();
|
||||
virtual bool find(
|
||||
int identifier, const WebKit::WebString& search_text,
|
||||
|
Loading…
x
Reference in New Issue
Block a user