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

@ -36,6 +36,8 @@ CefBrowserContext::~CefBrowserContext() {
}
void CefBrowserContext::Initialize() {
content::BrowserContext::Initialize(this, GetPath());
const bool extensions_enabled = extensions::ExtensionsEnabled();
if (extensions_enabled) {
// Create the custom ExtensionSystem first because other KeyedServices

View File

@ -449,8 +449,8 @@ net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
url_request_getter_ = new CefURLRequestContextGetterImpl(
settings_,
GetPrefs(),
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO),
BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE),
protocol_handlers,
std::move(proxy_config_service),
std::move(request_interceptors));

View File

@ -127,9 +127,13 @@ GpuModeManager* ChromeBrowserProcessStub::gpu_mode_manager() {
}
void ChromeBrowserProcessStub::CreateDevToolsHttpProtocolHandler(
chrome::HostDesktopType host_desktop_type,
const std::string& ip,
uint16_t port) {
NOTIMPLEMENTED();
}
void ChromeBrowserProcessStub::CreateDevToolsAutoOpener() {
NOTIMPLEMENTED();
}
unsigned int ChromeBrowserProcessStub::AddRefModule() {
@ -276,10 +280,10 @@ gcm::GCMDriver* ChromeBrowserProcessStub::gcm_driver() {
return NULL;
}
ShellIntegration::DefaultWebClientState
shell_integration::DefaultWebClientState
ChromeBrowserProcessStub::CachedDefaultWebClientState() {
NOTIMPLEMENTED();
return ShellIntegration::UNKNOWN_DEFAULT;
return shell_integration::UNKNOWN_DEFAULT;
}
memory::TabManager* ChromeBrowserProcessStub::GetTabManager() {

View File

@ -52,10 +52,9 @@ class ChromeBrowserProcessStub : public BrowserProcess {
IconManager* icon_manager() override;
GLStringManager* gl_string_manager() override;
GpuModeManager* gpu_mode_manager() override;
void CreateDevToolsHttpProtocolHandler(
chrome::HostDesktopType host_desktop_type,
const std::string& ip,
uint16_t port) override;
void CreateDevToolsHttpProtocolHandler(const std::string& ip,
uint16_t port) override;
void CreateDevToolsAutoOpener() override;
unsigned int AddRefModule() override;
unsigned int ReleaseModule() override;
bool IsShuttingDown() override;
@ -97,7 +96,7 @@ class ChromeBrowserProcessStub : public BrowserProcess {
#endif
network_time::NetworkTimeTracker* network_time_tracker() override;
gcm::GCMDriver* gcm_driver() override;
ShellIntegration::DefaultWebClientState
shell_integration::DefaultWebClientState
CachedDefaultWebClientState() override;
memory::TabManager* GetTabManager() override;

View File

@ -112,6 +112,7 @@ class CefConfigurator : public Configurator {
CreateOutOfProcessPatcher() const override;
bool DeltasEnabled() const override;
bool UseBackgroundDownloader() const override;
bool UseCupSigning() const override;
scoped_refptr<base::SequencedTaskRunner> GetSequencedTaskRunner()
const override;
@ -264,6 +265,10 @@ bool CefConfigurator::UseBackgroundDownloader() const {
return background_downloads_enabled_;
}
bool CefConfigurator::UseCupSigning() const {
return true;
}
scoped_refptr<base::SequencedTaskRunner>
CefConfigurator::GetSequencedTaskRunner() const {
return content::BrowserThread::GetBlockingPool()

View File

@ -101,19 +101,18 @@ class CefAccessTokenStore : public content::AccessTokenStore {
explicit CefAccessTokenStore(net::URLRequestContextGetter* system_context)
: system_context_(system_context) {}
void LoadAccessTokens(
const LoadAccessTokensCallbackType& callback) override {
callback.Run(access_token_set_, system_context_);
void LoadAccessTokens(const LoadAccessTokensCallback& callback) override {
callback.Run(access_token_map_, system_context_);
}
void SaveAccessToken(
const GURL& server_url, const base::string16& access_token) override {
access_token_set_[server_url] = access_token;
access_token_map_[server_url] = access_token;
}
private:
net::URLRequestContextGetter* system_context_;
AccessTokenSet access_token_set_;
AccessTokenMap access_token_map_;
DISALLOW_COPY_AND_ASSIGN(CefAccessTokenStore);
};

View File

@ -11,7 +11,6 @@
#include "libcef/browser/content_browser_client.h"
#include "libcef/browser/context.h"
#include "libcef/browser/net/network_delegate.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/time_util.h"
#include "base/bind.h"
@ -33,9 +32,9 @@ namespace {
class VisitCookiesCallback : public base::RefCounted<VisitCookiesCallback> {
public:
explicit VisitCookiesCallback(
scoped_refptr<net::CookieMonster> cookie_monster,
const CefCookieManagerImpl::CookieStoreGetter& cookie_store_getter,
CefRefPtr<CefCookieVisitor> visitor)
: cookie_monster_(cookie_monster),
: cookie_store_getter_(cookie_store_getter),
visitor_(visitor) {
}
@ -53,8 +52,11 @@ class VisitCookiesCallback : public base::RefCounted<VisitCookiesCallback> {
bool deleteCookie = false;
bool keepLooping = visitor_->Visit(cookie, count, total, deleteCookie);
if (deleteCookie) {
cookie_monster_->DeleteCanonicalCookieAsync(cc,
net::CookieMonster::DeleteCookieCallback());
net::CookieStore* cookie_store = cookie_store_getter_.Run();
if (cookie_store) {
cookie_store->DeleteCanonicalCookieAsync(cc,
net::CookieMonster::DeleteCallback());
}
}
if (!keepLooping)
break;
@ -66,12 +68,12 @@ class VisitCookiesCallback : public base::RefCounted<VisitCookiesCallback> {
~VisitCookiesCallback() {}
scoped_refptr<net::CookieMonster> cookie_monster_;
CefCookieManagerImpl::CookieStoreGetter cookie_store_getter_;
CefRefPtr<CefCookieVisitor> visitor_;
};
// Methods extracted from net/cookies/cookie_monster.cc
// Methods extracted from net/cookies/cookie_store.cc
// Determine the cookie domain to use for setting the specified cookie.
bool GetCookieDomain(const GURL& url,
@ -118,6 +120,7 @@ CefCookieManagerImpl::CefCookieManagerImpl() {
}
CefCookieManagerImpl::~CefCookieManagerImpl() {
CEF_REQUIRE_IOT();
}
void CefCookieManagerImpl::Initialize(
@ -135,53 +138,54 @@ void CefCookieManagerImpl::Initialize(
}
}
void CefCookieManagerImpl::GetCookieMonster(
void CefCookieManagerImpl::GetCookieStore(
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
const CookieMonsterCallback& callback) {
const CookieStoreCallback& callback) {
if (!task_runner.get())
task_runner = base::MessageLoop::current()->task_runner();
if (!CEF_CURRENTLY_ON_IOT()) {
CEF_POST_TASK(CEF_IOT,
base::Bind(&CefCookieManagerImpl::GetCookieMonster, this, task_runner,
base::Bind(&CefCookieManagerImpl::GetCookieStore, this, task_runner,
callback));
return;
}
if (HasContext()) {
RunMethodWithContext(
base::Bind(&CefCookieManagerImpl::GetCookieMonsterWithContext, this,
base::Bind(&CefCookieManagerImpl::GetCookieStoreWithContext, this,
task_runner, callback));
return;
}
DCHECK(cookie_monster_.get());
if (cookie_monster_.get()) {
if (task_runner->BelongsToCurrentThread()) {
// Execute the callback immediately.
callback.Run(cookie_monster_);
} else {
// Execute the callback on the target thread.
task_runner->PostTask(FROM_HERE, base::Bind(callback, cookie_monster_));
}
return;
DCHECK(cookie_store_.get());
const CookieStoreGetter& cookie_store_getter =
base::Bind(&CefCookieManagerImpl::GetExistingCookieStore, this);
if (task_runner->BelongsToCurrentThread()) {
// Execute the callback immediately.
callback.Run(cookie_store_getter);
} else {
// Execute the callback on the target thread.
task_runner->PostTask(FROM_HERE,
base::Bind(callback, cookie_store_getter));
}
}
scoped_refptr<net::CookieMonster>
CefCookieManagerImpl::GetExistingCookieMonster() {
net::CookieStore* CefCookieManagerImpl::GetExistingCookieStore() {
CEF_REQUIRE_IOT();
if (cookie_monster_.get()) {
return cookie_monster_;
if (cookie_store_.get()) {
return cookie_store_.get();
} else if (request_context_impl_.get()) {
scoped_refptr<net::CookieMonster> cookie_monster =
request_context_impl_->GetCookieMonster();
DCHECK(cookie_monster.get());
return cookie_monster;
net::CookieStore* cookie_store =
request_context_impl_->GetExistingCookieStore();
DCHECK(cookie_store);
return cookie_store;
}
LOG(ERROR) << "Cookie manager backing store does not exist yet";
return NULL;
LOG(ERROR) << "Cookie store does not exist";
return nullptr;
}
void CefCookieManagerImpl::SetSupportedSchemes(
@ -204,7 +208,7 @@ void CefCookieManagerImpl::SetSupportedSchemes(
bool CefCookieManagerImpl::VisitAllCookies(
CefRefPtr<CefCookieVisitor> visitor) {
GetCookieMonster(
GetCookieStore(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
base::Bind(&CefCookieManagerImpl::VisitAllCookiesInternal, this,
visitor));
@ -215,7 +219,7 @@ bool CefCookieManagerImpl::VisitUrlCookies(
const CefString& url,
bool includeHttpOnly,
CefRefPtr<CefCookieVisitor> visitor) {
GetCookieMonster(
GetCookieStore(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
base::Bind(&CefCookieManagerImpl::VisitUrlCookiesInternal, this, url,
includeHttpOnly, visitor));
@ -230,7 +234,7 @@ bool CefCookieManagerImpl::SetCookie(
if (!gurl.is_valid())
return false;
GetCookieMonster(
GetCookieStore(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
base::Bind(&CefCookieManagerImpl::SetCookieInternal, this, gurl, cookie,
callback));
@ -246,7 +250,7 @@ bool CefCookieManagerImpl::DeleteCookies(
if (!gurl.is_empty() && !gurl.is_valid())
return false;
GetCookieMonster(
GetCookieStore(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
base::Bind(&CefCookieManagerImpl::DeleteCookiesInternal, this, gurl,
cookie_name, callback));
@ -275,7 +279,7 @@ bool CefCookieManagerImpl::SetStoragePath(
if (!path.empty())
new_path = base::FilePath(path);
if (cookie_monster_.get() && ((storage_path_.empty() && path.empty()) ||
if (cookie_store_.get() && ((storage_path_.empty() && path.empty()) ||
storage_path_ == new_path)) {
// The path has not changed so don't do anything.
RunAsyncCompletionOnIOThread(callback);
@ -306,9 +310,9 @@ bool CefCookieManagerImpl::SetStoragePath(
// 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.
cookie_monster_ = new net::CookieMonster(persistent_store.get(), NULL);
cookie_store_.reset(new net::CookieMonster(persistent_store.get(), NULL));
if (persistent_store.get() && persist_session_cookies)
cookie_monster_->SetPersistSessionCookies(true);
cookie_store_->SetPersistSessionCookies(true);
storage_path_ = new_path;
// Restore the previously supported schemes.
@ -319,7 +323,7 @@ bool CefCookieManagerImpl::SetStoragePath(
bool CefCookieManagerImpl::FlushStore(
CefRefPtr<CefCompletionCallback> callback) {
GetCookieMonster(
GetCookieStore(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
base::Bind(&CefCookieManagerImpl::FlushStoreInternal, this, callback));
return true;
@ -457,27 +461,29 @@ void CefCookieManagerImpl::SetSupportedSchemesWithContext(
RunAsyncCompletionOnIOThread(callback);
}
void CefCookieManagerImpl::GetCookieMonsterWithContext(
void CefCookieManagerImpl::GetCookieStoreWithContext(
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
const CookieMonsterCallback& callback,
const CookieStoreCallback& callback,
scoped_refptr<CefURLRequestContextGetterImpl> request_context) {
CEF_REQUIRE_IOT();
DCHECK(request_context->GetExistingCookieStore());
scoped_refptr<net::CookieMonster> cookie_monster =
request_context->GetCookieMonster();
const CookieStoreGetter& cookie_store_getter =
base::Bind(&CefURLRequestContextGetterImpl::GetExistingCookieStore,
request_context);
if (task_runner->BelongsToCurrentThread()) {
// Execute the callback immediately.
callback.Run(cookie_monster);
callback.Run(cookie_store_getter);
} else {
// Execute the callback on the target thread.
task_runner->PostTask(FROM_HERE, base::Bind(callback, cookie_monster));
task_runner->PostTask(FROM_HERE, base::Bind(callback, cookie_store_getter));
}
}
void CefCookieManagerImpl::SetSupportedSchemesInternal(
const std::vector<std::string>& schemes,
CefRefPtr<CefCompletionCallback> callback){
CefRefPtr<CefCompletionCallback> callback) {
CEF_REQUIRE_IOT();
if (HasContext()) {
@ -487,25 +493,29 @@ void CefCookieManagerImpl::SetSupportedSchemesInternal(
return;
}
DCHECK(cookie_monster_.get());
if (!cookie_monster_.get())
DCHECK(cookie_store_.get());
if (!cookie_store_.get())
return;
supported_schemes_ = schemes;
SetCookieMonsterSchemes(cookie_monster_.get(), supported_schemes_);
SetCookieMonsterSchemes(cookie_store_.get(), supported_schemes_);
RunAsyncCompletionOnIOThread(callback);
}
void CefCookieManagerImpl::VisitAllCookiesInternal(
CefRefPtr<CefCookieVisitor> visitor,
scoped_refptr<net::CookieMonster> cookie_monster) {
const CookieStoreGetter& cookie_store_getter) {
CEF_REQUIRE_IOT();
scoped_refptr<VisitCookiesCallback> callback(
new VisitCookiesCallback(cookie_monster, visitor));
net::CookieStore* cookie_store = cookie_store_getter.Run();
if (!cookie_store)
return;
cookie_monster->GetAllCookiesAsync(
scoped_refptr<VisitCookiesCallback> callback(
new VisitCookiesCallback(cookie_store_getter, visitor));
cookie_store->GetAllCookiesAsync(
base::Bind(&VisitCookiesCallback::Run, callback.get()));
}
@ -513,18 +523,22 @@ void CefCookieManagerImpl::VisitUrlCookiesInternal(
const CefString& url,
bool includeHttpOnly,
CefRefPtr<CefCookieVisitor> visitor,
scoped_refptr<net::CookieMonster> cookie_monster) {
const CookieStoreGetter& cookie_store_getter) {
CEF_REQUIRE_IOT();
net::CookieStore* cookie_store = cookie_store_getter.Run();
if (!cookie_store)
return;
net::CookieOptions options;
if (includeHttpOnly)
options.set_include_httponly();
scoped_refptr<VisitCookiesCallback> callback(
new VisitCookiesCallback(cookie_monster, visitor));
new VisitCookiesCallback(cookie_store_getter, visitor));
GURL gurl = GURL(url.ToString());
cookie_monster->GetAllCookiesForURLWithOptionsAsync(gurl, options,
cookie_store->GetCookieListWithOptionsAsync(gurl, options,
base::Bind(&VisitCookiesCallback::Run, callback.get()));
}
@ -532,9 +546,13 @@ void CefCookieManagerImpl::SetCookieInternal(
const GURL& url,
const CefCookie& cookie,
CefRefPtr<CefSetCookieCallback> callback,
scoped_refptr<net::CookieMonster> cookie_monster) {
const CookieStoreGetter& cookie_store_getter) {
CEF_REQUIRE_IOT();
net::CookieStore* cookie_store = cookie_store_getter.Run();
if (!cookie_store)
return;
std::string name = CefString(&cookie.name).ToString();
std::string value = CefString(&cookie.value).ToString();
std::string domain = CefString(&cookie.domain).ToString();
@ -544,13 +562,14 @@ void CefCookieManagerImpl::SetCookieInternal(
if (cookie.has_expires)
cef_time_to_basetime(cookie.expires, expiration_time);
cookie_monster->SetCookieWithDetailsAsync(
cookie_store->SetCookieWithDetailsAsync(
url, name, value, domain, path,
base::Time(), // Creation time.
expiration_time,
base::Time(), // Last access time.
cookie.secure ? true : false,
cookie.httponly ? true : false,
false, // First-party only.
net::CookieSameSite::DEFAULT_MODE,
CefNetworkDelegate::AreStrictSecureCookiesEnabled(),
net::COOKIE_PRIORITY_DEFAULT,
base::Bind(SetCookieCallbackImpl, callback));
@ -560,31 +579,39 @@ void CefCookieManagerImpl::DeleteCookiesInternal(
const GURL& url,
const CefString& cookie_name,
CefRefPtr<CefDeleteCookiesCallback> callback,
scoped_refptr<net::CookieMonster> cookie_monster) {
const CookieStoreGetter& cookie_store_getter) {
CEF_REQUIRE_IOT();
net::CookieStore* cookie_store = cookie_store_getter.Run();
if (!cookie_store)
return;
if (url.is_empty()) {
// Delete all cookies.
cookie_monster->DeleteAllAsync(
cookie_store->DeleteAllAsync(
base::Bind(DeleteCookiesCallbackImpl, callback));
} else if (cookie_name.empty()) {
// Delete all matching host cookies.
cookie_monster->DeleteAllCreatedBetweenForHostAsync(
cookie_store->DeleteAllCreatedBetweenForHostAsync(
base::Time(), base::Time::Max(), url,
base::Bind(DeleteCookiesCallbackImpl, callback));
} else {
// Delete all matching host and domain cookies.
cookie_monster->DeleteCookieAsync(url, cookie_name,
cookie_store->DeleteCookieAsync(url, cookie_name,
base::Bind(DeleteCookiesCallbackImpl, callback, -1));
}
}
void CefCookieManagerImpl::FlushStoreInternal(
CefRefPtr<CefCompletionCallback> callback,
scoped_refptr<net::CookieMonster> cookie_monster) {
const CookieStoreGetter& cookie_store_getter) {
CEF_REQUIRE_IOT();
cookie_monster->FlushStore(
net::CookieStore* cookie_store = cookie_store_getter.Run();
if (!cookie_store)
return;
cookie_store->FlushStore(
base::Bind(RunAsyncCompletionOnIOThread, callback));
}

View File

@ -9,6 +9,7 @@
#include "include/cef_cookie.h"
#include "libcef/browser/request_context_impl.h"
#include "libcef/browser/thread_util.h"
#include "base/files/file_path.h"
#include "net/cookies/cookie_monster.h"
@ -25,19 +26,20 @@ class CefCookieManagerImpl : public CefCookieManager {
bool persist_session_cookies,
CefRefPtr<CefCompletionCallback> callback);
// Executes |callback| either synchronously or asynchronously with the cookie
// monster object when it's available. If |task_runner| is NULL the callback
// will be executed on the originating thread. The resulting cookie monster
// object can only be accessed on the IO thread.
typedef base::Callback<void(scoped_refptr<net::CookieMonster>)>
CookieMonsterCallback;
void GetCookieMonster(
// Executes |callback| either synchronously or asynchronously with the
// CookieStoreGetter when the cookie store object is available. If
// |task_runner| is NULL the callback will be executed on the originating
// thread. CookieStoreGetter can only be executed on, and the resulting cookie
// store object can only be accessed on, the IO thread.
typedef base::Callback<net::CookieStore*()> CookieStoreGetter;
typedef base::Callback<void(const CookieStoreGetter&)> CookieStoreCallback;
void GetCookieStore(
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
const CookieMonsterCallback& callback);
const CookieStoreCallback& callback);
// Returns the existing cookie monster object. Logs an error if the cookie
// monster does not yet exist. Must be called on the IO thread.
scoped_refptr<net::CookieMonster> GetExistingCookieMonster();
// 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();
// CefCookieManager methods.
void SetSupportedSchemes(const std::vector<CefString>& schemes,
@ -85,9 +87,9 @@ class CefCookieManagerImpl : public CefCookieManager {
const std::vector<std::string>& schemes,
CefRefPtr<CefCompletionCallback> callback,
scoped_refptr<CefURLRequestContextGetterImpl> request_context);
void GetCookieMonsterWithContext(
void GetCookieStoreWithContext(
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
const CookieMonsterCallback& callback,
const CookieStoreCallback& callback,
scoped_refptr<CefURLRequestContextGetterImpl> request_context);
void SetSupportedSchemesInternal(
@ -95,25 +97,25 @@ class CefCookieManagerImpl : public CefCookieManager {
CefRefPtr<CefCompletionCallback> callback);
void VisitAllCookiesInternal(
CefRefPtr<CefCookieVisitor> visitor,
scoped_refptr<net::CookieMonster> cookie_monster);
const CookieStoreGetter& cookie_store_getter);
void VisitUrlCookiesInternal(
const CefString& url,
bool includeHttpOnly,
CefRefPtr<CefCookieVisitor> visitor,
scoped_refptr<net::CookieMonster> cookie_monster);
const CookieStoreGetter& cookie_store_getter);
void SetCookieInternal(
const GURL& url,
const CefCookie& cookie,
CefRefPtr<CefSetCookieCallback> callback,
scoped_refptr<net::CookieMonster> cookie_monster);
const CookieStoreGetter& cookie_store_getter);
void DeleteCookiesInternal(
const GURL& url,
const CefString& cookie_name,
CefRefPtr<CefDeleteCookiesCallback> callback,
scoped_refptr<net::CookieMonster> cookie_monster);
const CookieStoreGetter& cookie_store_getter);
void FlushStoreInternal(
CefRefPtr<CefCompletionCallback> callback,
scoped_refptr<net::CookieMonster> cookie_monster);
const CookieStoreGetter& cookie_store_getter);
// Used for cookie monsters owned by the context.
CefRefPtr<CefRequestContextImpl> request_context_;
@ -122,9 +124,9 @@ class CefCookieManagerImpl : public CefCookieManager {
// Used for cookie monsters owned by this object.
base::FilePath storage_path_;
std::vector<std::string> supported_schemes_;
scoped_refptr<net::CookieMonster> cookie_monster_;
scoped_ptr<net::CookieMonster> cookie_store_;
IMPLEMENT_REFCOUNTING(CefCookieManagerImpl);
IMPLEMENT_REFCOUNTING_DELETE_ON_IOT(CefCookieManagerImpl);
};
#endif // CEF_LIBCEF_BROWSER_COOKIE_MANAGER_IMPL_H_

View File

@ -70,15 +70,18 @@ int ResponseWriter::Initialize(const net::CompletionCallback& callback) {
int ResponseWriter::Write(net::IOBuffer* buffer,
int num_bytes,
const net::CompletionCallback& callback) {
std::string chunk = std::string(buffer->data(), num_bytes);
if (!base::IsStringUTF8(chunk))
return num_bytes;
base::FundamentalValue* id = new base::FundamentalValue(stream_id_);
base::StringValue* chunk =
new base::StringValue(std::string(buffer->data(), num_bytes));
base::StringValue* chunkValue = new base::StringValue(chunk);
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE,
base::Bind(&CefDevToolsFrontend::CallClientFunction,
devtools_, "DevToolsAPI.streamWrite",
base::Owned(id), base::Owned(chunk), nullptr));
base::Owned(id), base::Owned(chunkValue), nullptr));
return num_bytes;
}

View File

@ -11,6 +11,7 @@
#include "libcef/browser/browser_host_impl.h"
#include "libcef/browser/thread_util.h"
#include "base/threading/worker_pool.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/common/file_chooser_file_info.h"
#include "net/base/directory_lister.h"
@ -364,7 +365,7 @@ void CefFileDialogManager::OnRunFileChooserUploadFolderDelegateCallback(
new UploadFolderHelper(
base::Bind(&CefFileDialogManager::OnRunFileChooserDelegateCallback,
weak_ptr_factory_.GetWeakPtr(), mode))));
lister_->Start();
lister_->Start(base::WorkerPool::GetTaskRunner(true).get());
}
}

View File

@ -14,7 +14,6 @@
#include "base/logging.h"
#include "base/strings/utf_string_conversions.h"
#include "components/url_formatter/elide_url.h"
#include "net/base/net_util.h"
namespace {
@ -148,7 +147,6 @@ void CefJavaScriptDialogManager::RunJavaScriptDialog(
void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
content::WebContents* web_contents,
const base::string16& message_text,
bool is_reload,
const DialogClosedCallback& callback) {
if (browser_->destruction_state() >=
@ -159,6 +157,9 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
return;
}
const base::string16& message_text =
base::ASCIIToUTF16("Is it OK to leave/reload this page?");
CefRefPtr<CefClient> client = browser_->GetClient();
if (client.get()) {
CefRefPtr<CefJSDialogHandler> handler = client->GetJSDialogHandler();
@ -187,14 +188,10 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
dialog_running_ = true;
base::string16 new_message_text =
message_text +
base::ASCIIToUTF16("\n\nIs it OK to leave/reload this page?");
runner_->Run(browser_,
content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM,
base::string16(), // display_url
new_message_text,
message_text,
base::string16(), // default_prompt_text
base::Bind(&CefJavaScriptDialogManager::DialogClosed,
weak_ptr_factory_.GetWeakPtr(), callback));

View File

@ -41,7 +41,6 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
bool* did_suppress_message) override;
void RunBeforeUnloadDialog(
content::WebContents* web_contents,
const base::string16& message_text,
bool is_reload,
const DialogClosedCallback& callback) override;
void CancelActiveAndPendingDialogs(

View File

@ -52,7 +52,7 @@ INT_PTR CALLBACK CefJavaScriptDialogRunnerWin::DialogProc(
GetWindowLongPtr(dialog, DWLP_USER));
base::string16 user_input;
bool finish = false;
bool result;
bool result = false;
switch (LOWORD(wparam)) {
case IDOK:
finish = true;

View File

@ -11,6 +11,7 @@
#include <X11/Xutil.h>
#include "ui/base/x/x11_util.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/events/platform/x11/x11_event_source.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
#include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h"

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);
};

View File

@ -5,6 +5,7 @@
#include "libcef/browser/osr/render_widget_host_view_osr.h"
#include <algorithm>
#include <limits>
#include <utility>
@ -267,7 +268,8 @@ bool CefRenderWidgetHostViewOSR::GetLineBreakIndex(
// assume the line breaking as the next character's y offset is larger than
// a threshold. Currently the threshold is determined as minimum y offset plus
// 75% of maximum height.
const size_t loop_end_idx = std::min(bounds.size(), range.end());
const size_t loop_end_idx =
std::min(bounds.size(), static_cast<size_t>(range.end()));
int max_height = 0;
int min_y_offset = std::numeric_limits<int32_t>::max();
for (size_t idx = range.start(); idx < loop_end_idx; ++idx) {

View File

@ -77,7 +77,6 @@ void CefPermissionContext::RequestPermission(
content::WebContents* web_contents,
const PermissionRequestID& id,
const GURL& requesting_frame,
bool user_gesture,
const BrowserPermissionCallback& callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@ -86,7 +85,6 @@ void CefPermissionContext::RequestPermission(
id,
requesting_frame.GetOrigin(),
web_contents->GetLastCommittedURL().GetOrigin(),
user_gesture,
callback);
}
@ -144,7 +142,6 @@ void CefPermissionContext::DecidePermission(
const PermissionRequestID& id,
const GURL& requesting_origin,
const GURL& embedding_origin,
bool user_gesture,
const BrowserPermissionCallback& callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);

View File

@ -37,7 +37,6 @@ class CefPermissionContext {
content::WebContents* web_contents,
const PermissionRequestID& id,
const GURL& requesting_frame,
bool user_gesture,
const BrowserPermissionCallback& callback);
// Withdraw an existing permission request, no op if the permission request
@ -65,7 +64,6 @@ class CefPermissionContext {
const PermissionRequestID& id,
const GURL& requesting_origin,
const GURL& embedding_origin,
bool user_gesture,
const BrowserPermissionCallback& callback);
void QueryPermission(content::PermissionType permission,

View File

@ -175,13 +175,11 @@ int CefPermissionManager::RequestPermission(
PermissionType permission,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
const base::Callback<void(PermissionStatus)>& callback) {
return RequestPermissions(
std::vector<PermissionType>(1, permission),
render_frame_host,
requesting_origin,
user_gesture,
base::Bind(&PermissionRequestResponseCallbackWrapper, callback));
}
@ -189,7 +187,6 @@ int CefPermissionManager::RequestPermissions(
const std::vector<PermissionType>& permissions,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
const base::Callback<void(
const std::vector<PermissionStatus>&)>& callback) {
if (permissions.empty()) {
@ -218,7 +215,7 @@ int CefPermissionManager::RequestPermissions(
}
context_.RequestPermission(
permission, web_contents, request, requesting_origin, user_gesture,
permission, web_contents, request, requesting_origin,
base::Bind(&ContentSettingToPermissionStatusCallbackWrapper,
base::Bind(
&CefPermissionManager::OnPermissionsRequestResponseStatus,

View File

@ -36,13 +36,11 @@ class CefPermissionManager : public KeyedService,
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
const base::Callback<void(content::PermissionStatus)>& callback) override;
int RequestPermissions(
const std::vector<content::PermissionType>& permissions,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
const base::Callback<void(
const std::vector<content::PermissionStatus>&)>& callback) override;
void CancelPermissionRequest(int request_id) override;

View File

@ -36,6 +36,8 @@ ContentSettingsType PermissionTypeToContentSetting(PermissionType permission) {
return CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC;
case PermissionType::VIDEO_CAPTURE:
return CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA;
case PermissionType::BACKGROUND_SYNC:
return CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC;
case PermissionType::NUM:
// This will hit the NOTREACHED below.
break;

View File

@ -46,4 +46,31 @@
content::BrowserThread::PostDelayedTask(id, FROM_HERE, task, \
base::TimeDelta::FromMilliseconds(delay_ms))
// Same as IMPLEMENT_REFCOUNTING() but using the specified Destructor.
#define IMPLEMENT_REFCOUNTING_EX(ClassName, Destructor) \
public: \
void AddRef() const OVERRIDE { \
ref_count_.AddRef(); \
} \
bool Release() const OVERRIDE { \
if (ref_count_.Release()) { \
Destructor::Destruct(this); \
return true; \
} \
return false; \
} \
bool HasOneRef() const OVERRIDE { \
return ref_count_.HasOneRef(); \
} \
private: \
CefRefCount ref_count_;
#define IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(ClassName) \
IMPLEMENT_REFCOUNTING_EX(ClassName, \
content::BrowserThread::DeleteOnUIThread)
#define IMPLEMENT_REFCOUNTING_DELETE_ON_IOT(ClassName) \
IMPLEMENT_REFCOUNTING_EX(ClassName, \
content::BrowserThread::DeleteOnIOThread)
#endif // CEF_LIBCEF_BROWSER_THREAD_UTIL_H_

View File

@ -218,12 +218,11 @@ void AddWidevineCdmFromCommandLine(
kWidevineCdmPluginMimeTypeDescription);
// Add the supported codecs as if they came from the component manifest.
// This list must match the CDM that is being shipped with Chrome.
std::vector<std::string> codecs;
codecs.push_back(kCdmSupportedCodecVorbis);
codecs.push_back(kCdmSupportedCodecVp8);
codecs.push_back(kCdmSupportedCodecVp9);
#if defined(USE_PROPRIETARY_CODECS)
codecs.push_back(kCdmSupportedCodecAac);
codecs.push_back(kCdmSupportedCodecAvc1);
#endif // defined(USE_PROPRIETARY_CODECS)
std::string codec_string = base::JoinString(
@ -279,6 +278,7 @@ void CefContentClient::AddPepperPlugins(
void CefContentClient::AddAdditionalSchemes(
std::vector<url::SchemeWithType>* standard_schemes,
std::vector<url::SchemeWithType>* referrer_schemes,
std::vector<std::string>* savable_schemes) {
DCHECK(!scheme_info_list_locked_);
@ -463,8 +463,3 @@ bool CefContentClient::GetLocalizedString(int message_id,
return (pack_loading_disabled_ || !value->empty());
}
scoped_ptr<gfx::Font> CefContentClient::GetFont(
ui::ResourceBundle::FontStyle style) {
return scoped_ptr<gfx::Font>();
}

View File

@ -35,6 +35,7 @@ class CefContentClient : public content::ContentClient,
std::vector<content::PepperPluginInfo>* plugins) override;
void AddAdditionalSchemes(
std::vector<url::SchemeWithType>* standard_schemes,
std::vector<url::SchemeWithType>* referrer_schemes,
std::vector<std::string>* savable_schemes) override;
std::string GetUserAgent() const override;
base::string16 GetLocalizedString(int message_id) const override;
@ -101,8 +102,6 @@ class CefContentClient : public content::ContentClient,
base::StringPiece* value) override;
bool GetLocalizedString(int message_id,
base::string16* value) override;
scoped_ptr<gfx::Font> GetFont(
ui::ResourceBundle::FontStyle style) override;
CefRefPtr<CefApp> application_;
bool pack_loading_disabled_;

View File

@ -8,7 +8,6 @@
#include "libcef/common/drag_data_impl.h"
#include "base/files/file_path.h"
#include "net/base/filename_util.h"
#include "net/base/net_util.h"
#define CHECK_READONLY_RETURN_VOID() \
if (read_only_) { \

View File

@ -540,7 +540,7 @@ void CefRequestImpl::Set(const blink::WebURLRequest& request) {
first_party_for_cookies_ = request.firstPartyForCookies().string();
if (request.cachePolicy() == blink::WebURLRequest::ReloadIgnoringCacheData)
if (request.getCachePolicy() == blink::WebURLRequest::ReloadIgnoringCacheData)
flags_ |= UR_FLAG_SKIP_CACHE;
if (request.allowStoredCredentials())
flags_ |= UR_FLAG_ALLOW_CACHED_CREDENTIALS;

View File

@ -33,6 +33,7 @@
#include "third_party/WebKit/public/web/WebDataSource.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebFrameContentDumper.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebNode.h"
#include "third_party/WebKit/public/web/WebScriptSource.h"
@ -595,8 +596,11 @@ void CefBrowserImpl::OnRequest(const Cef_Request_Params& params) {
DCHECK(!command.empty());
if (base::LowerCaseEqualsASCII(command, "getsource")) {
response = web_frame->contentAsMarkup().utf8();
success = true;
if (web_frame->isWebLocalFrame()) {
response = blink::WebFrameContentDumper::dumpAsMarkup(
web_frame->toWebLocalFrame()).utf8();
success = true;
}
} else if (base::LowerCaseEqualsASCII(command, "gettext")) {
response = webkit_glue::DumpDocumentText(web_frame);
success = true;

View File

@ -7,6 +7,14 @@
#include <utility>
#include "base/compiler_specific.h"
// Enable deprecation warnings for MSVC. See http://crbug.com/585142.
#if defined(OS_WIN)
#pragma warning(push)
#pragma warning(default:4996)
#endif
#include "libcef/browser/context.h"
#include "libcef/common/cef_messages.h"
#include "libcef/common/cef_switches.h"
@ -497,7 +505,7 @@ bool CefContentRendererClient::OverrideCreatePlugin(
GURL url(params.url);
CefViewHostMsg_GetPluginInfo_Output output;
blink::WebString top_origin = frame->top()->securityOrigin().toString();
blink::WebString top_origin = frame->top()->getSecurityOrigin().toString();
render_frame->Send(new CefViewHostMsg_GetPluginInfo(
render_frame->GetRoutingID(), url, blink::WebStringToGURL(top_origin),
orig_mime_type, &output));
@ -888,3 +896,9 @@ void CefContentRendererClient::RunSingleProcessCleanupOnUIThread() {
if (!CefContext::Get()->settings().multi_threaded_message_loop)
delete host;
}
// Enable deprecation warnings for MSVC. See http://crbug.com/585142.
#if defined(OS_WIN)
#pragma warning(pop)
#endif

View File

@ -82,7 +82,8 @@ bool CrossesExtensionExtents(blink::WebLocalFrame* frame,
// in an extension process (other than the Chrome Web Store), we want to
// keep it in process to allow the opener to script it.
blink::WebDocument opener_document = opener_frame->document();
blink::WebSecurityOrigin opener_origin = opener_document.securityOrigin();
blink::WebSecurityOrigin opener_origin =
opener_document.getSecurityOrigin();
bool opener_is_extension_url = !opener_origin.isUnique() &&
extension_registry->GetExtensionOrAppByURL(
opener_document.url()) != nullptr;

View File

@ -4,6 +4,14 @@
#include "libcef/renderer/frame_impl.h"
#include "base/compiler_specific.h"
// Enable deprecation warnings for MSVC. See http://crbug.com/585142.
#if defined(OS_WIN)
#pragma warning(push)
#pragma warning(default:4996)
#endif
#include "libcef/common/cef_messages.h"
#include "libcef/common/net/http_header_utils.h"
#include "libcef/common/request_impl.h"
@ -18,6 +26,7 @@
#include "third_party/WebKit/public/platform/WebURL.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebFrameContentDumper.h"
#include "third_party/WebKit/public/web/WebKit.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "third_party/WebKit/public/web/WebScriptSource.h"
@ -88,9 +97,10 @@ void CefFrameImpl::ViewSource() {
void CefFrameImpl::GetSource(CefRefPtr<CefStringVisitor> visitor) {
CEF_REQUIRE_RT_RETURN_VOID();
if (frame_) {
CefString content = std::string(frame_->contentAsMarkup().utf8());
if (frame_ && frame_->isWebLocalFrame()) {
const CefString& content =
std::string(blink::WebFrameContentDumper::dumpAsMarkup(
frame_->toWebLocalFrame()).utf8());
visitor->Visit(content);
}
}
@ -99,7 +109,7 @@ void CefFrameImpl::GetText(CefRefPtr<CefStringVisitor> visitor) {
CEF_REQUIRE_RT_RETURN_VOID();
if (frame_) {
CefString content = webkit_glue::DumpDocumentText(frame_);
const CefString& content = webkit_glue::DumpDocumentText(frame_);
visitor->Visit(content);
}
}
@ -270,3 +280,9 @@ void CefFrameImpl::Detach() {
browser_ = NULL;
frame_ = NULL;
}
// Enable deprecation warnings for MSVC. See http://crbug.com/585142.
#if defined(OS_WIN)
#pragma warning(pop)
#endif

View File

@ -119,7 +119,7 @@ static void AddPepperBasedWidevine(
}
cdm::AddWidevineWithCodecs(
cdm::WIDEVINE, supported_codecs,
supported_codecs,
media::EmeRobustness::SW_SECURE_CRYPTO, // Maximum audio robustness.
media::EmeRobustness::SW_SECURE_DECODE, // Maximum video robustness.
media::EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license.

View File

@ -17,6 +17,7 @@
#include "chrome/grit/generated_resources.h"
#include "chrome/renderer/custom_menu_commands.h"
#include "components/content_settings/content/common/content_settings_messages.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/context_menu_params.h"
#include "content/public/renderer/render_frame.h"
@ -178,7 +179,8 @@ void CefPluginPlaceholder::PluginListChanged() {
CefViewHostMsg_GetPluginInfo_Output output;
std::string mime_type(GetPluginParams().mimeType.utf8());
blink::WebString top_origin = GetFrame()->top()->securityOrigin().toString();
blink::WebString top_origin =
GetFrame()->top()->getSecurityOrigin().toString();
render_frame()->Send(
new CefViewHostMsg_GetPluginInfo(routing_id(),
GURL(GetPluginParams().url),

View File

@ -7,10 +7,14 @@
#include "config.h"
MSVC_PUSH_WARNING_LEVEL(0);
#include "bindings/core/v8/V8RecursionScope.h"
#include "platform/ScriptForbiddenScope.h"
MSVC_POP_WARNING();
#undef FROM_HERE
#undef LOG
// Enable deprecation warnings for MSVC. See http://crbug.com/585142.
#if defined(OS_WIN)
#pragma warning(push)
#pragma warning(default:4996)
#endif
#include "libcef/renderer/render_frame_observer.h"
@ -53,7 +57,8 @@ void CefRenderFrameObserver::DidCreateScriptContext(
v8::Isolate* isolate = blink::mainThreadIsolate();
v8::HandleScope handle_scope(isolate);
v8::Context::Scope scope(context);
blink::V8RecursionScope recursion_scope(isolate);
v8::MicrotasksScope microtasks_scope(isolate,
v8::MicrotasksScope::kRunMicrotasks);
CefRefPtr<CefV8Context> contextPtr(new CefV8ContextImpl(isolate, context));
@ -94,3 +99,9 @@ void CefRenderFrameObserver::WillReleaseScriptContext(
CefV8ReleaseContext(context);
}
// Enable deprecation warnings for MSVC. See http://crbug.com/585142.
#if defined(OS_WIN)
#pragma warning(pop)
#endif

View File

@ -20,8 +20,6 @@ MSVC_PUSH_WARNING_LEVEL(0);
#include "bindings/core/v8/ScriptController.h"
#include "bindings/core/v8/V8Binding.h"
MSVC_POP_WARNING();
#undef FROM_HERE
#undef LOG
// Enable deprecation warnings for MSVC. See http://crbug.com/585142.
#if defined(OS_WIN)
@ -945,11 +943,8 @@ bool CefV8Context::InContext() {
CefV8ContextImpl::CefV8ContextImpl(v8::Isolate* isolate,
v8::Local<v8::Context> context)
: handle_(new Handle(isolate, context, context))
#ifndef NDEBUG
, enter_count_(0)
#endif
{ // NOLINT(whitespace/braces)
: handle_(new Handle(isolate, context, context)),
enter_count_(0) {
}
CefV8ContextImpl::~CefV8ContextImpl() {
@ -1019,11 +1014,15 @@ bool CefV8ContextImpl::Enter() {
v8::Isolate* isolate = handle_->isolate();
v8::HandleScope handle_scope(isolate);
blink::V8PerIsolateData::from(isolate)->incrementRecursionLevel();
handle_->GetNewV8Handle()->Enter();
#ifndef NDEBUG
if (!microtasks_scope_) {
// Increment the MicrotasksScope recursion level.
microtasks_scope_.reset(
new v8::MicrotasksScope(isolate, v8::MicrotasksScope::kRunMicrotasks));
}
++enter_count_;
#endif
handle_->GetNewV8Handle()->Enter();
return true;
}
@ -1033,15 +1032,21 @@ bool CefV8ContextImpl::Exit() {
if (blink::ScriptForbiddenScope::isScriptForbidden())
return false;
v8::Isolate* isolate = handle_->isolate();
if (enter_count_ <= 0) {
LOG(ERROR) << "Call to CefV8Context::Exit() without matching call to "
"CefV8Context::Enter()";
return false;
}
v8::HandleScope handle_scope(handle_->isolate());
DLOG_ASSERT(enter_count_ > 0);
handle_->GetNewV8Handle()->Exit();
blink::V8PerIsolateData::from(isolate)->decrementRecursionLevel();
#ifndef NDEBUG
--enter_count_;
#endif
if (--enter_count_ == 0) {
// Decrement the MicrotasksScope recursion level.
microtasks_scope_.reset(nullptr);
}
return true;
}

View File

@ -188,14 +188,12 @@ class CefV8ContextImpl : public CefV8Context {
v8::Local<v8::Context> GetV8Context();
blink::WebFrame* GetWebFrame();
protected:
private:
typedef CefV8Handle<v8::Context> Handle;
scoped_refptr<Handle> handle_;
#ifndef NDEBUG
// Used in debug builds to catch missing Exits in destructor.
int enter_count_;
#endif
scoped_ptr<v8::MicrotasksScope> microtasks_scope_;
IMPLEMENT_REFCOUNTING(CefV8ContextImpl);
DISALLOW_COPY_AND_ASSIGN(CefV8ContextImpl);
@ -279,7 +277,7 @@ class CefV8ValueImpl : public CefV8Value {
CefRefPtr<CefV8Value> object,
const CefV8ValueList& arguments) override;
protected:
private:
// Test for and record any exception.
bool HasCaught(v8::Local<v8::Context> context, v8::TryCatch& try_catch);
@ -299,7 +297,7 @@ class CefV8ValueImpl : public CefV8Value {
void SetWeakIfNecessary();
protected:
private:
~Handle() override;
private:
@ -366,7 +364,7 @@ class CefV8StackTraceImpl : public CefV8StackTrace {
int GetFrameCount() override;
CefRefPtr<CefV8StackFrame> GetFrame(int index) override;
protected:
private:
std::vector<CefRefPtr<CefV8StackFrame> > frames_;
IMPLEMENT_REFCOUNTING(CefV8StackTraceImpl);
@ -388,7 +386,7 @@ class CefV8StackFrameImpl : public CefV8StackFrame {
bool IsEval() override;
bool IsConstructor() override;
protected:
private:
CefString script_name_;
CefString script_name_or_source_url_;
CefString function_name_;

View File

@ -83,7 +83,7 @@ std::string DumpDocumentText(blink::WebFrame* frame) {
cef_dom_node_type_t GetNodeType(const blink::WebNode& node) {
const blink::Node* web_node = node.constUnwrap<blink::Node>();
switch (web_node->nodeType()) {
switch (web_node->getNodeType()) {
case blink::Node::ELEMENT_NODE:
return DOM_NODE_TYPE_ELEMENT;
case blink::Node::ATTRIBUTE_NODE:

View File

@ -361,9 +361,6 @@ need to be translated for each locale.-->
<message name="IDS_PLUGIN_HIDE" desc="The tooltip for hiding a blocked plugin, displayed in the click to play UI.">
Hide this plugin
</message>
<message name="IDS_PLUGIN_NOT_SUPPORTED" desc="The placeholder text for an unsupported plugin.">
This plugin is not supported.
</message>
<if expr="is_macosx">
<message name="IDS_PLUGIN_BLOCKED" desc="The placeholder text for a blocked plugin.">
Control-click to play <ph name="PLUGIN_NAME">$1<ex>Flash</ex></ph>.
@ -404,14 +401,6 @@ need to be translated for each locale.-->
</if>
<!-- Preferences. -->
<!-- The default value for HTTP Accept-Language header. -->
<message name="IDS_ACCEPT_LANGUAGES" use_name_for_id="true">
en-US,en
</message>
<!-- The default value for |WebPreference::default_encoding|. -->
<message name="IDS_DEFAULT_ENCODING" use_name_for_id="true">
windows-1252
</message>
<!-- The default value for |WebPreference::uses_universal_detector|. -->
<message name="IDS_USES_UNIVERSAL_DETECTOR" use_name_for_id="true">
false