libcef: Update due to underlying chromium changes.

- Add the printing project and delete duplicated files from the CEF printing directory.
- Add media-related projects and support for <video> and <image> tags.
- Use WebKit::WebHTTPBody instead of net::UploadData for web requests.
- Numerous changes due to continued cleanup of webkit/glue and webkit/api/public.
- Use a separate BrowserWebViewDelegate instance for popup windows.

libcef:
- Add support for printing to file.
- Use WebFrame::GetFullPageHtml() instead of webkit_glue::GetDocumentString().
- Parse extra header values in RequestProxy for passing to CefHandler::HandleBeforeResourceLoad().
- Add urlmon.lib dependency in libcef.vsprops.

tools:
- Add the patch application tool (patcher.py).

patch:
- New project for applying required patches to the Chromium source tree (issue #47).
- Add webkit_glue.patch for http://codereview.chromium.org/160004

cefclient:
- Add new test for submitting and handling requests.
- Don't change navigation button state for popup windows.
- Fix problem on Vista where the string returned by EM_GETLINE is not NULL-terminated.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@32 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2009-07-24 18:37:00 +00:00
parent 0a92d27cc1
commit 6a7b6d5038
50 changed files with 1910 additions and 1124 deletions

View File

@@ -9,15 +9,22 @@
#include "request_impl.h"
#include "base/string_util.h"
#include "webkit/api/public/WebHTTPBody.h"
#include "webkit/api/public/WebScriptSource.h"
#include "webkit/api/public/WebString.h"
#include "webkit/api/public/WebURL.h"
#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::WebHTTPBody;
using WebKit::WebScriptSource;
using WebKit::WebString;
using WebKit::WebURL;
using WebKit::WebURLRequest;
using webkit_glue::StdStringToWebString;
using webkit_glue::WebStringToStdString;
CefBrowserImpl::CefBrowserImpl(CefWindowInfo& windowInfo, bool popup,
@@ -27,6 +34,7 @@ CefBrowserImpl::CefBrowserImpl(CefWindowInfo& windowInfo, bool popup,
frame_main_(NULL)
{
delegate_ = new BrowserWebViewDelegate(this);
popup_delegate_ = new BrowserWebViewDelegate(this);
nav_controller_.reset(new BrowserNavigationController(this));
}
@@ -342,8 +350,8 @@ CefRefPtr<CefBrowser> CefBrowser::CreateBrowserSync(CefWindowInfo& windowInfo,
void CefBrowserImpl::UIT_LoadURL(CefFrame* frame,
const std::wstring& url)
{
UIT_LoadURLForRequest(frame, url, std::wstring(), NULL,
WebRequest::HeaderMap());
UIT_LoadURLForRequest(frame, url, std::wstring(), WebHTTPBody(),
CefRequest::HeaderMap());
}
void CefBrowserImpl::UIT_LoadURLForRequestRef(CefFrame* frame,
@@ -354,27 +362,26 @@ void CefBrowserImpl::UIT_LoadURLForRequestRef(CefFrame* frame,
CefRequestImpl *impl = static_cast<CefRequestImpl*>(request);
scoped_refptr<net::UploadData> upload_data;
WebHTTPBody upload_data;
CefRefPtr<CefPostData> postdata = impl->GetPostData();
if(postdata.get())
{
upload_data = new net::UploadData();
static_cast<CefPostDataImpl*>(postdata.get())->Get(*upload_data.get());
if(postdata.get()) {
upload_data.initialize();
static_cast<CefPostDataImpl*>(postdata.get())->Get(upload_data);
}
WebRequest::HeaderMap headers;
CefRequest::HeaderMap headers;
impl->GetHeaderMap(headers);
UIT_LoadURLForRequest(frame, url, method, upload_data.get(), headers);
UIT_LoadURLForRequest(frame, url, method, upload_data, headers);
request->Release();
}
void CefBrowserImpl::UIT_LoadURLForRequest(CefFrame* frame,
const std::wstring& url,
const std::wstring& method,
net::UploadData *upload_data,
const WebRequest::HeaderMap& headers)
const std::wstring& url,
const std::wstring& method,
const WebKit::WebHTTPBody& upload_data,
const CefRequest::HeaderMap& headers)
{
REQUIRE_UIT();
@@ -508,41 +515,40 @@ 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 && !entry.GetContentState().empty()) {
if (reload) {
frame->Reload();
} else if (!entry.GetContentState().empty()) {
DCHECK(entry.GetPageID() != -1);
frame->LoadHistoryState(entry.GetContentState());
frame->LoadHistoryItem(
webkit_glue::HistoryItemFromString(entry.GetContentState()));
} else {
WebRequestCachePolicy cache_policy;
if (reload) {
cache_policy = WebRequestReloadIgnoringCacheData;
} else {
DCHECK(entry.GetPageID() == -1);
cache_policy = WebRequestUseProtocolCachePolicy;
DCHECK(entry.GetPageID() == -1);
WebURLRequest request(entry.GetURL());
if(entry.GetMethod().size() > 0) {
request.setHTTPMethod(
StdStringToWebString(WideToUTF8(entry.GetMethod())));
}
scoped_ptr<WebRequest> request(WebRequest::Create(entry.GetURL()));
request->SetCachePolicy(cache_policy);
if(entry.GetMethod().size() > 0)
request->SetHttpMethod(WideToUTF8(entry.GetMethod()));
if(entry.GetHeaders().size() > 0)
request->SetHttpHeaders(entry.GetHeaders());
CefRequestImpl::SetHeaderMap(entry.GetHeaders(), request);
if(entry.GetUploadData())
if(!entry.GetUploadData().isNull())
{
if(request->GetHttpMethod() == "GET"
|| request->GetHttpMethod() == "HEAD") {
request->SetHttpMethod("POST");
std::string method = WebStringToStdString(request.httpMethod());
if(method == "GET" || method == "HEAD") {
request.setHTTPMethod(StdStringToWebString("POST"));
}
if(request->GetHttpHeaderValue("Content-Type").size() == 0) {
request->SetHttpHeaderValue(
"Content-Type", "application/x-www-form-urlencoded");
if(request.httpHeaderField(StdStringToWebString("Content-Type")).length()
== 0) {
request.setHTTPHeaderField(
StdStringToWebString("Content-Type"),
StdStringToWebString("application/x-www-form-urlencoded"));
}
request->SetUploadData(*entry.GetUploadData());
request.setHTTPBody(entry.GetUploadData());
}
frame->LoadRequest(request.get());
frame->LoadRequest(request);
}
// In case LoadRequest failed before DidCreateDataSource was called.
@@ -590,11 +596,10 @@ CefRefPtr<CefBrowserImpl> CefBrowserImpl::UIT_CreatePopupWindow(const std::wstri
return browser;
}
void CefBrowserImpl::UIT_Show(WebView* webview,
WindowOpenDisposition disposition)
void CefBrowserImpl::UIT_Show(WebKit::WebNavigationPolicy policy)
{
REQUIRE_UIT();
delegate_->Show(webview, disposition);
delegate_->show(policy);
}
void CefBrowserImpl::UIT_HandleActionView(CefHandler::MenuId menuId)