mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02: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:
@ -67,3 +67,4 @@ Date | CEF Revision | Chromium Revision
|
|||||||
2011-05-16 | /trunk@233 | /trunk@85305
|
2011-05-16 | /trunk@233 | /trunk@85305
|
||||||
2011-07-02 | /trunk@263 | /trunk@91424
|
2011-07-02 | /trunk@263 | /trunk@91424
|
||||||
2011-09-10 | /trunk@284 | /trunk@100584
|
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': {
|
'variables': {
|
||||||
# Directory for CEF source files.
|
|
||||||
'conditions': [
|
'conditions': [
|
||||||
|
# Directory for CEF source files.
|
||||||
[ 'OS=="win"', {
|
[ 'OS=="win"', {
|
||||||
'cef_directory' : '<!(echo %CEF_DIRECTORY%)',
|
'cef_directory' : '<!(echo %CEF_DIRECTORY%)',
|
||||||
}, { # OS!="win"
|
}, { # OS!="win"
|
||||||
'cef_directory' : '<!(echo $CEF_DIRECTORY)',
|
'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,
|
virtual bool GetAuthCredentials(CefRefPtr<CefBrowser> browser,
|
||||||
bool isProxy,
|
bool isProxy,
|
||||||
const CefString& host,
|
const CefString& host,
|
||||||
|
int port,
|
||||||
const CefString& realm,
|
const CefString& realm,
|
||||||
const CefString& scheme,
|
const CefString& scheme,
|
||||||
CefString& username,
|
CefString& username,
|
||||||
|
@ -990,7 +990,7 @@ typedef struct _cef_request_handler_t
|
|||||||
///
|
///
|
||||||
int (CEF_CALLBACK *get_auth_credentials)(struct _cef_request_handler_t* self,
|
int (CEF_CALLBACK *get_auth_credentials)(struct _cef_request_handler_t* self,
|
||||||
struct _cef_browser_t* browser, int isProxy, const cef_string_t* host,
|
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_string_t* username, cef_string_t* password);
|
||||||
|
|
||||||
} cef_request_handler_t;
|
} 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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "browser_appcache_system.h"
|
#include "browser_appcache_system.h"
|
||||||
#include "browser_resource_loader_bridge.h"
|
#include "browser_resource_loader_bridge.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "base/callback.h"
|
#include "base/callback.h"
|
||||||
#include "base/synchronization/lock.h"
|
|
||||||
#include "base/task.h"
|
#include "base/task.h"
|
||||||
#include "base/synchronization/waitable_event.h"
|
#include "base/synchronization/waitable_event.h"
|
||||||
#include "webkit/appcache/appcache_interceptor.h"
|
#include "webkit/appcache/appcache_interceptor.h"
|
||||||
@ -17,34 +19,6 @@ using WebKit::WebApplicationCacheHostClient;
|
|||||||
using appcache::WebApplicationCacheHostImpl;
|
using appcache::WebApplicationCacheHostImpl;
|
||||||
using appcache::AppCacheBackendImpl;
|
using appcache::AppCacheBackendImpl;
|
||||||
using appcache::AppCacheInterceptor;
|
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 --------------------------------------------------------
|
// BrowserFrontendProxy --------------------------------------------------------
|
||||||
// Proxies method calls from the backend IO thread to the frontend UI thread.
|
// Proxies method calls from the backend IO thread to the frontend UI thread.
|
||||||
@ -63,15 +37,15 @@ class BrowserFrontendProxy
|
|||||||
const appcache::AppCacheInfo& info) {
|
const appcache::AppCacheInfo& info) {
|
||||||
if (!system_)
|
if (!system_)
|
||||||
return;
|
return;
|
||||||
if (system_->is_io_thread())
|
if (system_->is_io_thread()) {
|
||||||
system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
system_->ui_message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
|
||||||
this, &BrowserFrontendProxy::OnCacheSelected,
|
this, &BrowserFrontendProxy::OnCacheSelected,
|
||||||
host_id, info));
|
host_id, info));
|
||||||
else if (system_->is_ui_thread()) {
|
} else if (system_->is_ui_thread()) {
|
||||||
system_->frontend_impl_.OnCacheSelected(host_id, info);
|
system_->frontend_impl_.OnCacheSelected(host_id, info);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnStatusChanged(const std::vector<int>& host_ids,
|
virtual void OnStatusChanged(const std::vector<int>& host_ids,
|
||||||
@ -364,8 +338,7 @@ BrowserAppCacheSystem::BrowserAppCacheSystem()
|
|||||||
backend_proxy_(new BrowserBackendProxy(this))),
|
backend_proxy_(new BrowserBackendProxy(this))),
|
||||||
ALLOW_THIS_IN_INITIALIZER_LIST(
|
ALLOW_THIS_IN_INITIALIZER_LIST(
|
||||||
frontend_proxy_(new BrowserFrontendProxy(this))),
|
frontend_proxy_(new BrowserFrontendProxy(this))),
|
||||||
backend_impl_(NULL), service_(NULL), db_thread_("AppCacheDBThread"),
|
backend_impl_(NULL), service_(NULL), db_thread_("AppCacheDBThread") {
|
||||||
thread_provider_(NULL) {
|
|
||||||
DCHECK(!instance_);
|
DCHECK(!instance_);
|
||||||
instance_ = this;
|
instance_ = this;
|
||||||
}
|
}
|
||||||
@ -391,7 +364,6 @@ BrowserAppCacheSystem::~BrowserAppCacheSystem() {
|
|||||||
|
|
||||||
void BrowserAppCacheSystem::InitOnUIThread(const FilePath& cache_directory) {
|
void BrowserAppCacheSystem::InitOnUIThread(const FilePath& cache_directory) {
|
||||||
DCHECK(!ui_message_loop_);
|
DCHECK(!ui_message_loop_);
|
||||||
AppCacheThread::Init(DB_THREAD_ID, IO_THREAD_ID);
|
|
||||||
ui_message_loop_ = MessageLoop::current();
|
ui_message_loop_ = MessageLoop::current();
|
||||||
cache_directory_ = cache_directory;
|
cache_directory_ = cache_directory;
|
||||||
}
|
}
|
||||||
@ -411,6 +383,7 @@ void BrowserAppCacheSystem::InitOnIOThread(
|
|||||||
service_ = new appcache::AppCacheService(NULL);
|
service_ = new appcache::AppCacheService(NULL);
|
||||||
backend_impl_ = new appcache::AppCacheBackendImpl();
|
backend_impl_ = new appcache::AppCacheBackendImpl();
|
||||||
service_->Initialize(cache_directory_,
|
service_->Initialize(cache_directory_,
|
||||||
|
db_thread_.message_loop_proxy(),
|
||||||
BrowserResourceLoaderBridge::GetCacheThread());
|
BrowserResourceLoaderBridge::GetCacheThread());
|
||||||
service_->set_request_context(request_context);
|
service_->set_request_context(request_context);
|
||||||
backend_impl_->Initialize(service_, frontend_proxy_.get(), kSingleProcessId);
|
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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef _BROWSER_APPCACHE_SYSTEM_H
|
#ifndef WEBKIT_TOOLS_TEST_SHELL_Browser_APPCACHE_SYSTEM_H_
|
||||||
#define _BROWSER_APPCACHE_SYSTEM_H
|
#define _BROWSER_APPCACHE_SYSTEM_H
|
||||||
|
|
||||||
#include "base/file_path.h"
|
#include "base/file_path.h"
|
||||||
@ -11,25 +11,23 @@
|
|||||||
#include "webkit/appcache/appcache_backend_impl.h"
|
#include "webkit/appcache/appcache_backend_impl.h"
|
||||||
#include "webkit/appcache/appcache_frontend_impl.h"
|
#include "webkit/appcache/appcache_frontend_impl.h"
|
||||||
#include "webkit/appcache/appcache_service.h"
|
#include "webkit/appcache/appcache_service.h"
|
||||||
#include "webkit/appcache/appcache_thread.h"
|
|
||||||
#include "webkit/glue/resource_type.h"
|
#include "webkit/glue/resource_type.h"
|
||||||
|
|
||||||
namespace net {
|
|
||||||
class URLRequest;
|
|
||||||
class URLRequestContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace WebKit {
|
namespace WebKit {
|
||||||
class WebApplicationCacheHost;
|
class WebApplicationCacheHost;
|
||||||
class WebApplicationCacheHostClient;
|
class WebApplicationCacheHostClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
class BrowserBackendProxy;
|
class BrowserBackendProxy;
|
||||||
class BrowserFrontendProxy;
|
class BrowserFrontendProxy;
|
||||||
|
|
||||||
|
namespace net {
|
||||||
|
class URLRequest;
|
||||||
|
class URLRequestContext;
|
||||||
|
} // namespace net
|
||||||
|
|
||||||
// A class that composes the constituent parts of an appcache system
|
// A class that composes the constituent parts of an appcache system
|
||||||
// together for use in a single process with two relavant threads,
|
// 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
|
// are handled. This class conspires with BrowserResourceLoaderBridge to
|
||||||
// retrieve resources from the appcache.
|
// retrieve resources from the appcache.
|
||||||
class BrowserAppCacheSystem {
|
class BrowserAppCacheSystem {
|
||||||
@ -76,43 +74,15 @@ class BrowserAppCacheSystem {
|
|||||||
|
|
||||||
// Called by BrowserResourceLoaderBridge extract extra response bits.
|
// Called by BrowserResourceLoaderBridge extract extra response bits.
|
||||||
static void GetExtraResponseInfo(net::URLRequest* request,
|
static void GetExtraResponseInfo(net::URLRequest* request,
|
||||||
int64* cache_id,
|
int64* cache_id,
|
||||||
GURL* manifest_url) {
|
GURL* manifest_url) {
|
||||||
if (instance_)
|
if (instance_)
|
||||||
instance_->GetExtraResponseBits(request, cache_id, manifest_url);
|
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:
|
private:
|
||||||
friend class BrowserBackendProxy;
|
friend class BrowserBackendProxy;
|
||||||
friend class BrowserFrontendProxy;
|
friend class BrowserFrontendProxy;
|
||||||
friend class appcache::AppCacheThread;
|
|
||||||
|
|
||||||
// Instance methods called by our static public methods
|
// Instance methods called by our static public methods
|
||||||
void InitOnUIThread(const FilePath& cache_directory);
|
void InitOnUIThread(const FilePath& cache_directory);
|
||||||
@ -138,16 +108,6 @@ class BrowserAppCacheSystem {
|
|||||||
bool is_initailized_on_ui_thread() {
|
bool is_initailized_on_ui_thread() {
|
||||||
return ui_message_loop_ ? true : false;
|
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_;
|
FilePath cache_directory_;
|
||||||
MessageLoop* io_message_loop_;
|
MessageLoop* io_message_loop_;
|
||||||
@ -165,9 +125,6 @@ class BrowserAppCacheSystem {
|
|||||||
// We start a thread for use as the DB thread.
|
// We start a thread for use as the DB thread.
|
||||||
base::Thread db_thread_;
|
base::Thread db_thread_;
|
||||||
|
|
||||||
// Some unittests create there own IO and DB threads.
|
|
||||||
ThreadProvider* thread_provider_;
|
|
||||||
|
|
||||||
// A low-tech singleton.
|
// A low-tech singleton.
|
||||||
static BrowserAppCacheSystem* instance_;
|
static BrowserAppCacheSystem* instance_;
|
||||||
};
|
};
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
#ifndef _BROWSER_DEVTOOLS_CLIENT_H
|
#ifndef _BROWSER_DEVTOOLS_CLIENT_H
|
||||||
#define _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 "base/task.h"
|
||||||
|
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h"
|
||||||
|
@ -131,7 +131,6 @@ BrowserFileSystem::BrowserFileSystem() {
|
|||||||
file_system_dir_.path(),
|
file_system_dir_.path(),
|
||||||
false /* incognito */,
|
false /* incognito */,
|
||||||
true /* allow_file_access */,
|
true /* allow_file_access */,
|
||||||
true /* unlimited_quota */,
|
|
||||||
NULL);
|
NULL);
|
||||||
} else {
|
} else {
|
||||||
LOG(WARNING) << "Failed to create a temp dir for the filesystem."
|
LOG(WARNING) << "Failed to create a temp dir for the filesystem."
|
||||||
|
@ -1,24 +1,38 @@
|
|||||||
// 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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#include "browser_persistent_cookie_store.h"
|
#include "browser_persistent_cookie_store.h"
|
||||||
|
#include "cef_thread.h"
|
||||||
|
|
||||||
#include <list>
|
#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/meta_table.h"
|
||||||
#include "sql/statement.h"
|
#include "sql/statement.h"
|
||||||
#include "sql/transaction.h"
|
#include "sql/transaction.h"
|
||||||
#include "base/file_path.h"
|
|
||||||
#include "base/file_util.h"
|
|
||||||
#include "googleurl/src/gurl.h"
|
|
||||||
|
|
||||||
using base::Time;
|
using base::Time;
|
||||||
|
|
||||||
// This class is designed to be shared between any calling threads and the
|
// This class is designed to be shared between any calling threads and the
|
||||||
// database thread. It batches operations and commits them on a timer.
|
// 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
|
class BrowserPersistentCookieStore::Backend
|
||||||
: public base::RefCountedThreadSafe<BrowserPersistentCookieStore::Backend> {
|
: public base::RefCountedThreadSafe<BrowserPersistentCookieStore::Backend> {
|
||||||
public:
|
public:
|
||||||
@ -30,7 +44,7 @@ class BrowserPersistentCookieStore::Backend
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Creates or load the SQLite database.
|
// Creates or load the SQLite database.
|
||||||
bool Load(std::vector<net::CookieMonster::CanonicalCookie*>* cookies);
|
bool Load(const LoadedCallback& loaded_callback);
|
||||||
|
|
||||||
// Batch a cookie addition.
|
// Batch a cookie addition.
|
||||||
void AddCookie(const net::CookieMonster::CanonicalCookie& cc);
|
void AddCookie(const net::CookieMonster::CanonicalCookie& cc);
|
||||||
@ -83,6 +97,18 @@ class BrowserPersistentCookieStore::Backend
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
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)
|
// Batch a cookie operation (add or delete)
|
||||||
void BatchOperation(PendingOperation::OperationType op,
|
void BatchOperation(PendingOperation::OperationType op,
|
||||||
const net::CookieMonster::CanonicalCookie& cc);
|
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,
|
// 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.
|
// 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
bool BrowserPersistentCookieStore::Backend::Load(
|
bool BrowserPersistentCookieStore::Backend::Load(
|
||||||
std::vector<net::CookieMonster::CanonicalCookie*>* cookies) {
|
const LoadedCallback& loaded_callback) {
|
||||||
// This function should be called only once per instance.
|
// This function should be called only once per instance.
|
||||||
DCHECK(!db_.get());
|
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);
|
db_.reset(new sql::Connection);
|
||||||
if (!db_->Open(path_)) {
|
if (!db_->Open(path_)) {
|
||||||
@ -165,6 +224,14 @@ bool BrowserPersistentCookieStore::Backend::Load(
|
|||||||
}
|
}
|
||||||
|
|
||||||
db_->Preload();
|
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.
|
// Slurp all the cookies into the out-vector.
|
||||||
sql::Statement smt(db_->GetUniqueStatement(
|
sql::Statement smt(db_->GetUniqueStatement(
|
||||||
@ -192,7 +259,7 @@ bool BrowserPersistentCookieStore::Backend::Load(
|
|||||||
Time::FromInternalValue(smt.ColumnInt64(8)), // last_access_utc
|
Time::FromInternalValue(smt.ColumnInt64(8)), // last_access_utc
|
||||||
smt.ColumnInt(6) != 0, // secure
|
smt.ColumnInt(6) != 0, // secure
|
||||||
smt.ColumnInt(7) != 0, // httponly
|
smt.ColumnInt(7) != 0, // httponly
|
||||||
true)); // has_
|
true)); // has_expires
|
||||||
DLOG_IF(WARNING,
|
DLOG_IF(WARNING,
|
||||||
cc->CreationDate() > Time::Now()) << L"CreationDate too recent";
|
cc->CreationDate() > Time::Now()) << L"CreationDate too recent";
|
||||||
cookies->push_back(cc.release());
|
cookies->push_back(cc.release());
|
||||||
@ -406,7 +473,6 @@ void BrowserPersistentCookieStore::Backend::Commit() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
transaction.Commit();
|
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
|
// 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.
|
// this fires we will already have been cleaned up and it will be ignored.
|
||||||
void BrowserPersistentCookieStore::Backend::Close() {
|
void BrowserPersistentCookieStore::Backend::Close() {
|
||||||
DCHECK(!CefThread::CurrentlyOn(CefThread::FILE));
|
if (CefThread::CurrentlyOn(CefThread::FILE)) {
|
||||||
// Must close the backend on the background thread.
|
InternalBackgroundClose();
|
||||||
CefThread::PostTask(
|
} else {
|
||||||
CefThread::FILE, FROM_HERE,
|
// Must close the backend on the background thread.
|
||||||
NewRunnableMethod(this, &Backend::InternalBackgroundClose));
|
CefThread::PostTask(
|
||||||
|
CefThread::FILE, FROM_HERE,
|
||||||
|
NewRunnableMethod(this, &Backend::InternalBackgroundClose));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserPersistentCookieStore::Backend::InternalBackgroundClose() {
|
void BrowserPersistentCookieStore::Backend::InternalBackgroundClose() {
|
||||||
@ -462,9 +531,8 @@ BrowserPersistentCookieStore::~BrowserPersistentCookieStore() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BrowserPersistentCookieStore::Load(
|
bool BrowserPersistentCookieStore::Load(const LoadedCallback& loaded_callback) {
|
||||||
std::vector<net::CookieMonster::CanonicalCookie*>* cookies) {
|
return backend_->Load(loaded_callback);
|
||||||
return backend_->Load(cookies);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserPersistentCookieStore::AddCookie(
|
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.
|
// 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
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
@ -31,16 +31,20 @@ class BrowserPersistentCookieStore
|
|||||||
explicit BrowserPersistentCookieStore(const FilePath& path);
|
explicit BrowserPersistentCookieStore(const FilePath& path);
|
||||||
virtual ~BrowserPersistentCookieStore();
|
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(
|
virtual void UpdateCookieAccessTime(
|
||||||
const net::CookieMonster::CanonicalCookie& cc);
|
const net::CookieMonster::CanonicalCookie& cc) OVERRIDE;
|
||||||
virtual void DeleteCookie(const net::CookieMonster::CanonicalCookie& cc);
|
|
||||||
|
|
||||||
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:
|
private:
|
||||||
class Backend;
|
class Backend;
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include "response_impl.h"
|
#include "response_impl.h"
|
||||||
#include "http_header_utils.h"
|
#include "http_header_utils.h"
|
||||||
|
|
||||||
|
#include "base/bind.h"
|
||||||
#include "base/file_path.h"
|
#include "base/file_path.h"
|
||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/memory/ref_counted.h"
|
#include "base/memory/ref_counted.h"
|
||||||
@ -680,9 +681,12 @@ class RequestProxy : public net::URLRequest::Delegate,
|
|||||||
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
|
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
|
||||||
if(handler.get()) {
|
if(handler.get()) {
|
||||||
CefString username, password;
|
CefString username, password;
|
||||||
if (handler->GetAuthCredentials(browser_, auth_info->is_proxy,
|
if (handler->GetAuthCredentials(browser_,
|
||||||
auth_info->host_and_port,
|
auth_info->is_proxy,
|
||||||
auth_info->realm, auth_info->scheme,
|
auth_info->challenger.host(),
|
||||||
|
auth_info->challenger.port(),
|
||||||
|
auth_info->realm,
|
||||||
|
auth_info->scheme,
|
||||||
username, password)) {
|
username, password)) {
|
||||||
request->SetAuth(username, password);
|
request->SetAuth(username, password);
|
||||||
return;
|
return;
|
||||||
@ -1030,8 +1034,11 @@ class CookieSetter : public base::RefCountedThreadSafe<CookieSetter> {
|
|||||||
REQUIRE_IOT();
|
REQUIRE_IOT();
|
||||||
net::CookieStore* cookie_store =
|
net::CookieStore* cookie_store =
|
||||||
_Context->request_context()->cookie_store();
|
_Context->request_context()->cookie_store();
|
||||||
if (cookie_store)
|
if (cookie_store) {
|
||||||
cookie_store->SetCookie(url, cookie);
|
cookie_store->SetCookieWithOptionsAsync(
|
||||||
|
url, cookie, net::CookieOptions(),
|
||||||
|
net::CookieStore::SetCookiesCallback());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -1048,9 +1055,11 @@ class CookieGetter : public base::RefCountedThreadSafe<CookieGetter> {
|
|||||||
void Get(const GURL& url) {
|
void Get(const GURL& url) {
|
||||||
net::CookieStore* cookie_store =
|
net::CookieStore* cookie_store =
|
||||||
_Context->request_context()->cookie_store();
|
_Context->request_context()->cookie_store();
|
||||||
if (cookie_store)
|
if (cookie_store) {
|
||||||
result_ = cookie_store->GetCookies(url);
|
cookie_store->GetCookiesWithOptionsAsync(
|
||||||
event_.Signal();
|
url, net::CookieOptions(),
|
||||||
|
base::Bind(&CookieGetter::OnGetCookies, this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetResult() {
|
std::string GetResult() {
|
||||||
@ -1060,6 +1069,10 @@ class CookieGetter : public base::RefCountedThreadSafe<CookieGetter> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void OnGetCookies(const std::string& cookie_line) {
|
||||||
|
result_ = cookie_line;
|
||||||
|
event_.Signal();
|
||||||
|
}
|
||||||
friend class base::RefCountedThreadSafe<CookieGetter>;
|
friend class base::RefCountedThreadSafe<CookieGetter>;
|
||||||
|
|
||||||
~CookieGetter() {}
|
~CookieGetter() {}
|
||||||
|
@ -20,8 +20,8 @@ MSVC_POP_WARNING();
|
|||||||
#include "cef_context.h"
|
#include "cef_context.h"
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
|
#include "base/memory/scoped_ptr.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/scoped_ptr.h"
|
|
||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
#include "base/string16.h"
|
#include "base/string16.h"
|
||||||
#include "net/base/mime_util.h"
|
#include "net/base/mime_util.h"
|
||||||
@ -55,13 +55,6 @@ bool IsProtocolSupportedForMedia(const GURL& url) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetWebKitLocale() {
|
|
||||||
const CefSettings& settings = _Context->settings();
|
|
||||||
if (settings.locale.length > 0)
|
|
||||||
return CefString(&settings.locale);
|
|
||||||
return "en-US";
|
|
||||||
}
|
|
||||||
|
|
||||||
void InitializeTextEncoding() {
|
void InitializeTextEncoding() {
|
||||||
WebCore::UTF8Encoding();
|
WebCore::UTF8Encoding();
|
||||||
}
|
}
|
||||||
@ -73,14 +66,6 @@ v8::Handle<v8::Context> GetV8Context(WebKit::WebFrame* frame)
|
|||||||
return WebCore::V8Proxy::context(core_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()
|
void ClearCache()
|
||||||
{
|
{
|
||||||
if (WebCore::memoryCache()->disabled())
|
if (WebCore::memoryCache()->disabled())
|
||||||
@ -109,10 +94,6 @@ std::string BuildUserAgent(bool mimic_windows) {
|
|||||||
return webkit_glue::BuildUserAgentHelper(mimic_windows, product_version);
|
return webkit_glue::BuildUserAgentHelper(mimic_windows, product_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsSingleProcess() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(OS_LINUX)
|
#if defined(OS_LINUX)
|
||||||
int MatchFontWithFallback(const std::string& face, bool bold,
|
int MatchFontWithFallback(const std::string& face, bool bold,
|
||||||
bool italic, int charset) {
|
bool italic, int charset) {
|
||||||
@ -125,10 +106,6 @@ bool GetFontTable(int fd, uint32_t table, uint8_t* output,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void EnableSpdy(bool enable) {
|
|
||||||
// Used in benchmarking, Ignored for CEF.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adapted from Chromium's BufferedResourceHandler::ShouldDownload
|
// Adapted from Chromium's BufferedResourceHandler::ShouldDownload
|
||||||
bool ShouldDownload(const std::string& content_disposition,
|
bool ShouldDownload(const std::string& content_disposition,
|
||||||
const std::string& mime_type)
|
const std::string& mime_type)
|
||||||
@ -180,7 +157,7 @@ bool ShouldDownload(const std::string& content_disposition,
|
|||||||
if (!plugins.empty()) {
|
if (!plugins.empty()) {
|
||||||
std::vector<webkit::WebPluginInfo>::const_iterator it = plugins.begin();
|
std::vector<webkit::WebPluginInfo>::const_iterator it = plugins.begin();
|
||||||
for (; it != plugins.end(); ++it) {
|
for (; it != plugins.end(); ++it) {
|
||||||
if (webkit::IsPluginEnabled(*it))
|
if (webkit_glue::IsPluginEnabled(*it))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -188,4 +165,8 @@ bool ShouldDownload(const std::string& content_disposition,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsPluginEnabled(const webkit::WebPluginInfo& plugin) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace webkit_glue
|
} // namespace webkit_glue
|
||||||
|
@ -14,6 +14,9 @@ namespace WebKit {
|
|||||||
class WebFrame;
|
class WebFrame;
|
||||||
class WebView;
|
class WebView;
|
||||||
}
|
}
|
||||||
|
namespace webkit {
|
||||||
|
struct WebPluginInfo;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
class FilePath;
|
class FilePath;
|
||||||
@ -52,4 +55,7 @@ void ClearCache();
|
|||||||
bool ShouldDownload(const std::string& content_disposition,
|
bool ShouldDownload(const std::string& content_disposition,
|
||||||
const std::string& mime_type);
|
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
|
} // namespace webkit_glue
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/mac/mac_util.h"
|
#include "base/mac/mac_util.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
|
#include "base/utf_string_conversions.h"
|
||||||
#include "grit/webkit_resources.h"
|
#include "grit/webkit_resources.h"
|
||||||
#include "ui/base/resource/data_pack.h"
|
#include "ui/base/resource/data_pack.h"
|
||||||
#include "webkit/glue/webkit_glue.h"
|
#include "webkit/glue/webkit_glue.h"
|
||||||
@ -59,8 +60,9 @@ string16 GetLocalizedString(int message_id) {
|
|||||||
LOG(FATAL) << "failed to load webkit string with id " << message_id;
|
LOG(FATAL) << "failed to load webkit string with id " << message_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
return string16(reinterpret_cast<const char16*>(res.data()),
|
string16 result;
|
||||||
res.length() / 2);
|
UTF8ToUTF16(res.data(), res.length(), &result);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
|
#include "base/memory/scoped_ptr.h"
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "base/scoped_ptr.h"
|
|
||||||
#include "build/build_config.h"
|
#include "build/build_config.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebContextMenuData.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.h"
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "cef_process.h"
|
#include "cef_process.h"
|
||||||
#include "../include/cef_nplugin.h"
|
#include "../include/cef_nplugin.h"
|
||||||
|
|
||||||
|
#include "base/bind.h"
|
||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/stringprintf.h"
|
#include "base/stringprintf.h"
|
||||||
#include "base/synchronization/waitable_event.h"
|
#include "base/synchronization/waitable_event.h"
|
||||||
@ -64,37 +65,56 @@ int GetThreadId(CefThreadId threadId)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IOT_VisitCookies(net::CookieMonster* cookie_monster,
|
// Callback class for visiting cookies.
|
||||||
const net::CookieList& list,
|
class VisitCookiesCallback : public base::RefCounted<VisitCookiesCallback> {
|
||||||
CefRefPtr<CefCookieVisitor> visitor)
|
public:
|
||||||
{
|
VisitCookiesCallback(CefRefPtr<CefCookieVisitor> visitor)
|
||||||
int total = list.size(), count = 0;
|
: visitor_(visitor)
|
||||||
|
{
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
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)
|
void IOT_VisitAllCookies(CefRefPtr<CefCookieVisitor> visitor)
|
||||||
{
|
{
|
||||||
@ -105,9 +125,11 @@ void IOT_VisitAllCookies(CefRefPtr<CefCookieVisitor> visitor)
|
|||||||
if (!cookie_monster)
|
if (!cookie_monster)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
net::CookieList list = cookie_monster->GetAllCookies();
|
scoped_refptr<VisitCookiesCallback> callback(
|
||||||
if (!list.empty())
|
new VisitCookiesCallback(visitor));
|
||||||
IOT_VisitCookies(cookie_monster, list, visitor);
|
|
||||||
|
cookie_monster->GetAllCookiesAsync(
|
||||||
|
base::Bind(&VisitCookiesCallback::Run, callback.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IOT_VisitUrlCookies(const GURL& url, bool includeHttpOnly,
|
void IOT_VisitUrlCookies(const GURL& url, bool includeHttpOnly,
|
||||||
@ -123,10 +145,12 @@ void IOT_VisitUrlCookies(const GURL& url, bool includeHttpOnly,
|
|||||||
net::CookieOptions options;
|
net::CookieOptions options;
|
||||||
if (includeHttpOnly)
|
if (includeHttpOnly)
|
||||||
options.set_include_httponly();
|
options.set_include_httponly();
|
||||||
net::CookieList list =
|
|
||||||
cookie_monster->GetAllCookiesForURLWithOptions(url, options);
|
scoped_refptr<VisitCookiesCallback> callback(
|
||||||
if (!list.empty())
|
new VisitCookiesCallback(visitor));
|
||||||
IOT_VisitCookies(cookie_monster, list, 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
|
// 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)
|
if (cookie.has_expires)
|
||||||
cef_time_to_basetime(cookie.expires, expiration_time);
|
cef_time_to_basetime(cookie.expires, expiration_time);
|
||||||
|
|
||||||
return cookie_monster->SetCookieWithDetails(gurl, name, value, domain, path,
|
cookie_monster->SetCookieWithDetailsAsync(gurl, name, value, domain, path,
|
||||||
expiration_time, cookie.secure,
|
expiration_time, cookie.secure, cookie.httponly,
|
||||||
cookie.httponly);
|
net::CookieStore::SetCookiesCallback());
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefDeleteCookies(const CefString& url, const CefString& cookie_name)
|
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()) {
|
if (url.empty()) {
|
||||||
// Delete all cookies.
|
// Delete all cookies.
|
||||||
cookie_monster->DeleteAll(true);
|
cookie_monster->DeleteAllAsync(net::CookieMonster::DeleteCallback());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,10 +463,11 @@ bool CefDeleteCookies(const CefString& url, const CefString& cookie_name)
|
|||||||
|
|
||||||
if (cookie_name.empty()) {
|
if (cookie_name.empty()) {
|
||||||
// Delete all matching host cookies.
|
// Delete all matching host cookies.
|
||||||
cookie_monster->DeleteAllForHost(gurl);
|
cookie_monster->DeleteAllForHostAsync(gurl,
|
||||||
|
net::CookieMonster::DeleteCallback());
|
||||||
} else {
|
} else {
|
||||||
// Delete all matching host and domain cookies.
|
// Delete all matching host and domain cookies.
|
||||||
cookie_monster->DeleteCookie(gurl, cookie_name);
|
cookie_monster->DeleteCookieAsync(gurl, cookie_name, base::Closure());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
#include "dom_storage_common.h"
|
#include "dom_storage_common.h"
|
||||||
|
|
||||||
#include "base/hash_tables.h"
|
#include "base/hash_tables.h"
|
||||||
#include "base/scoped_ptr.h"
|
#include "base/memory/scoped_ptr.h"
|
||||||
#include "base/string16.h"
|
#include "base/string16.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h"
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ class ExternalPopupMenu : public WebKit::WebExternalPopupMenu {
|
|||||||
ExternalPopupMenu(BrowserWebViewDelegate* delegate,
|
ExternalPopupMenu(BrowserWebViewDelegate* delegate,
|
||||||
const WebKit::WebPopupMenuInfo& popup_menu_info,
|
const WebKit::WebPopupMenuInfo& popup_menu_info,
|
||||||
WebKit::WebExternalPopupMenuClient* popup_menu_client);
|
WebKit::WebExternalPopupMenuClient* popup_menu_client);
|
||||||
|
virtual ~ExternalPopupMenu() {}
|
||||||
|
|
||||||
// WebKit::WebExternalPopupMenu implementation:
|
// WebKit::WebExternalPopupMenu implementation:
|
||||||
virtual void show(const WebKit::WebRect& bounds);
|
virtual void show(const WebKit::WebRect& bounds);
|
||||||
|
@ -799,7 +799,7 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::GetValue(const CefString& key)
|
|||||||
return NULL;
|
return NULL;
|
||||||
if(!GetHandle()->IsObject()) {
|
if(!GetHandle()->IsObject()) {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
return false;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::HandleScope handle_scope;
|
v8::HandleScope handle_scope;
|
||||||
@ -812,7 +812,7 @@ CefRefPtr<CefV8Value> CefV8ValueImpl::GetValue(int index)
|
|||||||
CEF_REQUIRE_UI_THREAD(NULL);
|
CEF_REQUIRE_UI_THREAD(NULL);
|
||||||
if(!GetHandle()->IsObject()) {
|
if(!GetHandle()->IsObject()) {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
return false;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::HandleScope handle_scope;
|
v8::HandleScope handle_scope;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "browser_webkit_glue.h"
|
||||||
#import "web_drag_utils_mac.h"
|
#import "web_drag_utils_mac.h"
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
@ -87,7 +88,7 @@ static BOOL IsSupportedFileURL(const GURL& url) {
|
|||||||
if (!plugins.empty()) {
|
if (!plugins.empty()) {
|
||||||
std::vector<webkit::WebPluginInfo>::const_iterator it = plugins.begin();
|
std::vector<webkit::WebPluginInfo>::const_iterator it = plugins.begin();
|
||||||
for (; it != plugins.end(); ++it) {
|
for (; it != plugins.end(); ++it) {
|
||||||
if (webkit::IsPluginEnabled(*it))
|
if (webkit_glue::IsPluginEnabled(*it))
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#define _WEB_DROP_TARGET_WIN_H
|
#define _WEB_DROP_TARGET_WIN_H
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "base/scoped_ptr.h"
|
#include "base/memory/scoped_ptr.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h"
|
||||||
#include "ui/base/dragdrop/drop_target.h"
|
#include "ui/base/dragdrop/drop_target.h"
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "response_impl.h"
|
#include "response_impl.h"
|
||||||
|
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/scoped_ptr.h"
|
#include "base/memory/scoped_ptr.h"
|
||||||
#include "googleurl/src/gurl.h"
|
#include "googleurl/src/gurl.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebURLLoaderClient.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_string.h"
|
||||||
#include "include/internal/cef_types.h"
|
#include "include/internal/cef_types.h"
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
#include "base/scoped_ptr.h"
|
#include "base/memory/scoped_ptr.h"
|
||||||
#include "base/task.h"
|
#include "base/task.h"
|
||||||
#include "skia/ext/platform_canvas.h"
|
#include "skia/ext/platform_canvas.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.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(
|
int CEF_CALLBACK request_handler_get_auth_credentials(
|
||||||
struct _cef_request_handler_t* self, cef_browser_t* browser, int isProxy,
|
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,
|
const cef_string_t* scheme, cef_string_t* username,
|
||||||
cef_string_t* password)
|
cef_string_t* password)
|
||||||
{
|
{
|
||||||
@ -155,7 +155,7 @@ int CEF_CALLBACK request_handler_get_auth_credentials(
|
|||||||
CefString passwordStr(password);
|
CefString passwordStr(password);
|
||||||
return CefRequestHandlerCppToC::Get(self)->GetAuthCredentials(
|
return CefRequestHandlerCppToC::Get(self)->GetAuthCredentials(
|
||||||
CefBrowserCToCpp::Wrap(browser), (isProxy ? true : false),
|
CefBrowserCToCpp::Wrap(browser), (isProxy ? true : false),
|
||||||
CefString(host), CefString(realm), CefString(scheme), usernameStr,
|
CefString(host), port, CefString(realm), CefString(scheme), usernameStr,
|
||||||
passwordStr);
|
passwordStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,14 +105,14 @@ bool CefRequestHandlerCToCpp::GetDownloadHandler(CefRefPtr<CefBrowser> browser,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CefRequestHandlerCToCpp::GetAuthCredentials(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)
|
const CefString& scheme, CefString& username, CefString& password)
|
||||||
{
|
{
|
||||||
if (CEF_MEMBER_MISSING(struct_, get_auth_credentials))
|
if (CEF_MEMBER_MISSING(struct_, get_auth_credentials))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return struct_->get_auth_credentials(struct_, CefBrowserCppToC::Wrap(browser),
|
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()) ?
|
username.GetWritableStruct(), password.GetWritableStruct()) ?
|
||||||
true : false;
|
true : false;
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,9 @@ public:
|
|||||||
const CefString& mimeType, const CefString& fileName,
|
const CefString& mimeType, const CefString& fileName,
|
||||||
int64 contentLength, CefRefPtr<CefDownloadHandler>& handler) OVERRIDE;
|
int64 contentLength, CefRefPtr<CefDownloadHandler>& handler) OVERRIDE;
|
||||||
virtual bool GetAuthCredentials(CefRefPtr<CefBrowser> browser, bool isProxy,
|
virtual bool GetAuthCredentials(CefRefPtr<CefBrowser> browser, bool isProxy,
|
||||||
const CefString& host, const CefString& realm, const CefString& scheme,
|
const CefString& host, int port, const CefString& realm,
|
||||||
CefString& username, CefString& password) OVERRIDE;
|
const CefString& scheme, CefString& username,
|
||||||
|
CefString& password) OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BUILDING_CEF_SHARED
|
#endif // BUILDING_CEF_SHARED
|
||||||
|
Reference in New Issue
Block a user