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