Update to Chromium revision 0bfd25d4 (#381305)

- Delete include/cef_runnable.h (issue #1336).
- Build the cef_unittests target using all Chromium headers. Add a
  USING_CHROMIUM_INCLUDES define and libcef_dll_wrapper_unittests
  target to support this. This change avoids compile errors due to
  the divergence of CEF and Chromium base/ header implementations.
  The libcef_dll_wrapper sources must now compile successfully with
  both CEF and Chromium base/ headers (issue #1632).
- The onbeforeunload message specified via JavaScript is no longer
  passed to the client (see http://crbug.com/587940).
This commit is contained in:
Marshall Greenblatt
2016-03-15 22:55:59 -04:00
parent 77746cfd1b
commit 243a9c26d7
152 changed files with 902 additions and 1211 deletions

View File

@@ -25,18 +25,13 @@ CefCookieStoreProxy::~CefCookieStoreProxy() {
CEF_REQUIRE_IOT();
}
void CefCookieStoreProxy::Detach() {
CEF_REQUIRE_IOT();
parent_ = NULL;
}
void CefCookieStoreProxy::SetCookieWithOptionsAsync(
const GURL& url,
const std::string& cookie_line,
const net::CookieOptions& options,
const SetCookiesCallback& callback) {
scoped_refptr<net::CookieStore> cookie_store = GetCookieStore();
if (cookie_store.get()) {
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) {
cookie_store->SetCookieWithOptionsAsync(url, cookie_line, options,
callback);
}
@@ -48,36 +43,47 @@ void CefCookieStoreProxy::SetCookieWithDetailsAsync(
const std::string& value,
const std::string& domain,
const std::string& path,
const base::Time creation_time,
const base::Time expiration_time,
base::Time creation_time,
base::Time expiration_time,
base::Time last_access_time,
bool secure,
bool http_only,
bool same_site,
net::CookieSameSite same_site,
bool enforce_strict_secure,
net::CookiePriority priority,
const SetCookiesCallback& callback) {
scoped_refptr<net::CookieStore> cookie_store = GetCookieStore();
if (cookie_store.get()) {
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) {
cookie_store->SetCookieWithDetailsAsync(url, name, value, domain, path,
creation_time, expiration_time,
secure, http_only, same_site,
enforce_strict_secure, priority,
callback);
last_access_time, secure, http_only,
same_site, enforce_strict_secure,
priority, callback);
}
}
void CefCookieStoreProxy::GetCookiesWithOptionsAsync(
const GURL& url, const net::CookieOptions& options,
const GURL& url,
const net::CookieOptions& options,
const GetCookiesCallback& callback) {
scoped_refptr<net::CookieStore> cookie_store = GetCookieStore();
if (cookie_store.get())
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store)
cookie_store->GetCookiesWithOptionsAsync(url, options, callback);
}
void CefCookieStoreProxy::GetCookieListWithOptionsAsync(
const GURL& url,
const net::CookieOptions& options,
const GetCookieListCallback& callback) {
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store)
cookie_store->GetCookieListWithOptionsAsync(url, options, callback);
}
void CefCookieStoreProxy::GetAllCookiesAsync(
const GetCookieListCallback& callback) {
scoped_refptr<net::CookieStore> cookie_store = GetCookieStore();
if (cookie_store.get())
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store)
cookie_store->GetAllCookiesAsync(callback);
}
@@ -85,25 +91,25 @@ void CefCookieStoreProxy::DeleteCookieAsync(
const GURL& url,
const std::string& cookie_name,
const base::Closure& callback) {
scoped_refptr<net::CookieStore> cookie_store = GetCookieStore();
if (cookie_store.get())
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store)
cookie_store->DeleteCookieAsync(url, cookie_name, callback);
}
void CefCookieStoreProxy::GetAllCookiesForURLAsync(
const GURL& url,
const GetCookieListCallback& callback) {
scoped_refptr<net::CookieStore> cookie_store = GetCookieStore();
if (cookie_store.get())
cookie_store->GetAllCookiesForURLAsync(url, callback);
void CefCookieStoreProxy::DeleteCanonicalCookieAsync(
const net::CanonicalCookie& cookie,
const DeleteCallback& callback) {
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store)
cookie_store->DeleteCanonicalCookieAsync(cookie, callback);
}
void CefCookieStoreProxy::DeleteAllCreatedBetweenAsync(
const base::Time& delete_begin,
const base::Time& delete_end,
const DeleteCallback& callback) {
scoped_refptr<net::CookieStore> cookie_store = GetCookieStore();
if (cookie_store.get()) {
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) {
cookie_store->DeleteAllCreatedBetweenAsync(delete_begin, delete_end,
callback);
}
@@ -114,8 +120,8 @@ void CefCookieStoreProxy::DeleteAllCreatedBetweenForHostAsync(
const base::Time delete_end,
const GURL& url,
const DeleteCallback& callback) {
scoped_refptr<net::CookieStore> cookie_store = GetCookieStore();
if (cookie_store.get()) {
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) {
cookie_store->DeleteAllCreatedBetweenForHostAsync(delete_begin, delete_end,
url, callback);
}
@@ -123,55 +129,57 @@ void CefCookieStoreProxy::DeleteAllCreatedBetweenForHostAsync(
void CefCookieStoreProxy::DeleteSessionCookiesAsync(
const DeleteCallback& callback) {
scoped_refptr<net::CookieStore> cookie_store = GetCookieStore();
if (cookie_store.get())
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store)
cookie_store->DeleteSessionCookiesAsync(callback);
}
void CefCookieStoreProxy::FlushStore(const base::Closure& callback) {
scoped_refptr<net::CookieStore> cookie_store = GetCookieStore();
if (cookie_store.get())
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store)
cookie_store->FlushStore(callback);
}
net::CookieMonster* CefCookieStoreProxy::GetCookieMonster() {
scoped_refptr<net::CookieStore> cookie_store = GetCookieStore();
if (cookie_store.get())
return cookie_store->GetCookieMonster();
return NULL;
}
scoped_ptr<net::CookieStore::CookieChangedSubscription>
CefCookieStoreProxy::AddCallbackForCookie(
const GURL& url,
const std::string& name,
const CookieChangedCallback& callback) {
scoped_refptr<net::CookieStore> cookie_store = GetCookieStore();
if (cookie_store.get())
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store)
return cookie_store->AddCallbackForCookie(url, name, callback);
return NULL;
}
bool CefCookieStoreProxy::IsEphemeral() {
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store)
return cookie_store->IsEphemeral();
return true;
}
net::CookieStore* CefCookieStoreProxy::GetCookieStore() {
CEF_REQUIRE_IOT();
scoped_refptr<net::CookieStore> cookie_store;
net::CookieStore* cookie_store = nullptr;
CefRefPtr<CefCookieManager> manager = handler_->GetCookieManager();
if (manager.get()) {
// Use the cookie store provided by the manager.
cookie_store = reinterpret_cast<CefCookieManagerImpl*>(manager.get())->
GetExistingCookieMonster();
DCHECK(cookie_store.get());
return cookie_store.get();
GetExistingCookieStore();
DCHECK(cookie_store);
return cookie_store;
}
DCHECK(parent_);
if (parent_) {
// Use the cookie store from the parent.
cookie_store = parent_->cookie_store();
DCHECK(cookie_store.get());
DCHECK(cookie_store);
if (!cookie_store)
LOG(ERROR) << "Cookie store does not exist";
}
return cookie_store.get();
return cookie_store;
}

View File

@@ -21,9 +21,6 @@ class CefCookieStoreProxy : public net::CookieStore {
CefRefPtr<CefRequestContextHandler> handler);
~CefCookieStoreProxy() override;
// The |parent_| object may no longer be valid after this method is called.
void Detach();
// net::CookieStore methods.
void SetCookieWithOptionsAsync(
const GURL& url,
@@ -36,24 +33,29 @@ class CefCookieStoreProxy : public net::CookieStore {
const std::string& value,
const std::string& domain,
const std::string& path,
const base::Time creation_time,
const base::Time expiration_time,
base::Time creation_time,
base::Time expiration_time,
base::Time last_access_time,
bool secure,
bool http_only,
bool same_site,
net::CookieSameSite same_site,
bool enforce_strict_secure,
net::CookiePriority priority,
const SetCookiesCallback& callback) override;
void GetCookiesWithOptionsAsync(
const GURL& url, const net::CookieOptions& options,
const GURL& url,
const net::CookieOptions& options,
const GetCookiesCallback& callback) override;
void GetCookieListWithOptionsAsync(
const GURL& url,
const net::CookieOptions& options,
const GetCookieListCallback& callback) override;
void GetAllCookiesAsync(const GetCookieListCallback& callback) override;
void DeleteCookieAsync(const GURL& url,
const std::string& cookie_name,
const base::Closure& callback) override;
void GetAllCookiesForURLAsync(
const GURL& url,
const GetCookieListCallback& callback) override;
void DeleteCanonicalCookieAsync(const net::CanonicalCookie& cookie,
const DeleteCallback& callback) override;
void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin,
const base::Time& delete_end,
const DeleteCallback& callback) override;
@@ -64,18 +66,17 @@ class CefCookieStoreProxy : public net::CookieStore {
const DeleteCallback& callback) override;
void DeleteSessionCookiesAsync(const DeleteCallback& callback) override;
void FlushStore(const base::Closure& callback) override;
net::CookieMonster* GetCookieMonster() override;
scoped_ptr<CookieChangedSubscription> AddCallbackForCookie(
const GURL& url,
const std::string& name,
const CookieChangedCallback& callback) override;
bool IsEphemeral() override;
private:
net::CookieStore* GetCookieStore();
// The |parent_| pointer is kept alive by CefURLRequestContextGetterProxy
// which has a ref to the owning CefURLRequestContextGetterImpl. Detach() will
// be called when the CefURLRequestContextGetterProxy is destroyed.
// which has a ref to the owning CefURLRequestContextGetterImpl.
CefURLRequestContextImpl* parent_;
CefRefPtr<CefRequestContextHandler> handler_;

View File

@@ -383,19 +383,13 @@ void CefResourceRequestJob::AddCookieHeaderAndStart() {
if (!request_)
return;
net::CookieStore* cookie_store =
request_->context()->cookie_store();
net::CookieStore* cookie_store = request_->context()->cookie_store();
if (cookie_store &&
!(request_->load_flags() & net::LOAD_DO_NOT_SEND_COOKIES)) {
net::CookieMonster* cookie_monster = cookie_store->GetCookieMonster();
if (cookie_monster) {
cookie_monster->GetAllCookiesForURLAsync(
request_->url(),
base::Bind(&CefResourceRequestJob::CheckCookiePolicyAndLoad,
weak_factory_.GetWeakPtr()));
} else {
DoLoadCookies();
}
cookie_store->GetAllCookiesForURLAsync(
request_->url(),
base::Bind(&CefResourceRequestJob::CheckCookiePolicyAndLoad,
weak_factory_.GetWeakPtr()));
} else {
DoStartTransaction();
}

View File

@@ -104,14 +104,14 @@ class CefHttpUserAgentSettings : public net::HttpUserAgentSettings {
CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
const CefRequestContextSettings& settings,
PrefService* pref_service,
base::MessageLoop* io_loop,
base::MessageLoop* file_loop,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner,
content::ProtocolHandlerMap* protocol_handlers,
scoped_ptr<net::ProxyConfigService> proxy_config_service,
content::URLRequestInterceptorScopedVector request_interceptors)
: settings_(settings),
io_loop_(io_loop),
file_loop_(file_loop),
io_task_runner_(std::move(io_task_runner)),
file_task_runner_(std::move(file_task_runner)),
proxy_config_service_(std::move(proxy_config_service)),
request_interceptors_(std::move(request_interceptors)) {
// Must first be created on the UI thread.
@@ -334,9 +334,8 @@ void CefURLRequestContextGetterImpl::SetCookieStoragePath(
// Set the new cookie store that will be used for all new requests. The old
// cookie store, if any, will be automatically flushed and closed when no
// longer referenced.
scoped_refptr<net::CookieMonster> cookie_monster =
new net::CookieMonster(persistent_store.get(), NULL);
storage_->set_cookie_store(cookie_monster.get());
scoped_ptr<net::CookieMonster> cookie_monster(
new net::CookieMonster(persistent_store.get(), NULL));
if (persistent_store.get() && persist_session_cookies)
cookie_monster->SetPersistSessionCookies(true);
cookie_store_path_ = path;
@@ -344,6 +343,8 @@ void CefURLRequestContextGetterImpl::SetCookieStoragePath(
// Restore the previously supported schemes.
CefCookieManagerImpl::SetCookieMonsterSchemes(cookie_monster.get(),
cookie_supported_schemes_);
storage_->set_cookie_store(std::move(cookie_monster));
}
void CefURLRequestContextGetterImpl::SetCookieSupportedSchemes(
@@ -351,8 +352,9 @@ void CefURLRequestContextGetterImpl::SetCookieSupportedSchemes(
CEF_REQUIRE_IOT();
cookie_supported_schemes_ = schemes;
CefCookieManagerImpl::SetCookieMonsterSchemes(GetCookieMonster(),
cookie_supported_schemes_);
CefCookieManagerImpl::SetCookieMonsterSchemes(
static_cast<net::CookieMonster*>(GetExistingCookieStore()),
cookie_supported_schemes_);
}
void CefURLRequestContextGetterImpl::AddHandler(
@@ -365,9 +367,14 @@ void CefURLRequestContextGetterImpl::AddHandler(
handler_list_.push_back(handler);
}
net::CookieMonster* CefURLRequestContextGetterImpl::GetCookieMonster() const {
net::CookieStore*
CefURLRequestContextGetterImpl::GetExistingCookieStore() const {
CEF_REQUIRE_IOT();
return url_request_context_->cookie_store()->GetCookieMonster();
if (url_request_context_ && url_request_context_->cookie_store())
return url_request_context_->cookie_store();
LOG(ERROR) << "Cookie store does not exist";
return nullptr;
}
void CefURLRequestContextGetterImpl::CreateProxyConfigService() {
@@ -376,5 +383,5 @@ void CefURLRequestContextGetterImpl::CreateProxyConfigService() {
proxy_config_service_ =
net::ProxyService::CreateSystemProxyConfigService(
io_loop_->task_runner(), file_loop_->task_runner());
io_task_runner_, file_task_runner_);
}

View File

@@ -46,8 +46,8 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
CefURLRequestContextGetterImpl(
const CefRequestContextSettings& settings,
PrefService* pref_service,
base::MessageLoop* io_loop,
base::MessageLoop* file_loop,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner,
content::ProtocolHandlerMap* protocol_handlers,
scoped_ptr<net::ProxyConfigService> proxy_config_service,
content::URLRequestInterceptorScopedVector request_interceptors);
@@ -69,7 +69,9 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
// kept alive until the context is destroyed.
void AddHandler(CefRefPtr<CefRequestContextHandler> handler);
net::CookieMonster* GetCookieMonster() const;
// Returns the existing cookie store object. Logs an error if the cookie
// store does not yet exist. Must be called on the IO thread.
net::CookieStore* GetExistingCookieStore() const;
CefURLRequestManager* request_manager() const {
return url_request_manager_.get();
@@ -80,8 +82,8 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
const CefRequestContextSettings settings_;
base::MessageLoop* io_loop_;
base::MessageLoop* file_loop_;
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
#if defined(OS_POSIX) && !defined(OS_ANDROID)
std::string gsapi_library_name_;

View File

@@ -16,7 +16,7 @@ CefURLRequestContextProxy::CefURLRequestContextProxy(
DCHECK(handler.get());
// Cookie store that proxies to the browser implementation.
cookie_store_proxy_ = new CefCookieStoreProxy(parent, handler);
cookie_store_proxy_.reset(new CefCookieStoreProxy(parent, handler));
set_cookie_store(cookie_store_proxy_.get());
// All other values refer to the parent request context.
@@ -39,6 +39,4 @@ CefURLRequestContextProxy::CefURLRequestContextProxy(
CefURLRequestContextProxy::~CefURLRequestContextProxy() {
CEF_REQUIRE_IOT();
// The CookieStore may outlive this object.
cookie_store_proxy_->Detach();
}

View File

@@ -7,12 +7,12 @@
#pragma once
#include "include/cef_request_context_handler.h"
#include "libcef/browser/net/cookie_store_proxy.h"
#include "libcef/browser/net/url_request_context.h"
#include "base/memory/scoped_ptr.h"
class CefBrowserHostImpl;
class CefCookieStoreProxy;
class CefURLRequestContextImpl;
// URLRequestContext implementation for a particular CefRequestContext. Life
@@ -28,7 +28,7 @@ class CefURLRequestContextProxy : public CefURLRequestContext {
~CefURLRequestContextProxy() override;
private:
scoped_refptr<CefCookieStoreProxy> cookie_store_proxy_;
scoped_ptr<CefCookieStoreProxy> cookie_store_proxy_;
DISALLOW_COPY_AND_ASSIGN(CefURLRequestContextProxy);
};