From 92197f8046cc2c5781c2cf4f938ffedf0c35c46a Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 13 Sep 2010 01:59:43 +0000 Subject: [PATCH] - Update to Chromium revision 59193. - Use Mesa for off-screen rendering. - Add support for the FileSystem API and "blob" schema. - Set User-Agent product version to "Chrome/7.0.517.0" git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@102 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- CHROMIUM_BUILD_COMPATIBILITY.txt | 1 + cef.gyp | 8 +++ libcef/browser_database_system.cc | 3 +- libcef/browser_impl.cc | 6 ++ libcef/browser_impl.h | 6 ++ libcef/browser_request_context.cc | 6 +- libcef/browser_request_context.h | 9 +++ libcef/browser_resource_loader_bridge.cc | 15 ++++ libcef/browser_resource_loader_bridge.h | 2 - libcef/browser_webblobregistry_impl.cc | 90 ++++++++++++++++++++++++ libcef/browser_webblobregistry_impl.h | 47 +++++++++++++ libcef/browser_webkit_glue.cc | 6 +- libcef/browser_webkit_init.h | 37 +++++++--- libcef/browser_webview_delegate.cc | 16 +++++ libcef/browser_webview_delegate.h | 6 ++ libcef/cef_process_io_thread.cc | 4 ++ libcef/cef_process_ui_thread.cc | 24 +++++++ libcef/request_impl.cc | 2 +- libcef/webwidget_host.cc | 2 + 19 files changed, 276 insertions(+), 14 deletions(-) create mode 100644 libcef/browser_webblobregistry_impl.cc create mode 100644 libcef/browser_webblobregistry_impl.h diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index aa3b04ab3..b9446bf3b 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -52,3 +52,4 @@ Date | CEF Revision | Chromium Revision 2010-03-29 | /trunk@72 | /trunk@42941 2010-06-21 | /trunk@82 | /trunk@50325 2010-08-09 | /trunk@93 | /trunk@55388 +2010-09-12 | /trunk@102 | /trunk@59193 diff --git a/cef.gyp b/cef.gyp index 20ae0248e..dc07e7ebb 100644 --- a/cef.gyp +++ b/cef.gyp @@ -128,6 +128,7 @@ '../base/base.gyp:base_i18n', '../breakpad/breakpad.gyp:breakpad_handler', '../build/temp_gyp/googleurl.gyp:googleurl', + '../gfx/gfx.gyp:gfx', '../media/media.gyp:media', '../net/net.gyp:net', '../net/net.gyp:net_resources', @@ -141,6 +142,7 @@ '../third_party/libjpeg/libjpeg.gyp:libjpeg', '../third_party/libpng/libpng.gyp:libpng', '../third_party/libxslt/libxslt.gyp:libxslt', + '../third_party/mesa/mesa.gyp:osmesa', '../third_party/modp_b64/modp_b64.gyp:modp_b64', '../third_party/WebKit/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:pcre', '../third_party/WebKit/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf', @@ -148,6 +150,7 @@ '../third_party/WebKit/WebKit/chromium/WebKit.gyp:webkit', '../third_party/zlib/zlib.gyp:zlib', '../webkit/support/webkit_support.gyp:appcache', + '../webkit/support/webkit_support.gyp:blob', '../webkit/support/webkit_support.gyp:database', '../webkit/support/webkit_support.gyp:glue', '../webkit/support/webkit_support.gyp:webkit_resources', @@ -299,6 +302,7 @@ '../base/base.gyp:base_i18n', '../breakpad/breakpad.gyp:breakpad_handler', '../build/temp_gyp/googleurl.gyp:googleurl', + '../gfx/gfx.gyp:gfx', '../media/media.gyp:media', '../net/net.gyp:net', '../net/net.gyp:net_resources', @@ -312,6 +316,7 @@ '../third_party/libjpeg/libjpeg.gyp:libjpeg', '../third_party/libpng/libpng.gyp:libpng', '../third_party/libxslt/libxslt.gyp:libxslt', + '../third_party/mesa/mesa.gyp:osmesa', '../third_party/modp_b64/modp_b64.gyp:modp_b64', '../third_party/WebKit/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:pcre', '../third_party/WebKit/JavaScriptCore/JavaScriptCore.gyp/JavaScriptCore.gyp:wtf', @@ -319,6 +324,7 @@ '../third_party/WebKit/WebKit/chromium/WebKit.gyp:webkit', '../third_party/zlib/zlib.gyp:zlib', '../webkit/support/webkit_support.gyp:appcache', + '../webkit/support/webkit_support.gyp:blob', '../webkit/support/webkit_support.gyp:database', '../webkit/support/webkit_support.gyp:glue', '../webkit/support/webkit_support.gyp:webkit_resources', @@ -356,6 +362,8 @@ 'libcef/browser_socket_stream_bridge.h', 'libcef/browser_webcookiejar_impl.cc', 'libcef/browser_webcookiejar_impl.h', + 'libcef/browser_webblobregistry_impl.cc', + 'libcef/browser_webblobregistry_impl.h', 'libcef/browser_webkit_glue.cc', 'libcef/browser_webkit_glue.h', 'libcef/browser_webkit_glue_win.cc', diff --git a/libcef/browser_database_system.cc b/libcef/browser_database_system.cc index 35f0e02ff..436a57002 100644 --- a/libcef/browser_database_system.cc +++ b/libcef/browser_database_system.cc @@ -9,7 +9,8 @@ #include "base/message_loop.h" #include "base/platform_thread.h" #include "base/process_util.h" -#include "third_party/sqlite/preprocessed/sqlite3.h" +#include "base/utf_string_conversions.h" +#include "third_party/sqlite/sqlite3.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" diff --git a/libcef/browser_impl.cc b/libcef/browser_impl.cc index 34609f664..c6f3699e7 100644 --- a/libcef/browser_impl.cc +++ b/libcef/browser_impl.cc @@ -53,6 +53,12 @@ CefBrowserImpl::CefBrowserImpl(CefWindowInfo& windowInfo, bool popup, delegate_.reset(new BrowserWebViewDelegate(this)); popup_delegate_.reset(new BrowserWebViewDelegate(this)); nav_controller_.reset(new BrowserNavigationController(this)); + + if (!file_system_root_.CreateUniqueTempDir()) { + LOG(WARNING) << "Failed to create a temp dir for the filesystem." + "FileSystem feature will be disabled."; + DCHECK(file_system_root_.path().empty()); + } } diff --git a/libcef/browser_impl.h b/libcef/browser_impl.h index 73ae76c3f..ba9f9999f 100644 --- a/libcef/browser_impl.h +++ b/libcef/browser_impl.h @@ -16,6 +16,7 @@ #include "printing/win_printing_context.h" #endif +#include "base/scoped_temp_dir.h" #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" namespace base { @@ -228,6 +229,8 @@ public: static bool ImplementsThreadSafeReferenceCounting() { return true; } + const FilePath& file_system_root() const { return file_system_root_.path(); } + protected: CefWindowInfo window_info_; bool is_popup_; @@ -250,6 +253,9 @@ protected: // Unique browser ID assigned by the context. int unique_id_; + + // A temporary directory for FileSystem API. + ScopedTempDir file_system_root_; }; diff --git a/libcef/browser_request_context.cc b/libcef/browser_request_context.cc index 4a65afd03..c647b8cfd 100644 --- a/libcef/browser_request_context.cc +++ b/libcef/browser_request_context.cc @@ -17,6 +17,7 @@ #include "net/proxy/proxy_config_service.h" #include "net/proxy/proxy_config_service_fixed.h" #include "net/proxy/proxy_service.h" +#include "webkit/blob/blob_storage_controller.h" #include "webkit/glue/webkit_glue.h" BrowserRequestContext::BrowserRequestContext() { @@ -46,7 +47,8 @@ void BrowserRequestContext::Init( net::ProxyService::CreateSystemProxyConfigService( MessageLoop::current(), NULL)); host_resolver_ = - net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism); + net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, + NULL); proxy_service_ = net::ProxyService::Create(proxy_config_service.release(), false, NULL, NULL, NULL, NULL); ssl_config_service_ = net::SSLConfigService::CreateSystemSSLConfigService(); @@ -65,6 +67,8 @@ void BrowserRequestContext::Init( http_transaction_factory_ = cache; ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_); + + blob_storage_controller_.reset(new webkit_blob::BlobStorageController()); } BrowserRequestContext::~BrowserRequestContext() { diff --git a/libcef/browser_request_context.h b/libcef/browser_request_context.h index 3072f39d9..9774eb562 100644 --- a/libcef/browser_request_context.h +++ b/libcef/browser_request_context.h @@ -10,6 +10,9 @@ #include "net/url_request/url_request_context.h" class FilePath; +namespace webkit_blob { +class BlobStorageController; +} // A basic URLRequestContext that only provides an in-memory cookie store. class BrowserRequestContext : public URLRequestContext { @@ -28,9 +31,15 @@ class BrowserRequestContext : public URLRequestContext { void SetAcceptAllCookies(bool accept_all_cookies); + webkit_blob::BlobStorageController* blob_storage_controller() const { + return blob_storage_controller_.get(); + } + private: void Init(const FilePath& cache_path, net::HttpCache::Mode cache_mode, bool no_proxy); + + scoped_ptr blob_storage_controller_; }; #endif // _BROWSER_REQUEST_CONTEXT_H diff --git a/libcef/browser_resource_loader_bridge.cc b/libcef/browser_resource_loader_bridge.cc index d975bac20..ff4f12002 100644 --- a/libcef/browser_resource_loader_bridge.cc +++ b/libcef/browser_resource_loader_bridge.cc @@ -52,6 +52,7 @@ #include "base/thread.h" #include "base/utf_string_conversions.h" #include "base/waitable_event.h" +#include "net/base/cookie_store.h" #include "net/base/io_buffer.h" #include "net/base/load_flags.h" #include "net/base/net_errors.h" @@ -67,6 +68,7 @@ #endif #include "net/url_request/url_request.h" #include "webkit/appcache/appcache_interfaces.h" +#include "webkit/blob/blob_storage_controller.h" #include "webkit/glue/resource_loader_bridge.h" using webkit_glue::ResourceLoaderBridge; @@ -298,6 +300,12 @@ class RequestProxy : public URLRequest::Delegate, if(!handled) { + // Might need to resolve the blob references in the upload data. + if (params->upload) { + _Context->request_context()->blob_storage_controller()-> + ResolveBlobReferencesInUploadData(params->upload.get()); + } + request_.reset(new URLRequest(params->url, this)); request_->set_method(params->method); request_->set_first_party_for_cookies(params->first_party_for_cookies); @@ -641,6 +649,13 @@ class ResourceLoaderBridgeImpl : public ResourceLoaderBridge { expected_modification_time); } + virtual void AppendBlobToUpload(const GURL& blob_url) { + DCHECK(params_.get()); + if (!params_->upload) + params_->upload = new net::UploadData(); + params_->upload->AppendBlob(blob_url); + } + virtual void SetUploadIdentifier(int64 identifier) { DCHECK(params_.get()); if (!params_->upload) diff --git a/libcef/browser_resource_loader_bridge.h b/libcef/browser_resource_loader_bridge.h index 92a256869..b49c5cc89 100644 --- a/libcef/browser_resource_loader_bridge.h +++ b/libcef/browser_resource_loader_bridge.h @@ -8,8 +8,6 @@ #include #include "base/message_loop_proxy.h" -#include "base/file_path.h" -#include "net/http/http_cache.h" class GURL; diff --git a/libcef/browser_webblobregistry_impl.cc b/libcef/browser_webblobregistry_impl.cc new file mode 100644 index 000000000..075c7ef9d --- /dev/null +++ b/libcef/browser_webblobregistry_impl.cc @@ -0,0 +1,90 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "browser_webblobregistry_impl.h" + +#include "base/message_loop.h" +#include "googleurl/src/gurl.h" +#include "third_party/WebKit/WebKit/chromium/public/WebBlobData.h" +#include "third_party/WebKit/WebKit/chromium/public/WebBlobStorageData.h" +#include "third_party/WebKit/WebKit/chromium/public/WebString.h" +#include "third_party/WebKit/WebKit/chromium/public/WebURL.h" +#include "webkit/blob/blob_data.h" +#include "webkit/blob/blob_storage_controller.h" + +using WebKit::WebBlobData; +using WebKit::WebBlobStorageData; +using WebKit::WebString; +using WebKit::WebURL; + +MessageLoop* g_io_thread; +webkit_blob::BlobStorageController* g_blob_storage_controller; + +/* static */ +void BrowserWebBlobRegistryImpl::InitializeOnIOThread( + webkit_blob::BlobStorageController* blob_storage_controller) { + g_io_thread = MessageLoop::current(); + g_blob_storage_controller = blob_storage_controller; +} + +/* static */ +void BrowserWebBlobRegistryImpl::Cleanup() { + g_io_thread = NULL; + g_blob_storage_controller = NULL; +} + +BrowserWebBlobRegistryImpl::BrowserWebBlobRegistryImpl() { +} + +void BrowserWebBlobRegistryImpl::registerBlobURL( + const WebURL& url, WebBlobData& data) { + DCHECK(g_io_thread); + scoped_refptr blob_data( + new webkit_blob::BlobData(data)); + blob_data->AddRef(); // Release on DoRegisterBlobURL. + g_io_thread->PostTask( + FROM_HERE, + NewRunnableMethod(this, + &BrowserWebBlobRegistryImpl::DoRegisterBlobUrl, + url, + blob_data.get())); +} + +void BrowserWebBlobRegistryImpl::registerBlobURL( + const WebURL& url, const WebURL& src_url) { + DCHECK(g_io_thread); + g_io_thread->PostTask( + FROM_HERE, + NewRunnableMethod(this, + &BrowserWebBlobRegistryImpl::DoRegisterBlobUrlFrom, + url, + src_url)); +} + +void BrowserWebBlobRegistryImpl::unregisterBlobURL(const WebURL& url) { + DCHECK(g_io_thread); + g_io_thread->PostTask( + FROM_HERE, + NewRunnableMethod(this, + &BrowserWebBlobRegistryImpl::DoUnregisterBlobUrl, + url)); +} + +void BrowserWebBlobRegistryImpl::DoRegisterBlobUrl( + const GURL& url, webkit_blob::BlobData* blob_data) { + DCHECK(g_blob_storage_controller); + g_blob_storage_controller->RegisterBlobUrl(url, blob_data); + blob_data->Release(); +} + +void BrowserWebBlobRegistryImpl::DoRegisterBlobUrlFrom( + const GURL& url, const GURL& src_url) { + DCHECK(g_blob_storage_controller); + g_blob_storage_controller->RegisterBlobUrlFrom(url, src_url); +} + +void BrowserWebBlobRegistryImpl::DoUnregisterBlobUrl(const GURL& url) { + DCHECK(g_blob_storage_controller); + g_blob_storage_controller->UnregisterBlobUrl(url); +} diff --git a/libcef/browser_webblobregistry_impl.h b/libcef/browser_webblobregistry_impl.h new file mode 100644 index 000000000..3e0f8b833 --- /dev/null +++ b/libcef/browser_webblobregistry_impl.h @@ -0,0 +1,47 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef BROWSER_WEBBLOBREGISTRY_IMPL_H_ +#define BROWSER_WEBBLOBREGISTRY_IMPL_H_ + +#include "base/ref_counted.h" +#include "third_party/WebKit/WebKit/chromium/public/WebBlobRegistry.h" + +class GURL; + +namespace webkit_blob { +class BlobData; +class BlobStorageController; +} + +class BrowserWebBlobRegistryImpl + : public WebKit::WebBlobRegistry, + public base::RefCountedThreadSafe { + public: + static void InitializeOnIOThread( + webkit_blob::BlobStorageController* blob_storage_controller); + static void Cleanup(); + + BrowserWebBlobRegistryImpl(); + + // See WebBlobRegistry.h for documentation on these functions. + virtual void registerBlobURL(const WebKit::WebURL& url, + WebKit::WebBlobData& data); + virtual void registerBlobURL(const WebKit::WebURL& url, + const WebKit::WebURL& src_url); + virtual void unregisterBlobURL(const WebKit::WebURL& url); + + // Run on I/O thread. + void DoRegisterBlobUrl(const GURL& url, webkit_blob::BlobData* blob_data); + void DoRegisterBlobUrlFrom(const GURL& url, const GURL& src_url); + void DoUnregisterBlobUrl(const GURL& url); + + protected: + friend class base::RefCountedThreadSafe; + + private: + DISALLOW_COPY_AND_ASSIGN(BrowserWebBlobRegistryImpl); +}; + +#endif // BROWSER_WEBBLOBREGISTRY_IMPL_H_ diff --git a/libcef/browser_webkit_glue.cc b/libcef/browser_webkit_glue.cc index 3e3d0484a..6f41cd961 100644 --- a/libcef/browser_webkit_glue.cc +++ b/libcef/browser_webkit_glue.cc @@ -115,7 +115,7 @@ std::string WebStringToStdString(const WebKit::WebString& str) { } std::string GetProductVersion() { - return std::string("CEF/0.0.0.0"); + return std::string("Chrome/7.0.517.0"); } bool IsSingleProcess() { @@ -134,4 +134,8 @@ bool GetFontTable(int fd, uint32_t table, uint8_t* output, } #endif +void EnableSpdy(bool enable) { + // Used in benchmarking, Ignored for CEF. +} + } // namespace webkit_glue diff --git a/libcef/browser_webkit_init.h b/libcef/browser_webkit_init.h index a9d1f5e91..56c06863d 100644 --- a/libcef/browser_webkit_init.h +++ b/libcef/browser_webkit_init.h @@ -15,7 +15,6 @@ #include "webkit/appcache/web_application_cache_host_impl.h" #include "webkit/database/vfs_backend.h" #include "webkit/extensions/v8/gears_extension.h" -#include "webkit/extensions/v8/interval_extension.h" #include "third_party/WebKit/WebKit/chromium/public/WebData.h" #include "third_party/WebKit/WebKit/chromium/public/WebDatabase.h" #include "third_party/WebKit/WebKit/chromium/public/WebKit.h" @@ -25,16 +24,20 @@ #include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h" #include "third_party/WebKit/WebKit/chromium/public/WebStorageEventDispatcher.h" #include "third_party/WebKit/WebKit/chromium/public/WebIDBFactory.h" +#include "third_party/WebKit/WebKit/chromium/public/WebIDBKey.h" +#include "third_party/WebKit/WebKit/chromium/public/WebIDBKeyPath.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSerializedScriptValue.h" #include "third_party/WebKit/WebKit/chromium/public/WebStorageNamespace.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h" #include "webkit/glue/simple_webmimeregistry_impl.h" #include "webkit/glue/webclipboard_impl.h" -#include "webkit/glue/webfilesystem_impl.h" +#include "webkit/glue/webfileutilities_impl.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/webkitclient_impl.h" #include "browser_appcache_system.h" #include "browser_database_system.h" #include "browser_resource_loader_bridge.h" +#include "browser_webblobregistry_impl.h" #include "browser_webcookiejar_impl.h" @@ -47,8 +50,6 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl { WebKit::setLayoutTestMode(false); WebKit::WebScriptController::registerExtension( extensions_v8::GearsExtension::Get()); - WebKit::WebScriptController::registerExtension( - extensions_v8::IntervalExtension::Get()); WebKit::WebRuntimeFeatures::enableSockets(true); WebKit::WebRuntimeFeatures::enableApplicationCache(true); WebKit::WebRuntimeFeatures::enableDatabase(true); @@ -59,6 +60,7 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl { WebKit::WebRuntimeFeatures::enableIndexedDatabase(true); WebKit::WebRuntimeFeatures::enableGeolocation(false); WebKit::WebRuntimeFeatures::enableSpeechInput(true); + WebKit::WebRuntimeFeatures::enableFileSystem(true); // TODO(hwennborg): Enable this once the implementation supports it. WebKit::WebRuntimeFeatures::enableDeviceMotion(false); @@ -83,7 +85,9 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl { WebKit::WebDatabase::setObserver(&database_system_); - file_system_.set_sandbox_enabled(false); + blob_registry_ = new BrowserWebBlobRegistryImpl(); + + file_utilities_.set_sandbox_enabled(false); } ~BrowserWebKitInit() { @@ -98,14 +102,18 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl { return &clipboard_; } - virtual WebKit::WebFileSystem* fileSystem() { - return &file_system_; + virtual WebKit::WebFileUtilities* fileUtilities() { + return &file_utilities_; } virtual WebKit::WebSandboxSupport* sandboxSupport() { return NULL; } + virtual WebKit::WebBlobRegistry* blobRegistry() { + return blob_registry_.get(); + } + virtual WebKit::WebCookieJar* cookieJar() { return &cookie_jar_; } @@ -187,14 +195,27 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl { return WebKit::WebIDBFactory::create(); } + virtual void createIDBKeysFromSerializedValuesAndKeyPath( + const WebKit::WebVector& values, + const WebKit::WebString& keyPath, + WebKit::WebVector& keys_out) { + WebKit::WebVector keys(values.size()); + for (size_t i = 0; i < values.size(); ++i) { + keys[i] = WebKit::WebIDBKey::createFromValueAndKeyPath( + values[i], WebKit::WebIDBKeyPath::create(keyPath)); + } + keys_out.swap(keys); + } + private: webkit_glue::SimpleWebMimeRegistryImpl mime_registry_; webkit_glue::WebClipboardImpl clipboard_; - webkit_glue::WebFileSystemImpl file_system_; + webkit_glue::WebFileUtilitiesImpl file_utilities_; ScopedTempDir appcache_dir_; BrowserAppCacheSystem appcache_system_; BrowserDatabaseSystem database_system_; BrowserWebCookieJarImpl cookie_jar_; + scoped_refptr blob_registry_; }; #endif // _BROWSER_WEBKIT_INIT_H diff --git a/libcef/browser_webview_delegate.cc b/libcef/browser_webview_delegate.cc index cb0d52c29..db9a823d2 100644 --- a/libcef/browser_webview_delegate.cc +++ b/libcef/browser_webview_delegate.cc @@ -31,6 +31,8 @@ #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/WebFileError.h" +#include "third_party/WebKit/WebKit/chromium/public/WebFileSystemCallbacks.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" @@ -83,6 +85,8 @@ using WebKit::WebDragData; using WebKit::WebDragOperationsMask; using WebKit::WebEditingAction; using WebKit::WebFileChooserParams; +using WebKit::WebFileSystem; +using WebKit::WebFileSystemCallbacks; using WebKit::WebFormElement; using WebKit::WebFrame; using WebKit::WebHistoryItem; @@ -778,6 +782,18 @@ void BrowserWebViewDelegate::reportFindInPageSelection( false); } +void BrowserWebViewDelegate::openFileSystem( + WebFrame* frame, WebFileSystem::Type type, long long size, + WebFileSystemCallbacks* callbacks) { + if (browser_->file_system_root().empty()) { + // The FileSystem temp directory was not initialized successfully. + callbacks->didFail(WebKit::WebFileErrorSecurity); + } else { + callbacks->didOpenFileSystem( + "CefFileSystem", + webkit_glue::FilePathToWebString(browser_->file_system_root())); + } +} // Public methods ------------------------------------------------------------ diff --git a/libcef/browser_webview_delegate.h b/libcef/browser_webview_delegate.h index ff2af4987..3b4168818 100644 --- a/libcef/browser_webview_delegate.h +++ b/libcef/browser_webview_delegate.h @@ -23,6 +23,7 @@ #include "base/weak_ptr.h" #include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h" #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserParams.h" +#include "third_party/WebKit/WebKit/chromium/public/WebFileSystem.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrameClient.h" #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" #include "third_party/WebKit/WebKit/chromium/public/WebViewClient.h" @@ -167,6 +168,11 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient, int request_id, int count, bool final_update); virtual void reportFindInPageSelection( int request_id, int active_match_ordinal, const WebKit::WebRect& sel); + virtual void openFileSystem( + WebKit::WebFrame* frame, + WebKit::WebFileSystem::Type type, + long long size, + WebKit::WebFileSystemCallbacks* callbacks); // webkit_glue::WebPluginPageDelegate virtual webkit_glue::WebPluginDelegate* CreatePluginDelegate( diff --git a/libcef/cef_process_io_thread.cc b/libcef/cef_process_io_thread.cc index 38f603194..54da2c92e 100644 --- a/libcef/cef_process_io_thread.cc +++ b/libcef/cef_process_io_thread.cc @@ -8,6 +8,7 @@ #include "browser_appcache_system.h" #include "browser_resource_loader_bridge.h" #include "browser_socket_stream_bridge.h" +#include "browser_webblobregistry_impl.h" #include "build/build_config.h" @@ -39,6 +40,8 @@ void CefProcessIOThread::Init() { BrowserAppCacheSystem::InitializeOnIOThread(request_context_); BrowserSocketStreamBridge::InitializeOnIOThread(request_context_); + BrowserWebBlobRegistryImpl::InitializeOnIOThread( + request_context_->blob_storage_controller()); } void CefProcessIOThread::CleanUp() { @@ -48,6 +51,7 @@ void CefProcessIOThread::CleanUp() { MessageLoop::current()->RunAllPending(); BrowserSocketStreamBridge::Cleanup(); + BrowserWebBlobRegistryImpl::Cleanup(); _Context->set_request_context(NULL); request_context_ = NULL; diff --git a/libcef/cef_process_ui_thread.cc b/libcef/cef_process_ui_thread.cc index c38f6baf1..edb7f18dd 100644 --- a/libcef/cef_process_ui_thread.cc +++ b/libcef/cef_process_ui_thread.cc @@ -17,11 +17,15 @@ #include "base/stats_table.h" #include "base/string_number_conversions.h" #include "build/build_config.h" +#include "app/gfx/gl/gl_implementation.h" #include "net/base/net_module.h" #if defined(OS_WIN) #include "net/socket/ssl_client_socket_nss_factory.h" #endif +#include "webkit/blob/blob_storage_controller.h" +#include "webkit/blob/blob_url_request_job.h" #include "webkit/extensions/v8/gc_extension.h" +#include "net/url_request/url_request.h" #if defined(OS_WIN) #include @@ -32,6 +36,22 @@ static const char* kStatsFilePrefix = "libcef_"; static int kStatsFileThreads = 20; static int kStatsFileCounters = 200; +namespace { + +URLRequestJob* BlobURLRequestJobFactory(URLRequest* request, + const std::string& scheme) { + webkit_blob::BlobStorageController* blob_storage_controller = + static_cast(request->context())-> + blob_storage_controller(); + return new webkit_blob::BlobURLRequestJob( + request, + blob_storage_controller->GetBlobDataFromUrl(request->url()), + NULL); +} + +} // namespace + + CefProcessUIThread::CefProcessUIThread() : CefThread(CefThread::UI), statstable_(NULL), webkit_init_(NULL) {} @@ -126,6 +146,10 @@ void CefProcessUIThread::Init() { net::ClientSocketFactory::SetSSLClientSocketFactory( net::SSLClientSocketNSSFactory); #endif + + gfx::InitializeGLBindings(gfx::kGLImplementationOSMesaGL); + + URLRequest::RegisterProtocolFactory("blob", &BlobURLRequestJobFactory); } void CefProcessUIThread::CleanUp() { diff --git a/libcef/request_impl.cc b/libcef/request_impl.cc index 919ef38d8..bb48537d9 100644 --- a/libcef/request_impl.cc +++ b/libcef/request_impl.cc @@ -299,7 +299,7 @@ void CefPostDataImpl::Get(net::UploadData& data) static_cast(it->get())->Get(element); data_elements.push_back(element); } - data.set_elements(data_elements); + data.SetElements(data_elements); Unlock(); } diff --git a/libcef/webwidget_host.cc b/libcef/webwidget_host.cc index 2c9d95006..b50d63653 100644 --- a/libcef/webwidget_host.cc +++ b/libcef/webwidget_host.cc @@ -15,6 +15,8 @@ #include "third_party/WebKit/WebKit/chromium/public/win/WebInputEventFactory.h" #include "third_party/WebKit/WebKit/chromium/public/win/WebScreenInfoFactory.h" +#include + using WebKit::WebInputEvent; using WebKit::WebInputEventFactory; using WebKit::WebKeyboardEvent;