mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium revision 213078.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1338 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -34,7 +34,6 @@
|
||||
#include "third_party/WebKit/public/web/WebScriptSource.h"
|
||||
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
|
||||
#include "third_party/WebKit/public/web/WebView.h"
|
||||
#include "webkit/base/file_path_string_conversions.h"
|
||||
#include "webkit/glue/webkit_glue.h"
|
||||
|
||||
using WebKit::WebFrame;
|
||||
@ -48,6 +47,15 @@ namespace {
|
||||
const int64 kInvalidBrowserId = -1;
|
||||
const int64 kInvalidFrameId = -1;
|
||||
|
||||
WebKit::WebString FilePathStringToWebString(
|
||||
const base::FilePath::StringType& str) {
|
||||
#if defined(OS_POSIX)
|
||||
return WideToUTF16Hack(base::SysNativeMBToWide(str));
|
||||
#elif defined(OS_WIN)
|
||||
return WideToUTF16Hack(str);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
@ -78,25 +86,25 @@ CefRefPtr<CefBrowserHost> CefBrowserImpl::GetHost() {
|
||||
bool CefBrowserImpl::CanGoBack() {
|
||||
CEF_REQUIRE_RT_RETURN(false);
|
||||
|
||||
return webkit_glue::CanGoBackOrForward(render_view()->GetWebView(), -1);
|
||||
return webkit_glue::CanGoBack(render_view()->GetWebView());
|
||||
}
|
||||
|
||||
void CefBrowserImpl::GoBack() {
|
||||
CEF_REQUIRE_RT_RETURN_VOID();
|
||||
|
||||
webkit_glue::GoBackOrForward(render_view()->GetWebView(), -1);
|
||||
webkit_glue::GoBack(render_view()->GetWebView());
|
||||
}
|
||||
|
||||
bool CefBrowserImpl::CanGoForward() {
|
||||
CEF_REQUIRE_RT_RETURN(false);
|
||||
|
||||
return webkit_glue::CanGoBackOrForward(render_view()->GetWebView(), 1);
|
||||
return webkit_glue::CanGoForward(render_view()->GetWebView());
|
||||
}
|
||||
|
||||
void CefBrowserImpl::GoForward() {
|
||||
CEF_REQUIRE_RT_RETURN_VOID();
|
||||
|
||||
webkit_glue::GoBackOrForward(render_view()->GetWebView(), 1);
|
||||
webkit_glue::GoForward(render_view()->GetWebView());
|
||||
}
|
||||
|
||||
bool CefBrowserImpl::IsLoading() {
|
||||
@ -334,7 +342,7 @@ void CefBrowserImpl::LoadRequest(const CefMsg_LoadRequest_Params& params) {
|
||||
data.assign(element.bytes(), element.bytes_length());
|
||||
body.appendData(data);
|
||||
} else if (element.type() == net::UploadElement::TYPE_FILE) {
|
||||
body.appendFile(webkit_base::FilePathToWebString(element.file_path()));
|
||||
body.appendFile(FilePathStringToWebString(element.file_path().value()));
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
@ -469,7 +469,7 @@ bool CefContentRendererClient::OverrideCreatePlugin(
|
||||
content::RenderViewImpl* render_view_impl =
|
||||
static_cast<content::RenderViewImpl*>(render_view);
|
||||
|
||||
webkit::WebPluginInfo info;
|
||||
content::WebPluginInfo info;
|
||||
std::string mime_type;
|
||||
bool found = render_view_impl->GetPluginInfo(params.url,
|
||||
frame->top()->document().url(),
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/message_loop.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/sequenced_task_runner.h"
|
||||
#include "content/public/renderer/content_renderer_client.h"
|
||||
|
||||
|
@ -8,12 +8,12 @@
|
||||
#include "libcef/common/cef_messages.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/message_loop.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "content/common/devtools_messages.h"
|
||||
#include "googleurl/src/gurl.h"
|
||||
#include "googleurl/src/url_util.h"
|
||||
#include "third_party/WebKit/public/platform/WebString.h"
|
||||
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
|
||||
#include "url/gurl.h"
|
||||
#include "url/url_util.h"
|
||||
|
||||
CefRenderMessageFilter::CefRenderMessageFilter()
|
||||
: channel_(NULL) {
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "libcef/common/response_impl.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/message_loop.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "third_party/WebKit/public/platform/Platform.h"
|
||||
#include "third_party/WebKit/public/platform/WebString.h"
|
||||
#include "third_party/WebKit/public/platform/WebURL.h"
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "config.h"
|
||||
MSVC_PUSH_WARNING_LEVEL(0);
|
||||
#include "core/page/Frame.h"
|
||||
#include "core/workers//WorkerContext.h"
|
||||
#include "core/workers/WorkerGlobalScope.h"
|
||||
#include "bindings/v8/ScriptController.h"
|
||||
#include "bindings/v8/V8Binding.h"
|
||||
#include "bindings/v8/V8RecursionScope.h"
|
||||
@ -32,10 +32,10 @@ MSVC_POP_WARNING();
|
||||
#include "base/lazy_instance.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/threading/thread_local.h"
|
||||
#include "googleurl/src/gurl.h"
|
||||
#include "third_party/WebKit/public/web/WebKit.h"
|
||||
#include "third_party/WebKit/public/web/WebFrame.h"
|
||||
#include "third_party/WebKit/public/web/WebScriptController.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@ -472,40 +472,45 @@ void GetCefString(v8::Handle<v8::String> str, CefString& out) {
|
||||
}
|
||||
|
||||
// V8 function callback.
|
||||
v8::Handle<v8::Value> FunctionCallbackImpl(const v8::Arguments& args) {
|
||||
void FunctionCallbackImpl(const v8::FunctionCallbackInfo<v8::Value>& info) {
|
||||
WebCore::V8RecursionScope recursion_scope(
|
||||
WebCore::toScriptExecutionContext(v8::Context::GetCurrent()));
|
||||
|
||||
CefV8Handler* handler =
|
||||
static_cast<CefV8Handler*>(v8::External::Cast(*args.Data())->Value());
|
||||
static_cast<CefV8Handler*>(v8::External::Cast(*info.Data())->Value());
|
||||
|
||||
CefV8ValueList params;
|
||||
for (int i = 0; i < args.Length(); i++)
|
||||
params.push_back(new CefV8ValueImpl(args[i]));
|
||||
for (int i = 0; i < info.Length(); i++)
|
||||
params.push_back(new CefV8ValueImpl(info[i]));
|
||||
|
||||
CefString func_name;
|
||||
GetCefString(v8::Handle<v8::String>::Cast(args.Callee()->GetName()),
|
||||
GetCefString(v8::Handle<v8::String>::Cast(info.Callee()->GetName()),
|
||||
func_name);
|
||||
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(args.This());
|
||||
CefRefPtr<CefV8Value> object = new CefV8ValueImpl(info.This());
|
||||
CefRefPtr<CefV8Value> retval;
|
||||
CefString exception;
|
||||
|
||||
if (handler->Execute(func_name, object, params, retval, exception)) {
|
||||
if (!exception.empty()) {
|
||||
return v8::ThrowException(v8::Exception::Error(GetV8String(exception)));
|
||||
info.GetReturnValue().Set(
|
||||
v8::ThrowException(v8::Exception::Error(GetV8String(exception))));
|
||||
return;
|
||||
} else {
|
||||
CefV8ValueImpl* rv = static_cast<CefV8ValueImpl*>(retval.get());
|
||||
if (rv && rv->IsValid())
|
||||
return rv->GetV8Value(true);
|
||||
if (rv && rv->IsValid()) {
|
||||
info.GetReturnValue().Set(rv->GetV8Value(true));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return v8::Undefined();
|
||||
info.GetReturnValue().SetUndefined();
|
||||
}
|
||||
|
||||
// V8 Accessor callbacks
|
||||
v8::Handle<v8::Value> AccessorGetterCallbackImpl(v8::Local<v8::String> property,
|
||||
const v8::AccessorInfo& info) {
|
||||
void AccessorGetterCallbackImpl(
|
||||
v8::Local<v8::String> property,
|
||||
const v8::PropertyCallbackInfo<v8::Value>& info) {
|
||||
WebCore::V8RecursionScope recursion_scope(
|
||||
WebCore::toScriptExecutionContext(v8::Context::GetCurrent()));
|
||||
|
||||
@ -524,22 +529,26 @@ v8::Handle<v8::Value> AccessorGetterCallbackImpl(v8::Local<v8::String> property,
|
||||
GetCefString(property, name);
|
||||
if (accessorPtr->Get(name, object, retval, exception)) {
|
||||
if (!exception.empty()) {
|
||||
return v8::ThrowException(
|
||||
v8::Exception::Error(GetV8String(exception)));
|
||||
info.GetReturnValue().Set(
|
||||
v8::ThrowException(v8::Exception::Error(GetV8String(exception))));
|
||||
return;
|
||||
} else {
|
||||
CefV8ValueImpl* rv = static_cast<CefV8ValueImpl*>(retval.get());
|
||||
if (rv && rv->IsValid())
|
||||
return rv->GetV8Value(true);
|
||||
if (rv && rv->IsValid()) {
|
||||
info.GetReturnValue().Set(rv->GetV8Value(true));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return v8::Undefined();
|
||||
return info.GetReturnValue().SetUndefined();
|
||||
}
|
||||
|
||||
void AccessorSetterCallbackImpl(v8::Local<v8::String> property,
|
||||
v8::Local<v8::Value> value,
|
||||
const v8::AccessorInfo& info) {
|
||||
void AccessorSetterCallbackImpl(
|
||||
v8::Local<v8::String> property,
|
||||
v8::Local<v8::Value> value,
|
||||
const v8::PropertyCallbackInfo<void>& info) {
|
||||
WebCore::V8RecursionScope recursion_scope(
|
||||
WebCore::toScriptExecutionContext(v8::Context::GetCurrent()));
|
||||
|
||||
@ -586,7 +595,7 @@ v8::Local<v8::Value> CallV8Function(v8::Handle<v8::Context> context,
|
||||
DCHECK(controller);
|
||||
if (controller) {
|
||||
func_rv = WebCore::ScriptController::callFunctionWithInstrumentation(
|
||||
controller->workerContext()->scriptExecutionContext(),
|
||||
controller->workerGlobalScope()->scriptExecutionContext(),
|
||||
function, receiver, argc, args);
|
||||
}
|
||||
}
|
||||
@ -1673,9 +1682,10 @@ bool CefV8ValueImpl::SetValue(const CefString& key, AccessControl settings,
|
||||
if (!accessorPtr.get())
|
||||
return false;
|
||||
|
||||
v8::AccessorGetter getter = AccessorGetterCallbackImpl;
|
||||
v8::AccessorSetter setter = (attribute & V8_PROPERTY_ATTRIBUTE_READONLY) ?
|
||||
NULL : AccessorSetterCallbackImpl;
|
||||
v8::AccessorGetterCallback getter = AccessorGetterCallbackImpl;
|
||||
v8::AccessorSetterCallback setter =
|
||||
(attribute & V8_PROPERTY_ATTRIBUTE_READONLY) ?
|
||||
NULL : AccessorSetterCallbackImpl;
|
||||
|
||||
v8::TryCatch try_catch;
|
||||
try_catch.SetVerbose(true);
|
||||
|
@ -14,31 +14,43 @@ MSVC_PUSH_WARNING_LEVEL(0);
|
||||
#include "bindings/v8/ScriptController.h"
|
||||
#include "core/history/BackForwardController.h"
|
||||
#include "core/page/Page.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/src/WebFrameImpl.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/src/WebViewImpl.h"
|
||||
#include "third_party/WebKit/Source/web/WebFrameImpl.h"
|
||||
#include "third_party/WebKit/Source/web/WebViewImpl.h"
|
||||
MSVC_POP_WARNING();
|
||||
#undef LOG
|
||||
|
||||
namespace webkit_glue {
|
||||
|
||||
bool CanGoBackOrForward(WebKit::WebView* view, int distance) {
|
||||
bool CanGoBack(WebKit::WebView* view) {
|
||||
if (!view)
|
||||
return false;
|
||||
WebKit::WebViewImpl* impl = reinterpret_cast<WebKit::WebViewImpl*>(view);
|
||||
if (distance == 0)
|
||||
return true;
|
||||
if (distance > 0 && distance <= impl->page()->backForward()->forwardCount())
|
||||
return true;
|
||||
if (distance < 0 && -distance <= impl->page()->backForward()->backCount())
|
||||
return true;
|
||||
return false;
|
||||
return (impl->page()->backForward()->backCount() > 0);
|
||||
}
|
||||
|
||||
void GoBackOrForward(WebKit::WebView* view, int distance) {
|
||||
bool CanGoForward(WebKit::WebView* view) {
|
||||
if (!view)
|
||||
return false;
|
||||
WebKit::WebViewImpl* impl = reinterpret_cast<WebKit::WebViewImpl*>(view);
|
||||
return (impl->page()->backForward()->forwardCount() > 0);
|
||||
}
|
||||
|
||||
void GoBack(WebKit::WebView* view) {
|
||||
if (!view)
|
||||
return;
|
||||
WebKit::WebViewImpl* impl = reinterpret_cast<WebKit::WebViewImpl*>(view);
|
||||
impl->page()->goBackOrForward(distance);
|
||||
WebCore::BackForwardController* controller = impl->page()->backForward();
|
||||
if (controller->backCount() > 0)
|
||||
controller->goBack();
|
||||
}
|
||||
|
||||
void GoForward(WebKit::WebView* view) {
|
||||
if (!view)
|
||||
return;
|
||||
WebKit::WebViewImpl* impl = reinterpret_cast<WebKit::WebViewImpl*>(view);
|
||||
WebCore::BackForwardController* controller = impl->page()->backForward();
|
||||
if (controller->forwardCount() > 0)
|
||||
controller->goForward();
|
||||
}
|
||||
|
||||
v8::Handle<v8::Context> GetV8Context(WebKit::WebFrame* frame) {
|
||||
|
@ -17,8 +17,10 @@ class WebView;
|
||||
|
||||
namespace webkit_glue {
|
||||
|
||||
bool CanGoBackOrForward(WebKit::WebView* view, int distance);
|
||||
void GoBackOrForward(WebKit::WebView* view, int distance);
|
||||
bool CanGoBack(WebKit::WebView* view);
|
||||
bool CanGoForward(WebKit::WebView* view);
|
||||
void GoBack(WebKit::WebView* view);
|
||||
void GoForward(WebKit::WebView* view);
|
||||
|
||||
// Retrieve the V8 context associated with the frame.
|
||||
v8::Handle<v8::Context> GetV8Context(WebKit::WebFrame* frame);
|
||||
|
Reference in New Issue
Block a user