libcef: Update due to underlying chromium changes.

- WebKit API upstreamed requiring header include path changes.
- AppCache, Database and ResourceLoader updates.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@65 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2010-01-12 01:37:00 +00:00
parent 0b9e189154
commit 23e155dca1
29 changed files with 441 additions and 217 deletions

View File

@ -47,3 +47,4 @@ Date | CEF Revision | Chromium Revision
2009-10-25 | /trunk@61 | /trunk@30028 2009-10-25 | /trunk@61 | /trunk@30028
2009-11-02 | /trunk@63 | /trunk@30778 2009-11-02 | /trunk@63 | /trunk@30778
2009-11-04 | /trunk@64 | /trunk@31062 2009-11-04 | /trunk@64 | /trunk@31062
2010-01-11 | /trunk@65 | /trunk@35902

View File

@ -145,6 +145,7 @@
'../third_party/WebKit/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:pcre', '../third_party/WebKit/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:pcre',
'../third_party/WebKit/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf', '../third_party/WebKit/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf',
'../third_party/WebKit/WebCore/WebCore.gyp/WebCore.gyp:webcore', '../third_party/WebKit/WebCore/WebCore.gyp/WebCore.gyp:webcore',
'../third_party/WebKit/WebKit/chromium/WebKit.gyp:webkit',
'../third_party/zlib/zlib.gyp:zlib', '../third_party/zlib/zlib.gyp:zlib',
'../webkit/api/WebKit.gyp:webkit', '../webkit/api/WebKit.gyp:webkit',
'../webkit/webkit.gyp:appcache', '../webkit/webkit.gyp:appcache',
@ -307,6 +308,7 @@
'../third_party/WebKit/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:pcre', '../third_party/WebKit/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:pcre',
'../third_party/WebKit/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf', '../third_party/WebKit/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf',
'../third_party/WebKit/WebCore/WebCore.gyp/WebCore.gyp:webcore', '../third_party/WebKit/WebCore/WebCore.gyp/WebCore.gyp:webcore',
'../third_party/WebKit/WebKit/chromium/WebKit.gyp:webkit',
'../third_party/zlib/zlib.gyp:zlib', '../third_party/zlib/zlib.gyp:zlib',
'../webkit/api/WebKit.gyp:webkit', '../webkit/api/WebKit.gyp:webkit',
'../webkit/webkit.gyp:appcache', '../webkit/webkit.gyp:appcache',

View File

@ -3,20 +3,47 @@
// LICENSE file. // LICENSE file.
#include "browser_appcache_system.h" #include "browser_appcache_system.h"
#include "browser_resource_loader_bridge.h"
#include "base/lock.h" #include "base/lock.h"
#include "base/task.h" #include "base/task.h"
#include "base/waitable_event.h" #include "base/waitable_event.h"
#include "webkit/appcache/appcache_interceptor.h" #include "webkit/appcache/appcache_interceptor.h"
#include "webkit/appcache/web_application_cache_host_impl.h" #include "webkit/appcache/web_application_cache_host_impl.h"
#include "browser_resource_loader_bridge.h"
using WebKit::WebApplicationCacheHost; using WebKit::WebApplicationCacheHost;
using WebKit::WebApplicationCacheHostClient; 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.
@ -72,6 +99,10 @@ class BrowserFrontendProxy
} }
private: private:
friend class base::RefCountedThreadSafe<BrowserFrontendProxy>;
~BrowserFrontendProxy() {}
BrowserAppCacheSystem* system_; BrowserAppCacheSystem* system_;
}; };
@ -215,6 +246,10 @@ class BrowserBackendProxy
} }
private: private:
friend class base::RefCountedThreadSafe<BrowserBackendProxy>;
~BrowserBackendProxy() {}
BrowserAppCacheSystem* system_; BrowserAppCacheSystem* system_;
base::WaitableEvent event_; base::WaitableEvent event_;
bool bool_result_; bool bool_result_;
@ -239,7 +274,8 @@ 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) { backend_impl_(NULL), service_(NULL), db_thread_("AppCacheDBThread"),
thread_provider_(NULL) {
DCHECK(!instance_); DCHECK(!instance_);
instance_ = this; instance_ = this;
} }
@ -254,6 +290,7 @@ void BrowserAppCacheSystem::InitOnUIThread(
const FilePath& cache_directory) { const FilePath& cache_directory) {
DCHECK(!ui_message_loop_); DCHECK(!ui_message_loop_);
DCHECK(!cache_directory.empty()); DCHECK(!cache_directory.empty());
AppCacheThread::InitIDs(DB_THREAD_ID, IO_THREAD_ID);
ui_message_loop_ = MessageLoop::current(); ui_message_loop_ = MessageLoop::current();
cache_directory_ = cache_directory; cache_directory_ = cache_directory;
} }
@ -266,6 +303,9 @@ void BrowserAppCacheSystem::InitOnIOThread(URLRequestContext* request_context) {
io_message_loop_ = MessageLoop::current(); io_message_loop_ = MessageLoop::current();
io_message_loop_->AddDestructionObserver(this); io_message_loop_->AddDestructionObserver(this);
if (!db_thread_.IsRunning())
db_thread_.Start();
// Recreate and initialize per each IO thread. // Recreate and initialize per each IO thread.
service_ = new appcache::AppCacheService(); service_ = new appcache::AppCacheService();
backend_impl_ = new appcache::AppCacheBackendImpl(); backend_impl_ = new appcache::AppCacheBackendImpl();
@ -313,11 +353,11 @@ void BrowserAppCacheSystem::WillDestroyCurrentMessageLoop() {
DCHECK(is_io_thread()); DCHECK(is_io_thread());
DCHECK(backend_impl_->hosts().empty()); DCHECK(backend_impl_->hosts().empty());
io_message_loop_ = NULL;
delete backend_impl_; delete backend_impl_;
delete service_; delete service_;
backend_impl_ = NULL; backend_impl_ = NULL;
service_ = NULL; service_ = NULL;
io_message_loop_ = NULL;
// Just in case the main thread is waiting on it. // Just in case the main thread is waiting on it.
backend_proxy_->SignalEvent(); backend_proxy_->SignalEvent();

View File

@ -7,9 +7,11 @@
#include "base/file_path.h" #include "base/file_path.h"
#include "base/message_loop.h" #include "base/message_loop.h"
#include "base/thread.h"
#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 WebKit { namespace WebKit {
@ -71,12 +73,37 @@ class BrowserAppCacheSystem : public MessageLoop::DestructionObserver {
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;
// A low-tech singleton.
static BrowserAppCacheSystem* instance_;
// 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);
@ -101,6 +128,16 @@ class BrowserAppCacheSystem : public MessageLoop::DestructionObserver {
bool is_initailized_on_ui_thread() { bool is_initailized_on_ui_thread() {
return ui_message_loop_ && !cache_directory_.empty(); return ui_message_loop_ && !cache_directory_.empty();
} }
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;
}
// IOThread DestructionObserver // IOThread DestructionObserver
virtual void WillDestroyCurrentMessageLoop(); virtual void WillDestroyCurrentMessageLoop();
@ -117,6 +154,15 @@ class BrowserAppCacheSystem : public MessageLoop::DestructionObserver {
// is started new instances will be created. // is started new instances will be created.
appcache::AppCacheBackendImpl* backend_impl_; appcache::AppCacheBackendImpl* backend_impl_;
appcache::AppCacheService* service_; appcache::AppCacheService* service_;
// 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_;
}; };
#endif // _BROWSER_APPCACHE_SYSTEM_H #endif // _BROWSER_APPCACHE_SYSTEM_H

View File

@ -11,12 +11,15 @@
#endif #endif
#include "base/file_util.h" #include "base/file_util.h"
#include "base/logging.h"
#include "base/platform_thread.h" #include "base/platform_thread.h"
#include "base/process_util.h" #include "base/process_util.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDatabase.h"
#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
#include "webkit/database/database_util.h"
#include "webkit/database/vfs_backend.h" #include "webkit/database/vfs_backend.h"
#include "webkit/glue/webkit_glue.h"
using webkit_database::DatabaseTracker;
using webkit_database::DatabaseUtil;
using webkit_database::VfsBackend; using webkit_database::VfsBackend;
BrowserDatabaseSystem* BrowserDatabaseSystem::instance_ = NULL; BrowserDatabaseSystem* BrowserDatabaseSystem::instance_ = NULL;
@ -26,57 +29,46 @@ BrowserDatabaseSystem* BrowserDatabaseSystem::GetInstance() {
return instance_; return instance_;
} }
BrowserDatabaseSystem::BrowserDatabaseSystem() BrowserDatabaseSystem::BrowserDatabaseSystem() {
: hack_main_db_handle_(base::kInvalidPlatformFileValue) {
temp_dir_.CreateUniqueTempDir(); temp_dir_.CreateUniqueTempDir();
db_tracker_ = new DatabaseTracker(temp_dir_.path());
DCHECK(!instance_); DCHECK(!instance_);
instance_ = this; instance_ = this;
} }
BrowserDatabaseSystem::~BrowserDatabaseSystem() { BrowserDatabaseSystem::~BrowserDatabaseSystem() {
base::ClosePlatformFile(hack_main_db_handle_);
instance_ = NULL; instance_ = NULL;
} }
base::PlatformFile BrowserDatabaseSystem::OpenFile( base::PlatformFile BrowserDatabaseSystem::OpenFile(
const FilePath& file_name, int desired_flags, const string16& vfs_file_name, int desired_flags,
base::PlatformFile* dir_handle) { base::PlatformFile* dir_handle) {
base::PlatformFile file_handle = base::kInvalidPlatformFileValue; base::PlatformFile file_handle = base::kInvalidPlatformFileValue;
VfsBackend::OpenFile(GetDBFileFullPath(file_name), GetDBDir(), desired_flags, FilePath file_name = GetFullFilePathForVfsFile(vfs_file_name);
base::GetCurrentProcessHandle(), &file_handle, if (file_name.empty()) {
dir_handle); VfsBackend::OpenTempFileInDirectory(
db_tracker_->DatabaseDirectory(), desired_flags,
// HACK: Currently, the DB object that keeps track of the main database base::GetCurrentProcessHandle(), &file_handle, dir_handle);
// (DatabaseTracker) is a singleton that is declared as a static variable } else {
// in a function, so it gets destroyed at the very end of the program. VfsBackend::OpenFile(file_name, desired_flags,
// Because of that, we have a handle opened to the main DB file until the base::GetCurrentProcessHandle(), &file_handle,
// very end of the program, which prevents temp_dir_'s destructor from dir_handle);
// deleting the database directory.
//
// We will properly solve this problem when we reimplement DatabaseTracker.
// For now, however, we are going to take advantage of the fact that in order
// to do anything related to DBs, we have to call openDatabase() first, which
// opens a handle to the main DB before opening handles to any other DB files.
// We are going to cache the first file handle we get, and we are going to
// manually close it in the destructor.
if (hack_main_db_handle_ == base::kInvalidPlatformFileValue) {
hack_main_db_handle_ = file_handle;
} }
return file_handle; return file_handle;
} }
int BrowserDatabaseSystem::DeleteFile( int BrowserDatabaseSystem::DeleteFile(
const FilePath& file_name, bool sync_dir) { const string16& vfs_file_name, bool sync_dir) {
// We try to delete the file multiple times, because that's what the default // We try to delete the file multiple times, because that's what the default
// VFS does (apparently deleting a file can sometimes fail on Windows). // VFS does (apparently deleting a file can sometimes fail on Windows).
// We sleep for 10ms between retries for the same reason. // We sleep for 10ms between retries for the same reason.
const int kNumDeleteRetries = 3; const int kNumDeleteRetries = 3;
int num_retries = 0; int num_retries = 0;
int error_code = SQLITE_OK; int error_code = SQLITE_OK;
FilePath file_name = GetFullFilePathForVfsFile(vfs_file_name);
do { do {
error_code = VfsBackend::DeleteFile( error_code = VfsBackend::DeleteFile(file_name, sync_dir);
GetDBFileFullPath(file_name), GetDBDir(), sync_dir);
} while ((++num_retries < kNumDeleteRetries) && } while ((++num_retries < kNumDeleteRetries) &&
(error_code == SQLITE_IOERR_DELETE) && (error_code == SQLITE_IOERR_DELETE) &&
(PlatformThread::Sleep(10), 1)); (PlatformThread::Sleep(10), 1));
@ -84,25 +76,99 @@ int BrowserDatabaseSystem::DeleteFile(
return error_code; return error_code;
} }
long BrowserDatabaseSystem::GetFileAttributes( long BrowserDatabaseSystem::GetFileAttributes(const string16& vfs_file_name) {
const FilePath& file_name) { return VfsBackend::GetFileAttributes(
return VfsBackend::GetFileAttributes(GetDBFileFullPath(file_name)); GetFullFilePathForVfsFile(vfs_file_name));
} }
long long BrowserDatabaseSystem::GetFileSize( long long BrowserDatabaseSystem::GetFileSize(const string16& vfs_file_name) {
const FilePath& file_name) { return VfsBackend::GetFileSize(GetFullFilePathForVfsFile(vfs_file_name));
return VfsBackend::GetFileSize(GetDBFileFullPath(file_name)); }
void BrowserDatabaseSystem::DatabaseOpened(const string16& origin_identifier,
const string16& database_name,
const string16& description,
int64 estimated_size) {
int64 database_size = 0;
int64 space_available = 0;
database_connections_.AddConnection(origin_identifier, database_name);
db_tracker_->DatabaseOpened(origin_identifier, database_name, description,
estimated_size, &database_size, &space_available);
SetFullFilePathsForVfsFile(origin_identifier, database_name);
OnDatabaseSizeChanged(origin_identifier, database_name,
database_size, space_available);
}
void BrowserDatabaseSystem::DatabaseModified(const string16& origin_identifier,
const string16& database_name) {
DCHECK(database_connections_.IsDatabaseOpened(
origin_identifier, database_name));
db_tracker_->DatabaseModified(origin_identifier, database_name);
}
void BrowserDatabaseSystem::DatabaseClosed(const string16& origin_identifier,
const string16& database_name) {
DCHECK(database_connections_.IsDatabaseOpened(
origin_identifier, database_name));
db_tracker_->DatabaseClosed(origin_identifier, database_name);
database_connections_.RemoveConnection(origin_identifier, database_name);
}
void BrowserDatabaseSystem::OnDatabaseSizeChanged(
const string16& origin_identifier,
const string16& database_name,
int64 database_size,
int64 space_available) {
if (database_connections_.IsOriginUsed(origin_identifier)) {
WebKit::WebDatabase::updateDatabaseSize(
origin_identifier, database_name, database_size, space_available);
}
}
void BrowserDatabaseSystem::databaseOpened(const WebKit::WebDatabase& database) {
DatabaseOpened(database.securityOrigin().databaseIdentifier(),
database.name(), database.displayName(),
database.estimatedSize());
}
void BrowserDatabaseSystem::databaseModified(
const WebKit::WebDatabase& database) {
DatabaseModified(database.securityOrigin().databaseIdentifier(),
database.name());
}
void BrowserDatabaseSystem::databaseClosed(const WebKit::WebDatabase& database) {
DatabaseClosed(database.securityOrigin().databaseIdentifier(),
database.name());
} }
void BrowserDatabaseSystem::ClearAllDatabases() { void BrowserDatabaseSystem::ClearAllDatabases() {
// TODO(dumi): implement this once we refactor DatabaseTracker db_tracker_->CloseDatabases(database_connections_);
//file_util::Delete(GetDBDir(), true); database_connections_.RemoveAllConnections();
db_tracker_->CloseTrackerDatabaseAndClearCaches();
file_util::Delete(db_tracker_->DatabaseDirectory(), true);
file_names_.clear();
} }
FilePath BrowserDatabaseSystem::GetDBDir() { void BrowserDatabaseSystem::SetFullFilePathsForVfsFile(
return temp_dir_.path().Append(FILE_PATH_LITERAL("databases")); const string16& origin_identifier,
const string16& database_name) {
string16 vfs_file_name = origin_identifier + ASCIIToUTF16("/") +
database_name + ASCIIToUTF16("#");
FilePath file_name =
DatabaseUtil::GetFullFilePathForVfsFile(db_tracker_, vfs_file_name);
AutoLock file_names_auto_lock(file_names_lock_);
file_names_[vfs_file_name] = file_name;
file_names_[vfs_file_name + ASCIIToUTF16("-journal")] =
FilePath::FromWStringHack(file_name.ToWStringHack() +
ASCIIToWide("-journal"));
} }
FilePath BrowserDatabaseSystem::GetDBFileFullPath(const FilePath& file_name) { FilePath BrowserDatabaseSystem::GetFullFilePathForVfsFile(
return GetDBDir().Append(file_name); const string16& vfs_file_name) {
} AutoLock file_names_auto_lock(file_names_lock_);
DCHECK(file_names_.find(vfs_file_name) != file_names_.end());
return file_names_[vfs_file_name];
}

View File

@ -6,33 +6,76 @@
#define _BROWSER_DATABASE_SYSTEM_H #define _BROWSER_DATABASE_SYSTEM_H
#include "base/file_path.h" #include "base/file_path.h"
#include "base/hash_tables.h"
#include "base/lock.h"
#include "base/platform_file.h" #include "base/platform_file.h"
#include "base/ref_counted.h"
#include "base/scoped_temp_dir.h" #include "base/scoped_temp_dir.h"
#include "base/string16.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDatabaseObserver.h"
#include "webkit/database/database_connections.h"
#include "webkit/database/database_tracker.h"
class BrowserDatabaseSystem { class BrowserDatabaseSystem : public webkit_database::DatabaseTracker::Observer,
public WebKit::WebDatabaseObserver {
public: public:
static BrowserDatabaseSystem* GetInstance(); static BrowserDatabaseSystem* GetInstance();
BrowserDatabaseSystem(); BrowserDatabaseSystem();
~BrowserDatabaseSystem(); ~BrowserDatabaseSystem();
base::PlatformFile OpenFile( // VFS functions
const FilePath& file_name, int desired_flags, base::PlatformFile OpenFile(const string16& vfs_file_name,
base::PlatformFile* dir_handle); int desired_flags,
int DeleteFile(const FilePath& file_name, bool sync_dir); base::PlatformFile* dir_handle);
long GetFileAttributes(const FilePath& file_name); int DeleteFile(const string16& vfs_file_name, bool sync_dir);
long long GetFileSize(const FilePath& file_name); long GetFileAttributes(const string16& vfs_file_name);
long long GetFileSize(const string16& vfs_file_name);
// database tracker functions
void DatabaseOpened(const string16& origin_identifier,
const string16& database_name,
const string16& description,
int64 estimated_size);
void DatabaseModified(const string16& origin_identifier,
const string16& database_name);
void DatabaseClosed(const string16& origin_identifier,
const string16& database_name);
// DatabaseTracker::Observer implementation
virtual void OnDatabaseSizeChanged(const string16& origin_identifier,
const string16& database_name,
int64 database_size,
int64 space_available);
// WebDatabaseObserver implementation
virtual void databaseOpened(const WebKit::WebDatabase& database);
virtual void databaseModified(const WebKit::WebDatabase& database);
virtual void databaseClosed(const WebKit::WebDatabase& database);
void ClearAllDatabases(); void ClearAllDatabases();
private: private:
FilePath GetDBDir(); // The calls that come from the database tracker run on the main thread.
FilePath GetDBFileFullPath(const FilePath& file_name); // Therefore, we can only call DatabaseUtil::GetFullFilePathForVfsFile()
// on the main thread. However, the VFS calls run on the DB thread and
// they need to crack VFS file paths. To resolve this problem, we store
// a map of vfs_file_names to file_paths. The map is updated on the main
// thread on each DatabaseOpened() call that comes from the database
// tracker, and is read on the DB thread by each VFS call.
void SetFullFilePathsForVfsFile(const string16& origin_identifier,
const string16& database_name);
FilePath GetFullFilePathForVfsFile(const string16& vfs_file_name);
static BrowserDatabaseSystem* instance_; static BrowserDatabaseSystem* instance_;
ScopedTempDir temp_dir_; ScopedTempDir temp_dir_;
// HACK: see OpenFile's implementation scoped_refptr<webkit_database::DatabaseTracker> db_tracker_;
base::PlatformFile hack_main_db_handle_;
Lock file_names_lock_;
base::hash_map<string16, FilePath> file_names_;
webkit_database::DatabaseConnections database_connections_;
}; };
#endif // _BROWSER_DATABASE_SYSTEM_H #endif // _BROWSER_DATABASE_SYSTEM_H

View File

@ -5,8 +5,8 @@
#include "browser_drag_delegate.h" #include "browser_drag_delegate.h"
#include "webkit/api/public/WebPoint.h" #include "third_party/WebKit/WebKit/chromium/public/WebPoint.h"
#include "webkit/api/public/WebView.h" #include "third_party/WebKit/WebKit/chromium/public/WebView.h"
using WebKit::WebPoint; using WebKit::WebPoint;
using WebKit::WebView; using WebKit::WebView;
@ -40,10 +40,3 @@ void BrowserDragDelegate::OnDragSourceDrop() {
webview_->dragSourceEndedAt(client, screen, WebKit::WebDragOperationCopy); webview_->dragSourceEndedAt(client, screen, WebKit::WebDragOperationCopy);
// TODO(snej): Pass the real drag operation instead // TODO(snej): Pass the real drag operation instead
} }
void BrowserDragDelegate::OnDragSourceMove() {
gfx::Point client;
gfx::Point screen;
GetCursorPositions(source_hwnd_, &client, &screen);
webview_->dragSourceMovedTo(client, screen);
}

View File

@ -5,9 +5,9 @@
#include "browser_drop_delegate.h" #include "browser_drop_delegate.h"
#include "webkit/api/public/WebDragData.h" #include "third_party/WebKit/WebKit/chromium/public/WebDragData.h"
#include "webkit/api/public/WebPoint.h" #include "third_party/WebKit/WebKit/chromium/public/WebPoint.h"
#include "webkit/api/public/WebView.h" #include "third_party/WebKit/WebKit/chromium/public/WebView.h"
#include "webkit/glue/webdropdata.h" #include "webkit/glue/webdropdata.h"
using WebKit::WebDragOperation; using WebKit::WebDragOperation;

View File

@ -8,13 +8,13 @@
#include "request_impl.h" #include "request_impl.h"
#include "base/string_util.h" #include "base/string_util.h"
#include "webkit/api/public/WebFrame.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
#include "webkit/api/public/WebHTTPBody.h" #include "third_party/WebKit/WebKit/chromium/public/WebHTTPBody.h"
#include "webkit/api/public/WebScriptSource.h" #include "third_party/WebKit/WebKit/chromium/public/WebScriptSource.h"
#include "webkit/api/public/WebString.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h"
#include "webkit/api/public/WebURL.h" #include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
#include "webkit/api/public/WebURLRequest.h" #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h"
#include "webkit/api/public/WebView.h" #include "third_party/WebKit/WebKit/chromium/public/WebView.h"
#include "webkit/glue/glue_serialize.h" #include "webkit/glue/glue_serialize.h"
#include "webkit/glue/glue_util.h" #include "webkit/glue/glue_util.h"

View File

@ -12,10 +12,10 @@
#include "base/string_util.h" #include "base/string_util.h"
#include "base/win_util.h" #include "base/win_util.h"
#include "skia/ext/vector_canvas.h" #include "skia/ext/vector_canvas.h"
#include "webkit/api/public/WebFrame.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
#include "webkit/api/public/WebRect.h" #include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
#include "webkit/api/public/WebSize.h" #include "third_party/WebKit/WebKit/chromium/public/WebSize.h"
#include "webkit/api/public/WebView.h" #include "third_party/WebKit/WebKit/chromium/public/WebView.h"
#include "webkit/glue/webkit_glue.h" #include "webkit/glue/webkit_glue.h"
#include <shellapi.h> #include <shellapi.h>

View File

@ -13,8 +13,8 @@
#include "base/linked_ptr.h" #include "base/linked_ptr.h"
#include "base/ref_counted.h" #include "base/ref_counted.h"
#include "googleurl/src/gurl.h" #include "googleurl/src/gurl.h"
#include "webkit/api/public/WebDataSource.h" #include "third_party/WebKit/WebKit/chromium/public/WebDataSource.h"
#include "webkit/api/public/WebHTTPBody.h" #include "third_party/WebKit/WebKit/chromium/public/WebHTTPBody.h"
#include "include/cef.h" #include "include/cef.h"

View File

@ -43,7 +43,7 @@ void BrowserRequestContext::Init(
net::ProxyService::CreateSystemProxyConfigService(NULL, NULL)); net::ProxyService::CreateSystemProxyConfigService(NULL, NULL));
host_resolver_ = net::CreateSystemHostResolver(); host_resolver_ = net::CreateSystemHostResolver();
proxy_service_ = net::ProxyService::Create(proxy_config_service.release(), proxy_service_ = net::ProxyService::Create(proxy_config_service.release(),
false, NULL, NULL); false, NULL, NULL, NULL);
ssl_config_service_ = net::SSLConfigService::CreateSystemSSLConfigService(); ssl_config_service_ = net::SSLConfigService::CreateSystemSSLConfigService();
net::HttpCache *cache; net::HttpCache *cache;

View File

@ -23,11 +23,11 @@ class BrowserRequestContext : public URLRequestContext {
net::HttpCache::Mode cache_mode, net::HttpCache::Mode cache_mode,
bool no_proxy); bool no_proxy);
~BrowserRequestContext();
virtual const std::string& GetUserAgent(const GURL& url) const; virtual const std::string& GetUserAgent(const GURL& url) const;
private: private:
~BrowserRequestContext();
void Init(const FilePath& cache_path, net::HttpCache::Mode cache_mode, void Init(const FilePath& cache_path, net::HttpCache::Mode cache_mode,
bool no_proxy); bool no_proxy);
}; };

View File

@ -55,8 +55,8 @@
#include "net/http/http_util.h" #include "net/http/http_util.h"
#include "net/proxy/proxy_service.h" #include "net/proxy/proxy_service.h"
#include "net/url_request/url_request.h" #include "net/url_request/url_request.h"
#include "webkit/api/public/WebFrame.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
#include "webkit/api/public/WebView.h" #include "third_party/WebKit/WebKit/chromium/public/WebView.h"
#include "webkit/appcache/appcache_interfaces.h" #include "webkit/appcache/appcache_interfaces.h"
#include "webkit/glue/resource_loader_bridge.h" #include "webkit/glue/resource_loader_bridge.h"
@ -127,12 +127,6 @@ class RequestProxy : public URLRequest::Delegate,
{ {
} }
virtual ~RequestProxy() {
// If we have a request, then we'd better be on the io thread!
DCHECK(!request_.get() ||
MessageLoop::current() == io_thread->message_loop());
}
void DropPeer() { void DropPeer() {
peer_ = NULL; peer_ = NULL;
} }
@ -153,6 +147,14 @@ class RequestProxy : public URLRequest::Delegate,
} }
protected: protected:
friend class base::RefCountedThreadSafe<RequestProxy>;
virtual ~RequestProxy() {
// If we have a request, then we'd better be on the io thread!
DCHECK(!request_.get() ||
MessageLoop::current() == io_thread->message_loop());
}
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// The following methods are called on the owner's thread in response to // The following methods are called on the owner's thread in response to
// various URLRequest callbacks. The event hooks, defined below, trigger // various URLRequest callbacks. The event hooks, defined below, trigger
@ -165,9 +167,14 @@ class RequestProxy : public URLRequest::Delegate,
void NotifyReceivedRedirect(const GURL& new_url, void NotifyReceivedRedirect(const GURL& new_url,
const ResourceLoaderBridge::ResponseInfo& info) { const ResourceLoaderBridge::ResponseInfo& info) {
if (peer_ && peer_->OnReceivedRedirect(new_url, info)) { bool has_new_first_party_for_cookies = false;
GURL new_first_party_for_cookies;
if (peer_ && peer_->OnReceivedRedirect(new_url, info,
&has_new_first_party_for_cookies,
&new_first_party_for_cookies)) {
io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
this, &RequestProxy::AsyncFollowDeferredRedirect)); this, &RequestProxy::AsyncFollowDeferredRedirect,
has_new_first_party_for_cookies, new_first_party_for_cookies));
} else { } else {
Cancel(); Cancel();
} }
@ -316,11 +323,14 @@ class RequestProxy : public URLRequest::Delegate,
Done(); Done();
} }
void AsyncFollowDeferredRedirect() { void AsyncFollowDeferredRedirect(bool has_new_first_party_for_cookies,
const GURL& new_first_party_for_cookies) {
// This can be null in cases where the request is already done. // This can be null in cases where the request is already done.
if (!request_.get()) if (!request_.get())
return; return;
if (has_new_first_party_for_cookies)
request_->set_first_party_for_cookies(new_first_party_for_cookies);
request_->FollowDeferredRedirect(); request_->FollowDeferredRedirect();
} }
@ -577,25 +587,18 @@ class SyncRequestProxy : public RequestProxy {
class ResourceLoaderBridgeImpl : public ResourceLoaderBridge { class ResourceLoaderBridgeImpl : public ResourceLoaderBridge {
public: public:
ResourceLoaderBridgeImpl(CefRefPtr<CefBrowser> browser, ResourceLoaderBridgeImpl(CefRefPtr<CefBrowser> browser,
const std::string& method, const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info)
const GURL& url,
const GURL& first_party_for_cookies,
const GURL& referrer,
const std::string& headers,
int load_flags,
ResourceType::Type request_type,
int appcache_host_id)
: browser_(browser), : browser_(browser),
params_(new RequestParams), params_(new RequestParams),
proxy_(NULL) { proxy_(NULL) {
params_->method = method; params_->method = request_info.method;
params_->url = url; params_->url = request_info.url;
params_->first_party_for_cookies = first_party_for_cookies; params_->first_party_for_cookies = request_info.first_party_for_cookies;
params_->referrer = referrer; params_->referrer = request_info.referrer;
params_->headers = headers; params_->headers = request_info.headers;
params_->load_flags = load_flags; params_->load_flags = request_info.load_flags;
params_->request_type = request_type; params_->request_type = request_info.request_type;
params_->appcache_host_id = appcache_host_id; params_->appcache_host_id = request_info.appcache_host_id;
} }
virtual ~ResourceLoaderBridgeImpl() { virtual ~ResourceLoaderBridgeImpl() {
@ -690,6 +693,11 @@ class CookieSetter : public base::RefCountedThreadSafe<CookieSetter> {
DCHECK(MessageLoop::current() == io_thread->message_loop()); DCHECK(MessageLoop::current() == io_thread->message_loop());
request_context->cookie_store()->SetCookie(url, cookie); request_context->cookie_store()->SetCookie(url, cookie);
} }
private:
friend class base::RefCountedThreadSafe<CookieSetter>;
~CookieSetter() {}
}; };
class CookieGetter : public base::RefCountedThreadSafe<CookieGetter> { class CookieGetter : public base::RefCountedThreadSafe<CookieGetter> {
@ -709,6 +717,10 @@ class CookieGetter : public base::RefCountedThreadSafe<CookieGetter> {
} }
private: private:
friend class base::RefCountedThreadSafe<CookieGetter>;
~CookieGetter() {}
base::WaitableEvent event_; base::WaitableEvent event_;
std::string result_; std::string result_;
}; };
@ -719,25 +731,12 @@ class CookieGetter : public base::RefCountedThreadSafe<CookieGetter> {
namespace webkit_glue { namespace webkit_glue {
// factory function // Factory function.
ResourceLoaderBridge* ResourceLoaderBridge::Create( ResourceLoaderBridge* ResourceLoaderBridge::Create(
const std::string& method, const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) {
const GURL& url, CefRefPtr<CefBrowser> browser =
const GURL& first_party_for_cookies, _Context->GetBrowserByID(request_info.routing_id);
const GURL& referrer, return new ResourceLoaderBridgeImpl(browser, request_info);
const std::string& frame_origin,
const std::string& main_frame_origin,
const std::string& headers,
int load_flags,
int requestor_pid,
ResourceType::Type request_type,
int appcache_host_id,
int routing_id) {
CefRefPtr<CefBrowser> browser = _Context->GetBrowserByID(routing_id);
return new ResourceLoaderBridgeImpl(browser, method, url,
first_party_for_cookies,
referrer, headers, load_flags,
request_type, appcache_host_id);
} }
// Issue the proxy resolve request on the io thread, and wait // Issue the proxy resolve request on the io thread, and wait

View File

@ -11,9 +11,9 @@
#include "googleurl/src/gurl.h" #include "googleurl/src/gurl.h"
#include "net/socket_stream/socket_stream.h" #include "net/socket_stream/socket_stream.h"
#include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context.h"
#include "webkit/api/public/WebSocketStreamHandle.h"
#include "webkit/glue/websocketstreamhandle_bridge.h" #include "webkit/glue/websocketstreamhandle_bridge.h"
#include "webkit/glue/websocketstreamhandle_delegate.h" #include "webkit/glue/websocketstreamhandle_delegate.h"
#include "third_party/WebKit/WebKit/chromium/public/WebSocketStreamHandle.h"
using webkit_glue::WebSocketStreamHandleBridge; using webkit_glue::WebSocketStreamHandleBridge;

View File

@ -9,7 +9,7 @@
MSVC_PUSH_WARNING_LEVEL(0); MSVC_PUSH_WARNING_LEVEL(0);
#include "Cache.h" #include "Cache.h"
#include "TextEncoding.h" #include "TextEncoding.h"
#include "webkit/api/src/WebFrameImpl.h" #include "third_party/WebKit/WebKit/chromium/src/WebFrameImpl.h"
MSVC_POP_WARNING(); MSVC_POP_WARNING();
#include "browser_webkit_glue.h" #include "browser_webkit_glue.h"
@ -22,7 +22,7 @@ MSVC_POP_WARNING();
#include "base/string16.h" #include "base/string16.h"
#include "base/win_util.h" #include "base/win_util.h"
#include "net/base/mime_util.h" #include "net/base/mime_util.h"
#include "webkit/api/public/WebFrame.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
#include "webkit/glue/glue_util.h" #include "webkit/glue/glue_util.h"
#include "webkit/glue/webkit_glue.h" #include "webkit/glue/webkit_glue.h"

View File

@ -20,9 +20,9 @@ MSVC_POP_WARNING();
#include "app/gfx/gdi_util.h" #include "app/gfx/gdi_util.h"
#include "base/logging.h" #include "base/logging.h"
#include "skia/ext/platform_canvas.h" #include "skia/ext/platform_canvas.h"
#include "webkit/api/public/WebRect.h" #include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
#include "webkit/api/public/WebSize.h" #include "third_party/WebKit/WebKit/chromium/public/WebSize.h"
#include "webkit/api/public/WebView.h" #include "third_party/WebKit/WebKit/chromium/public/WebView.h"
#include "webkit/glue/webkit_glue.h" #include "webkit/glue/webkit_glue.h"
#include "webkit/glue/plugins/plugin_list.h" #include "webkit/glue/plugins/plugin_list.h"

View File

@ -16,17 +16,18 @@
#include "webkit/database/vfs_backend.h" #include "webkit/database/vfs_backend.h"
#include "webkit/extensions/v8/gears_extension.h" #include "webkit/extensions/v8/gears_extension.h"
#include "webkit/extensions/v8/interval_extension.h" #include "webkit/extensions/v8/interval_extension.h"
#include "webkit/api/public/WebCString.h" #include "third_party/WebKit/WebKit/chromium/public/WebCString.h"
#include "webkit/api/public/WebData.h" #include "third_party/WebKit/WebKit/chromium/public/WebData.h"
#include "webkit/api/public/WebRuntimeFeatures.h" #include "third_party/WebKit/WebKit/chromium/public/WebDatabase.h"
#include "webkit/api/public/WebKit.h" #include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
#include "webkit/api/public/WebScriptController.h" #include "third_party/WebKit/WebKit/chromium/public/WebRuntimeFeatures.h"
#include "webkit/api/public/WebSecurityPolicy.h" #include "third_party/WebKit/WebKit/chromium/public/WebScriptController.h"
#include "webkit/api/public/WebStorageArea.h" #include "third_party/WebKit/WebKit/chromium/public/WebSecurityPolicy.h"
#include "webkit/api/public/WebStorageEventDispatcher.h" #include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h"
#include "webkit/api/public/WebStorageNamespace.h" #include "third_party/WebKit/WebKit/chromium/public/WebStorageEventDispatcher.h"
#include "webkit/api/public/WebString.h" #include "third_party/WebKit/WebKit/chromium/public/WebStorageNamespace.h"
#include "webkit/api/public/WebURL.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
#include "webkit/glue/simple_webmimeregistry_impl.h" #include "webkit/glue/simple_webmimeregistry_impl.h"
#include "webkit/glue/webclipboard_impl.h" #include "webkit/glue/webclipboard_impl.h"
#include "webkit/glue/webkit_glue.h" #include "webkit/glue/webkit_glue.h"
@ -48,6 +49,8 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
WebKit::WebScriptController::registerExtension( WebKit::WebScriptController::registerExtension(
extensions_v8::IntervalExtension::Get()); extensions_v8::IntervalExtension::Get());
WebKit::WebRuntimeFeatures::enableSockets(true); WebKit::WebRuntimeFeatures::enableSockets(true);
WebKit::WebRuntimeFeatures::enableApplicationCache(true);
WebKit::WebRuntimeFeatures::enableDatabase(true);
// Load libraries for media and enable the media player. // Load libraries for media and enable the media player.
FilePath module_path; FilePath module_path;
@ -60,6 +63,8 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
// content during the run. Upon exit that directory is deleted. // content during the run. Upon exit that directory is deleted.
if (appcache_dir_.CreateUniqueTempDir()) if (appcache_dir_.CreateUniqueTempDir())
BrowserAppCacheSystem::InitializeOnUIThread(appcache_dir_.path()); BrowserAppCacheSystem::InitializeOnUIThread(appcache_dir_.path());
WebKit::WebDatabase::setObserver(&database_system_);
} }
~BrowserWebKitInit() { ~BrowserWebKitInit() {
@ -83,27 +88,27 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
} }
virtual WebKit::WebKitClient::FileHandle databaseOpenFile( virtual WebKit::WebKitClient::FileHandle databaseOpenFile(
const WebKit::WebString& file_name, int desired_flags, const WebKit::WebString& vfs_file_name, int desired_flags,
WebKit::WebKitClient::FileHandle* dir_handle) { WebKit::WebKitClient::FileHandle* dir_handle) {
return BrowserDatabaseSystem::GetInstance()->OpenFile( return BrowserDatabaseSystem::GetInstance()->OpenFile(
webkit_glue::WebStringToFilePath(file_name), vfs_file_name, desired_flags, dir_handle);
desired_flags, dir_handle);
} }
virtual int databaseDeleteFile(const WebKit::WebString& file_name, virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name,
bool sync_dir) { bool sync_dir) {
return BrowserDatabaseSystem::GetInstance()->DeleteFile( return BrowserDatabaseSystem::GetInstance()->DeleteFile(
webkit_glue::WebStringToFilePath(file_name), sync_dir); vfs_file_name, sync_dir);
} }
virtual long databaseGetFileAttributes(const WebKit::WebString& file_name) { virtual long databaseGetFileAttributes(
const WebKit::WebString& vfs_file_name) {
return BrowserDatabaseSystem::GetInstance()->GetFileAttributes( return BrowserDatabaseSystem::GetInstance()->GetFileAttributes(
webkit_glue::WebStringToFilePath(file_name)); vfs_file_name);
} }
virtual long long databaseGetFileSize(const WebKit::WebString& file_name) { virtual long long databaseGetFileSize(
return BrowserDatabaseSystem::GetInstance()->GetFileSize( const WebKit::WebString& vfs_file_name) {
webkit_glue::WebStringToFilePath(file_name)); return BrowserDatabaseSystem::GetInstance()->GetFileSize(vfs_file_name);
} }
virtual bool getFileSize(const WebKit::WebString& path, long long& result) { virtual bool getFileSize(const WebKit::WebString& path, long long& result) {
@ -178,7 +183,8 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
void dispatchStorageEvent(const WebKit::WebString& key, void dispatchStorageEvent(const WebKit::WebString& key,
const WebKit::WebString& old_value, const WebKit::WebString& new_value, const WebKit::WebString& old_value, const WebKit::WebString& new_value,
const WebKit::WebString& origin, bool is_local_storage) { const WebKit::WebString& origin, const WebKit::WebURL& url,
bool is_local_storage) {
// TODO(jorlow): Implement // TODO(jorlow): Implement
if (!is_local_storage) if (!is_local_storage)
return; return;
@ -187,8 +193,8 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
dom_storage_event_dispatcher_.reset( dom_storage_event_dispatcher_.reset(
WebKit::WebStorageEventDispatcher::create()); WebKit::WebStorageEventDispatcher::create());
} }
dom_storage_event_dispatcher_->dispatchStorageEvent(key, old_value, dom_storage_event_dispatcher_->dispatchStorageEvent(
new_value, origin, is_local_storage); key, old_value, new_value, origin, url, is_local_storage);
} }
virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost( virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost(
@ -200,7 +206,7 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl {
return NULL; return NULL;
} }
private: private:
webkit_glue::SimpleWebMimeRegistryImpl mime_registry_; webkit_glue::SimpleWebMimeRegistryImpl mime_registry_;
webkit_glue::WebClipboardImpl clipboard_; webkit_glue::WebClipboardImpl clipboard_;
ScopedTempDir appcache_dir_; ScopedTempDir appcache_dir_;

View File

@ -7,8 +7,6 @@
// as the WebViewDelegate for the BrowserWebHost. The host is expected to // as the WebViewDelegate for the BrowserWebHost. The host is expected to
// have initialized a MessageLoop before these methods are called. // have initialized a MessageLoop before these methods are called.
#include "third_party/webkit/webcore/config.h"
#undef LOG
#include "browser_webview_delegate.h" #include "browser_webview_delegate.h"
#include "browser_impl.h" #include "browser_impl.h"
#include "browser_navigation_controller.h" #include "browser_navigation_controller.h"
@ -25,27 +23,27 @@
#include "base/string_util.h" #include "base/string_util.h"
#include "base/trace_event.h" #include "base/trace_event.h"
#include "net/base/net_errors.h" #include "net/base/net_errors.h"
#include "webkit/api/public/WebConsoleMessage.h" #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h"
#include "webkit/api/public/WebContextMenuData.h" #include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h"
#include "webkit/api/public/WebCString.h" #include "third_party/WebKit/WebKit/chromium/public/WebCString.h"
#include "third_party/WebKit/WebKit/chromium/public/WebData.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDataSource.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDragData.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h"
#include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
#include "third_party/WebKit/WebKit/chromium/public/WebNode.h"
#include "third_party/WebKit/WebKit/chromium/public/WebPoint.h"
#include "third_party/WebKit/WebKit/chromium/public/WebPopupMenu.h"
#include "third_party/WebKit/WebKit/chromium/public/WebRange.h"
#include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h"
#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURL.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURLError.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h"
#include "third_party/WebKit/WebKit/chromium/public/WebView.h"
#include "webkit/appcache/appcache_interfaces.h" #include "webkit/appcache/appcache_interfaces.h"
#include "webkit/api/public/WebData.h"
#include "webkit/api/public/WebDataSource.h"
#include "webkit/api/public/WebDragData.h"
#include "webkit/api/public/WebFrame.h"
#include "webkit/api/public/WebHistoryItem.h"
#include "webkit/api/public/WebKit.h"
#include "webkit/api/public/WebNode.h"
#include "webkit/api/public/WebPoint.h"
#include "webkit/api/public/WebPopupMenu.h"
#include "webkit/api/public/WebRange.h"
#include "webkit/api/public/WebScreenInfo.h"
#include "webkit/api/public/WebString.h"
#include "webkit/api/public/WebURL.h"
#include "webkit/api/public/WebURLError.h"
#include "webkit/api/public/WebURLRequest.h"
#include "webkit/api/public/WebURLResponse.h"
#include "webkit/api/public/WebView.h"
#include "webkit/glue/glue_serialize.h" #include "webkit/glue/glue_serialize.h"
#include "webkit/glue/glue_util.h" #include "webkit/glue/glue_util.h"
#include "webkit/glue/media/buffered_data_source.h" #include "webkit/glue/media/buffered_data_source.h"
@ -74,7 +72,7 @@ using WebKit::WebDataSource;
using WebKit::WebDragData; using WebKit::WebDragData;
using WebKit::WebDragOperationsMask; using WebKit::WebDragOperationsMask;
using WebKit::WebEditingAction; using WebKit::WebEditingAction;
using WebKit::WebForm; using WebKit::WebFormElement;
using WebKit::WebFrame; using WebKit::WebFrame;
using WebKit::WebHistoryItem; using WebKit::WebHistoryItem;
using WebKit::WebMediaPlayer; using WebKit::WebMediaPlayer;
@ -222,6 +220,18 @@ bool BrowserWebViewDelegate::isSelectTrailingWhitespaceEnabled() {
return select_trailing_whitespace_enabled_; return select_trailing_whitespace_enabled_;
} }
bool BrowserWebViewDelegate::handleCurrentKeyboardEvent() {
if (edit_command_name_.empty())
return false;
WebFrame* frame = browser_->GetWebView()->focusedFrame();
if (!frame)
return false;
return frame->executeCommand(WebString::fromUTF8(edit_command_name_),
WebString::fromUTF8(edit_command_value_));
}
bool BrowserWebViewDelegate::runFileChooser( bool BrowserWebViewDelegate::runFileChooser(
bool multi_select, const WebKit::WebString& title, bool multi_select, const WebKit::WebString& title,
const WebKit::WebString& initial_value, const WebKit::WebString& initial_value,

View File

@ -21,10 +21,10 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/scoped_ptr.h" #include "base/scoped_ptr.h"
#include "base/weak_ptr.h" #include "base/weak_ptr.h"
#include "webkit/api/public/WebContextMenuData.h" #include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h"
#include "webkit/api/public/WebFrameClient.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrameClient.h"
#include "webkit/api/public/WebRect.h" #include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
#include "webkit/api/public/WebViewClient.h" #include "third_party/WebKit/WebKit/chromium/public/WebViewClient.h"
#include "webkit/glue/webcursor.h" #include "webkit/glue/webcursor.h"
#include "webkit/glue/webplugin_page_delegate.h" #include "webkit/glue/webplugin_page_delegate.h"
#if defined(OS_WIN) #if defined(OS_WIN)
@ -69,6 +69,7 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
const WebKit::WebString& style, const WebKit::WebRange& range); const WebKit::WebString& style, const WebKit::WebRange& range);
virtual bool isSmartInsertDeleteEnabled(); virtual bool isSmartInsertDeleteEnabled();
virtual bool isSelectTrailingWhitespaceEnabled(); virtual bool isSelectTrailingWhitespaceEnabled();
virtual bool handleCurrentKeyboardEvent();
virtual bool runFileChooser( virtual bool runFileChooser(
bool multi_select, const WebKit::WebString& title, bool multi_select, const WebKit::WebString& title,
const WebKit::WebString& initial_value, const WebKit::WebString& initial_value,
@ -210,6 +211,16 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
return block_redirects_; return block_redirects_;
} }
void SetEditCommand(const std::string& name, const std::string& value) {
edit_command_name_ = name;
edit_command_value_ = value;
}
void ClearEditCommand() {
edit_command_name_.clear();
edit_command_value_.clear();
}
CefBrowserImpl* GetBrowser() { return browser_; } CefBrowserImpl* GetBrowser() { return browser_; }
protected: protected:
@ -286,6 +297,10 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient,
// true if we should block any redirects // true if we should block any redirects
bool block_redirects_; bool block_redirects_;
// Edit command associated to the current keyboard event.
std::string edit_command_name_;
std::string edit_command_value_;
DISALLOW_COPY_AND_ASSIGN(BrowserWebViewDelegate); DISALLOW_COPY_AND_ASSIGN(BrowserWebViewDelegate);
}; };

View File

@ -25,11 +25,11 @@
#include "base/string_util.h" #include "base/string_util.h"
#include "base/trace_event.h" #include "base/trace_event.h"
#include "net/base/net_errors.h" #include "net/base/net_errors.h"
#include "webkit/api/public/WebContextMenuData.h" #include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h"
#include "webkit/api/public/WebCursorInfo.h" #include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h"
#include "webkit/api/public/WebFrame.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
#include "webkit/api/public/WebRect.h" #include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
#include "webkit/api/public/WebView.h" #include "third_party/WebKit/WebKit/chromium/public/WebView.h"
#include "webkit/glue/webdropdata.h" #include "webkit/glue/webdropdata.h"
#include "webkit/glue/webpreferences.h" #include "webkit/glue/webpreferences.h"
#include "webkit/glue/webplugin.h" #include "webkit/glue/webplugin.h"

View File

@ -19,7 +19,7 @@
#include "base/stats_table.h" #include "base/stats_table.h"
#include "base/string_util.h" #include "base/string_util.h"
#include "net/base/net_module.h" #include "net/base/net_module.h"
#include "webkit/api/public/WebScriptController.h" #include "third_party/WebKit/WebKit/chromium/public/WebScriptController.h"
#include "webkit/extensions/v8/gc_extension.h" #include "webkit/extensions/v8/gc_extension.h"
#include "webkit/glue/webplugin.h" #include "webkit/glue/webplugin.h"
#include "webkit/glue/plugins/plugin_lib.h" #include "webkit/glue/plugins/plugin_lib.h"
@ -342,6 +342,7 @@ bool CefContext::Initialize(bool multi_threaded_message_loop,
webprefs_->javascript_can_open_windows_automatically = true; webprefs_->javascript_can_open_windows_automatically = true;
webprefs_->dom_paste_enabled = true; webprefs_->dom_paste_enabled = true;
webprefs_->developer_extras_enabled = true; webprefs_->developer_extras_enabled = true;
webprefs_->site_specific_quirks_enabled = true;
webprefs_->shrinks_standalone_images_to_fit = false; webprefs_->shrinks_standalone_images_to_fit = false;
webprefs_->uses_universal_detector = false; webprefs_->uses_universal_detector = false;
webprefs_->text_areas_are_resizable = true; webprefs_->text_areas_are_resizable = true;
@ -350,7 +351,6 @@ bool CefContext::Initialize(bool multi_threaded_message_loop,
webprefs_->xss_auditor_enabled = false; webprefs_->xss_auditor_enabled = false;
webprefs_->remote_fonts_enabled = true; webprefs_->remote_fonts_enabled = true;
webprefs_->local_storage_enabled = true; webprefs_->local_storage_enabled = true;
webprefs_->session_storage_enabled = true;
webprefs_->application_cache_enabled = true; webprefs_->application_cache_enabled = true;
webprefs_->databases_enabled = true; webprefs_->databases_enabled = true;

View File

@ -9,7 +9,7 @@
#include "net/http/http_response_headers.h" #include "net/http/http_response_headers.h"
#include "net/http/http_util.h" #include "net/http/http_util.h"
#include "net/url_request/url_request.h" #include "net/url_request/url_request.h"
#include "webkit/api/public/WebHTTPHeaderVisitor.h" #include "third_party/WebKit/WebKit/chromium/public/WebHTTPHeaderVisitor.h"
#include "webkit/glue/glue_util.h" #include "webkit/glue/glue_util.h"
using net::HttpResponseHeaders; using net::HttpResponseHeaders;

View File

@ -7,8 +7,8 @@
#include "../include/cef.h" #include "../include/cef.h"
#include "net/base/upload_data.h" #include "net/base/upload_data.h"
#include "webkit/api/public/WebHTTPBody.h" #include "third_party/WebKit/WebKit/chromium/public/WebHTTPBody.h"
#include "webkit/api/public/WebURLRequest.h" #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h"
class URLRequest; class URLRequest;

View File

@ -360,7 +360,7 @@ private:
CefUrlRequestFilter* CefUrlRequestFilter::shared_instance_ = NULL; CefUrlRequestFilter* CefUrlRequestFilter::shared_instance_ = NULL;
class SchemeRequestJobWrapper { class SchemeRequestJobWrapper : public CefThreadSafeBase<CefBase> {
public: public:
SchemeRequestJobWrapper(const std::string& scheme_name, SchemeRequestJobWrapper(const std::string& scheme_name,
const std::string& host_name, const std::string& host_name,
@ -379,9 +379,6 @@ public:
scheme_name_, host_name_, factory_); scheme_name_, host_name_, factory_);
} }
void AddRef() {}
void Release() { delete this; }
static bool ImplementsThreadSafeReferenceCounting() { return true; } static bool ImplementsThreadSafeReferenceCounting() { return true; }
private: private:
@ -398,10 +395,16 @@ bool CefRegisterScheme(const std::wstring& scheme_name,
if(!_Context.get()) if(!_Context.get())
return false; return false;
SchemeRequestJobWrapper* wrapper = new SchemeRequestJobWrapper( // Use a smart pointer for the wrapper object because
WideToUTF8(scheme_name), WideToUTF8(host_name), factory); // RunnableMethodTraits::RetainCallee() (originating from NewRunnableMethod)
// will call AddRef() and Release() on the object in debug mode, resulting in
// the object being deleted if it doesn't already have a reference.
CefRefPtr<SchemeRequestJobWrapper> wrapper(
new SchemeRequestJobWrapper(WideToUTF8(scheme_name),
WideToUTF8(host_name), factory));
PostTask(FROM_HERE, NewRunnableMethod(wrapper, PostTask(FROM_HERE, NewRunnableMethod(wrapper.get(),
&SchemeRequestJobWrapper::RegisterScheme)); &SchemeRequestJobWrapper::RegisterScheme));
return true; return true;
} }

View File

@ -7,8 +7,8 @@
#include "tracker.h" #include "tracker.h"
#include "base/lazy_instance.h" #include "base/lazy_instance.h"
#include "base/string_util.h" #include "base/string_util.h"
#include "webkit/api/public/WebKit.h" #include "third_party/WebKit/WebKit/chromium/public/WebKit.h"
#include "webkit/api/public/WebScriptController.h" #include "third_party/WebKit/WebKit/chromium/public/WebScriptController.h"
// Memory manager. // Memory manager.

View File

@ -8,7 +8,7 @@
#include "base/gfx/rect.h" #include "base/gfx/rect.h"
#include "base/gfx/size.h" #include "base/gfx/size.h"
#include "base/win_util.h" #include "base/win_util.h"
#include "webkit/api/public/WebView.h" #include "third_party/WebKit/WebKit/chromium/public/WebView.h"
#include "webkit/glue/webpreferences.h" #include "webkit/glue/webpreferences.h"
using namespace WebKit; using namespace WebKit;

View File

@ -8,12 +8,12 @@
#include "base/gfx/rect.h" #include "base/gfx/rect.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/win_util.h" #include "base/win_util.h"
#include "webkit/api/public/WebInputEvent.h" #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h"
#include "webkit/api/public/WebPopupMenu.h" #include "third_party/WebKit/WebKit/chromium/public/WebPopupMenu.h"
#include "webkit/api/public/WebScreenInfo.h" #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h"
#include "webkit/api/public/WebSize.h" #include "third_party/WebKit/WebKit/chromium/public/WebSize.h"
#include "webkit/api/public/win/WebInputEventFactory.h" #include "third_party/WebKit/WebKit/chromium/public/win/WebInputEventFactory.h"
#include "webkit/api/public/win/WebScreenInfoFactory.h" #include "third_party/WebKit/WebKit/chromium/public/win/WebScreenInfoFactory.h"
using WebKit::WebInputEvent; using WebKit::WebInputEvent;
using WebKit::WebInputEventFactory; using WebKit::WebInputEventFactory;

View File

@ -53,6 +53,8 @@ class WebWidgetHost {
WebKit::WebScreenInfo GetScreenInfo(); WebKit::WebScreenInfo GetScreenInfo();
void PaintRect(const gfx::Rect& rect);
protected: protected:
WebWidgetHost(); WebWidgetHost();
~WebWidgetHost(); ~WebWidgetHost();
@ -97,8 +99,6 @@ class WebWidgetHost {
void TrackMouseLeave(bool enable); void TrackMouseLeave(bool enable);
void ResetScrollRect(); void ResetScrollRect();
void PaintRect(const gfx::Rect& rect);
void set_painting(bool value) { void set_painting(bool value) {
#ifndef NDEBUG #ifndef NDEBUG
painting_ = value; painting_ = value;