mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-03-28 18:00:52 +01:00
Update to Chromium revision 102269.
- Disable use of clang on Mac for the time being. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@292 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
32402b2287
commit
0fc3af0dbb
@ -67,3 +67,4 @@ Date | CEF Revision | Chromium Revision
|
||||
2011-05-16 | /trunk@233 | /trunk@85305
|
||||
2011-07-02 | /trunk@263 | /trunk@91424
|
||||
2011-09-10 | /trunk@284 | /trunk@100584
|
||||
2011-09-22 | /trunk@292 | /trunk@102269
|
||||
|
8
cef.gypi
8
cef.gypi
@ -4,13 +4,19 @@
|
||||
|
||||
{
|
||||
'variables': {
|
||||
# Directory for CEF source files.
|
||||
'conditions': [
|
||||
# Directory for CEF source files.
|
||||
[ 'OS=="win"', {
|
||||
'cef_directory' : '<!(echo %CEF_DIRECTORY%)',
|
||||
}, { # OS!="win"
|
||||
'cef_directory' : '<!(echo $CEF_DIRECTORY)',
|
||||
}],
|
||||
[ 'OS=="mac"', {
|
||||
# Don't use clang with CEF until http://llvm.org/bugs/show_bug.cgi?id=10990 is resolved.
|
||||
'clang': 0,
|
||||
# Don't use the chrome style plugin with CEF.
|
||||
'clang_use_chrome_plugins': 0,
|
||||
}],
|
||||
]
|
||||
},
|
||||
}
|
||||
|
@ -1167,6 +1167,7 @@ public:
|
||||
virtual bool GetAuthCredentials(CefRefPtr<CefBrowser> browser,
|
||||
bool isProxy,
|
||||
const CefString& host,
|
||||
int port,
|
||||
const CefString& realm,
|
||||
const CefString& scheme,
|
||||
CefString& username,
|
||||
|
@ -990,7 +990,7 @@ typedef struct _cef_request_handler_t
|
||||
///
|
||||
int (CEF_CALLBACK *get_auth_credentials)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser, int isProxy, const cef_string_t* host,
|
||||
const cef_string_t* realm, const cef_string_t* scheme,
|
||||
int port, const cef_string_t* realm, const cef_string_t* scheme,
|
||||
cef_string_t* username, cef_string_t* password);
|
||||
|
||||
} cef_request_handler_t;
|
||||
|
@ -1,12 +1,14 @@
|
||||
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
|
||||
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "browser_appcache_system.h"
|
||||
#include "browser_resource_loader_bridge.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "base/synchronization/lock.h"
|
||||
#include "base/task.h"
|
||||
#include "base/synchronization/waitable_event.h"
|
||||
#include "webkit/appcache/appcache_interceptor.h"
|
||||
@ -17,34 +19,6 @@ using WebKit::WebApplicationCacheHostClient;
|
||||
using appcache::WebApplicationCacheHostImpl;
|
||||
using appcache::AppCacheBackendImpl;
|
||||
using appcache::AppCacheInterceptor;
|
||||
using appcache::AppCacheThread;
|
||||
|
||||
namespace appcache {
|
||||
|
||||
// An impl of AppCacheThread we need to provide to the appcache lib.
|
||||
|
||||
bool AppCacheThread::PostTask(
|
||||
int id,
|
||||
const tracked_objects::Location& from_here,
|
||||
Task* task) {
|
||||
if (BrowserAppCacheSystem::thread_provider()) {
|
||||
return BrowserAppCacheSystem::thread_provider()->PostTask(
|
||||
id, from_here, task);
|
||||
}
|
||||
scoped_ptr<Task> task_ptr(task);
|
||||
MessageLoop* loop = BrowserAppCacheSystem::GetMessageLoop(id);
|
||||
if (loop)
|
||||
loop->PostTask(from_here, task_ptr.release());
|
||||
return loop ? true : false;
|
||||
}
|
||||
|
||||
bool AppCacheThread::CurrentlyOn(int id) {
|
||||
if (BrowserAppCacheSystem::thread_provider())
|
||||
return BrowserAppCacheSystem::thread_provider()->CurrentlyOn(id);
|
||||
return MessageLoop::current() == BrowserAppCacheSystem::GetMessageLoop(id);
|
||||
}
|
||||
|
||||
} // namespace appcache
|
||||
|
||||
// BrowserFrontendProxy --------------------------------------------------------
|
||||
// Proxies method calls from the backend IO thread to the frontend UI thread.
|
||||
@ -63,15 +37,15 @@ class BrowserFrontendProxy
|
||||
const appcache::AppCacheInfo& info) {
|
||||
if (!system_)
|
||||
return;
|
||||
if (system_->is_io_thread())
|
||||
if (system_->is_io_thread()) {
|
||||
system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||
this, &BrowserFrontendProxy::OnCacheSelected,
|
||||
host_id, info));
|
||||
else if (system_->is_ui_thread()) {
|
||||
} else if (system_->is_ui_thread()) {
|
||||
system_->frontend_impl_.OnCacheSelected(host_id, info);
|
||||
}
|
||||
else
|
||||
} else {
|
||||
NOTREACHED();
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnStatusChanged(const std::vector<int>& host_ids,
|
||||
@ -364,8 +338,7 @@ BrowserAppCacheSystem::BrowserAppCacheSystem()
|
||||
backend_proxy_(new BrowserBackendProxy(this))),
|
||||
ALLOW_THIS_IN_INITIALIZER_LIST(
|
||||
frontend_proxy_(new BrowserFrontendProxy(this))),
|
||||
backend_impl_(NULL), service_(NULL), db_thread_("AppCacheDBThread"),
|
||||
thread_provider_(NULL) {
|
||||
backend_impl_(NULL), service_(NULL), db_thread_("AppCacheDBThread") {
|
||||
DCHECK(!instance_);
|
||||
instance_ = this;
|
||||
}
|
||||
@ -391,7 +364,6 @@ BrowserAppCacheSystem::~BrowserAppCacheSystem() {
|
||||
|
||||
void BrowserAppCacheSystem::InitOnUIThread(const FilePath& cache_directory) {
|
||||
DCHECK(!ui_message_loop_);
|
||||
AppCacheThread::Init(DB_THREAD_ID, IO_THREAD_ID);
|
||||
ui_message_loop_ = MessageLoop::current();
|
||||
cache_directory_ = cache_directory;
|
||||
}
|
||||
@ -411,6 +383,7 @@ void BrowserAppCacheSystem::InitOnIOThread(
|
||||
service_ = new appcache::AppCacheService(NULL);
|
||||
backend_impl_ = new appcache::AppCacheBackendImpl();
|
||||
service_->Initialize(cache_directory_,
|
||||
db_thread_.message_loop_proxy(),
|
||||
BrowserResourceLoaderBridge::GetCacheThread());
|
||||
service_->set_request_context(request_context);
|
||||
backend_impl_->Initialize(service_, frontend_proxy_.get(), kSingleProcessId);
|
||||
|
@ -1,8 +1,8 @@
|
||||
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
|
||||
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef _BROWSER_APPCACHE_SYSTEM_H
|
||||
#ifndef WEBKIT_TOOLS_TEST_SHELL_Browser_APPCACHE_SYSTEM_H_
|
||||
#define _BROWSER_APPCACHE_SYSTEM_H
|
||||
|
||||
#include "base/file_path.h"
|
||||
@ -11,25 +11,23 @@
|
||||
#include "webkit/appcache/appcache_backend_impl.h"
|
||||
#include "webkit/appcache/appcache_frontend_impl.h"
|
||||
#include "webkit/appcache/appcache_service.h"
|
||||
#include "webkit/appcache/appcache_thread.h"
|
||||
#include "webkit/glue/resource_type.h"
|
||||
|
||||
namespace net {
|
||||
class URLRequest;
|
||||
class URLRequestContext;
|
||||
}
|
||||
|
||||
namespace WebKit {
|
||||
class WebApplicationCacheHost;
|
||||
class WebApplicationCacheHostClient;
|
||||
}
|
||||
|
||||
class BrowserBackendProxy;
|
||||
class BrowserFrontendProxy;
|
||||
|
||||
namespace net {
|
||||
class URLRequest;
|
||||
class URLRequestContext;
|
||||
} // namespace net
|
||||
|
||||
// A class that composes the constituent parts of an appcache system
|
||||
// together for use in a single process with two relavant threads,
|
||||
// a UI thread on which webkit runs and an IO thread on which net::URLRequests
|
||||
// a UI thread on which webkit runs and an IO thread on which URLRequests
|
||||
// are handled. This class conspires with BrowserResourceLoaderBridge to
|
||||
// retrieve resources from the appcache.
|
||||
class BrowserAppCacheSystem {
|
||||
@ -76,43 +74,15 @@ class BrowserAppCacheSystem {
|
||||
|
||||
// Called by BrowserResourceLoaderBridge extract extra response bits.
|
||||
static void GetExtraResponseInfo(net::URLRequest* request,
|
||||
int64* cache_id,
|
||||
GURL* manifest_url) {
|
||||
int64* cache_id,
|
||||
GURL* manifest_url) {
|
||||
if (instance_)
|
||||
instance_->GetExtraResponseBits(request, cache_id, manifest_url);
|
||||
}
|
||||
|
||||
// Some unittests create their own IO and DB threads.
|
||||
|
||||
enum AppCacheThreadID {
|
||||
DB_THREAD_ID,
|
||||
IO_THREAD_ID,
|
||||
};
|
||||
|
||||
class ThreadProvider {
|
||||
public:
|
||||
virtual ~ThreadProvider() {}
|
||||
virtual bool PostTask(
|
||||
int id,
|
||||
const tracked_objects::Location& from_here,
|
||||
Task* task) = 0;
|
||||
virtual bool CurrentlyOn(int id) = 0;
|
||||
};
|
||||
|
||||
static void set_thread_provider(ThreadProvider* provider) {
|
||||
DCHECK(instance_);
|
||||
DCHECK(!provider || !instance_->thread_provider_);
|
||||
instance_->thread_provider_ = provider;
|
||||
}
|
||||
|
||||
static ThreadProvider* thread_provider() {
|
||||
return instance_ ? instance_->thread_provider_ : NULL;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class BrowserBackendProxy;
|
||||
friend class BrowserFrontendProxy;
|
||||
friend class appcache::AppCacheThread;
|
||||
|
||||
// Instance methods called by our static public methods
|
||||
void InitOnUIThread(const FilePath& cache_directory);
|
||||
@ -138,16 +108,6 @@ class BrowserAppCacheSystem {
|
||||
bool is_initailized_on_ui_thread() {
|
||||
return ui_message_loop_ ? true : false;
|
||||
}
|
||||
static MessageLoop* GetMessageLoop(int id) {
|
||||
if (instance_) {
|
||||
if (id == IO_THREAD_ID)
|
||||
return instance_->io_message_loop_;
|
||||
if (id == DB_THREAD_ID)
|
||||
return instance_->db_thread_.message_loop();
|
||||
NOTREACHED() << "Invalid AppCacheThreadID value";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FilePath cache_directory_;
|
||||
MessageLoop* io_message_loop_;
|
||||
@ -165,9 +125,6 @@ class BrowserAppCacheSystem {
|
||||
// We start a thread for use as the DB thread.
|
||||
base::Thread db_thread_;
|
||||
|
||||
// Some unittests create there own IO and DB threads.
|
||||
ThreadProvider* thread_provider_;
|
||||
|
||||
// A low-tech singleton.
|
||||
static BrowserAppCacheSystem* instance_;
|
||||
};
|
||||
|
@ -5,7 +5,7 @@
|
||||
#ifndef _BROWSER_DEVTOOLS_CLIENT_H
|
||||
#define _BROWSER_DEVTOOLS_CLIENT_H
|
||||
|
||||
#include "base/scoped_ptr.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/task.h"
|
||||
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h"
|
||||
|
@ -131,7 +131,6 @@ BrowserFileSystem::BrowserFileSystem() {
|
||||
file_system_dir_.path(),
|
||||
false /* incognito */,
|
||||
true /* allow_file_access */,
|
||||
true /* unlimited_quota */,
|
||||
NULL);
|
||||
} else {
|
||||
LOG(WARNING) << "Failed to create a temp dir for the filesystem."
|
||||
|
@ -1,24 +1,38 @@
|
||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright (c) 2010 The Chromium Authors. All rights reserved.
|
||||
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "browser_persistent_cookie_store.h"
|
||||
#include "cef_thread.h"
|
||||
|
||||
#include <list>
|
||||
|
||||
#include "cef_thread.h"
|
||||
#include "base/basictypes.h"
|
||||
#include "base/bind.h"
|
||||
#include "base/file_path.h"
|
||||
#include "base/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/metrics/histogram.h"
|
||||
#include "base/string_util.h"
|
||||
#include "base/threading/thread.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "googleurl/src/gurl.h"
|
||||
#include "sql/meta_table.h"
|
||||
#include "sql/statement.h"
|
||||
#include "sql/transaction.h"
|
||||
#include "base/file_path.h"
|
||||
#include "base/file_util.h"
|
||||
#include "googleurl/src/gurl.h"
|
||||
|
||||
using base::Time;
|
||||
|
||||
// This class is designed to be shared between any calling threads and the
|
||||
// database thread. It batches operations and commits them on a timer.
|
||||
// This class expects to be Load()'ed once on any thread. Loading occurs
|
||||
// asynchronously on the DB thread and the caller will be notified on the IO
|
||||
// thread. Subsequent to loading, mutations may be queued by any thread using
|
||||
// AddCookie, UpdateCookieAccessTime, and DeleteCookie. These are flushed to
|
||||
// disk on the DB thread every 30 seconds, 512 operations, or call to Flush(),
|
||||
// whichever occurs first.
|
||||
class BrowserPersistentCookieStore::Backend
|
||||
: public base::RefCountedThreadSafe<BrowserPersistentCookieStore::Backend> {
|
||||
public:
|
||||
@ -30,7 +44,7 @@ class BrowserPersistentCookieStore::Backend
|
||||
}
|
||||
|
||||
// Creates or load the SQLite database.
|
||||
bool Load(std::vector<net::CookieMonster::CanonicalCookie*>* cookies);
|
||||
bool Load(const LoadedCallback& loaded_callback);
|
||||
|
||||
// Batch a cookie addition.
|
||||
void AddCookie(const net::CookieMonster::CanonicalCookie& cc);
|
||||
@ -83,6 +97,18 @@ class BrowserPersistentCookieStore::Backend
|
||||
};
|
||||
|
||||
private:
|
||||
// Creates or load the SQLite database on DB thread.
|
||||
void LoadAndNotifyOnDBThread(const LoadedCallback& loaded_callback);
|
||||
// Notify the CookieMonster when loading complete.
|
||||
void NotifyOnIOThread(
|
||||
const LoadedCallback& loaded_callback,
|
||||
bool load_success,
|
||||
const std::vector<net::CookieMonster::CanonicalCookie*>& cookies);
|
||||
// Initialize the data base.
|
||||
bool InitializeDatabase();
|
||||
// Load cookies to the data base, and read cookies.
|
||||
bool LoadInternal(std::vector<net::CookieMonster::CanonicalCookie*>* cookies);
|
||||
|
||||
// Batch a cookie operation (add or delete)
|
||||
void BatchOperation(PendingOperation::OperationType op,
|
||||
const net::CookieMonster::CanonicalCookie& cc);
|
||||
@ -138,16 +164,49 @@ bool InitTable(sql::Connection* db) {
|
||||
|
||||
// Try to create the index every time. Older versions did not have this index,
|
||||
// so we want those people to get it. Ignore errors, since it may exist.
|
||||
db->Execute("CREATE INDEX cookie_times ON cookies (creation_utc)");
|
||||
db->Execute("CREATE INDEX IF NOT EXISTS cookie_times ON cookies"
|
||||
" (creation_utc)");
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
bool BrowserPersistentCookieStore::Backend::Load(
|
||||
std::vector<net::CookieMonster::CanonicalCookie*>* cookies) {
|
||||
const LoadedCallback& loaded_callback) {
|
||||
// This function should be called only once per instance.
|
||||
DCHECK(!db_.get());
|
||||
CefThread::PostTask(
|
||||
CefThread::FILE, FROM_HERE,
|
||||
base::Bind(&Backend::LoadAndNotifyOnDBThread, base::Unretained(this),
|
||||
loaded_callback));
|
||||
return true;
|
||||
}
|
||||
|
||||
void BrowserPersistentCookieStore::Backend::LoadAndNotifyOnDBThread(
|
||||
const LoadedCallback& loaded_callback) {
|
||||
DCHECK(CefThread::CurrentlyOn(CefThread::FILE));
|
||||
std::vector<net::CookieMonster::CanonicalCookie*> cookies;
|
||||
|
||||
bool load_success = LoadInternal(&cookies);
|
||||
|
||||
CefThread::PostTask(CefThread::IO, FROM_HERE, base::Bind(
|
||||
&BrowserPersistentCookieStore::Backend::NotifyOnIOThread,
|
||||
base::Unretained(this), loaded_callback, load_success, cookies));
|
||||
}
|
||||
|
||||
void BrowserPersistentCookieStore::Backend::NotifyOnIOThread(
|
||||
const LoadedCallback& loaded_callback,
|
||||
bool load_success,
|
||||
const std::vector<net::CookieMonster::CanonicalCookie*>& cookies) {
|
||||
DCHECK(CefThread::CurrentlyOn(CefThread::IO));
|
||||
loaded_callback.Run(cookies);
|
||||
}
|
||||
|
||||
bool BrowserPersistentCookieStore::Backend::InitializeDatabase() {
|
||||
const FilePath dir = path_.DirName();
|
||||
if (!file_util::PathExists(dir) && !file_util::CreateDirectory(dir)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
db_.reset(new sql::Connection);
|
||||
if (!db_->Open(path_)) {
|
||||
@ -165,6 +224,14 @@ bool BrowserPersistentCookieStore::Backend::Load(
|
||||
}
|
||||
|
||||
db_->Preload();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BrowserPersistentCookieStore::Backend::LoadInternal(
|
||||
std::vector<net::CookieMonster::CanonicalCookie*>* cookies) {
|
||||
if (!InitializeDatabase()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Slurp all the cookies into the out-vector.
|
||||
sql::Statement smt(db_->GetUniqueStatement(
|
||||
@ -192,7 +259,7 @@ bool BrowserPersistentCookieStore::Backend::Load(
|
||||
Time::FromInternalValue(smt.ColumnInt64(8)), // last_access_utc
|
||||
smt.ColumnInt(6) != 0, // secure
|
||||
smt.ColumnInt(7) != 0, // httponly
|
||||
true)); // has_
|
||||
true)); // has_expires
|
||||
DLOG_IF(WARNING,
|
||||
cc->CreationDate() > Time::Now()) << L"CreationDate too recent";
|
||||
cookies->push_back(cc.release());
|
||||
@ -406,7 +473,6 @@ void BrowserPersistentCookieStore::Backend::Commit() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
transaction.Commit();
|
||||
}
|
||||
|
||||
@ -426,11 +492,14 @@ void BrowserPersistentCookieStore::Backend::Flush(Task* completion_task) {
|
||||
// pending commit timer that will be holding a reference on us, but if/when
|
||||
// this fires we will already have been cleaned up and it will be ignored.
|
||||
void BrowserPersistentCookieStore::Backend::Close() {
|
||||
DCHECK(!CefThread::CurrentlyOn(CefThread::FILE));
|
||||
// Must close the backend on the background thread.
|
||||
CefThread::PostTask(
|
||||
CefThread::FILE, FROM_HERE,
|
||||
NewRunnableMethod(this, &Backend::InternalBackgroundClose));
|
||||
if (CefThread::CurrentlyOn(CefThread::FILE)) {
|
||||
InternalBackgroundClose();
|
||||
} else {
|
||||
// Must close the backend on the background thread.
|
||||
CefThread::PostTask(
|
||||
CefThread::FILE, FROM_HERE,
|
||||
NewRunnableMethod(this, &Backend::InternalBackgroundClose));
|
||||
}
|
||||
}
|
||||
|
||||
void BrowserPersistentCookieStore::Backend::InternalBackgroundClose() {
|
||||
@ -462,9 +531,8 @@ BrowserPersistentCookieStore::~BrowserPersistentCookieStore() {
|
||||
}
|
||||
}
|
||||
|
||||
bool BrowserPersistentCookieStore::Load(
|
||||
std::vector<net::CookieMonster::CanonicalCookie*>* cookies) {
|
||||
return backend_->Load(cookies);
|
||||
bool BrowserPersistentCookieStore::Load(const LoadedCallback& loaded_callback) {
|
||||
return backend_->Load(loaded_callback);
|
||||
}
|
||||
|
||||
void BrowserPersistentCookieStore::AddCookie(
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors.
|
||||
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
||||
// Portions copyright (c) 2010 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
@ -31,16 +31,20 @@ class BrowserPersistentCookieStore
|
||||
explicit BrowserPersistentCookieStore(const FilePath& path);
|
||||
virtual ~BrowserPersistentCookieStore();
|
||||
|
||||
virtual bool Load(std::vector<net::CookieMonster::CanonicalCookie*>* cookies);
|
||||
virtual bool Load(const LoadedCallback& loaded_callback) OVERRIDE;
|
||||
|
||||
virtual void AddCookie(
|
||||
const net::CookieMonster::CanonicalCookie& cc) OVERRIDE;
|
||||
|
||||
virtual void AddCookie(const net::CookieMonster::CanonicalCookie& cc);
|
||||
virtual void UpdateCookieAccessTime(
|
||||
const net::CookieMonster::CanonicalCookie& cc);
|
||||
virtual void DeleteCookie(const net::CookieMonster::CanonicalCookie& cc);
|
||||
const net::CookieMonster::CanonicalCookie& cc) OVERRIDE;
|
||||
|
||||
virtual void SetClearLocalStateOnExit(bool clear_local_state);
|
||||
virtual void DeleteCookie(
|
||||
const net::CookieMonster::CanonicalCookie& cc) OVERRIDE;
|
||||
|
||||
virtual void Flush(Task* completion_task);
|
||||
virtual void SetClearLocalStateOnExit(bool clear_local_state) OVERRIDE;
|
||||
|
||||
virtual void Flush(Task* completion_task) OVERRIDE;
|
||||
|
||||
private:
|
||||
class Backend;
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "response_impl.h"
|
||||
#include "http_header_utils.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/file_path.h"
|
||||
#include "base/file_util.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
@ -680,9 +681,12 @@ class RequestProxy : public net::URLRequest::Delegate,
|
||||
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
|
||||
if(handler.get()) {
|
||||
CefString username, password;
|
||||
if (handler->GetAuthCredentials(browser_, auth_info->is_proxy,
|
||||
auth_info->host_and_port,
|
||||
auth_info->realm, auth_info->scheme,
|
||||
if (handler->GetAuthCredentials(browser_,
|
||||
auth_info->is_proxy,
|
||||
auth_info->challenger.host(),
|
||||
auth_info->challenger.port(),
|
||||
auth_info->realm,
|
||||
auth_info->scheme,
|
||||
username, password)) {
|
||||
request->SetAuth(username, password);
|
||||
return;
|
||||
@ -1030,8 +1034,11 @@ class CookieSetter : public base::RefCountedThreadSafe<CookieSetter> {
|
||||
REQUIRE_IOT();
|
||||
net::CookieStore* cookie_store =
|
||||
_Context->request_context()->cookie_store();
|
||||
if (cookie_store)
|
||||
cookie_store->SetCookie(url, cookie);
|
||||
if (cookie_store) {
|
||||
cookie_store->SetCookieWithOptionsAsync(
|
||||
url, cookie, net::CookieOptions(),
|
||||
net::CookieStore::SetCookiesCallback());
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
@ -1048,9 +1055,11 @@ class CookieGetter : public base::RefCountedThreadSafe<CookieGetter> {
|
||||
void Get(const GURL& url) {
|
||||
net::CookieStore* cookie_store =
|
||||
_Context->request_context()->cookie_store();
|
||||
if (cookie_store)
|
||||
result_ = cookie_store->GetCookies(url);
|
||||
event_.Signal();
|
||||
if (cookie_store) {
|
||||
cookie_store->GetCookiesWithOptionsAsync(
|
||||
url, net::CookieOptions(),
|
||||
base::Bind(&CookieGetter::OnGetCookies, this));
|
||||
}
|
||||
}
|
||||
|
||||
std::string GetResult() {
|
||||
@ -1060,6 +1069,10 @@ class CookieGetter : public base::RefCountedThreadSafe<CookieGetter> {
|
||||
}
|
||||
|
||||
private:
|
||||
void OnGetCookies(const std::string& cookie_line) {
|
||||
result_ = cookie_line;
|
||||
event_.Signal();
|
||||
}
|
||||
friend class base::RefCountedThreadSafe<CookieGetter>;
|
||||
|
||||
~CookieGetter() {}
|
||||
|
@ -20,8 +20,8 @@ MSVC_POP_WARNING();
|
||||
#include "cef_context.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/scoped_ptr.h"
|
||||
#include "base/string_util.h"
|
||||
#include "base/string16.h"
|
||||
#include "net/base/mime_util.h"
|
||||
@ -55,13 +55,6 @@ bool IsProtocolSupportedForMedia(const GURL& url) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string GetWebKitLocale() {
|
||||
const CefSettings& settings = _Context->settings();
|
||||
if (settings.locale.length > 0)
|
||||
return CefString(&settings.locale);
|
||||
return "en-US";
|
||||
}
|
||||
|
||||
void InitializeTextEncoding() {
|
||||
WebCore::UTF8Encoding();
|
||||
}
|
||||
@ -73,14 +66,6 @@ v8::Handle<v8::Context> GetV8Context(WebKit::WebFrame* frame)
|
||||
return WebCore::V8Proxy::context(core_frame);
|
||||
}
|
||||
|
||||
void CloseIdleConnections() {
|
||||
// Used in benchmarking, Ignored for CEF.
|
||||
}
|
||||
|
||||
void SetCacheMode(bool enabled) {
|
||||
// Used in benchmarking, Ignored for CEF.
|
||||
}
|
||||
|
||||
void ClearCache()
|
||||
{
|
||||
if (WebCore::memoryCache()->disabled())
|
||||
@ -109,10 +94,6 @@ std::string BuildUserAgent(bool mimic_windows) {
|
||||
return webkit_glue::BuildUserAgentHelper(mimic_windows, product_version);
|
||||
}
|
||||
|
||||
bool IsSingleProcess() {
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
int MatchFontWithFallback(const std::string& face, bool bold,
|
||||
bool italic, int charset) {
|
||||
@ -125,10 +106,6 @@ bool GetFontTable(int fd, uint32_t table, uint8_t* output,
|
||||
}
|
||||
#endif
|
||||
|
||||
void EnableSpdy(bool enable) {
|
||||
// Used in benchmarking, Ignored for CEF.
|
||||
}
|
||||
|
||||
// Adapted from Chromium's BufferedResourceHandler::ShouldDownload
|
||||
bool ShouldDownload(const std::string& content_disposition,
|
||||
const std::string& mime_type)
|
||||
@ -180,7 +157,7 @@ bool ShouldDownload(const std::string& content_disposition,
|
||||
if (!plugins.empty()) {
|
||||
std::vector<webkit::WebPluginInfo>::const_iterator it = plugins.begin();
|
||||
for (; it != plugins.end(); ++it) {
|
||||
if (webkit::IsPluginEnabled(*it))
|
||||
if (webkit_glue::IsPluginEnabled(*it))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -188,4 +165,8 @@ bool ShouldDownload(const std::string& content_disposition,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool IsPluginEnabled(const webkit::WebPluginInfo& plugin) {
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace webkit_glue
|
||||
|
@ -14,6 +14,9 @@ namespace WebKit {
|
||||
class WebFrame;
|
||||
class WebView;
|
||||
}
|
||||
namespace webkit {
|
||||
struct WebPluginInfo;
|
||||
}
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
class FilePath;
|
||||
@ -52,4 +55,7 @@ void ClearCache();
|
||||
bool ShouldDownload(const std::string& content_disposition,
|
||||
const std::string& mime_type);
|
||||
|
||||
// Checks whether a plugin is enabled either by the user or by policy.
|
||||
bool IsPluginEnabled(const webkit::WebPluginInfo& plugin);
|
||||
|
||||
} // namespace webkit_glue
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/mac/mac_util.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/utf_string_conversions.h"
|
||||
#include "grit/webkit_resources.h"
|
||||
#include "ui/base/resource/data_pack.h"
|
||||
#include "webkit/glue/webkit_glue.h"
|
||||
@ -58,9 +59,10 @@ string16 GetLocalizedString(int message_id) {
|
||||
if (!g_resource_data_pack->GetStringPiece(message_id, &res)) {
|
||||
LOG(FATAL) << "failed to load webkit string with id " << message_id;
|
||||
}
|
||||
|
||||
return string16(reinterpret_cast<const char16*>(res.data()),
|
||||
res.length() / 2);
|
||||
|
||||
string16 result;
|
||||
UTF8ToUTF16(res.data(), res.length(), &result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
#include <map>
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/scoped_ptr.h"
|
||||
#include "build/build_config.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.h"
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "cef_process.h"
|
||||
#include "../include/cef_nplugin.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/file_util.h"
|
||||
#include "base/stringprintf.h"
|
||||
#include "base/synchronization/waitable_event.h"
|
||||
@ -64,37 +65,56 @@ int GetThreadId(CefThreadId threadId)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void IOT_VisitCookies(net::CookieMonster* cookie_monster,
|
||||
const net::CookieList& list,
|
||||
CefRefPtr<CefCookieVisitor> visitor)
|
||||
{
|
||||
int total = list.size(), count = 0;
|
||||
|
||||
net::CookieList::const_iterator it = list.begin();
|
||||
for (; it != list.end(); ++it, ++count) {
|
||||
CefCookie cookie;
|
||||
const net::CookieMonster::CanonicalCookie& cc = *(it);
|
||||
|
||||
CefString(&cookie.name).FromString(cc.Name());
|
||||
CefString(&cookie.value).FromString(cc.Value());
|
||||
CefString(&cookie.domain).FromString(cc.Domain());
|
||||
CefString(&cookie.path).FromString(cc.Path());
|
||||
cookie.secure = cc.IsSecure();
|
||||
cookie.httponly = cc.IsHttpOnly();
|
||||
cef_time_from_basetime(cc.CreationDate(), cookie.creation);
|
||||
cef_time_from_basetime(cc.LastAccessDate(), cookie.last_access);
|
||||
cookie.has_expires = cc.DoesExpire();
|
||||
if (cookie.has_expires)
|
||||
cef_time_from_basetime(cc.ExpiryDate(), cookie.expires);
|
||||
|
||||
bool deleteCookie = false;
|
||||
bool keepLooping = visitor->Visit(cookie, count, total, deleteCookie);
|
||||
if (deleteCookie)
|
||||
cookie_monster->DeleteCanonicalCookie(cc);
|
||||
if (!keepLooping)
|
||||
break;
|
||||
// Callback class for visiting cookies.
|
||||
class VisitCookiesCallback : public base::RefCounted<VisitCookiesCallback> {
|
||||
public:
|
||||
VisitCookiesCallback(CefRefPtr<CefCookieVisitor> visitor)
|
||||
: visitor_(visitor)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void Run(const net::CookieList& list)
|
||||
{
|
||||
REQUIRE_IOT();
|
||||
|
||||
net::CookieMonster* cookie_monster = static_cast<net::CookieMonster*>(
|
||||
_Context->request_context()->cookie_store());
|
||||
if (!cookie_monster)
|
||||
return;
|
||||
|
||||
int total = list.size(), count = 0;
|
||||
|
||||
net::CookieList::const_iterator it = list.begin();
|
||||
for (; it != list.end(); ++it, ++count) {
|
||||
CefCookie cookie;
|
||||
const net::CookieMonster::CanonicalCookie& cc = *(it);
|
||||
|
||||
CefString(&cookie.name).FromString(cc.Name());
|
||||
CefString(&cookie.value).FromString(cc.Value());
|
||||
CefString(&cookie.domain).FromString(cc.Domain());
|
||||
CefString(&cookie.path).FromString(cc.Path());
|
||||
cookie.secure = cc.IsSecure();
|
||||
cookie.httponly = cc.IsHttpOnly();
|
||||
cef_time_from_basetime(cc.CreationDate(), cookie.creation);
|
||||
cef_time_from_basetime(cc.LastAccessDate(), cookie.last_access);
|
||||
cookie.has_expires = cc.DoesExpire();
|
||||
if (cookie.has_expires)
|
||||
cef_time_from_basetime(cc.ExpiryDate(), cookie.expires);
|
||||
|
||||
bool deleteCookie = false;
|
||||
bool keepLooping = visitor_->Visit(cookie, count, total, deleteCookie);
|
||||
if (deleteCookie) {
|
||||
cookie_monster->DeleteCanonicalCookieAsync(cc,
|
||||
net::CookieMonster::DeleteCookieCallback());
|
||||
}
|
||||
if (!keepLooping)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
CefRefPtr<CefCookieVisitor> visitor_;
|
||||
};
|
||||
|
||||
void IOT_VisitAllCookies(CefRefPtr<CefCookieVisitor> visitor)
|
||||
{
|
||||
@ -105,9 +125,11 @@ void IOT_VisitAllCookies(CefRefPtr<CefCookieVisitor> visitor)
|
||||
if (!cookie_monster)
|
||||
return;
|
||||
|
||||
net::CookieList list = cookie_monster->GetAllCookies();
|
||||
if (!list.empty())
|
||||
IOT_VisitCookies(cookie_monster, list, visitor);
|
||||
scoped_refptr<VisitCookiesCallback> callback(
|
||||
new VisitCookiesCallback(visitor));
|
||||
|
||||
cookie_monster->GetAllCookiesAsync(
|
||||
base::Bind(&VisitCookiesCallback::Run, callback.get()));
|
||||
}
|
||||
|
||||
void IOT_VisitUrlCookies(const GURL& url, bool includeHttpOnly,
|
||||
@ -123,10 +145,12 @@ void IOT_VisitUrlCookies(const GURL& url, bool includeHttpOnly,
|
||||
net::CookieOptions options;
|
||||
if (includeHttpOnly)
|
||||
options.set_include_httponly();
|
||||
net::CookieList list =
|
||||
cookie_monster->GetAllCookiesForURLWithOptions(url, options);
|
||||
if (!list.empty())
|
||||
IOT_VisitCookies(cookie_monster, list, visitor);
|
||||
|
||||
scoped_refptr<VisitCookiesCallback> callback(
|
||||
new VisitCookiesCallback(visitor));
|
||||
|
||||
cookie_monster->GetAllCookiesForURLWithOptionsAsync(url, options,
|
||||
base::Bind(&VisitCookiesCallback::Run, callback.get()));
|
||||
}
|
||||
|
||||
// Used in multi-threaded message loop mode to observe shutdown of the UI
|
||||
@ -401,9 +425,10 @@ bool CefSetCookie(const CefString& url, const CefCookie& cookie)
|
||||
if (cookie.has_expires)
|
||||
cef_time_to_basetime(cookie.expires, expiration_time);
|
||||
|
||||
return cookie_monster->SetCookieWithDetails(gurl, name, value, domain, path,
|
||||
expiration_time, cookie.secure,
|
||||
cookie.httponly);
|
||||
cookie_monster->SetCookieWithDetailsAsync(gurl, name, value, domain, path,
|
||||
expiration_time, cookie.secure, cookie.httponly,
|
||||
net::CookieStore::SetCookiesCallback());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefDeleteCookies(const CefString& url, const CefString& cookie_name)
|
||||
@ -427,7 +452,7 @@ bool CefDeleteCookies(const CefString& url, const CefString& cookie_name)
|
||||
|
||||
if (url.empty()) {
|
||||
// Delete all cookies.
|
||||
cookie_monster->DeleteAll(true);
|
||||
cookie_monster->DeleteAllAsync(net::CookieMonster::DeleteCallback());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -438,10 +463,11 @@ bool CefDeleteCookies(const CefString& url, const CefString& cookie_name)
|
||||
|
||||
if (cookie_name.empty()) {
|
||||
// Delete all matching host cookies.
|
||||
cookie_monster->DeleteAllForHost(gurl);
|
||||
cookie_monster->DeleteAllForHostAsync(gurl,
|
||||
net::CookieMonster::DeleteCallback());
|
||||
} else {
|
||||
// Delete all matching host and domain cookies.
|
||||
cookie_monster->DeleteCookie(gurl, cookie_name);
|
||||
cookie_monster->DeleteCookieAsync(gurl, cookie_name, base::Closure());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "dom_storage_common.h"
|
||||
|
||||
#include "base/hash_tables.h"
|
||||
#include "base/scoped_ptr.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/string16.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
|
||||
|
||||
|
@ -20,6 +20,7 @@ class ExternalPopupMenu : public WebKit::WebExternalPopupMenu {
|
||||
ExternalPopupMenu(BrowserWebViewDelegate* delegate,
|
||||
const WebKit::WebPopupMenuInfo& popup_menu_info,
|
||||
WebKit::WebExternalPopupMenuClient* popup_menu_client);
|
||||
virtual ~ExternalPopupMenu() {}
|
||||
|
||||
// WebKit::WebExternalPopupMenu implementation:
|
||||
virtual void show(const WebKit::WebRect& bounds);
|
||||
|
@ -799,7 +799,7 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::GetValue(const CefString& key)
|
||||
return NULL;
|
||||
if(!GetHandle()->IsObject()) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
v8::HandleScope handle_scope;
|
||||
@ -812,7 +812,7 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::GetValue(int index)
|
||||
CEF_REQUIRE_UI_THREAD(NULL);
|
||||
if(!GetHandle()->IsObject()) {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
v8::HandleScope handle_scope;
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "browser_webkit_glue.h"
|
||||
#import "web_drag_utils_mac.h"
|
||||
|
||||
#include "base/basictypes.h"
|
||||
@ -87,7 +88,7 @@ static BOOL IsSupportedFileURL(const GURL& url) {
|
||||
if (!plugins.empty()) {
|
||||
std::vector<webkit::WebPluginInfo>::const_iterator it = plugins.begin();
|
||||
for (; it != plugins.end(); ++it) {
|
||||
if (webkit::IsPluginEnabled(*it))
|
||||
if (webkit_glue::IsPluginEnabled(*it))
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
#define _WEB_DROP_TARGET_WIN_H
|
||||
#pragma once
|
||||
|
||||
#include "base/scoped_ptr.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
|
||||
#include "ui/base/dragdrop/drop_target.h"
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "response_impl.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/scoped_ptr.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "googleurl/src/gurl.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoaderClient.h"
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "include/internal/cef_string.h"
|
||||
#include "include/internal/cef_types.h"
|
||||
#include "base/basictypes.h"
|
||||
#include "base/scoped_ptr.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "base/task.h"
|
||||
#include "skia/ext/platform_canvas.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
|
||||
|
@ -137,7 +137,7 @@ int CEF_CALLBACK request_handler_get_download_handler(
|
||||
|
||||
int CEF_CALLBACK request_handler_get_auth_credentials(
|
||||
struct _cef_request_handler_t* self, cef_browser_t* browser, int isProxy,
|
||||
const cef_string_t* host, const cef_string_t* realm,
|
||||
const cef_string_t* host, int port, const cef_string_t* realm,
|
||||
const cef_string_t* scheme, cef_string_t* username,
|
||||
cef_string_t* password)
|
||||
{
|
||||
@ -155,7 +155,7 @@ int CEF_CALLBACK request_handler_get_auth_credentials(
|
||||
CefString passwordStr(password);
|
||||
return CefRequestHandlerCppToC::Get(self)->GetAuthCredentials(
|
||||
CefBrowserCToCpp::Wrap(browser), (isProxy ? true : false),
|
||||
CefString(host), CefString(realm), CefString(scheme), usernameStr,
|
||||
CefString(host), port, CefString(realm), CefString(scheme), usernameStr,
|
||||
passwordStr);
|
||||
}
|
||||
|
||||
|
@ -105,14 +105,14 @@ bool CefRequestHandlerCToCpp::GetDownloadHandler(CefRefPtr<CefBrowser> browser,
|
||||
}
|
||||
|
||||
bool CefRequestHandlerCToCpp::GetAuthCredentials(CefRefPtr<CefBrowser> browser,
|
||||
bool isProxy, const CefString& host, const CefString& realm,
|
||||
bool isProxy, const CefString& host, int port, const CefString& realm,
|
||||
const CefString& scheme, CefString& username, CefString& password)
|
||||
{
|
||||
if (CEF_MEMBER_MISSING(struct_, get_auth_credentials))
|
||||
return false;
|
||||
|
||||
return struct_->get_auth_credentials(struct_, CefBrowserCppToC::Wrap(browser),
|
||||
isProxy, host.GetStruct(), realm.GetStruct(), scheme.GetStruct(),
|
||||
isProxy, host.GetStruct(), port, realm.GetStruct(), scheme.GetStruct(),
|
||||
username.GetWritableStruct(), password.GetWritableStruct()) ?
|
||||
true : false;
|
||||
}
|
||||
|
@ -49,8 +49,9 @@ public:
|
||||
const CefString& mimeType, const CefString& fileName,
|
||||
int64 contentLength, CefRefPtr<CefDownloadHandler>& handler) OVERRIDE;
|
||||
virtual bool GetAuthCredentials(CefRefPtr<CefBrowser> browser, bool isProxy,
|
||||
const CefString& host, const CefString& realm, const CefString& scheme,
|
||||
CefString& username, CefString& password) OVERRIDE;
|
||||
const CefString& host, int port, const CefString& realm,
|
||||
const CefString& scheme, CefString& username,
|
||||
CefString& password) OVERRIDE;
|
||||
};
|
||||
|
||||
#endif // BUILDING_CEF_SHARED
|
||||
|
Loading…
x
Reference in New Issue
Block a user