mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update to Chromium version 74.0.3729.0 (#638880)
- Windows: 10.0.17763.0 SDK is now required. - Mac: 10.13 SDK is now required. - Removed CefRequestContext::ResolveHostCached which is no longer supported by Chromium.
This commit is contained in:
committed by
Marshall Greenblatt
parent
58e1149c71
commit
725ed88529
@@ -500,6 +500,10 @@ const PrefService* CefBrowserContextImpl::GetPrefs() const {
|
||||
return pref_service_.get();
|
||||
}
|
||||
|
||||
SimpleFactoryKey* CefBrowserContextImpl::GetSimpleFactoryKey() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CefRequestContextImpl* CefBrowserContextImpl::GetCefRequestContext() const {
|
||||
return GetCefRequestContext(false);
|
||||
}
|
||||
|
@@ -87,7 +87,9 @@ class CefBrowserContextImpl : public CefBrowserContext,
|
||||
|
||||
// Profile methods.
|
||||
PrefService* GetPrefs() override;
|
||||
bool AllowsBrowserWindows() const override { return false; }
|
||||
const PrefService* GetPrefs() const override;
|
||||
SimpleFactoryKey* GetSimpleFactoryKey() const override;
|
||||
|
||||
// CefBrowserContext methods.
|
||||
CefRequestContextImpl* GetCefRequestContext() const override;
|
||||
|
@@ -208,10 +208,18 @@ PrefService* CefBrowserContextProxy::GetPrefs() {
|
||||
return parent_->GetPrefs();
|
||||
}
|
||||
|
||||
bool CefBrowserContextProxy::AllowsBrowserWindows() const {
|
||||
return parent_->AllowsBrowserWindows();
|
||||
}
|
||||
|
||||
const PrefService* CefBrowserContextProxy::GetPrefs() const {
|
||||
return parent_->GetPrefs();
|
||||
}
|
||||
|
||||
SimpleFactoryKey* CefBrowserContextProxy::GetSimpleFactoryKey() const {
|
||||
return parent_->GetSimpleFactoryKey();
|
||||
}
|
||||
|
||||
CefRequestContextImpl* CefBrowserContextProxy::GetCefRequestContext() const {
|
||||
return request_context_;
|
||||
}
|
||||
|
@@ -64,7 +64,9 @@ class CefBrowserContextProxy : public CefBrowserContext {
|
||||
|
||||
// Profile methods.
|
||||
PrefService* GetPrefs() override;
|
||||
bool AllowsBrowserWindows() const override;
|
||||
const PrefService* GetPrefs() const override;
|
||||
SimpleFactoryKey* GetSimpleFactoryKey() const override;
|
||||
|
||||
// CefBrowserContext methods.
|
||||
CefRequestContextImpl* GetCefRequestContext() const override;
|
||||
|
@@ -512,7 +512,7 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::GetBrowserForRequest(
|
||||
return GetBrowserForFrame(render_process_id, render_frame_id);
|
||||
}
|
||||
|
||||
const content::ResourceRequestInfo* request_info =
|
||||
content::ResourceRequestInfo* request_info =
|
||||
content::ResourceRequestInfo::ForRequest(request);
|
||||
if (request_info)
|
||||
return GetBrowserForFrameTreeNode(request_info->GetFrameTreeNodeId());
|
||||
@@ -1644,7 +1644,7 @@ void CefBrowserHostImpl::CancelContextMenu() {
|
||||
CefRefPtr<CefFrame> CefBrowserHostImpl::GetFrameForRequest(
|
||||
const net::URLRequest* request) {
|
||||
CEF_REQUIRE_IOT();
|
||||
const content::ResourceRequestInfo* info =
|
||||
content::ResourceRequestInfo* info =
|
||||
content::ResourceRequestInfo::ForRequest(request);
|
||||
if (!info)
|
||||
return nullptr;
|
||||
@@ -2435,6 +2435,7 @@ bool CefBrowserHostImpl::TakeFocus(content::WebContents* source, bool reverse) {
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::HandleContextMenu(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const content::ContextMenuParams& params) {
|
||||
return HandleContextMenu(web_contents(), params);
|
||||
}
|
||||
|
@@ -426,7 +426,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
bool proceed,
|
||||
bool* proceed_to_fire_unload) override;
|
||||
bool TakeFocus(content::WebContents* source, bool reverse) override;
|
||||
bool HandleContextMenu(const content::ContextMenuParams& params) override;
|
||||
|
||||
bool HandleContextMenu(content::RenderFrameHost* render_frame_host,
|
||||
const content::ContextMenuParams& params) override;
|
||||
content::KeyboardEventProcessingResult PreHandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
|
@@ -85,7 +85,7 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
|
||||
CefBrowserInfo(int browser_id, bool is_popup);
|
||||
|
||||
int browser_id() const { return browser_id_; };
|
||||
int browser_id() const { return browser_id_; }
|
||||
bool is_popup() const { return is_popup_; }
|
||||
bool is_windowless() const { return is_windowless_; }
|
||||
|
||||
|
@@ -7,11 +7,16 @@
|
||||
#include "libcef/common/content_client.h"
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/message_loop/message_pump_for_ui.h"
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#include "base/mac/scoped_nsautorelease_pool.h"
|
||||
#include "base/message_loop/message_pump_mac.h"
|
||||
#endif
|
||||
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// MessagePump implementation that delegates to OnScheduleMessagePumpWork() for
|
||||
@@ -82,23 +87,27 @@ CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<base::MessagePump> CreatePump() {
|
||||
const CefSettings& settings = CefContext::Get()->settings();
|
||||
if (settings.external_message_pump) {
|
||||
std::unique_ptr<base::MessagePump> MessagePumpFactoryForUI() {
|
||||
if (!content::BrowserThread::IsThreadInitialized(
|
||||
content::BrowserThread::UI) ||
|
||||
content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
|
||||
CefRefPtr<CefBrowserProcessHandler> handler = GetBrowserProcessHandler();
|
||||
if (handler)
|
||||
return base::WrapUnique(new MessagePumpExternal(0.01f, handler));
|
||||
return std::make_unique<MessagePumpExternal>(0.01f, handler);
|
||||
}
|
||||
|
||||
return base::MessageLoop::CreateMessagePumpForType(
|
||||
base::MessageLoop::TYPE_UI);
|
||||
#if defined(OS_MACOSX)
|
||||
return base::MessagePumpMac::Create();
|
||||
#else
|
||||
return std::make_unique<base::MessagePumpForUI>();
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefBrowserMessageLoop::CefBrowserMessageLoop()
|
||||
: base::MessageLoopForUI(CreatePump()) {
|
||||
BindToCurrentThread();
|
||||
void InitMessagePumpFactoryForUI() {
|
||||
const CefSettings& settings = CefContext::Get()->settings();
|
||||
if (settings.external_message_pump) {
|
||||
base::MessageLoop::InitMessagePumpForUIFactory(MessagePumpFactoryForUI);
|
||||
}
|
||||
}
|
||||
|
||||
CefBrowserMessageLoop::~CefBrowserMessageLoop() {}
|
||||
|
@@ -4,21 +4,7 @@
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_LOOP_H_
|
||||
#define CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_LOOP_H_
|
||||
#pragma once
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
|
||||
// Class used to process events on the current message loop.
|
||||
class CefBrowserMessageLoop : public base::MessageLoopForUI {
|
||||
typedef base::MessageLoopForUI inherited;
|
||||
|
||||
public:
|
||||
CefBrowserMessageLoop();
|
||||
~CefBrowserMessageLoop() override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserMessageLoop);
|
||||
};
|
||||
void InitMessagePumpFactoryForUI();
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_BROWSER_MESSAGE_LOOP_H_
|
||||
|
@@ -75,11 +75,11 @@ void ChromeBrowserProcessStub::Shutdown() {
|
||||
|
||||
void ChromeBrowserProcessStub::ResourceDispatcherHostCreated() {
|
||||
NOTREACHED();
|
||||
};
|
||||
}
|
||||
|
||||
void ChromeBrowserProcessStub::EndSession() {
|
||||
NOTREACHED();
|
||||
};
|
||||
}
|
||||
|
||||
void ChromeBrowserProcessStub::FlushLocalStateAndReply(
|
||||
base::OnceClosure reply) {
|
||||
|
@@ -553,6 +553,34 @@ bool CefContentBrowserClient::ShouldUseProcessPerSite(
|
||||
return true;
|
||||
}
|
||||
|
||||
// Based on
|
||||
// ChromeContentBrowserClientExtensionsPart::DoesSiteRequireDedicatedProcess.
|
||||
bool CefContentBrowserClient::DoesSiteRequireDedicatedProcess(
|
||||
content::BrowserContext* browser_context,
|
||||
const GURL& effective_site_url) {
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
return false;
|
||||
|
||||
extensions::ExtensionRegistry* registry =
|
||||
extensions::ExtensionRegistry::Get(browser_context);
|
||||
const extensions::Extension* extension =
|
||||
registry->enabled_extensions().GetExtensionOrAppByURL(effective_site_url);
|
||||
if (!extension)
|
||||
return false;
|
||||
|
||||
// Always isolate Chrome Web Store.
|
||||
if (extension->id() == extensions::kWebStoreAppId)
|
||||
return true;
|
||||
|
||||
// Extensions should be isolated, except for hosted apps. Isolating hosted
|
||||
// apps is a good idea, but ought to be a separate knob.
|
||||
if (extension->is_hosted_app())
|
||||
return false;
|
||||
|
||||
// Isolate all extensions.
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefContentBrowserClient::IsHandledURL(const GURL& url) {
|
||||
if (!url.is_valid())
|
||||
return false;
|
||||
@@ -1126,6 +1154,7 @@ bool CefContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
content::RenderFrameHost* frame,
|
||||
int render_process_id,
|
||||
bool is_navigation,
|
||||
bool is_download,
|
||||
const url::Origin& request_initiator,
|
||||
network::mojom::URLLoaderFactoryRequest* factory_request,
|
||||
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
|
||||
@@ -1137,8 +1166,8 @@ bool CefContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
extensions::BrowserContextKeyedAPIFactory<extensions::WebRequestAPI>::Get(
|
||||
browser_context);
|
||||
bool use_proxy = web_request_api->MaybeProxyURLLoaderFactory(
|
||||
browser_context, frame, render_process_id, is_navigation, factory_request,
|
||||
header_client);
|
||||
browser_context, frame, render_process_id, is_navigation, is_download,
|
||||
factory_request, header_client);
|
||||
if (bypass_redirect_checks)
|
||||
*bypass_redirect_checks = use_proxy;
|
||||
return use_proxy;
|
||||
@@ -1191,7 +1220,7 @@ blink::UserAgentMetadata CefContentBrowserClient::GetUserAgentMetadata() const {
|
||||
blink::UserAgentMetadata metadata;
|
||||
|
||||
metadata.brand = version_info::GetProductName();
|
||||
metadata.version = version_info::GetVersionNumber();
|
||||
metadata.full_version = version_info::GetVersionNumber();
|
||||
metadata.platform = version_info::GetOSType();
|
||||
|
||||
// TODO(mkwst): Poke at BuildUserAgentFromProduct to split out these pieces.
|
||||
|
@@ -48,6 +48,8 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
service_manager::mojom::ServiceRequest* service_request) override;
|
||||
bool ShouldUseProcessPerSite(content::BrowserContext* browser_context,
|
||||
const GURL& effective_url) override;
|
||||
bool DoesSiteRequireDedicatedProcess(content::BrowserContext* browser_context,
|
||||
const GURL& effective_site_url) override;
|
||||
bool IsHandledURL(const GURL& url) override;
|
||||
void SiteInstanceGotProcess(content::SiteInstance* site_instance) override;
|
||||
void SiteInstanceDeleting(content::SiteInstance* site_instance) override;
|
||||
@@ -147,6 +149,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
content::RenderFrameHost* frame,
|
||||
int render_process_id,
|
||||
bool is_navigation,
|
||||
bool is_download,
|
||||
const url::Origin& request_initiator,
|
||||
network::mojom::URLLoaderFactoryRequest* factory_request,
|
||||
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
|
||||
|
@@ -420,21 +420,17 @@ bool CefContext::Initialize(const CefMainArgs& args,
|
||||
// gets called by some call down the line of service_manager::MainRun.
|
||||
content::SetUpFieldTrialsAndFeatureList();
|
||||
|
||||
if (!main_delegate_->CreateUIThread()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
initialized_ = true;
|
||||
|
||||
// Can't use CEF_POST_TASK here yet, because the TaskRunner is not yet set.
|
||||
main_delegate_->ui_thread()->task_runner()->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(
|
||||
if (!main_delegate_->CreateUIThread(base::BindOnce(
|
||||
[](CefContext* context, base::WaitableEvent* event) {
|
||||
service_manager::MainRun(*context->sm_main_params_);
|
||||
event->Signal();
|
||||
},
|
||||
base::Unretained(this), base::Unretained(&uithread_startup_event)));
|
||||
base::Unretained(this),
|
||||
base::Unretained(&uithread_startup_event)))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
initialized_ = true;
|
||||
|
||||
// We need to wait until service_manager::MainRun has finished.
|
||||
uithread_startup_event.Wait();
|
||||
|
@@ -107,11 +107,14 @@ void DeleteCookiesCallbackImpl(CefRefPtr<CefDeleteCookiesCallback> callback,
|
||||
|
||||
// Always execute the callback asynchronously.
|
||||
void SetCookieCallbackImpl(CefRefPtr<CefSetCookieCallback> callback,
|
||||
bool success) {
|
||||
net::CanonicalCookie::CookieInclusionStatus status) {
|
||||
if (!callback.get())
|
||||
return;
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefSetCookieCallback::OnComplete,
|
||||
callback.get(), success));
|
||||
CEF_POST_TASK(
|
||||
CEF_IOT,
|
||||
base::Bind(
|
||||
&CefSetCookieCallback::OnComplete, callback.get(),
|
||||
status == net::CanonicalCookie::CookieInclusionStatus::INCLUDE));
|
||||
}
|
||||
|
||||
net::CookieStore* GetExistingCookieStoreHelper(
|
||||
@@ -560,7 +563,7 @@ void CefCookieManagerImpl::SetCookieInternal(
|
||||
base::Time(), // Last access time.
|
||||
cookie.secure ? true : false, cookie.httponly ? true : false,
|
||||
net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT),
|
||||
cookie.secure ? true : false, cookie.httponly ? true : false,
|
||||
url.scheme(), cookie.httponly ? true : false,
|
||||
base::Bind(SetCookieCallbackImpl, callback));
|
||||
}
|
||||
|
||||
|
@@ -249,7 +249,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
std::string method;
|
||||
base::ListValue* params = NULL;
|
||||
base::DictionaryValue* dict = NULL;
|
||||
std::unique_ptr<base::Value> parsed_message = base::JSONReader::Read(message);
|
||||
base::Optional<base::Value> parsed_message = base::JSONReader::Read(message);
|
||||
if (!parsed_message || !parsed_message->GetAsDictionary(&dict) ||
|
||||
!dict->GetString("method", &method)) {
|
||||
return;
|
||||
|
@@ -14,7 +14,7 @@
|
||||
|
||||
namespace extensions {
|
||||
class Extension;
|
||||
};
|
||||
}
|
||||
|
||||
// CefNavigationEntry implementation
|
||||
class CefExtensionImpl : public CefExtension {
|
||||
|
@@ -21,8 +21,8 @@
|
||||
#include "extensions/browser/extension_function_dispatcher.h"
|
||||
#include "extensions/common/error_utils.h"
|
||||
|
||||
using content::WebContents;
|
||||
using content::RenderViewHost;
|
||||
using content::WebContents;
|
||||
|
||||
namespace extensions {
|
||||
|
||||
@@ -92,7 +92,7 @@ class CefGetExtensionLoadFileCallbackImpl
|
||||
static std::unique_ptr<std::string> LoadFileFromStream(
|
||||
const std::string& file,
|
||||
CefRefPtr<CefStreamReader> stream) {
|
||||
base::AssertBlockingAllowedDeprecated();
|
||||
CEF_REQUIRE_BLOCKING();
|
||||
|
||||
// Move to the end of the stream.
|
||||
stream->Seek(0, SEEK_END);
|
||||
|
@@ -19,4 +19,8 @@ void CefPDFWebContentsHelperClient::OnPDFHasUnsupportedFeature(
|
||||
|
||||
void CefPDFWebContentsHelperClient::OnSaveURL(content::WebContents* contents) {}
|
||||
|
||||
void CefPDFWebContentsHelperClient::SetPluginCanSave(
|
||||
content::WebContents* contents,
|
||||
bool can_save) {}
|
||||
|
||||
} // namespace extensions
|
||||
|
@@ -21,6 +21,7 @@ class CefPDFWebContentsHelperClient : public pdf::PDFWebContentsHelperClient {
|
||||
int content_restrictions) override;
|
||||
void OnPDFHasUnsupportedFeature(content::WebContents* contents) override;
|
||||
void OnSaveURL(content::WebContents* contents) override;
|
||||
void SetPluginCanSave(content::WebContents* contents, bool can_save) override;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefPDFWebContentsHelperClient);
|
||||
};
|
||||
|
@@ -29,7 +29,7 @@ const blink::MediaStreamDevice* FindDefaultDeviceWithId(
|
||||
}
|
||||
|
||||
return &(*devices.begin());
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
|
@@ -305,7 +305,6 @@ void CefMenuManager::CreateDefaultModel() {
|
||||
model_->AddItem(MENU_ID_CUT, GetLabel(IDS_CONTENT_CONTEXT_CUT));
|
||||
model_->AddItem(MENU_ID_COPY, GetLabel(IDS_CONTENT_CONTEXT_COPY));
|
||||
model_->AddItem(MENU_ID_PASTE, GetLabel(IDS_CONTENT_CONTEXT_PASTE));
|
||||
model_->AddItem(MENU_ID_DELETE, GetLabel(IDS_CONTENT_CONTEXT_DELETE));
|
||||
|
||||
model_->AddSeparator();
|
||||
model_->AddItem(MENU_ID_SELECT_ALL,
|
||||
|
@@ -17,7 +17,7 @@
|
||||
namespace content {
|
||||
class RenderFrameHost;
|
||||
class WebContents;
|
||||
};
|
||||
} // namespace content
|
||||
|
||||
class CefBrowserHostImpl;
|
||||
class CefRunContextMenuCallback;
|
||||
|
@@ -64,22 +64,24 @@ void CefCookieStoreProxy::SetCookieWithOptionsAsync(
|
||||
cookie_store->SetCookieWithOptionsAsync(url, cookie_line, options,
|
||||
std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(false);
|
||||
std::move(callback).Run(
|
||||
net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_FAILURE_TO_STORE);
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::SetCanonicalCookieAsync(
|
||||
std::unique_ptr<net::CanonicalCookie> cookie,
|
||||
bool secure_source,
|
||||
std::string source_scheme,
|
||||
bool modify_http_only,
|
||||
SetCookiesCallback callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store) {
|
||||
cookie_store->SetCanonicalCookieAsync(std::move(cookie), secure_source,
|
||||
cookie_store->SetCanonicalCookieAsync(std::move(cookie), source_scheme,
|
||||
modify_http_only,
|
||||
std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(false);
|
||||
std::move(callback).Run(
|
||||
net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_FAILURE_TO_STORE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -23,7 +23,7 @@ class CefCookieStoreProxy : public net::CookieStore {
|
||||
const net::CookieOptions& options,
|
||||
SetCookiesCallback callback) override;
|
||||
void SetCanonicalCookieAsync(std::unique_ptr<net::CanonicalCookie> cookie,
|
||||
bool secure_source,
|
||||
std::string source_scheme,
|
||||
bool modify_http_only,
|
||||
SetCookiesCallback callback) override;
|
||||
void GetCookieListWithOptionsAsync(const GURL& url,
|
||||
|
@@ -19,4 +19,4 @@ bool IsInternalRequest(const net::URLRequest* request) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}; // namespace net_util
|
||||
} // namespace net_util
|
||||
|
@@ -16,6 +16,6 @@ namespace net_util {
|
||||
// the CEF API.
|
||||
bool IsInternalRequest(const net::URLRequest* request);
|
||||
|
||||
}; // namespace net_util
|
||||
} // namespace net_util
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_NET_NET_UTIL_H_
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "include/cef_callback.h"
|
||||
#include "include/cef_parser.h"
|
||||
#include "libcef/browser/cookie_manager_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/request_impl.h"
|
||||
@@ -565,7 +566,7 @@ void CefResourceRequestJob::SaveNextCookie() {
|
||||
|
||||
if (can_set_cookie) {
|
||||
request_->context()->cookie_store()->SetCanonicalCookieAsync(
|
||||
std::move(cookie), request_->url().SchemeIsCryptographic(),
|
||||
std::move(cookie), request_->url().scheme(),
|
||||
!options.exclude_httponly(),
|
||||
base::Bind(&CefResourceRequestJob::OnCookieSaved,
|
||||
weak_factory_.GetWeakPtr()));
|
||||
@@ -575,7 +576,8 @@ void CefResourceRequestJob::SaveNextCookie() {
|
||||
CookieHandled();
|
||||
}
|
||||
|
||||
void CefResourceRequestJob::OnCookieSaved(bool cookie_status) {
|
||||
void CefResourceRequestJob::OnCookieSaved(
|
||||
net::CanonicalCookie::CookieInclusionStatus status) {
|
||||
CookieHandled();
|
||||
}
|
||||
|
||||
|
@@ -61,7 +61,7 @@ class CefResourceRequestJob : public net::URLRequestJob {
|
||||
net::HttpResponseHeaders* GetResponseHeaders();
|
||||
void SaveCookiesAndNotifyHeadersComplete();
|
||||
void SaveNextCookie();
|
||||
void OnCookieSaved(bool cookie_status);
|
||||
void OnCookieSaved(net::CanonicalCookie::CookieInclusionStatus status);
|
||||
void CookieHandled();
|
||||
void FetchResponseCookies(std::vector<std::string>* cookies);
|
||||
|
||||
|
@@ -363,7 +363,6 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
||||
|
||||
io_state_->storage_->set_http_auth_handler_factory(
|
||||
net::HttpAuthHandlerRegistryFactory::Create(
|
||||
io_state_->url_request_context_->host_resolver(),
|
||||
io_state_->http_auth_preferences_.get(), supported_schemes
|
||||
#if defined(OS_POSIX) && !defined(OS_ANDROID)
|
||||
,
|
||||
|
@@ -191,6 +191,9 @@ struct PopulateAxNodeAttributes {
|
||||
}
|
||||
attributes->SetList(ToString(attr.first), list);
|
||||
} break;
|
||||
case ax::mojom::IntAttribute::kImageAnnotationStatus: {
|
||||
// TODO(cef): Implement support for Image Annotation Status
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/osr/osr_util.h"
|
||||
#include "libcef/browser/osr/software_output_device_osr.h"
|
||||
#include "libcef/browser/osr/synthetic_gesture_target_osr.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "base/callback_helpers.h"
|
||||
@@ -161,7 +162,7 @@ class CefDelegatedFrameHostClient : public content::DelegatedFrameHostClient {
|
||||
|
||||
void InvalidateLocalSurfaceIdOnEviction() override {}
|
||||
|
||||
bool ShouldShowStaleContentOnEviction() override { return false; };
|
||||
bool ShouldShowStaleContentOnEviction() override { return false; }
|
||||
|
||||
private:
|
||||
CefRenderWidgetHostViewOSR* const view_;
|
||||
@@ -1133,10 +1134,7 @@ viz::FrameSinkId CefRenderWidgetHostViewOSR::GetRootFrameSinkId() {
|
||||
|
||||
std::unique_ptr<content::SyntheticGestureTarget>
|
||||
CefRenderWidgetHostViewOSR::CreateSyntheticGestureTarget() {
|
||||
// TODO(cef): This is likely incorrect for OOPIF.
|
||||
// See https://crrev.com/5375957bb5.
|
||||
return std::unique_ptr<content::SyntheticGestureTarget>(
|
||||
new content::SyntheticGestureTargetBase(host()));
|
||||
return std::make_unique<CefSyntheticGestureTargetOSR>(host());
|
||||
}
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
@@ -1193,8 +1191,7 @@ bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpaceLegacy(
|
||||
bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView(
|
||||
const gfx::PointF& point,
|
||||
RenderWidgetHostViewBase* target_view,
|
||||
gfx::PointF* transformed_point,
|
||||
viz::EventSource source) {
|
||||
gfx::PointF* transformed_point) {
|
||||
if (target_view == this) {
|
||||
*transformed_point = point;
|
||||
return true;
|
||||
|
@@ -194,8 +194,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
bool TransformPointToCoordSpaceForView(
|
||||
const gfx::PointF& point,
|
||||
RenderWidgetHostViewBase* target_view,
|
||||
gfx::PointF* transformed_point,
|
||||
viz::EventSource source = viz::EventSource::ANY) override;
|
||||
gfx::PointF* transformed_point) override;
|
||||
void DidNavigate() override;
|
||||
void SelectionChanged(const base::string16& text,
|
||||
size_t offset,
|
||||
@@ -369,8 +368,8 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
std::unique_ptr<content::BrowserCompositorMac> browser_compositor_;
|
||||
MacHelper* mac_helper_;
|
||||
#elif defined(USE_X11)
|
||||
CefWindowX11* window_;
|
||||
std::unique_ptr<ui::XScopedCursor> invisible_cursor_;
|
||||
CefWindowX11* window_;
|
||||
std::unique_ptr<ui::XScopedCursor> invisible_cursor_;
|
||||
#endif
|
||||
|
||||
std::unique_ptr<content::CursorManager> cursor_manager_;
|
||||
|
61
libcef/browser/osr/synthetic_gesture_target_osr.cc
Normal file
61
libcef/browser/osr/synthetic_gesture_target_osr.cc
Normal file
@@ -0,0 +1,61 @@
|
||||
// Copyright (c) 2019 The Chromium Embedded Framework 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/osr/synthetic_gesture_target_osr.h"
|
||||
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/public/common/screen_info.h"
|
||||
#include "ui/events/gesture_detection/gesture_configuration.h"
|
||||
|
||||
CefSyntheticGestureTargetOSR::CefSyntheticGestureTargetOSR(
|
||||
content::RenderWidgetHostImpl* host)
|
||||
: SyntheticGestureTargetBase(host) {}
|
||||
|
||||
void CefSyntheticGestureTargetOSR::DispatchWebTouchEventToPlatform(
|
||||
const blink::WebTouchEvent& web_touch,
|
||||
const ui::LatencyInfo& latency_info) {
|
||||
// We assume that platforms supporting touch have their own implementation of
|
||||
// SyntheticGestureTarget to route the events through their respective input
|
||||
// stack.
|
||||
LOG(ERROR) << "Touch events not supported for this browser.";
|
||||
}
|
||||
|
||||
void CefSyntheticGestureTargetOSR::DispatchWebMouseWheelEventToPlatform(
|
||||
const blink::WebMouseWheelEvent& web_wheel,
|
||||
const ui::LatencyInfo& latency_info) {
|
||||
render_widget_host()->ForwardWheelEventWithLatencyInfo(web_wheel,
|
||||
latency_info);
|
||||
}
|
||||
|
||||
void CefSyntheticGestureTargetOSR::DispatchWebGestureEventToPlatform(
|
||||
const blink::WebGestureEvent& web_gesture,
|
||||
const ui::LatencyInfo& latency_info) {
|
||||
render_widget_host()->ForwardGestureEventWithLatencyInfo(web_gesture,
|
||||
latency_info);
|
||||
}
|
||||
|
||||
void CefSyntheticGestureTargetOSR::DispatchWebMouseEventToPlatform(
|
||||
const blink::WebMouseEvent& web_mouse,
|
||||
const ui::LatencyInfo& latency_info) {
|
||||
render_widget_host()->ForwardMouseEventWithLatencyInfo(web_mouse,
|
||||
latency_info);
|
||||
}
|
||||
|
||||
content::SyntheticGestureParams::GestureSourceType
|
||||
CefSyntheticGestureTargetOSR::GetDefaultSyntheticGestureSourceType() const {
|
||||
return content::SyntheticGestureParams::MOUSE_INPUT;
|
||||
}
|
||||
|
||||
float CefSyntheticGestureTargetOSR::GetTouchSlopInDips() const {
|
||||
return ui::GestureConfiguration::GetInstance()
|
||||
->max_touch_move_in_pixels_for_click();
|
||||
}
|
||||
|
||||
float CefSyntheticGestureTargetOSR::GetSpanSlopInDips() const {
|
||||
return ui::GestureConfiguration::GetInstance()->span_slop();
|
||||
}
|
||||
|
||||
float CefSyntheticGestureTargetOSR::GetMinScalingSpanInDips() const {
|
||||
return ui::GestureConfiguration::GetInstance()->min_scaling_span_in_pixels();
|
||||
}
|
42
libcef/browser/osr/synthetic_gesture_target_osr.h
Normal file
42
libcef/browser/osr/synthetic_gesture_target_osr.h
Normal file
@@ -0,0 +1,42 @@
|
||||
// Copyright (c) 2019 The Chromium Embedded Framework 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_OSR_SYNTHETIC_GESTURE_TARGET_OSR_H_
|
||||
#define CEF_LIBCEF_BROWSER_OSR_SYNTHETIC_GESTURE_TARGET_OSR_H_
|
||||
|
||||
#include "base/macros.h"
|
||||
#include "content/browser/renderer_host/input/synthetic_gesture_target_base.h"
|
||||
|
||||
// SyntheticGestureTarget implementation for OSR.
|
||||
class CefSyntheticGestureTargetOSR
|
||||
: public content::SyntheticGestureTargetBase {
|
||||
public:
|
||||
explicit CefSyntheticGestureTargetOSR(content::RenderWidgetHostImpl* host);
|
||||
|
||||
// SyntheticGestureTargetBase:
|
||||
void DispatchWebTouchEventToPlatform(
|
||||
const blink::WebTouchEvent& web_touch,
|
||||
const ui::LatencyInfo& latency_info) override;
|
||||
void DispatchWebMouseWheelEventToPlatform(
|
||||
const blink::WebMouseWheelEvent& web_wheel,
|
||||
const ui::LatencyInfo& latency_info) override;
|
||||
void DispatchWebGestureEventToPlatform(
|
||||
const blink::WebGestureEvent& web_gesture,
|
||||
const ui::LatencyInfo& latency_info) override;
|
||||
void DispatchWebMouseEventToPlatform(
|
||||
const blink::WebMouseEvent& web_mouse,
|
||||
const ui::LatencyInfo& latency_info) override;
|
||||
|
||||
// SyntheticGestureTarget:
|
||||
content::SyntheticGestureParams::GestureSourceType
|
||||
GetDefaultSyntheticGestureSourceType() const override;
|
||||
float GetTouchSlopInDips() const override;
|
||||
float GetSpanSlopInDips() const override;
|
||||
float GetMinScalingSpanInDips() const override;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CefSyntheticGestureTargetOSR);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_OSR_SYNTHETIC_GESTURE_TARGET_OSR_H_
|
@@ -151,11 +151,9 @@ void CefWebContentsViewOSR::RenderViewHostChanged(
|
||||
void CefWebContentsViewOSR::SetOverscrollControllerEnabled(bool enabled) {}
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
bool CefWebContentsViewOSR::IsEventTracking() const {
|
||||
bool CefWebContentsViewOSR::CloseTabAfterEventTrackingIfNeeded() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::CloseTabAfterEventTracking() {}
|
||||
#endif // defined(OS_MACOSX)
|
||||
|
||||
void CefWebContentsViewOSR::StartDragging(
|
||||
|
@@ -59,8 +59,7 @@ class CefWebContentsViewOSR : public content::WebContentsView,
|
||||
void SetOverscrollControllerEnabled(bool enabled) override;
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
bool IsEventTracking() const override;
|
||||
void CloseTabAfterEventTracking() override;
|
||||
bool CloseTabAfterEventTrackingIfNeeded() override;
|
||||
#endif
|
||||
|
||||
// RenderViewHostDelegateView methods.
|
||||
|
@@ -61,11 +61,13 @@ struct ResolveHostHelper {
|
||||
|
||||
void OnResolveCompleted(int result) {
|
||||
std::vector<CefString> resolved_ips;
|
||||
|
||||
net::AddressList::const_iterator iter = address_list_.begin();
|
||||
for (; iter != address_list_.end(); ++iter)
|
||||
resolved_ips.push_back(iter->ToStringWithoutPort());
|
||||
|
||||
base::Optional<net::AddressList> maybe_address_list =
|
||||
request_->GetAddressResults();
|
||||
if (maybe_address_list) {
|
||||
net::AddressList::const_iterator iter = maybe_address_list->begin();
|
||||
for (; iter != maybe_address_list->end(); ++iter)
|
||||
resolved_ips.push_back(iter->ToStringWithoutPort());
|
||||
}
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(&CefResolveCallback::OnResolveCompleted, callback_,
|
||||
@@ -75,8 +77,7 @@ struct ResolveHostHelper {
|
||||
}
|
||||
|
||||
CefRefPtr<CefResolveCallback> callback_;
|
||||
net::AddressList address_list_;
|
||||
std::unique_ptr<net::HostResolver::Request> request_;
|
||||
std::unique_ptr<net::HostResolver::ResolveHostRequest> request_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
@@ -475,39 +476,6 @@ void CefRequestContextImpl::ResolveHost(
|
||||
callback));
|
||||
}
|
||||
|
||||
cef_errorcode_t CefRequestContextImpl::ResolveHostCached(
|
||||
const CefString& origin,
|
||||
std::vector<CefString>& resolved_ips) {
|
||||
resolved_ips.clear();
|
||||
|
||||
if (!CEF_CURRENTLY_ON_IOT()) {
|
||||
NOTREACHED() << "called on invalid thread";
|
||||
return ERR_FAILED;
|
||||
}
|
||||
|
||||
if (!request_context_getter_impl_)
|
||||
return ERR_FAILED;
|
||||
|
||||
int retval = ERR_FAILED;
|
||||
|
||||
net::HostResolver* host_resolver =
|
||||
request_context_getter_impl_->GetHostResolver();
|
||||
if (host_resolver) {
|
||||
net::HostResolver::RequestInfo request_info(
|
||||
net::HostPortPair::FromURL(GURL(origin.ToString())));
|
||||
net::AddressList address_list;
|
||||
retval = host_resolver->ResolveFromCache(request_info, &address_list,
|
||||
net::NetLogWithSource());
|
||||
if (retval == net::OK) {
|
||||
net::AddressList::const_iterator iter = address_list.begin();
|
||||
for (; iter != address_list.end(); ++iter)
|
||||
resolved_ips.push_back(iter->ToString());
|
||||
}
|
||||
}
|
||||
|
||||
return static_cast<cef_errorcode_t>(retval);
|
||||
}
|
||||
|
||||
void CefRequestContextImpl::LoadExtension(
|
||||
const CefString& root_directory,
|
||||
CefRefPtr<CefDictionaryValue> manifest,
|
||||
@@ -801,13 +769,11 @@ void CefRequestContextImpl::ResolveHostInternal(
|
||||
|
||||
net::HostResolver* host_resolver = request_context->GetHostResolver();
|
||||
if (host_resolver) {
|
||||
net::HostResolver::RequestInfo request_info(
|
||||
net::HostPortPair::FromURL(GURL(origin.ToString())));
|
||||
retval = host_resolver->Resolve(
|
||||
request_info, net::DEFAULT_PRIORITY, &helper->address_list_,
|
||||
base::Bind(&ResolveHostHelper::OnResolveCompleted,
|
||||
base::Unretained(helper)),
|
||||
&helper->request_, net::NetLogWithSource());
|
||||
helper->request_ = host_resolver->CreateRequest(
|
||||
net::HostPortPair::FromURL(GURL(origin.ToString())),
|
||||
net::NetLogWithSource(), {});
|
||||
retval = helper->request_->Start(base::Bind(
|
||||
&ResolveHostHelper::OnResolveCompleted, base::Unretained(helper)));
|
||||
if (retval == net::ERR_IO_PENDING) {
|
||||
// The result will be delivered asynchronously via the callback.
|
||||
return;
|
||||
|
@@ -77,9 +77,6 @@ class CefRequestContextImpl : public CefRequestContext {
|
||||
void CloseAllConnections(CefRefPtr<CefCompletionCallback> callback) override;
|
||||
void ResolveHost(const CefString& origin,
|
||||
CefRefPtr<CefResolveCallback> callback) override;
|
||||
cef_errorcode_t ResolveHostCached(
|
||||
const CefString& origin,
|
||||
std::vector<CefString>& resolved_ips) override;
|
||||
void LoadExtension(const CefString& root_directory,
|
||||
CefRefPtr<CefDictionaryValue> manifest,
|
||||
CefRefPtr<CefExtensionHandler> handler) override;
|
||||
|
@@ -46,7 +46,7 @@ bool CefResourceDispatcherHostDelegate::ShouldInterceptResourceAsStream(
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
return false;
|
||||
|
||||
const content::ResourceRequestInfo* info =
|
||||
content::ResourceRequestInfo* info =
|
||||
content::ResourceRequestInfo::ForRequest(request);
|
||||
CefResourceContext* context =
|
||||
static_cast<CefResourceContext*>(info->GetContext());
|
||||
@@ -91,7 +91,7 @@ void CefResourceDispatcherHostDelegate::OnStreamCreated(
|
||||
net::URLRequest* request,
|
||||
std::unique_ptr<content::StreamInfo> stream) {
|
||||
DCHECK(extensions::ExtensionsEnabled());
|
||||
const content::ResourceRequestInfo* info =
|
||||
content::ResourceRequestInfo* info =
|
||||
content::ResourceRequestInfo::ForRequest(request);
|
||||
std::map<net::URLRequest*, StreamTargetInfo>::iterator ix =
|
||||
stream_target_info_.find(request);
|
||||
|
@@ -16,7 +16,7 @@
|
||||
|
||||
namespace base {
|
||||
class Thread;
|
||||
};
|
||||
}
|
||||
|
||||
class CefServerImpl : public CefServer, net::HttpServer::Delegate {
|
||||
public:
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include "base/location.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/task/post_task.h"
|
||||
#include "base/threading/scoped_blocking_call.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
@@ -73,7 +74,9 @@
|
||||
CEF_POST_BLOCKING_TASK(base::TaskPriority::BEST_EFFORT, task)
|
||||
|
||||
// Assert that blocking is allowed on the current thread.
|
||||
#define CEF_REQUIRE_BLOCKING() base::AssertBlockingAllowedDeprecated()
|
||||
#define CEF_REQUIRE_BLOCKING() \
|
||||
base::ScopedBlockingCall scoped_blocking_call( \
|
||||
FROM_HERE, base::BlockingType::WILL_BLOCK)
|
||||
|
||||
// Same as IMPLEMENT_REFCOUNTING() but using the specified Destructor.
|
||||
#define IMPLEMENT_REFCOUNTING_EX(ClassName, Destructor) \
|
||||
@@ -92,7 +95,7 @@
|
||||
} \
|
||||
\
|
||||
private: \
|
||||
CefRefCount ref_count_;
|
||||
CefRefCount ref_count_
|
||||
|
||||
#define IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(ClassName) \
|
||||
IMPLEMENT_REFCOUNTING_EX(ClassName, content::BrowserThread::DeleteOnUIThread)
|
||||
|
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace views {
|
||||
class LayoutManager;
|
||||
};
|
||||
}
|
||||
|
||||
// Exposes a common interface from all CefLayout implementation objects to
|
||||
// simplify the layout_util implementation. See comments in view_impl.h for a
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include "content/public/common/pepper_plugin_info.h"
|
||||
#include "ppapi/shared_impl/ppapi_permissions.h"
|
||||
#include "third_party/widevine/cdm/buildflags.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
@@ -161,8 +162,10 @@ bool GetSystemPepperFlash(content::PepperPluginInfo* plugin) {
|
||||
std::string manifest_data;
|
||||
if (!base::ReadFileToString(manifest_path, &manifest_data))
|
||||
return false;
|
||||
std::unique_ptr<base::Value> manifest_value(
|
||||
base::JSONReader::Read(manifest_data, base::JSON_ALLOW_TRAILING_COMMAS));
|
||||
std::unique_ptr<base::Value> manifest_value(base::Value::ToUniquePtrValue(
|
||||
std::move(base::JSONReader::Read(manifest_data,
|
||||
base::JSON_ALLOW_TRAILING_COMMAS)
|
||||
.value())));
|
||||
if (!manifest_value.get())
|
||||
return false;
|
||||
base::DictionaryValue* manifest = NULL;
|
||||
@@ -242,6 +245,16 @@ base::string16 CefContentClient::GetLocalizedString(int message_id) const {
|
||||
return value;
|
||||
}
|
||||
|
||||
base::string16 CefContentClient::GetLocalizedString(
|
||||
int message_id,
|
||||
const base::string16& replacement) const {
|
||||
base::string16 value = l10n_util::GetStringFUTF16(message_id, replacement);
|
||||
if (value.empty())
|
||||
LOG(ERROR) << "No localized string available for id " << message_id;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
base::StringPiece CefContentClient::GetDataResource(
|
||||
int resource_id,
|
||||
ui::ScaleFactor scale_factor) const {
|
||||
|
@@ -38,6 +38,9 @@ class CefContentClient : public content::ContentClient,
|
||||
std::vector<media::CdmHostFilePath>* cdm_host_file_paths) override;
|
||||
void AddAdditionalSchemes(Schemes* schemes) override;
|
||||
base::string16 GetLocalizedString(int message_id) const override;
|
||||
base::string16 GetLocalizedString(
|
||||
int message_id,
|
||||
const base::string16& replacement) const override;
|
||||
base::StringPiece GetDataResource(
|
||||
int resource_id,
|
||||
ui::ScaleFactor scale_factor) const override;
|
||||
|
@@ -34,10 +34,13 @@ int GetJSONWriterOptions(cef_json_writer_options_t options) {
|
||||
CefRefPtr<CefValue> CefParseJSON(const CefString& json_string,
|
||||
cef_json_parser_options_t options) {
|
||||
const std::string& json = json_string.ToString();
|
||||
std::unique_ptr<base::Value> parse_result =
|
||||
base::Optional<base::Value> parse_result =
|
||||
base::JSONReader::Read(json, GetJSONReaderOptions(options));
|
||||
if (parse_result)
|
||||
return new CefValueImpl(parse_result.release());
|
||||
if (parse_result) {
|
||||
return new CefValueImpl(
|
||||
base::Value::ToUniquePtrValue(std::move(parse_result.value()))
|
||||
.release());
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -48,16 +51,19 @@ CefRefPtr<CefValue> CefParseJSONAndReturnError(
|
||||
CefString& error_msg_out) {
|
||||
const std::string& json = json_string.ToString();
|
||||
|
||||
int error_code;
|
||||
std::string error_msg;
|
||||
std::unique_ptr<base::Value> parse_result =
|
||||
base::JSONReader::ReadAndReturnError(json, GetJSONReaderOptions(options),
|
||||
&error_code, &error_msg);
|
||||
if (parse_result)
|
||||
return new CefValueImpl(parse_result.release());
|
||||
base::JSONReader::ValueWithError value_and_error =
|
||||
base::JSONReader::ReadAndReturnValueWithError(
|
||||
json, GetJSONReaderOptions(options));
|
||||
if (value_and_error.value) {
|
||||
return new CefValueImpl(
|
||||
base::Value::ToUniquePtrValue(std::move(value_and_error.value.value()))
|
||||
.release());
|
||||
}
|
||||
|
||||
error_code_out = static_cast<cef_json_parser_error_t>(error_code);
|
||||
error_msg_out = error_msg;
|
||||
error_code_out =
|
||||
static_cast<cef_json_parser_error_t>(value_and_error.error_code);
|
||||
error_msg_out = value_and_error.error_message;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include "components/content_settings/core/common/content_settings_pattern.h"
|
||||
#include "components/viz/common/features.h"
|
||||
#include "content/browser/browser_process_sub_thread.h"
|
||||
#include "content/browser/scheduler/browser_task_executor.h"
|
||||
#include "content/public/browser/browser_main_runner.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/common/content_features.h"
|
||||
@@ -45,6 +46,7 @@
|
||||
#include "extensions/common/constants.h"
|
||||
#include "ipc/ipc_buildflags.h"
|
||||
#include "pdf/pdf_ppapi.h"
|
||||
#include "services/network/public/cpp/features.h"
|
||||
#include "services/service_manager/sandbox/switches.h"
|
||||
#include "ui/base/layout.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
@@ -274,22 +276,52 @@ void OverrideAssetPath() {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Used to run the UI on a separate thread.
|
||||
class CefUIThread : public base::Thread {
|
||||
public:
|
||||
CefUIThread() : base::Thread("CefUIThread") {}
|
||||
} // namespace
|
||||
|
||||
void Init() override {
|
||||
#if defined(OS_WIN)
|
||||
// Initializes the COM library on the current thread.
|
||||
CoInitialize(NULL);
|
||||
#endif
|
||||
// Used to run the UI on a separate thread.
|
||||
class CefUIThread : public base::PlatformThread::Delegate {
|
||||
public:
|
||||
explicit CefUIThread(base::OnceClosure setup_callback)
|
||||
: setup_callback_(std::move(setup_callback)) {}
|
||||
~CefUIThread() override { Stop(); }
|
||||
|
||||
void Start() {
|
||||
base::AutoLock lock(thread_lock_);
|
||||
bool success = base::PlatformThread::CreateWithPriority(
|
||||
0, this, &thread_, base::ThreadPriority::NORMAL);
|
||||
if (!success) {
|
||||
LOG(FATAL) << "failed to UI create thread";
|
||||
}
|
||||
}
|
||||
|
||||
void Stop() {
|
||||
base::AutoLock lock(thread_lock_);
|
||||
|
||||
if (!stopping_) {
|
||||
stopping_ = true;
|
||||
base::PostTaskWithTraits(
|
||||
FROM_HERE, {content::BrowserThread::UI},
|
||||
base::BindOnce(&CefUIThread::ThreadQuitHelper, Unretained(this)));
|
||||
}
|
||||
|
||||
// Can't join if the |thread_| is either already gone or is non-joinable.
|
||||
if (thread_.is_null())
|
||||
return;
|
||||
|
||||
base::PlatformThread::Join(thread_);
|
||||
thread_ = base::PlatformThreadHandle();
|
||||
|
||||
stopping_ = false;
|
||||
}
|
||||
|
||||
bool WaitUntilThreadStarted() const {
|
||||
DCHECK(owning_sequence_checker_.CalledOnValidSequence());
|
||||
start_event_.Wait();
|
||||
return true;
|
||||
}
|
||||
|
||||
void InitializeBrowserRunner(
|
||||
const content::MainFunctionParams& main_function_params) {
|
||||
DCHECK(task_runner()->BelongsToCurrentThread());
|
||||
|
||||
// Use our own browser process runner.
|
||||
browser_runner_ = content::BrowserMainRunner::Create();
|
||||
|
||||
@@ -298,15 +330,27 @@ class CefUIThread : public base::Thread {
|
||||
CHECK_EQ(exit_code, -1);
|
||||
}
|
||||
|
||||
void CleanUp() override {
|
||||
protected:
|
||||
void ThreadMain() override {
|
||||
base::PlatformThread::SetName("CefUIThread");
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// Initializes the COM library on the current thread.
|
||||
CoInitialize(NULL);
|
||||
#endif
|
||||
|
||||
start_event_.Signal();
|
||||
|
||||
std::move(setup_callback_).Run();
|
||||
|
||||
base::RunLoop run_loop;
|
||||
run_loop_ = &run_loop;
|
||||
run_loop.Run();
|
||||
|
||||
browser_runner_->Shutdown();
|
||||
browser_runner_.reset(NULL);
|
||||
|
||||
// Release MessagePump resources registered with the AtExitManager.
|
||||
base::MessageLoop* ml = const_cast<base::MessageLoop*>(message_loop());
|
||||
base::MessageLoopCurrent::UnbindFromCurrentThreadInternal(
|
||||
ml->GetMessageLoopBase());
|
||||
ml->ReleasePump();
|
||||
content::BrowserTaskExecutor::Shutdown();
|
||||
|
||||
// Run exit callbacks on the UI thread to avoid sequence check failures.
|
||||
base::AtExitManager::ProcessCallbacksNow();
|
||||
@@ -316,13 +360,32 @@ class CefUIThread : public base::Thread {
|
||||
// be balanced by a corresponding call to CoUninitialize.
|
||||
CoUninitialize();
|
||||
#endif
|
||||
|
||||
run_loop_ = nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
std::unique_ptr<content::BrowserMainRunner> browser_runner_;
|
||||
};
|
||||
void ThreadQuitHelper() {
|
||||
DCHECK(run_loop_);
|
||||
run_loop_->QuitWhenIdle();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
std::unique_ptr<content::BrowserMainRunner> browser_runner_;
|
||||
base::OnceClosure setup_callback_;
|
||||
|
||||
bool stopping_ = false;
|
||||
|
||||
// The thread's handle.
|
||||
base::PlatformThreadHandle thread_;
|
||||
mutable base::Lock thread_lock_; // Protects |thread_|.
|
||||
|
||||
base::RunLoop* run_loop_ = nullptr;
|
||||
|
||||
mutable base::WaitableEvent start_event_;
|
||||
|
||||
// This class is not thread-safe, use this to verify access from the owning
|
||||
// sequence of the Thread.
|
||||
base::SequenceChecker owning_sequence_checker_;
|
||||
};
|
||||
|
||||
CefMainDelegate::CefMainDelegate(CefRefPtr<CefApp> application)
|
||||
: content_client_(application) {
|
||||
@@ -339,10 +402,7 @@ CefMainDelegate::CefMainDelegate(CefRefPtr<CefApp> application)
|
||||
CefMainDelegate::~CefMainDelegate() {}
|
||||
|
||||
void CefMainDelegate::PreCreateMainMessageLoop() {
|
||||
if (!message_loop_) {
|
||||
// Create the main message loop.
|
||||
message_loop_.reset(new CefBrowserMessageLoop());
|
||||
}
|
||||
InitMessagePumpFactoryForUI();
|
||||
}
|
||||
|
||||
bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
|
||||
@@ -506,6 +566,13 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
|
||||
}
|
||||
}
|
||||
|
||||
// Disable NetworkService for now
|
||||
// TODO(cef): Implement the required changes for network service
|
||||
if (network::features::kNetworkService.default_state ==
|
||||
base::FEATURE_ENABLED_BY_DEFAULT) {
|
||||
disable_features.push_back(network::features::kNetworkService.name);
|
||||
}
|
||||
|
||||
if (!disable_features.empty()) {
|
||||
DCHECK(!base::FeatureList::GetInstance());
|
||||
std::string disable_features_str =
|
||||
@@ -653,8 +720,7 @@ int CefMainDelegate::RunProcess(
|
||||
} else {
|
||||
// Running on the separate UI thread.
|
||||
DCHECK(ui_thread_);
|
||||
static_cast<CefUIThread*>(ui_thread_.get())
|
||||
->InitializeBrowserRunner(main_function_params);
|
||||
ui_thread_->InitializeBrowserRunner(main_function_params);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -663,22 +729,16 @@ int CefMainDelegate::RunProcess(
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool CefMainDelegate::CreateUIThread() {
|
||||
bool CefMainDelegate::CreateUIThread(base::OnceClosure setup_callback) {
|
||||
DCHECK(!ui_thread_);
|
||||
DCHECK(!message_loop_);
|
||||
|
||||
std::unique_ptr<base::Thread> thread;
|
||||
thread.reset(new CefUIThread());
|
||||
base::Thread::Options options;
|
||||
options.message_loop_type = base::MessageLoop::TYPE_UI;
|
||||
if (!thread->StartWithOptions(options)) {
|
||||
NOTREACHED() << "failed to start UI thread";
|
||||
return false;
|
||||
}
|
||||
std::unique_ptr<CefUIThread> thread;
|
||||
thread.reset(new CefUIThread(std::move(setup_callback)));
|
||||
thread->Start();
|
||||
thread->WaitUntilThreadStarted();
|
||||
ui_thread_.swap(thread);
|
||||
|
||||
message_loop_.reset(new CefBrowserMessageLoop());
|
||||
InitMessagePumpFactoryForUI();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -717,8 +777,6 @@ void CefMainDelegate::ShutdownBrowser() {
|
||||
browser_runner_.reset(NULL);
|
||||
}
|
||||
|
||||
message_loop_.reset();
|
||||
|
||||
if (ui_thread_.get()) {
|
||||
// Blocks until the thread has stopped.
|
||||
ui_thread_->Stop();
|
||||
|
@@ -27,6 +27,7 @@ class BrowserMainRunner;
|
||||
class CefContentBrowserClient;
|
||||
class CefContentRendererClient;
|
||||
class CefContentUtilityClient;
|
||||
class CefUIThread;
|
||||
|
||||
class CefMainDelegate : public content::ContentMainDelegate {
|
||||
public:
|
||||
@@ -48,21 +49,19 @@ class CefMainDelegate : public content::ContentMainDelegate {
|
||||
content::ContentRendererClient* CreateContentRendererClient() override;
|
||||
content::ContentUtilityClient* CreateContentUtilityClient() override;
|
||||
|
||||
bool CreateUIThread();
|
||||
bool CreateUIThread(base::OnceClosure setup_callback);
|
||||
|
||||
// Shut down the browser runner.
|
||||
void ShutdownBrowser();
|
||||
|
||||
CefContentBrowserClient* browser_client() { return browser_client_.get(); }
|
||||
CefContentClient* content_client() { return &content_client_; }
|
||||
base::Thread* ui_thread() { return ui_thread_.get(); }
|
||||
|
||||
private:
|
||||
void InitializeResourceBundle();
|
||||
|
||||
std::unique_ptr<base::MessageLoop> message_loop_;
|
||||
std::unique_ptr<content::BrowserMainRunner> browser_runner_;
|
||||
std::unique_ptr<base::Thread> ui_thread_;
|
||||
std::unique_ptr<CefUIThread> ui_thread_;
|
||||
|
||||
std::unique_ptr<CefContentBrowserClient> browser_client_;
|
||||
std::unique_ptr<CefContentRendererClient> renderer_client_;
|
||||
|
@@ -17,6 +17,6 @@ typedef CefRequest::HeaderMap HeaderMap;
|
||||
std::string GenerateHeaders(const HeaderMap& map);
|
||||
void ParseHeaders(const std::string& header_str, HeaderMap& map);
|
||||
|
||||
}; // namespace HttpHeaderUtils
|
||||
} // namespace HttpHeaderUtils
|
||||
|
||||
#endif // CEF_LIBCEF_COMMON_NET_HTTP_HEADER_UTILS_H_
|
||||
|
@@ -448,7 +448,7 @@ void CefRequestImpl::Set(const net::URLRequest* request) {
|
||||
|
||||
site_for_cookies_ = request->site_for_cookies();
|
||||
|
||||
const content::ResourceRequestInfo* info =
|
||||
content::ResourceRequestInfo* info =
|
||||
content::ResourceRequestInfo::ForRequest(request);
|
||||
if (info) {
|
||||
resource_type_ = static_cast<cef_resource_type_t>(info->GetResourceType());
|
||||
|
@@ -29,7 +29,7 @@ class UploadElement;
|
||||
class UploadElementReader;
|
||||
class URLFetcher;
|
||||
class URLRequest;
|
||||
}; // namespace net
|
||||
} // namespace net
|
||||
|
||||
namespace blink {
|
||||
class WebURLRequest;
|
||||
|
@@ -438,11 +438,6 @@ void CefBrowserImpl::DidFinishLoad(blink::WebLocalFrame* frame) {
|
||||
OnLoadEnd(frame);
|
||||
}
|
||||
|
||||
void CefBrowserImpl::DidStartProvisionalLoad(blink::WebLocalFrame* frame) {
|
||||
// Send the frame creation notification if necessary.
|
||||
GetWebFrameImpl(frame);
|
||||
}
|
||||
|
||||
void CefBrowserImpl::DidFailProvisionalLoad(blink::WebLocalFrame* frame,
|
||||
const blink::WebURLError& error) {
|
||||
OnLoadError(frame, error);
|
||||
|
@@ -115,7 +115,6 @@ class CefBrowserImpl : public CefBrowser, public content::RenderViewObserver {
|
||||
|
||||
// Forwarded from CefRenderFrameObserver.
|
||||
void DidFinishLoad(blink::WebLocalFrame* frame);
|
||||
void DidStartProvisionalLoad(blink::WebLocalFrame* frame);
|
||||
void FrameDetached(blink::WebLocalFrame* frame);
|
||||
void FocusedNodeChanged(const blink::WebNode& node);
|
||||
void DraggableRegionsChanged(blink::WebLocalFrame* frame);
|
||||
|
@@ -12,7 +12,7 @@
|
||||
namespace blink {
|
||||
class WebLocalFrame;
|
||||
class WebNode;
|
||||
}; // namespace blink
|
||||
} // namespace blink
|
||||
|
||||
class CefBrowserImpl;
|
||||
|
||||
|
@@ -152,7 +152,7 @@ bool CefExtensionsRendererClient::OverrideCreatePlugin(
|
||||
return true;
|
||||
|
||||
bool guest_view_api_available = false;
|
||||
extension_dispatcher_->script_context_set().ForEach(
|
||||
extension_dispatcher_->script_context_set_iterator()->ForEach(
|
||||
render_frame, base::Bind(&IsGuestViewApiAvailableToScriptContext,
|
||||
&guest_view_api_available));
|
||||
return !guest_view_api_available;
|
||||
|
@@ -39,18 +39,6 @@ void CefRenderFrameObserver::OnInterfaceRequestForFrame(
|
||||
registry_.TryBindInterface(interface_name, interface_pipe);
|
||||
}
|
||||
|
||||
void CefRenderFrameObserver::DidStartProvisionalLoad(
|
||||
blink::WebDocumentLoader* document_loader,
|
||||
bool is_content_initiated) {
|
||||
blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
|
||||
CefRefPtr<CefBrowserImpl> browserPtr =
|
||||
CefBrowserImpl::GetBrowserForMainFrame(frame->Top());
|
||||
if (!browserPtr.get())
|
||||
return;
|
||||
|
||||
browserPtr->DidStartProvisionalLoad(frame);
|
||||
}
|
||||
|
||||
void CefRenderFrameObserver::DidFinishLoad() {
|
||||
blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
|
||||
CefRefPtr<CefBrowserImpl> browserPtr =
|
||||
|
@@ -21,8 +21,6 @@ class CefRenderFrameObserver : public content::RenderFrameObserver {
|
||||
void OnInterfaceRequestForFrame(
|
||||
const std::string& interface_name,
|
||||
mojo::ScopedMessagePipeHandle* interface_pipe) override;
|
||||
void DidStartProvisionalLoad(blink::WebDocumentLoader* document_loader,
|
||||
bool is_content_initiated) override;
|
||||
void DidFinishLoad() override;
|
||||
void FrameDetached() override;
|
||||
void FrameFocused() override;
|
||||
|
@@ -40,8 +40,8 @@ class CefWebURLLoaderClient : public blink::WebURLLoaderClient {
|
||||
~CefWebURLLoaderClient() override;
|
||||
|
||||
// blink::WebURLLoaderClient methods.
|
||||
void DidSendData(unsigned long long bytesSent,
|
||||
unsigned long long totalBytesToBeSent) override;
|
||||
void DidSendData(uint64_t bytes_sent,
|
||||
uint64_t total_bytes_to_be_sent) override;
|
||||
void DidReceiveResponse(const WebURLResponse& response) override;
|
||||
void DidReceiveData(const char* data, int dataLength) override;
|
||||
void DidFinishLoading(
|
||||
@@ -280,10 +280,10 @@ CefWebURLLoaderClient::CefWebURLLoaderClient(
|
||||
|
||||
CefWebURLLoaderClient::~CefWebURLLoaderClient() {}
|
||||
|
||||
void CefWebURLLoaderClient::DidSendData(unsigned long long bytesSent,
|
||||
unsigned long long totalBytesToBeSent) {
|
||||
void CefWebURLLoaderClient::DidSendData(uint64_t bytes_sent,
|
||||
uint64_t total_bytes_to_be_sent) {
|
||||
if (request_flags_ & UR_FLAG_REPORT_UPLOAD_PROGRESS)
|
||||
context_->OnUploadProgress(bytesSent, totalBytesToBeSent);
|
||||
context_->OnUploadProgress(bytes_sent, total_bytes_to_be_sent);
|
||||
}
|
||||
|
||||
void CefWebURLLoaderClient::DidReceiveResponse(const WebURLResponse& response) {
|
||||
|
@@ -22,7 +22,7 @@ class GURL;
|
||||
|
||||
namespace blink {
|
||||
class WebLocalFrame;
|
||||
};
|
||||
}
|
||||
|
||||
// Call after a V8 Isolate has been created and entered for the first time.
|
||||
void CefV8IsolateCreated();
|
||||
|
Reference in New Issue
Block a user