Commit 07d12b78 authored by Marshall Greenblatt's avatar Marshall Greenblatt
Browse files

Update to Chromium revision 9cedf753 (#418732)

- Simplify usage of OnBeforePluginLoad (issue #2015)
- Switch crash reporting from crashpad to breakpad on Windows and OS X.
  Adds a new chrome_elf.dll dependency on Windows (issue #1995)
- Remove CefTextfield::GetPlaceholderTextColor() method which is no
  longer supported by Chromium.
parent a1fc6f1a
......@@ -241,10 +241,10 @@ static_library("libcef_static") {
"libcef/browser/context_menu_params_impl.h",
"libcef/browser/cookie_manager_impl.cc",
"libcef/browser/cookie_manager_impl.h",
"libcef/browser/devtools_delegate.cc",
"libcef/browser/devtools_delegate.h",
"libcef/browser/devtools_frontend.cc",
"libcef/browser/devtools_frontend.h",
"libcef/browser/devtools_manager_delegate.cc",
"libcef/browser/devtools_manager_delegate.h",
"libcef/browser/download_item_impl.cc",
"libcef/browser/download_item_impl.h",
"libcef/browser/download_manager_delegate.cc",
......@@ -566,11 +566,8 @@ static_library("libcef_static") {
"//components/cdm/renderer",
"//components/content_settings/core/browser",
"//components/content_settings/core/common",
"//components/crash/content/app:app_breakpad_mac_win_to_be_deleted",
"//components/crx_file",
"//components/data_use_measurement/core",
"//components/devtools_discovery",
"//components/devtools_http_handler",
"//components/google/core/browser",
"//components/keyed_service/content:content",
"//components/keyed_service/core:core",
......@@ -600,7 +597,7 @@ static_library("libcef_static") {
"//content/public/utility",
"//crypto",
"//device/core",
"//device/geolocation:device_geolocation",
"//device/geolocation",
"//device/hid",
"//extensions/browser",
"//extensions/common/api",
......@@ -666,6 +663,11 @@ static_library("libcef_static") {
"libcef/utility/printing_handler.cc",
"libcef/utility/printing_handler.h",
]
deps += [
"//chrome_elf",
"//components/crash/content/app:run_as_crashpad_handler",
]
}
if (is_linux) {
......
......@@ -7,5 +7,5 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': '1ae106dbab4bddd85132d5b75c670794311f4c57',
'chromium_checkout': '9cedf75377d817c6b32a01f1d30fbe10663b8bb8',
}
......@@ -39,12 +39,12 @@
#pragma once
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_ssl_status_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_sslstatus_t;
///
// Structure used to represent an entry in navigation history.
......
......@@ -40,12 +40,12 @@
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_values_capi.h"
#include "include/capi/cef_x509_certificate_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
struct _cef_x509certificate_t;
///
// Structure representing the SSL information for a navigation entry.
......
......@@ -251,12 +251,6 @@ typedef struct _cef_textfield_t {
void (CEF_CALLBACK *set_placeholder_text_color)(struct _cef_textfield_t* self,
cef_color_t color);
///
// Returns the placeholder text color.
///
cef_color_t (CEF_CALLBACK *get_placeholder_text_color)(
struct _cef_textfield_t* self);
///
// Set the accessible name that will be exposed to assistive technology (AT).
///
......
......@@ -39,8 +39,7 @@
#pragma once
#include "include/cef_base.h"
class CefSSLStatus;
#include "include/cef_ssl_status.h"
///
// Class used to represent an entry in navigation history.
......
......@@ -40,8 +40,7 @@
#include "include/cef_base.h"
#include "include/cef_values.h"
class CefX509Certificate;
#include "include/cef_x509_certificate.h"
///
// Class representing the SSL information for a navigation entry.
......
......@@ -262,12 +262,6 @@ class CefTextfield : public CefView {
/*--cef()--*/
virtual void SetPlaceholderTextColor(cef_color_t color) =0;
///
// Returns the placeholder text color.
///
/*--cef()--*/
virtual cef_color_t GetPlaceholderTextColor() =0;
///
// Set the accessible name that will be exposed to assistive technology (AT).
///
......
......@@ -124,3 +124,33 @@ ChromeZoomLevelPrefs* CefBrowserContext::GetZoomLevelPrefs() {
return static_cast<ChromeZoomLevelPrefs*>(
GetStoragePartition(this, NULL)->GetZoomLevelDelegate());
}
void CefBrowserContext::OnRenderFrameDeleted(int render_process_id,
int render_frame_id,
bool is_main_frame,
bool is_guest_view) {
CEF_POST_TASK(CEF_IOT,
base::Bind(&CefBrowserContext::RenderFrameDeletedOnIOThread, this,
render_process_id, render_frame_id, is_main_frame,
is_guest_view));
}
void CefBrowserContext::OnPurgePluginListCache() {
CEF_POST_TASK(CEF_IOT,
base::Bind(&CefBrowserContext::PurgePluginListCacheOnIOThread, this));
}
void CefBrowserContext::RenderFrameDeletedOnIOThread(int render_process_id,
int render_frame_id,
bool is_main_frame,
bool is_guest_view) {
if (resource_context_ && is_main_frame) {
DCHECK_GE(render_process_id, 0);
resource_context_->ClearPluginLoadDecision(render_process_id);
}
}
void CefBrowserContext::PurgePluginListCacheOnIOThread() {
if (resource_context_)
resource_context_->ClearPluginLoadDecision(-1);
}
......@@ -164,6 +164,18 @@ class CefBrowserContext
// visited links.
virtual void AddVisitedURLs(const std::vector<GURL>& urls) = 0;
// Called from CefBrowserHostImpl::RenderFrameDeleted or
// CefMimeHandlerViewGuestDelegate::OnGuestDetached when a render frame is
// deleted.
void OnRenderFrameDeleted(int render_process_id,
int render_frame_id,
bool is_main_frame,
bool is_guest_view);
// Called from CefRequestContextImpl::PurgePluginListCacheInternal when the
// plugin list cache should be purged.
void OnPurgePluginListCache();
CefResourceContext* resource_context() const {
return resource_context_.get();
}
......@@ -188,6 +200,12 @@ class CefBrowserContext
content::BrowserThread::UI>;
friend class base::DeleteHelper<CefBrowserContext>;
void RenderFrameDeletedOnIOThread(int render_process_id,
int render_frame_id,
bool is_main_frame,
bool is_guest_view);
void PurgePluginListCacheOnIOThread();
// True if this CefBrowserContext is a CefBrowserContextProxy.
const bool is_proxy_;
......
......@@ -15,8 +15,8 @@
#include "libcef/browser/browser_util.h"
#include "libcef/browser/content_browser_client.h"
#include "libcef/browser/context.h"
#include "libcef/browser/devtools_delegate.h"
#include "libcef/browser/devtools_frontend.h"
#include "libcef/browser/devtools_manager_delegate.h"
#include "libcef/browser/extensions/browser_extensions_util.h"
#include "libcef/browser/image_impl.h"
#include "libcef/browser/media_capture_devices_dispatcher.h"
......@@ -2390,6 +2390,16 @@ void CefBrowserHostImpl::RenderFrameDeleted(
const int render_routing_id = render_frame_host->GetRoutingID();
browser_info_->render_id_manager()->remove_render_frame_id(
render_process_id, render_routing_id);
if (web_contents()) {
const bool is_main_frame = (render_frame_host->GetParent() == nullptr);
scoped_refptr<CefBrowserContext> context =
static_cast<CefBrowserContext*>(web_contents()->GetBrowserContext());
if (context) {
context->OnRenderFrameDeleted(render_process_id, render_routing_id,
is_main_frame, false);
}
}
}
void CefBrowserHostImpl::RenderViewCreated(
......
......@@ -13,7 +13,7 @@
#include "libcef/browser/browser_message_loop.h"
#include "libcef/browser/content_browser_client.h"
#include "libcef/browser/context.h"
#include "libcef/browser/devtools_delegate.h"
#include "libcef/browser/devtools_manager_delegate.h"
#include "libcef/browser/extensions/browser_context_keyed_service_factories.h"
#include "libcef/browser/extensions/extensions_browser_client.h"
#include "libcef/browser/extensions/extension_system_factory.h"
......@@ -194,19 +194,7 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
global_browser_context_ = new CefBrowserContextImpl(settings);
global_browser_context_->Initialize();
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kRemoteDebuggingPort)) {
std::string port_str =
command_line->GetSwitchValueASCII(switches::kRemoteDebuggingPort);
int port;
if (base::StringToInt(port_str, &port) && port > 0 && port < 65535) {
devtools_delegate_ =
new CefDevToolsDelegate(static_cast<uint16_t>(port));
} else {
LOG(WARNING) << "Invalid http debugger port number " << port;
}
}
CefDevToolsManagerDelegate::StartHttpHandler(global_browser_context_.get());
// Triggers initialization of the singleton instance on UI thread.
PluginFinder::GetInstance()->Init();
......@@ -217,18 +205,16 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
}
void CefBrowserMainParts::PostMainMessageLoopRun() {
// NOTE: Destroy objects in reverse order of creation.
CefDevToolsManagerDelegate::StopHttpHandler();
global_browser_context_ = NULL;
if (extensions::ExtensionsEnabled()) {
extensions::ExtensionsBrowserClient::Set(NULL);
extensions_browser_client_.reset();
}
if (devtools_delegate_) {
devtools_delegate_->Stop();
devtools_delegate_ = NULL;
}
global_browser_context_ = NULL;
#if DCHECK_IS_ON()
// No CefBrowserContext instances should exist at this point.
DCHECK_EQ(0, CefBrowserContext::DebugObjCt);
......
......@@ -14,7 +14,7 @@
#include "libcef/browser/browser_message_filter.h"
#include "libcef/browser/browser_platform_delegate.h"
#include "libcef/browser/context.h"
#include "libcef/browser/devtools_delegate.h"
#include "libcef/browser/devtools_manager_delegate.h"
#include "libcef/browser/extensions/extension_system.h"
#include "libcef/browser/media_capture_devices_dispatcher.h"
#include "libcef/browser/net/chrome_scheme_handler.h"
......
......@@ -31,7 +31,11 @@
#include "ui/base/ui_base_switches.h"
#if defined(OS_WIN)
#include "chrome_elf/chrome_elf_main.h"
#include "content/public/app/sandbox_helper_win.h"
#include "components/crash/content/app/crash_switches.h"
#include "components/crash/content/app/crashpad.h"
#include "components/crash/content/app/run_as_crashpad_handler_win.h"
#include "sandbox/win/src/sandbox_types.h"
#endif
......@@ -93,6 +97,11 @@ int CefExecuteProcess(const CefMainArgs& args,
if (process_type.empty())
return -1;
#if defined(OS_WIN)
if (process_type == crash_reporter::switches::kCrashpadHandler)
return crash_reporter::RunAsCrashpadHandler(command_line);
#endif
CefMainDelegate main_delegate(application);
// Execute the secondary process.
......@@ -260,6 +269,11 @@ bool CefContext::Initialize(const CefMainArgs& args,
}
#endif
#if defined(OS_WIN)
// Signal Chrome Elf that Chrome has begun to start.
SignalChromeElf();
#endif
main_delegate_.reset(new CefMainDelegate(application));
main_runner_.reset(content::ContentMainRunner::Create());
browser_info_manager_.reset(new CefBrowserInfoManager);
......
// Copyright 2013 the Chromium Embedded Framework Authors. Portions Copyright
// 2012 The Chromium Authors. All rights reserved. Use of this source code is
// governed by a BSD-style license that can be found in the LICENSE file.
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/devtools_frontend.h"
#include "libcef/browser/content_browser_client.h"
#include "libcef/browser/devtools_delegate.h"
#include "libcef/browser/request_context_impl.h"
#include "libcef/browser/thread_util.h"
#include <stddef.h>
#include "libcef/browser/devtools_manager_delegate.h"
#include "libcef/browser/net/devtools_scheme_handler.h"
#include "base/command_line.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/json/string_escape.h"
#include "base/memory/ptr_util.h"
#include "base/macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_client.h"
#include "content/public/common/url_constants.h"
#include "ipc/ipc_channel.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
......@@ -38,7 +39,7 @@ namespace {
class ResponseWriter : public net::URLFetcherResponseWriter {
public:
ResponseWriter(base::WeakPtr<CefDevToolsFrontend> devtools_,
ResponseWriter(base::WeakPtr<CefDevToolsFrontend> shell_devtools_,
int stream_id);
~ResponseWriter() override;
......@@ -50,16 +51,16 @@ class ResponseWriter : public net::URLFetcherResponseWriter {
int Finish(const net::CompletionCallback& callback) override;
private:
base::WeakPtr<CefDevToolsFrontend> devtools_;
base::WeakPtr<CefDevToolsFrontend> shell_devtools_;
int stream_id_;
DISALLOW_COPY_AND_ASSIGN(ResponseWriter);
};
ResponseWriter::ResponseWriter(
base::WeakPtr<CefDevToolsFrontend> devtools,
base::WeakPtr<CefDevToolsFrontend> shell_devtools,
int stream_id)
: devtools_(devtools),
: shell_devtools_(shell_devtools),
stream_id_(stream_id) {
}
......@@ -83,7 +84,7 @@ int ResponseWriter::Write(net::IOBuffer* buffer,
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE,
base::Bind(&CefDevToolsFrontend::CallClientFunction,
devtools_, "DevToolsAPI.streamWrite",
shell_devtools_, "DevToolsAPI.streamWrite",
base::Owned(id), base::Owned(chunkValue), nullptr));
return num_bytes;
}
......@@ -92,12 +93,17 @@ int ResponseWriter::Finish(const net::CompletionCallback& callback) {
return net::OK;
}
static std::string GetFrontendURL() {
return base::StringPrintf("%s://%s/inspector.html",
content::kChromeDevToolsScheme, scheme::kChromeDevToolsHost);
}
} // namespace
// This constant should be in sync with
// the constant at devtools_ui_bindings.cc.
const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4;
} // namespace
// static
CefDevToolsFrontend* CefDevToolsFrontend::Show(
CefRefPtr<CefBrowserHostImpl> inspected_browser,
......@@ -132,13 +138,15 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show(
inspected_contents, inspect_element_at);
// Need to load the URL after creating the DevTools objects.
CefDevToolsDelegate* delegate =
CefContentBrowserClient::Get()->devtools_delegate();
frontend_browser->GetMainFrame()->LoadURL(delegate->GetChromeDevToolsURL());
frontend_browser->GetMainFrame()->LoadURL(GetFrontendURL());
return devtools_frontend;
}
void CefDevToolsFrontend::Activate() {
frontend_browser_->ActivateContents(web_contents());
}
void CefDevToolsFrontend::Focus() {
frontend_browser_->SetFocus(true);
}
......@@ -151,7 +159,8 @@ void CefDevToolsFrontend::InspectElementAt(int x, int y) {
}
void CefDevToolsFrontend::Close() {
CEF_POST_TASK(CEF_UIT,
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE,
base::Bind(&CefBrowserHostImpl::CloseBrowser, frontend_browser_.get(),
true));
}
......@@ -167,7 +176,7 @@ CefDevToolsFrontend::CefDevToolsFrontend(
CefRefPtr<CefBrowserHostImpl> frontend_browser,
content::WebContents* inspected_contents,
const CefPoint& inspect_element_at)
: WebContentsObserver(frontend_browser->web_contents()),
: content::WebContentsObserver(frontend_browser->web_contents()),
frontend_browser_(frontend_browser),
inspected_contents_(inspected_contents),
inspect_element_at_(inspect_element_at),
......@@ -186,7 +195,6 @@ void CefDevToolsFrontend::RenderViewCreated(
web_contents()->GetMainFrame(),
base::Bind(&CefDevToolsFrontend::HandleMessageFromDevToolsFrontend,
base::Unretained(this))));
}
}
......@@ -199,9 +207,10 @@ void CefDevToolsFrontend::DocumentAvailableInMainFrame() {
if (agent_host != agent_host_) {
agent_host_ = agent_host;
agent_host_->AttachClient(this);
if (!inspect_element_at_.IsEmpty())
InspectElementAt(inspect_element_at_.x, inspect_element_at_.y);
if (inspect_element_at_.IsEmpty()) {
agent_host_->InspectElement(
this, inspect_element_at_.x, inspect_element_at_.y);
}
}
}
......@@ -211,6 +220,21 @@ void CefDevToolsFrontend::WebContentsDestroyed() {
delete this;
}
void CefDevToolsFrontend::SetPreferences(const std::string& json) {
preferences_.Clear();
if (json.empty())
return;
base::DictionaryValue* dict = nullptr;
std::unique_ptr<base::Value> parsed = base::JSONReader::Read(json);
if (!parsed || !parsed->GetAsDictionary(&dict))
return;
for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) {
if (!it.value().IsType(base::Value::TYPE_STRING))
continue;
preferences_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy());
}
}
void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
const std::string& message) {
if (!agent_host_)
......@@ -265,8 +289,9 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
web_contents()->GetBrowserContext())->
GetURLRequestContext());
fetcher->SetExtraRequestHeaders(headers);
fetcher->SaveResponseWithWriter(base::WrapUnique(
new ResponseWriter(weak_factory_.GetWeakPtr(), stream_id)));
fetcher->SaveResponseWithWriter(
std::unique_ptr<net::URLFetcherResponseWriter>(
new ResponseWriter(weak_factory_.GetWeakPtr(), stream_id)));
fetcher->Start();
return;
} else if (method == "getPreferences") {
......@@ -297,8 +322,8 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
}
void CefDevToolsFrontend::DispatchProtocolMessage(
content::DevToolsAgentHost* agent_host,
const std::string& message) {
content::DevToolsAgentHost* agent_host, const std::string& message) {
if (message.length() < kMaxMessageChunkSize) {
std::string param;
base::EscapeJSONString(message, true, &param);
......@@ -320,21 +345,6 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
}
}
void CefDevToolsFrontend::SetPreferences(const std::string& json) {
preferences_.Clear();
if (json.empty())
return;
base::DictionaryValue* dict = nullptr;
std::unique_ptr<base::Value> parsed = base::JSONReader::Read(json);
if (!parsed || !parsed->GetAsDictionary(&dict))
return;
for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) {
if (!it.value().IsType(base::Value::TYPE_STRING))
continue;
preferences_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy());
}
}
void CefDevToolsFrontend::OnURLFetchComplete(const net::URLFetcher* source) {
// TODO(pfeldman): this is a copy of chrome's devtools_ui_bindings.cc.
// We should handle some of the commands including this one in content.
......@@ -384,15 +394,14 @@ void CefDevToolsFrontend::CallClientFunction(
}
void CefDevToolsFrontend::SendMessageAck(int request_id,
const base::Value* arg) {
const base::Value* arg) {
base::FundamentalValue id_value(request_id);
CallClientFunction("DevToolsAPI.embedderMessageAck",
&id_value, arg, nullptr);
}
void CefDevToolsFrontend::AgentHostClosed(
content::DevToolsAgentHost* agent_host,
bool replaced) {
content::DevToolsAgentHost* agent_host, bool replaced) {
DCHECK(agent_host == agent_host_.get());
Close();
}
// Copyright 2013 the Chromium Embedded Framework Authors. Portions Copyright
// 2012 The Chromium Authors. All rights reserved. Use of this source code is
// governed by a BSD-style license that can be found in the LICENSE file.
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_DEVTOOLS_FRONTEND_H_
#define CEF_LIBCEF_BROWSER_DEVTOOLS_FRONTEND_H_
#include <memory>
#include "libcef/browser/browser_host_impl.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/values.h"
......@@ -36,22 +39,23 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
const CefBrowserSettings& settings,
const CefPoint& inspect_element_at);
void Activate();
void Focus();
void InspectElementAt(int x, int y);
void Close();
void DisconnectFromTarget();
CefRefPtr<CefBrowserHostImpl> frontend_browser() const {
return frontend_browser_;
}
void CallClientFunction(const std::string& function_name,
const base::Value* arg1,
const base::Value* arg2,
const base::Value* arg3);
private:
CefRefPtr<CefBrowserHostImpl> frontend_browser() const {
return frontend_browser_;
}
protected:
CefDevToolsFrontend(CefRefPtr<CefBrowserHostImpl> frontend_browser,
content::WebContents* inspected_contents,
const CefPoint& inspect_element_at);
......@@ -63,14 +67,14 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host,
const std::string& message) override;
void SetPreferences(const std::string& json);
virtual void HandleMessageFromDevToolsFrontend(const std::string& message);
private:
// WebContentsObserver overrides
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
void DocumentAvailableInMainFrame() override;
void WebContentsDestroyed() override;
void HandleMessageFromDevToolsFrontend(const std::string& message);
// net::URLFetcherDelegate overrides.
void OnURLFetchComplete(const net::URLFetcher* source) override;
......@@ -79,8 +83,8 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
CefRefPtr<CefBrowserHostImpl> frontend_browser_;