Update to Chromium revision fc6aaca4 (#406441)

This commit is contained in:
Marshall Greenblatt
2016-07-21 17:21:32 -04:00
parent d92bc1d200
commit 98f59f47fd
79 changed files with 478 additions and 402 deletions

View File

@@ -606,7 +606,9 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) {
} else if (base::LowerCaseEqualsASCII(command, "gettext")) {
response = webkit_glue::DumpDocumentText(web_frame);
success = true;
} else if (web_frame->executeCommand(base::UTF8ToUTF16(command))) {
} else if (web_frame->isWebLocalFrame() &&
web_frame->toWebLocalFrame()->executeCommand(
base::UTF8ToUTF16(command))) {
success = true;
}
}

View File

@@ -12,6 +12,7 @@
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebElement.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebNode.h"
#include "third_party/WebKit/public/web/WebRange.h"
@@ -92,17 +93,21 @@ CefRefPtr<CefDOMNode> CefDOMDocumentImpl::GetFocusedNode() {
}
bool CefDOMDocumentImpl::HasSelection() {
if (!VerifyContext())
if (!VerifyContext() || !frame_->isWebLocalFrame())
return false;
return frame_->hasSelection();
return frame_->toWebLocalFrame()->hasSelection();
}
int CefDOMDocumentImpl::GetSelectionStartOffset() {
if (!VerifyContext() || !frame_->hasSelection())
if (!VerifyContext() || !frame_->isWebLocalFrame())
return 0;
const WebRange& range = frame_->selectionRange();
blink::WebLocalFrame* local_frame = frame_->toWebLocalFrame();
if (!!local_frame->hasSelection())
return 0;
const WebRange& range = local_frame->selectionRange();
if (range.isNull())
return 0;
@@ -110,10 +115,14 @@ int CefDOMDocumentImpl::GetSelectionStartOffset() {
}
int CefDOMDocumentImpl::GetSelectionEndOffset() {
if (!VerifyContext() || !frame_->hasSelection())
if (!VerifyContext() || !frame_->isWebLocalFrame())
return 0;
const WebRange& range = frame_->selectionRange();
blink::WebLocalFrame* local_frame = frame_->toWebLocalFrame();
if (!!local_frame->hasSelection())
return 0;
const WebRange& range = local_frame->selectionRange();
if (range.isNull())
return 0;
@@ -122,10 +131,14 @@ int CefDOMDocumentImpl::GetSelectionEndOffset() {
CefString CefDOMDocumentImpl::GetSelectionAsMarkup() {
CefString str;
if (!VerifyContext() || !frame_->hasSelection())
if (!VerifyContext() || !frame_->isWebLocalFrame())
return str;
const WebString& markup = frame_->selectionAsMarkup();
blink::WebLocalFrame* local_frame = frame_->toWebLocalFrame();
if (!!local_frame->hasSelection())
return str;
const WebString& markup = local_frame->selectionAsMarkup();
if (!markup.isNull())
str = markup;
@@ -134,10 +147,14 @@ CefString CefDOMDocumentImpl::GetSelectionAsMarkup() {
CefString CefDOMDocumentImpl::GetSelectionAsText() {
CefString str;
if (!VerifyContext() || !frame_->hasSelection())
if (!VerifyContext() || !frame_->isWebLocalFrame())
return str;
const WebString& text = frame_->selectionAsText();
blink::WebLocalFrame* local_frame = frame_->toWebLocalFrame();
if (!!local_frame->hasSelection())
return str;
const WebString& text = local_frame->selectionAsText();
if (!text.isNull())
str = text;

View File

@@ -28,6 +28,7 @@
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebFrameContentDumper.h"
#include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "third_party/WebKit/public/web/WebScriptSource.h"
@@ -50,45 +51,31 @@ bool CefFrameImpl::IsValid() {
}
void CefFrameImpl::Undo() {
CEF_REQUIRE_RT_RETURN_VOID();
if (frame_)
frame_->executeCommand(WebString::fromUTF8("Undo"));
ExecuteCommand("Undo");
}
void CefFrameImpl::Redo() {
CEF_REQUIRE_RT_RETURN_VOID();
if (frame_)
frame_->executeCommand(WebString::fromUTF8("Redo"));
ExecuteCommand("Redo");
}
void CefFrameImpl::Cut() {
CEF_REQUIRE_RT_RETURN_VOID();
if (frame_)
frame_->executeCommand(WebString::fromUTF8("Cut"));
ExecuteCommand("Cut");
}
void CefFrameImpl::Copy() {
CEF_REQUIRE_RT_RETURN_VOID();
if (frame_)
frame_->executeCommand(WebString::fromUTF8("Copy"));
ExecuteCommand("Copy");
}
void CefFrameImpl::Paste() {
CEF_REQUIRE_RT_RETURN_VOID();
if (frame_)
frame_->executeCommand(WebString::fromUTF8("Paste"));
ExecuteCommand("Paste");
}
void CefFrameImpl::Delete() {
CEF_REQUIRE_RT_RETURN_VOID();
if (frame_)
frame_->executeCommand(WebString::fromUTF8("Delete"));
ExecuteCommand("Delete");
}
void CefFrameImpl::SelectAll() {
CEF_REQUIRE_RT_RETURN_VOID();
if (frame_)
frame_->executeCommand(WebString::fromUTF8("SelectAll"));
ExecuteCommand("SelectAll");
}
void CefFrameImpl::ViewSource() {
@@ -281,6 +268,12 @@ void CefFrameImpl::Detach() {
frame_ = NULL;
}
void CefFrameImpl::ExecuteCommand(const std::string& command) {
CEF_REQUIRE_RT_RETURN_VOID();
if (frame_ && frame_->isWebLocalFrame())
frame_->toWebLocalFrame()->executeCommand(WebString::fromUTF8(command));
}
// Enable deprecation warnings for MSVC. See http://crbug.com/585142.
#if defined(OS_WIN)

View File

@@ -58,7 +58,9 @@ class CefFrameImpl : public CefFrame {
blink::WebFrame* web_frame() const { return frame_; }
protected:
private:
void ExecuteCommand(const std::string& command);
CefBrowserImpl* browser_;
blink::WebFrame* frame_;
int64 frame_id_;

View File

@@ -60,7 +60,7 @@ CefPluginPlaceholder::CefPluginPlaceholder(
status_(CefViewHostMsg_GetPluginInfo_Status::kAllowed),
title_(title),
context_menu_request_id_(0),
ignore_updates_(false) {
did_send_blocked_content_notification_(false) {
RenderThread::Get()->AddObserver(this);
}
@@ -286,29 +286,10 @@ blink::WebPlugin* CefPluginPlaceholder::CreatePlugin() {
GetPluginParams(), std::move(throttler));
}
void CefPluginPlaceholder::OnLoadedRectUpdate(
const gfx::Rect& unobscured_rect,
content::RenderFrame::PeripheralContentStatus status) {
// If the placeholder is in the blocked state, do nothing.
if (ignore_updates_)
void CefPluginPlaceholder::OnBlockedTinyContent() {
if (did_send_blocked_content_notification_)
return;
// This should only be called once.
set_delayed(false);
// block tiny cross-origin - simply by not continuing the load chain.
if (status ==
content::RenderFrame::CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_TINY) {
ignore_updates_ = true;
return;
}
// For essential content, powersaver can be turned off.
if (status != content::RenderFrame::CONTENT_STATUS_PERIPHERAL)
set_power_saver_enabled(false);
AllowLoading();
LoadPlugin();
did_send_blocked_content_notification_ = true;
}
gin::ObjectTemplateBuilder CefPluginPlaceholder::GetObjectTemplateBuilder(

View File

@@ -52,9 +52,7 @@ class CefPluginPlaceholder final
// content::LoadablePluginPlaceholder overrides:
blink::WebPlugin* CreatePlugin() override;
void OnLoadedRectUpdate(
const gfx::Rect& unobscured_rect,
content::RenderFrame::PeripheralContentStatus status) override;
void OnBlockedTinyContent() override;
// gin::Wrappable (via PluginPlaceholder) method
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
@@ -85,7 +83,7 @@ class CefPluginPlaceholder final
int context_menu_request_id_; // Nonzero when request pending.
base::string16 plugin_name_;
bool ignore_updates_;
bool did_send_blocked_content_notification_;
DISALLOW_COPY_AND_ASSIGN(CefPluginPlaceholder);
};

View File

@@ -13,6 +13,7 @@
#include "base/compiler_specific.h"
MSVC_PUSH_WARNING_LEVEL(0);
#include "core/dom/Document.h"
#include "core/frame/Frame.h"
#include "core/frame/LocalFrame.h"
#include "bindings/core/v8/ScriptController.h"
@@ -42,7 +43,6 @@ MSVC_POP_WARNING();
#include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebScriptController.h"
#include "url/gurl.h"
namespace {
@@ -661,20 +661,15 @@ v8::MaybeLocal<v8::Value> CallV8Function(v8::Local<v8::Context> context,
v8::Isolate* isolate) {
v8::MaybeLocal<v8::Value> func_rv;
// Execute the function call using the ScriptController so that inspector
// Execute the function call using the V8ScriptRunner so that inspector
// instrumentation works.
if (CEF_CURRENTLY_ON_RT()) {
blink::LocalFrame* frame =
toLocalFrame(blink::toFrameIfNotDetached(context));
DCHECK(frame);
if (frame &&
frame->script().canExecuteScripts(blink::AboutToExecuteScript)) {
func_rv = frame->script().callFunction(function, receiver, argc, args);
}
} else {
func_rv = blink::ScriptController::callFunction(
blink::toExecutionContext(context),
function, receiver, argc, args, isolate);
blink::LocalFrame* frame =
toLocalFrame(blink::toFrameIfNotDetached(context));
DCHECK(frame);
if (frame &&
frame->script().canExecuteScripts(blink::AboutToExecuteScript)) {
func_rv = blink::V8ScriptRunner::callFunction(
function, frame->document(), receiver, argc, args, isolate);
}
return func_rv;
@@ -779,10 +774,8 @@ void MessageListenerCallbackImpl(v8::Handle<v8::Message> message,
CefRefPtr<CefV8Exception> exception = new CefV8ExceptionImpl(
static_cast<CefV8ContextImpl*>(context.get())->GetV8Context(), message);
if (CEF_CURRENTLY_ON_RT()) {
handler->OnUncaughtException(context->GetBrowser(), context->GetFrame(),
context, exception, stackTrace);
}
handler->OnUncaughtException(context->GetBrowser(), context->GetFrame(),
context, exception, stackTrace);
}
} // namespace
@@ -961,10 +954,6 @@ CefRefPtr<CefBrowser> CefV8ContextImpl::GetBrowser() {
CefRefPtr<CefBrowser> browser;
CEF_V8_REQUIRE_VALID_HANDLE_RETURN(browser);
// Return NULL for WebWorkers.
if (!CEF_CURRENTLY_ON_RT())
return browser;
blink::WebFrame* webframe = GetWebFrame();
if (webframe)
browser = CefBrowserImpl::GetBrowserForMainFrame(webframe->top());
@@ -976,10 +965,6 @@ CefRefPtr<CefFrame> CefV8ContextImpl::GetFrame() {
CefRefPtr<CefFrame> frame;
CEF_V8_REQUIRE_VALID_HANDLE_RETURN(frame);
// Return NULL for WebWorkers.
if (!CEF_CURRENTLY_ON_RT())
return frame;
blink::WebFrame* webframe = GetWebFrame();
if (webframe) {
CefRefPtr<CefBrowserImpl> browser =