Update to Chromium revision cb947c01 (#352221)

- Implement CefRequestHandler::OnBeforeBrowse using NavigationThrottle
  instead of ResourceThrottle (see http://crbug.com/537634). The CefRequest
  object passed to OnBeforeBrowse will no longer have an associated request
  identifier.
- Mac: Remove additional helper apps which are no longer required (see
  http://crbug.com/520680)
- Remove the UR_FLAG_REPORT_RAW_HEADERS flag which is no longer supported (see
  http://crbug.com/517114)
- Remove the CefBrowserSettings.java parameter. Java is an NPAPI plugin and
  NPAPI plugins are no longer supported (see http://crbug.com/470301#c11)
- Add CefFormatUrlForSecurityDisplay function in cef_parser.h
- Fix crash when passing `--disable-extensions` command-line flag (issue #1721)
- Linux: Fix NSS handler loading (issue #1727)
This commit is contained in:
Marshall Greenblatt
2015-10-09 11:23:12 -04:00
parent 5780ea8baa
commit 8aac23386e
104 changed files with 938 additions and 940 deletions

View File

@@ -112,54 +112,6 @@ class CefPrerendererClient : public content::RenderViewObserver,
void willAddPrerender(blink::WebPrerender* prerender) override {}
};
// Implementation of SequencedTaskRunner for WebWorker threads.
class CefWebWorkerTaskRunner : public base::SequencedTaskRunner,
public content::WorkerTaskRunner::Observer {
public:
CefWebWorkerTaskRunner(content::WorkerTaskRunner* runner,
int worker_id)
: runner_(runner),
worker_id_(worker_id) {
DCHECK(runner_);
DCHECK_GT(worker_id_, 0);
DCHECK(RunsTasksOnCurrentThread());
// Adds an observer for the current thread.
runner_->AddStopObserver(this);
}
// SequencedTaskRunner methods:
bool PostNonNestableDelayedTask(
const tracked_objects::Location& from_here,
const base::Closure& task,
base::TimeDelta delay) override {
return PostDelayedTask(from_here, task, delay);
}
// TaskRunner methods:
bool PostDelayedTask(const tracked_objects::Location& from_here,
const base::Closure& task,
base::TimeDelta delay) override {
if (delay != base::TimeDelta())
LOG(WARNING) << "Delayed tasks are not supported on WebWorker threads";
runner_->PostTask(worker_id_, task);
return true;
}
bool RunsTasksOnCurrentThread() const override {
return (runner_->CurrentWorkerId() == worker_id_);
}
// WorkerTaskRunner::Observer methods:
void OnWorkerRunLoopStopped() override {
CefContentRendererClient::Get()->RemoveWorkerTaskRunner(worker_id_);
}
private:
content::WorkerTaskRunner* runner_;
int worker_id_;
};
void IsGuestViewApiAvailableToScriptContext(
bool* api_is_available,
extensions::ScriptContext* context) {
@@ -351,21 +303,6 @@ void CefContentRendererClient::DevToolsAgentDetached() {
// When the last DevToolsAgent is detached the stack size is set to 0.
// Restore the user-specified stack size here.
CefV8SetUncaughtExceptionStackSize(uncaught_exception_stack_size_);
// And do the same for any WebWorker threads.
WorkerTaskRunnerMap map_copy;
{
base::AutoLock lock_scope(worker_task_runner_lock_);
map_copy = worker_task_runner_map_;
}
WorkerTaskRunnerMap::const_iterator it = map_copy.begin();
for (; it != map_copy.end(); ++it) {
it->second->PostTask(FROM_HERE,
base::Bind(CefV8SetUncaughtExceptionStackSize,
uncaught_exception_stack_size_));
}
}
}
@@ -374,45 +311,9 @@ scoped_refptr<base::SequencedTaskRunner>
// Check if currently on the render thread.
if (CEF_CURRENTLY_ON_RT())
return render_task_runner_;
// Check if a WebWorker exists for the current thread.
content::WorkerTaskRunner* worker_runner =
content::WorkerTaskRunner::Instance();
int worker_id = worker_runner->CurrentWorkerId();
if (worker_id > 0) {
base::AutoLock lock_scope(worker_task_runner_lock_);
WorkerTaskRunnerMap::const_iterator it =
worker_task_runner_map_.find(worker_id);
if (it != worker_task_runner_map_.end())
return it->second;
scoped_refptr<base::SequencedTaskRunner> task_runner =
new CefWebWorkerTaskRunner(worker_runner, worker_id);
worker_task_runner_map_[worker_id] = task_runner;
return task_runner;
}
return NULL;
}
scoped_refptr<base::SequencedTaskRunner>
CefContentRendererClient::GetWorkerTaskRunner(int worker_id) {
base::AutoLock lock_scope(worker_task_runner_lock_);
WorkerTaskRunnerMap::const_iterator it =
worker_task_runner_map_.find(worker_id);
if (it != worker_task_runner_map_.end())
return it->second;
return NULL;
}
void CefContentRendererClient::RemoveWorkerTaskRunner(int worker_id) {
base::AutoLock lock_scope(worker_task_runner_lock_);
WorkerTaskRunnerMap::iterator it = worker_task_runner_map_.find(worker_id);
if (it != worker_task_runner_map_.end())
worker_task_runner_map_.erase(it);
}
void CefContentRendererClient::RunSingleProcessCleanup() {
DCHECK(content::RenderProcessHost::run_renderer_in_process());

View File

@@ -71,18 +71,10 @@ class CefContentRendererClient : public content::ContentRendererClient,
void DevToolsAgentAttached();
void DevToolsAgentDetached();
// Returns the task runner for the current thread. If this is a WebWorker
// thread and the task runner does not already exist it will be created.
// Returns NULL if the current thread is not a valid render process thread.
// Returns the task runner for the current thread. Returns NULL if the current
// thread is not the main render process thread.
scoped_refptr<base::SequencedTaskRunner> GetCurrentTaskRunner();
// Returns the task runner for the specified worker ID or NULL if the
// specified worker ID is not valid.
scoped_refptr<base::SequencedTaskRunner> GetWorkerTaskRunner(int worker_id);
// Remove the task runner associated with the specified worker ID.
void RemoveWorkerTaskRunner(int worker_id);
// Perform cleanup work that needs to occur before shutdown when running in
// single-process mode. Blocks until cleanup is complete.
void RunSingleProcessCleanup();
@@ -154,13 +146,6 @@ class CefContentRendererClient : public content::ContentRendererClient,
int devtools_agent_count_;
int uncaught_exception_stack_size_;
// Map of worker thread IDs to task runners. Access must be protected by
// |worker_task_runner_lock_|.
typedef std::map<int, scoped_refptr<base::SequencedTaskRunner> >
WorkerTaskRunnerMap;
WorkerTaskRunnerMap worker_task_runner_map_;
base::Lock worker_task_runner_lock_;
// Used in single-process mode to test when cleanup is complete.
// Access must be protected by |single_process_cleanup_lock_|.
bool single_process_cleanup_complete_;

View File

@@ -51,28 +51,7 @@ CefDOMNodeImpl::Type CefDOMNodeImpl::GetType() {
if (!VerifyContext())
return DOM_NODE_TYPE_UNSUPPORTED;
switch (node_.nodeType()) {
case WebNode::ElementNode:
return DOM_NODE_TYPE_ELEMENT;
case WebNode::AttributeNode:
return DOM_NODE_TYPE_ATTRIBUTE;
case WebNode::TextNode:
return DOM_NODE_TYPE_TEXT;
case WebNode::CDataSectionNode:
return DOM_NODE_TYPE_CDATA_SECTION;
case WebNode::ProcessingInstructionsNode:
return DOM_NODE_TYPE_PROCESSING_INSTRUCTIONS;
case WebNode::CommentNode:
return DOM_NODE_TYPE_COMMENT;
case WebNode::DocumentNode:
return DOM_NODE_TYPE_DOCUMENT;
case WebNode::DocumentTypeNode:
return DOM_NODE_TYPE_DOCUMENT_TYPE;
case WebNode::DocumentFragmentNode:
return DOM_NODE_TYPE_DOCUMENT_FRAGMENT;
default:
return DOM_NODE_TYPE_UNSUPPORTED;
}
return webkit_glue::GetNodeType(node_);
}
bool CefDOMNodeImpl::IsText() {
@@ -166,7 +145,7 @@ CefString CefDOMNodeImpl::GetName() {
if (!VerifyContext())
return str;
const WebString& name = node_.nodeName();
const WebString& name = webkit_glue::GetNodeName(node_);
if (!name.isNull())
str = name;
@@ -226,7 +205,7 @@ CefString CefDOMNodeImpl::GetAsMarkup() {
if (!VerifyContext())
return str;
const WebString& markup = node_.createMarkup();
const WebString& markup = webkit_glue::CreateNodeMarkup(node_);
if (!markup.isNull())
str = markup;

View File

@@ -4,12 +4,6 @@
#include "libcef/renderer/extensions/extensions_dispatcher_delegate.h"
#include "content/public/common/url_constants.h"
#include "extensions/common/extension.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/web/WebSecurityPolicy.h"
namespace extensions {
CefExtensionsDispatcherDelegate::CefExtensionsDispatcherDelegate() {
@@ -18,19 +12,4 @@ CefExtensionsDispatcherDelegate::CefExtensionsDispatcherDelegate() {
CefExtensionsDispatcherDelegate::~CefExtensionsDispatcherDelegate() {
}
void CefExtensionsDispatcherDelegate::InitOriginPermissions(
const Extension* extension,
bool is_extension_active) {
if (is_extension_active) {
// The chrome: scheme is marked as display isolated in
// RenderThreadImpl::RegisterSchemes() so an exception must be added for
// accessing chrome://resources from the extension origin.
blink::WebSecurityPolicy::addOriginAccessWhitelistEntry(
extension->url(),
blink::WebString::fromUTF8(content::kChromeUIScheme),
blink::WebString::fromUTF8("resources"),
false);
}
}
} // namespace extensions

View File

@@ -16,10 +16,6 @@ class CefExtensionsDispatcherDelegate : public DispatcherDelegate {
~CefExtensionsDispatcherDelegate() override;
private:
// DispatcherDelegate implementation.
void InitOriginPermissions(const Extension* extension,
bool is_extension_active) override;
DISALLOW_COPY_AND_ASSIGN(CefExtensionsDispatcherDelegate);
};

View File

@@ -99,6 +99,7 @@ CefPluginPlaceholder* CefPluginPlaceholder::CreateBlockedPlugin(
values.SetString("name", name);
values.SetString("hide", l10n_util::GetStringUTF8(IDS_PLUGIN_HIDE));
values.SetString("pluginType",
frame->view()->mainFrame()->isWebLocalFrame() &&
frame->view()->mainFrame()->document().isPluginDocument()
? "document"
: "embedded");
@@ -240,8 +241,10 @@ void CefPluginPlaceholder::ShowContextMenu(
content::MenuItem hide_item;
hide_item.action = chrome::MENU_COMMAND_PLUGIN_HIDE;
hide_item.enabled =
!GetFrame()->view()->mainFrame()->document().isPluginDocument();
bool is_main_frame_plugin_document =
GetFrame()->view()->mainFrame()->isWebLocalFrame() &&
GetFrame()->view()->mainFrame()->document().isPluginDocument();
hide_item.enabled = !is_main_frame_plugin_document;
hide_item.label = l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLUGIN_HIDE);
params.custom_items.push_back(hide_item);

View File

@@ -27,6 +27,7 @@ MSVC_PUSH_WARNING_LEVEL(0);
#include "third_party/WebKit/Source/core/css/parser/CSSParser.h"
#include "third_party/WebKit/Source/core/dom/Node.h"
#include "third_party/WebKit/Source/core/editing/serializers/Serialization.h"
#include "third_party/WebKit/Source/web/WebLocalFrameImpl.h"
#include "third_party/WebKit/Source/web/WebViewImpl.h"
MSVC_POP_WARNING();
@@ -79,6 +80,41 @@ std::string DumpDocumentText(blink::WebFrame* frame) {
return document_element.textContent().utf8();
}
cef_dom_node_type_t GetNodeType(const blink::WebNode& node) {
const blink::Node* web_node = node.constUnwrap<blink::Node>();
switch (web_node->nodeType()) {
case blink::Node::ELEMENT_NODE:
return DOM_NODE_TYPE_ELEMENT;
case blink::Node::ATTRIBUTE_NODE:
return DOM_NODE_TYPE_ATTRIBUTE;
case blink::Node::TEXT_NODE:
return DOM_NODE_TYPE_TEXT;
case blink::Node::CDATA_SECTION_NODE:
return DOM_NODE_TYPE_CDATA_SECTION;
case blink::Node::PROCESSING_INSTRUCTION_NODE:
return DOM_NODE_TYPE_PROCESSING_INSTRUCTIONS;
case blink::Node::COMMENT_NODE:
return DOM_NODE_TYPE_COMMENT;
case blink::Node::DOCUMENT_NODE:
return DOM_NODE_TYPE_DOCUMENT;
case blink::Node::DOCUMENT_TYPE_NODE:
return DOM_NODE_TYPE_DOCUMENT_TYPE;
case blink::Node::DOCUMENT_FRAGMENT_NODE:
return DOM_NODE_TYPE_DOCUMENT_FRAGMENT;
}
return DOM_NODE_TYPE_UNSUPPORTED;
}
blink::WebString GetNodeName(const blink::WebNode& node) {
const blink::Node* web_node = node.constUnwrap<blink::Node>();
return web_node->nodeName();
}
blink::WebString CreateNodeMarkup(const blink::WebNode& node) {
const blink::Node* web_node = node.constUnwrap<blink::Node>();
return blink::createMarkup(web_node);
}
bool SetNodeValue(blink::WebNode& node, const blink::WebString& value) {
blink::Node* web_node = node.unwrap<blink::Node>();
web_node->setNodeValue(value);

View File

@@ -10,6 +10,8 @@
#include "base/basictypes.h"
#include "third_party/skia/include/core/SkColor.h"
#include "include/internal/cef_types.h"
namespace blink {
class WebFrame;
class WebNode;
@@ -29,6 +31,10 @@ void GoForward(blink::WebView* view);
// Returns the text of the document element.
std::string DumpDocumentText(blink::WebFrame* frame);
// Expose additional actions on WebNode.
cef_dom_node_type_t GetNodeType(const blink::WebNode& node);
blink::WebString GetNodeName(const blink::WebNode& node);
blink::WebString CreateNodeMarkup(const blink::WebNode& node);
bool SetNodeValue(blink::WebNode& node, const blink::WebString& value);
int64 GetIdentifier(blink::WebFrame* frame);