diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index 348856e30..66b75631b 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -59,3 +59,4 @@ Date | CEF Revision | Chromium Revision 2010-10-26 | /trunk@127 | /trunk@63876 2010-10-28 | /trunk@129 | /trunk@64233 2010-11-16 | /trunk@138 | /trunk@66269 +2010-12-16 | /trunk@152 | /trunk@69409 diff --git a/include/cef.h b/include/cef.h index e666243e8..57149ce80 100644 --- a/include/cef.h +++ b/include/cef.h @@ -1770,8 +1770,9 @@ public: local_storage_disabled = r.local_storage_disabled; databases_disabled = r.databases_disabled; application_cache_disabled = r.application_cache_disabled; - experimental_webgl_enabled = r.experimental_webgl_enabled; + webgl_disabled = r.webgl_disabled; accelerated_compositing_disabled = r.accelerated_compositing_disabled; + accelerated_layers_disabled = r.accelerated_layers_disabled; accelerated_2d_canvas_disabled = r.accelerated_2d_canvas_disabled; return *this; diff --git a/include/cef_types.h b/include/cef_types.h index d3022be33..ba31a7fcf 100644 --- a/include/cef_types.h +++ b/include/cef_types.h @@ -200,12 +200,16 @@ typedef struct _cef_browser_settings_t // Set to true (1) to disable application cache. bool application_cache_disabled; - // Set to true (1) to enable experimental WebGL features. - bool experimental_webgl_enabled; + // Set to true (1) to disable WebGL. + bool webgl_disabled; // Set to true (1) to disable accelerated compositing. bool accelerated_compositing_disabled; + // Set to true (1) to disable accelerated layers. This affects features like + // 3D CSS transforms. + bool accelerated_layers_disabled; + // Set to true (1) to disable accelerated 2d canvas. bool accelerated_2d_canvas_disabled; } cef_browser_settings_t; diff --git a/libcef/browser_appcache_system.cc b/libcef/browser_appcache_system.cc index 447810223..10a41d4c9 100644 --- a/libcef/browser_appcache_system.cc +++ b/libcef/browser_appcache_system.cc @@ -431,7 +431,7 @@ WebApplicationCacheHost* BrowserAppCacheSystem::CreateCacheHostForWebKit( } void BrowserAppCacheSystem::SetExtraRequestBits( - URLRequest* request, int host_id, ResourceType::Type resource_type) { + net::URLRequest* request, int host_id, ResourceType::Type resource_type) { if (is_initialized()) { DCHECK(is_io_thread()); AppCacheInterceptor::SetExtraRequestInfo( @@ -440,7 +440,7 @@ void BrowserAppCacheSystem::SetExtraRequestBits( } void BrowserAppCacheSystem::GetExtraResponseBits( - URLRequest* request, int64* cache_id, GURL* manifest_url) { + net::URLRequest* request, int64* cache_id, GURL* manifest_url) { if (is_initialized()) { DCHECK(is_io_thread()); AppCacheInterceptor::GetExtraResponseInfo( diff --git a/libcef/browser_appcache_system.h b/libcef/browser_appcache_system.h index 1d5077522..ac53e3364 100644 --- a/libcef/browser_appcache_system.h +++ b/libcef/browser_appcache_system.h @@ -20,12 +20,12 @@ class WebApplicationCacheHostClient; } class BrowserBackendProxy; class BrowserFrontendProxy; -class URLRequest; +class net::URLRequest; class URLRequestContext; // A class that composes the constituent parts of an appcache system // together for use in a single process with two relavant threads, -// a UI thread on which webkit runs and an IO thread on which URLRequests +// a UI thread on which webkit runs and an IO thread on which net::URLRequests // are handled. This class conspires with BrowserResourceLoaderBridge to // retrieve resources from the appcache. class BrowserAppCacheSystem { @@ -63,7 +63,7 @@ class BrowserAppCacheSystem { } // Called by BrowserResourceLoaderBridge to hook into resource loads. - static void SetExtraRequestInfo(URLRequest* request, + static void SetExtraRequestInfo(net::URLRequest* request, int host_id, ResourceType::Type resource_type) { if (instance_) @@ -71,7 +71,7 @@ class BrowserAppCacheSystem { } // Called by BrowserResourceLoaderBridge extract extra response bits. - static void GetExtraResponseInfo(URLRequest* request, + static void GetExtraResponseInfo(net::URLRequest* request, int64* cache_id, GURL* manifest_url) { if (instance_) @@ -116,10 +116,10 @@ class BrowserAppCacheSystem { void CleanupIOThread(); WebKit::WebApplicationCacheHost* CreateCacheHostForWebKit( WebKit::WebApplicationCacheHostClient* client); - void SetExtraRequestBits(URLRequest* request, + void SetExtraRequestBits(net::URLRequest* request, int host_id, ResourceType::Type resource_type); - void GetExtraResponseBits(URLRequest* request, + void GetExtraResponseBits(net::URLRequest* request, int64* cache_id, GURL* manifest_url); diff --git a/libcef/browser_file_system.cc b/libcef/browser_file_system.cc index bed6c1c3e..1b2a9994f 100644 --- a/libcef/browser_file_system.cc +++ b/libcef/browser_file_system.cc @@ -6,58 +6,79 @@ #include "browser_file_writer.h" #include "base/file_path.h" +#include "base/message_loop.h" #include "base/message_loop_proxy.h" +#include "base/scoped_callback_factory.h" #include "base/time.h" +#include "base/utf_string_conversions.h" +#include "googleurl/src/gurl.h" #include "third_party/WebKit/WebKit/chromium/public/WebFileInfo.h" +#include "third_party/WebKit/WebKit/chromium/public/WebFileSystemCallbacks.h" #include "third_party/WebKit/WebKit/chromium/public/WebFileSystemEntry.h" +#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" +#include "third_party/WebKit/WebKit/chromium/public/WebSecurityOrigin.h" #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" #include "webkit/fileapi/file_system_callback_dispatcher.h" +#include "webkit/fileapi/file_system_path_manager.h" +#include "webkit/fileapi/file_system_types.h" +#include "webkit/fileapi/sandboxed_file_system_context.h" +#include "webkit/fileapi/sandboxed_file_system_operation.h" #include "webkit/glue/webkit_glue.h" +using base::WeakPtr; + using WebKit::WebFileInfo; +using WebKit::WebFileSystem; using WebKit::WebFileSystemCallbacks; using WebKit::WebFileSystemEntry; using WebKit::WebFileWriter; using WebKit::WebFileWriterClient; +using WebKit::WebFrame; +using WebKit::WebSecurityOrigin; using WebKit::WebString; using WebKit::WebVector; +using fileapi::FileSystemCallbackDispatcher; +using fileapi::SandboxedFileSystemContext; +using fileapi::SandboxedFileSystemOperation; + namespace { class BrowserFileSystemCallbackDispatcher - : public fileapi::FileSystemCallbackDispatcher { + : public FileSystemCallbackDispatcher { public: BrowserFileSystemCallbackDispatcher( - BrowserFileSystem* file_system, + const WeakPtr& file_system, WebFileSystemCallbacks* callbacks) : file_system_(file_system), - callbacks_(callbacks), - request_id_(-1) { + callbacks_(callbacks) { } - void set_request_id(int request_id) { request_id_ = request_id; } + ~BrowserFileSystemCallbackDispatcher() { + } virtual void DidSucceed() { + DCHECK(file_system_); callbacks_->didSucceed(); - file_system_->RemoveCompletedOperation(request_id_); } virtual void DidReadMetadata(const base::PlatformFileInfo& info) { + DCHECK(file_system_); WebFileInfo web_file_info; web_file_info.length = info.size; web_file_info.modificationTime = info.last_modified.ToDoubleT(); web_file_info.type = info.is_directory ? WebFileInfo::TypeDirectory : WebFileInfo::TypeFile; callbacks_->didReadMetadata(web_file_info); - file_system_->RemoveCompletedOperation(request_id_); } virtual void DidReadDirectory( const std::vector& entries, bool has_more) { + DCHECK(file_system_); std::vector web_entries_vector; for (std::vector::const_iterator it = - entries.begin(); it != entries.end(); ++it) { + entries.begin(); it != entries.end(); ++it) { WebFileSystemEntry entry; entry.name = webkit_glue::FilePathStringToWebString(it->name); entry.isDirectory = it->is_directory; @@ -66,17 +87,22 @@ class BrowserFileSystemCallbackDispatcher WebVector web_entries = web_entries_vector; callbacks_->didReadDirectory(web_entries, has_more); - file_system_->RemoveCompletedOperation(request_id_); } - virtual void DidOpenFileSystem(const std::string&, const FilePath&) { - NOTREACHED(); + virtual void DidOpenFileSystem( + const std::string& name, const FilePath& path) { + DCHECK(file_system_); + if (path.empty()) + callbacks_->didFail(WebKit::WebFileErrorSecurity); + else + callbacks_->didOpenFileSystem( + UTF8ToUTF16(name), webkit_glue::FilePathToWebString(path)); } virtual void DidFail(base::PlatformFileError error_code) { + DCHECK(file_system_); callbacks_->didFail( webkit_glue::PlatformFileErrorToWebFileError(error_code)); - file_system_->RemoveCompletedOperation(request_id_); } virtual void DidWrite(int64, bool) { @@ -84,18 +110,53 @@ class BrowserFileSystemCallbackDispatcher } private: - BrowserFileSystem* file_system_; + WeakPtr file_system_; WebFileSystemCallbacks* callbacks_; - int request_id_; }; -} // namespace +} // namespace + +BrowserFileSystem::BrowserFileSystem() { + if (file_system_dir_.CreateUniqueTempDir()) { + sandboxed_context_ = new SandboxedFileSystemContext( + base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::CreateForCurrentThread(), + file_system_dir_.path(), + false /* incognito */, + true /* allow_file_access */, + false /* unlimited_quota */); + } else { + LOG(WARNING) << "Failed to create a temp dir for the filesystem." + "FileSystem feature will be disabled."; + } +} BrowserFileSystem::~BrowserFileSystem() { - // Drop all the operations. - for (OperationsMap::const_iterator iter(&operations_); - !iter.IsAtEnd(); iter.Advance()) - operations_.Remove(iter.GetCurrentKey()); +} + +void BrowserFileSystem::OpenFileSystem( + WebFrame* frame, WebFileSystem::Type web_filesystem_type, + long long, bool create, + WebFileSystemCallbacks* callbacks) { + if (!frame || !sandboxed_context_.get()) { + // The FileSystem temp directory was not initialized successfully. + callbacks->didFail(WebKit::WebFileErrorSecurity); + return; + } + + fileapi::FileSystemType type; + if (web_filesystem_type == WebFileSystem::TypeTemporary) + type = fileapi::kFileSystemTypeTemporary; + else if (web_filesystem_type == WebFileSystem::TypePersistent) + type = fileapi::kFileSystemTypePersistent; + else { + // Unknown type filesystem is requested. + callbacks->didFail(WebKit::WebFileErrorSecurity); + return; + } + + GURL origin_url(frame->securityOrigin().toString()); + GetNewOperation(callbacks)->OpenFileSystem(origin_url, type, create); } void BrowserFileSystem::move( @@ -177,18 +238,12 @@ WebFileWriter* BrowserFileSystem::createFileWriter( return new BrowserFileWriter(path, client); } -fileapi::FileSystemOperation* BrowserFileSystem::GetNewOperation( +SandboxedFileSystemOperation* BrowserFileSystem::GetNewOperation( WebFileSystemCallbacks* callbacks) { - // This pointer will be owned by |operation|. BrowserFileSystemCallbackDispatcher* dispatcher = - new BrowserFileSystemCallbackDispatcher(this, callbacks); - fileapi::FileSystemOperation* operation = new fileapi::FileSystemOperation( - dispatcher, base::MessageLoopProxy::CreateForCurrentThread()); - int32 request_id = operations_.Add(operation); - dispatcher->set_request_id(request_id); + new BrowserFileSystemCallbackDispatcher(AsWeakPtr(), callbacks); + SandboxedFileSystemOperation* operation = new SandboxedFileSystemOperation( + dispatcher, base::MessageLoopProxy::CreateForCurrentThread(), + sandboxed_context_.get()); return operation; } - -void BrowserFileSystem::RemoveCompletedOperation(int request_id) { - operations_.Remove(request_id); -} diff --git a/libcef/browser_file_system.h b/libcef/browser_file_system.h index e60229e4a..c57b56d9e 100644 --- a/libcef/browser_file_system.h +++ b/libcef/browser_file_system.h @@ -8,16 +8,33 @@ #include #include "base/file_util_proxy.h" #include "base/id_map.h" +#include "base/scoped_temp_dir.h" +#include "base/weak_ptr.h" #include "third_party/WebKit/WebKit/chromium/public/WebFileSystem.h" -#include "third_party/WebKit/WebKit/chromium/public/WebFileSystemCallbacks.h" -#include "webkit/fileapi/file_system_operation.h" +#include "webkit/fileapi/file_system_types.h" -class BrowserFileSystem : public WebKit::WebFileSystem { +namespace WebKit { +class WebFileSystemCallbacks; +class WebFrame; +} + +namespace fileapi { +class SandboxedFileSystemContext; +class SandboxedFileSystemOperation; +} + +class BrowserFileSystem + : public WebKit::WebFileSystem, + public base::SupportsWeakPtr { public: - BrowserFileSystem() {} + BrowserFileSystem(); virtual ~BrowserFileSystem(); - void RemoveCompletedOperation(int request_id); + void OpenFileSystem(WebKit::WebFrame* frame, + WebKit::WebFileSystem::Type type, + long long size, + bool create, + WebKit::WebFileSystemCallbacks* callbacks); // WebKit::WebFileSystem methods. virtual void move(const WebKit::WebString& src_path, @@ -49,12 +66,13 @@ class BrowserFileSystem : public WebKit::WebFileSystem { private: // Helpers. - fileapi::FileSystemOperation* GetNewOperation( + fileapi::SandboxedFileSystemOperation* GetNewOperation( WebKit::WebFileSystemCallbacks* callbacks); - // Keeps ongoing file system operations. - typedef IDMap OperationsMap; - OperationsMap operations_; + // A temporary directory for FileSystem API. + ScopedTempDir file_system_dir_; + + scoped_refptr sandboxed_context_; DISALLOW_COPY_AND_ASSIGN(BrowserFileSystem); }; diff --git a/libcef/browser_file_writer.cc b/libcef/browser_file_writer.cc index 52439ae57..e5e9cfbf0 100644 --- a/libcef/browser_file_writer.cc +++ b/libcef/browser_file_writer.cc @@ -28,7 +28,8 @@ class BrowserFileWriter::IOThreadProxy : public base::RefCountedThreadSafe { public: explicit IOThreadProxy(const base::WeakPtr& simple_writer) - : simple_writer_(simple_writer) { + : simple_writer_(simple_writer), + operation_(NULL) { io_thread_ = CefThread::GetMessageLoopProxyForThread(CefThread::IO); main_thread_ = base::MessageLoopProxy::CreateForCurrentThread(); } @@ -42,8 +43,8 @@ class BrowserFileWriter::IOThreadProxy this, &IOThreadProxy::Truncate, path, offset)); return; } - DCHECK(!operation_.get()); - operation_.reset(GetNewOperation()); + DCHECK(!operation_); + operation_ = GetNewOperation(); operation_->Truncate(path, offset); } @@ -54,8 +55,8 @@ class BrowserFileWriter::IOThreadProxy return; } DCHECK(request_context_); - DCHECK(!operation_.get()); - operation_.reset(GetNewOperation()); + DCHECK(!operation_); + operation_ = GetNewOperation(); operation_->Write(request_context_, path, blob_url, offset); } @@ -65,12 +66,11 @@ class BrowserFileWriter::IOThreadProxy this, &IOThreadProxy::Cancel)); return; } - if (!operation_.get()) { + if (!operation_) { DidFail(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); return; } - cancel_operation_.reset(GetNewOperation()); - operation_->Cancel(cancel_operation_.get()); + operation_->Cancel(GetNewOperation()); } private: @@ -80,6 +80,10 @@ class BrowserFileWriter::IOThreadProxy explicit CallbackDispatcher(IOThreadProxy* proxy) : proxy_(proxy) { } + ~CallbackDispatcher() { + proxy_->ClearOperation(); + } + virtual void DidSucceed() { proxy_->DidSucceed(); } @@ -117,7 +121,6 @@ class BrowserFileWriter::IOThreadProxy void DidSucceed() { if (!main_thread_->BelongsToCurrentThread()) { - operation_.reset(); main_thread_->PostTask(FROM_HERE, NewRunnableMethod( this, &IOThreadProxy::DidSucceed)); return; @@ -128,7 +131,6 @@ class BrowserFileWriter::IOThreadProxy void DidFail(base::PlatformFileError error_code) { if (!main_thread_->BelongsToCurrentThread()) { - operation_.reset(); main_thread_->PostTask(FROM_HERE, NewRunnableMethod( this, &IOThreadProxy::DidFail, error_code)); return; @@ -139,8 +141,6 @@ class BrowserFileWriter::IOThreadProxy void DidWrite(int64 bytes, bool complete) { if (!main_thread_->BelongsToCurrentThread()) { - if (complete) - operation_.reset(); main_thread_->PostTask(FROM_HERE, NewRunnableMethod( this, &IOThreadProxy::DidWrite, bytes, complete)); return; @@ -149,6 +149,11 @@ class BrowserFileWriter::IOThreadProxy simple_writer_->DidWrite(bytes, complete); } + void ClearOperation() { + DCHECK(io_thread_->BelongsToCurrentThread()); + operation_ = NULL; + } + scoped_refptr io_thread_; scoped_refptr main_thread_; @@ -156,8 +161,7 @@ class BrowserFileWriter::IOThreadProxy base::WeakPtr simple_writer_; // Only used on the io thread. - scoped_ptr operation_; - scoped_ptr cancel_operation_; + FileSystemOperation* operation_; }; diff --git a/libcef/browser_request_context.cc b/libcef/browser_request_context.cc index 07f0a73dc..09a4febd3 100644 --- a/libcef/browser_request_context.cc +++ b/libcef/browser_request_context.cc @@ -101,7 +101,7 @@ void BrowserRequestContext::Init( cache_path, 0, BrowserResourceLoaderBridge::GetCacheThread()); net::HttpCache* cache = - new net::HttpCache(host_resolver_, NULL, proxy_service_, + new net::HttpCache(host_resolver_, NULL, NULL, proxy_service_, ssl_config_service_, http_auth_handler_factory_, NULL, NULL, backend); diff --git a/libcef/browser_resource_loader_bridge.cc b/libcef/browser_resource_loader_bridge.cc index 7f668cce6..6e4ed00b3 100644 --- a/libcef/browser_resource_loader_bridge.cc +++ b/libcef/browser_resource_loader_bridge.cc @@ -4,12 +4,12 @@ // found in the LICENSE file. // // This file contains an implementation of the ResourceLoaderBridge class. -// The class is implemented using URLRequest, meaning it is a "simple" version +// The class is implemented using net::URLRequest, meaning it is a "simple" version // that directly issues requests. The more complicated one used in the // browser uses IPC. // -// Because URLRequest only provides an asynchronous resource loading API, this -// file makes use of URLRequest from a background IO thread. Requests for +// Because net::URLRequest only provides an asynchronous resource loading API, this +// file makes use of net::URLRequest from a background IO thread. Requests for // cookies and synchronously loaded resources result in the main thread of the // application blocking until the IO thread completes the operation. (See // GetCookies and SyncLoad) @@ -17,9 +17,9 @@ // Main thread IO thread // ----------- --------- // ResourceLoaderBridge <---o---------> RequestProxy (normal case) -// \ -> URLRequest +// \ -> net::URLRequest // o-------> SyncRequestProxy (synchronous case) -// -> URLRequest +// -> net::URLRequest // SetCookie <------------------------> CookieSetter // -> net_util::SetCookie // GetCookies <-----------------------> CookieGetter @@ -27,7 +27,7 @@ // // NOTE: The implementation in this file may be used to have WebKit fetch // resources in-process. For example, it is handy for building a single- -// process WebKit embedding (e.g., test_shell) that can use URLRequest to +// process WebKit embedding (e.g., test_shell) that can use net::URLRequest to // perform URL loads. See renderer/resource_dispatcher.h for details on an // alternate implementation that defers fetching to another process. @@ -101,9 +101,9 @@ struct RequestParams { static const int kUpdateUploadProgressIntervalMsec = 100; // The RequestProxy does most of its work on the IO thread. The Start and -// Cancel methods are proxied over to the IO thread, where an URLRequest object +// Cancel methods are proxied over to the IO thread, where an net::URLRequest object // is instantiated. -class RequestProxy : public URLRequest::Delegate, +class RequestProxy : public net::URLRequest::Delegate, public base::RefCountedThreadSafe { public: // Takes ownership of the params. @@ -149,7 +149,7 @@ class RequestProxy : public URLRequest::Delegate, // -------------------------------------------------------------------------- // The following methods are called on the owner's thread in response to - // various URLRequest callbacks. The event hooks, defined below, trigger + // various net::URLRequest callbacks. The event hooks, defined below, trigger // these methods asynchronously. void NotifyReceivedRedirect(const GURL& new_url, @@ -360,7 +360,7 @@ class RequestProxy : public URLRequest::Delegate, ResolveBlobReferencesInUploadData(params->upload.get()); } - request_.reset(new URLRequest(params->url, this)); + request_.reset(new net::URLRequest(params->url, this)); request_->set_method(params->method); request_->set_first_party_for_cookies(params->first_party_for_cookies); request_->set_referrer(params->referrer.spec()); @@ -447,7 +447,7 @@ class RequestProxy : public URLRequest::Delegate, } // -------------------------------------------------------------------------- - // The following methods are event hooks (corresponding to URLRequest + // The following methods are event hooks (corresponding to net::URLRequest // callbacks) that run on the IO thread. They are designed to be overridden // by the SyncRequestProxy subclass. @@ -491,9 +491,9 @@ class RequestProxy : public URLRequest::Delegate, } // -------------------------------------------------------------------------- - // URLRequest::Delegate implementation: + // net::URLRequest::Delegate implementation: - virtual void OnReceivedRedirect(URLRequest* request, + virtual void OnReceivedRedirect(net::URLRequest* request, const GURL& new_url, bool* defer_redirect) { DCHECK(request->status().is_success()); @@ -502,7 +502,7 @@ class RequestProxy : public URLRequest::Delegate, OnReceivedRedirect(new_url, info, defer_redirect); } - virtual void OnResponseStarted(URLRequest* request) { + virtual void OnResponseStarted(net::URLRequest* request) { if (request->status().is_success()) { ResourceResponseInfo info; PopulateResponseInfo(request, &info); @@ -513,14 +513,14 @@ class RequestProxy : public URLRequest::Delegate, } } - virtual void OnSSLCertificateError(URLRequest* request, + virtual void OnSSLCertificateError(net::URLRequest* request, int cert_error, net::X509Certificate* cert) { // Allow all certificate errors. request->ContinueDespiteLastError(); } - virtual void OnReadCompleted(URLRequest* request, int bytes_read) { + virtual void OnReadCompleted(net::URLRequest* request, int bytes_read) { if (request->status().is_success() && bytes_read > 0) { OnReceivedData(bytes_read); } else { @@ -550,7 +550,7 @@ class RequestProxy : public URLRequest::Delegate, // Called on the IO thread. void MaybeUpdateUploadProgress() { - // If a redirect is received upload is cancelled in URLRequest, we should + // If a redirect is received upload is cancelled in net::URLRequest, we should // try to stop the |upload_progress_timer_| timer and return. if (!request_->has_upload()) { if (upload_progress_timer_.IsRunning()) @@ -583,7 +583,7 @@ class RequestProxy : public URLRequest::Delegate, } } - void PopulateResponseInfo(URLRequest* request, + void PopulateResponseInfo(net::URLRequest* request, ResourceResponseInfo* info) const { info->request_time = request->request_time(); info->response_time = request->response_time(); @@ -599,7 +599,7 @@ class RequestProxy : public URLRequest::Delegate, &info->appcache_manifest_url); } - scoped_ptr request_; + scoped_ptr request_; CefRefPtr resource_stream_; // Support for request.download_to_file behavior. diff --git a/libcef/browser_settings.cc b/libcef/browser_settings.cc index 39a259781..ac44879f5 100644 --- a/libcef/browser_settings.cc +++ b/libcef/browser_settings.cc @@ -121,9 +121,10 @@ void BrowserToWebSettings(const CefBrowserSettings& cef, WebPreferences& web) web.allow_universal_access_from_file_urls = cef.universal_access_from_file_urls_allowed; web.allow_file_access_from_file_urls = cef.file_access_from_file_urls_allowed; - web.experimental_webgl_enabled = cef.experimental_webgl_enabled; + web.experimental_webgl_enabled = !cef.webgl_disabled; web.show_composited_layer_borders = false; web.accelerated_compositing_enabled = !cef.accelerated_compositing_disabled; + web.accelerated_layers_enabled = !cef.accelerated_layers_disabled; web.accelerated_2d_canvas_enabled = !cef.accelerated_2d_canvas_disabled; web.memory_info_enabled = false; } diff --git a/libcef/browser_webkit_glue.cc b/libcef/browser_webkit_glue.cc index 85b45bff5..a6b429160 100644 --- a/libcef/browser_webkit_glue.cc +++ b/libcef/browser_webkit_glue.cc @@ -26,6 +26,7 @@ MSVC_POP_WARNING(); #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h" #include "webkit/glue/webkit_glue.h" +#include "webkit/glue/plugins/plugin_list.h" // Generated by GRIT #include "grit/webkit_resources.h" @@ -60,6 +61,10 @@ bool GetPluginFinderURL(std::string* plugin_finder_url) { return false; } +void GetPlugins(bool refresh, std::vector* plugins) { + NPAPI::PluginList::Singleton()->GetPlugins(refresh, plugins); +} + bool IsDefaultPluginEnabled() { return false; } diff --git a/libcef/browser_webkit_glue_mac.mm b/libcef/browser_webkit_glue_mac.mm index cfbfcea73..be3ec1b38 100644 --- a/libcef/browser_webkit_glue_mac.mm +++ b/libcef/browser_webkit_glue_mac.mm @@ -17,7 +17,6 @@ #include "base/path_service.h" #include "grit/webkit_resources.h" #include "webkit/glue/webkit_glue.h" -#include "webkit/glue/plugins/plugin_list.h" namespace webkit_glue { @@ -127,10 +126,6 @@ base::StringPiece GetDataResource(int resource_id) { return base::StringPiece(); } -void GetPlugins(bool refresh, std::vector* plugins) { - NPAPI::PluginList::Singleton()->GetPlugins(refresh, plugins); -} - void DidLoadPlugin(const std::string& filename) { } diff --git a/libcef/browser_webkit_glue_win.cc b/libcef/browser_webkit_glue_win.cc index bcdeb9c6b..a62cf297f 100644 --- a/libcef/browser_webkit_glue_win.cc +++ b/libcef/browser_webkit_glue_win.cc @@ -25,7 +25,6 @@ MSVC_POP_WARNING(); #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" #include "third_party/WebKit/WebKit/chromium/public/WebView.h" #include "webkit/glue/webkit_glue.h" -#include "webkit/glue/plugins/plugin_list.h" using WebKit::WebRect; using WebKit::WebSize; @@ -70,10 +69,6 @@ base::StringPiece GetDataResource(int resource_id) { return NetResourceProvider(resource_id); } -void GetPlugins(bool refresh, std::vector* plugins) { - NPAPI::PluginList::Singleton()->GetPlugins(refresh, plugins); -} - bool EnsureFontLoaded(HFONT font) { return true; } diff --git a/libcef/browser_webkit_init.h b/libcef/browser_webkit_init.h index 9d5979e96..512b49cd8 100644 --- a/libcef/browser_webkit_init.h +++ b/libcef/browser_webkit_init.h @@ -232,6 +232,56 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl { return WebKit::WebGraphicsContext3D::createDefault(); } + WebKit::WebString queryLocalizedString( + WebKit::WebLocalizedString::Name name) { + switch (name) { + case WebKit::WebLocalizedString::ValidationValueMissing: + case WebKit::WebLocalizedString::ValidationValueMissingForCheckbox: + case WebKit::WebLocalizedString::ValidationValueMissingForFile: + case WebKit::WebLocalizedString::ValidationValueMissingForMultipleFile: + case WebKit::WebLocalizedString::ValidationValueMissingForRadio: + case WebKit::WebLocalizedString::ValidationValueMissingForSelect: + return ASCIIToUTF16("value missing"); + case WebKit::WebLocalizedString::ValidationTypeMismatch: + case WebKit::WebLocalizedString::ValidationTypeMismatchForEmail: + case WebKit::WebLocalizedString::ValidationTypeMismatchForMultipleEmail: + case WebKit::WebLocalizedString::ValidationTypeMismatchForURL: + return ASCIIToUTF16("type mismatch"); + case WebKit::WebLocalizedString::ValidationPatternMismatch: + return ASCIIToUTF16("pattern mismatch"); + case WebKit::WebLocalizedString::ValidationTooLong: + return ASCIIToUTF16("too long"); + case WebKit::WebLocalizedString::ValidationRangeUnderflow: + return ASCIIToUTF16("range underflow"); + case WebKit::WebLocalizedString::ValidationRangeOverflow: + return ASCIIToUTF16("range overflow"); + case WebKit::WebLocalizedString::ValidationStepMismatch: + return ASCIIToUTF16("step mismatch"); + default: + return WebKitClientImpl::queryLocalizedString(name); + } + } + + WebKit::WebString queryLocalizedString( + WebKit::WebLocalizedString::Name name, const WebKit::WebString& value) { + if (name == WebKit::WebLocalizedString::ValidationRangeUnderflow) + return ASCIIToUTF16("range underflow"); + if (name == WebKit::WebLocalizedString::ValidationRangeOverflow) + return ASCIIToUTF16("range overflow"); + return WebKitClientImpl::queryLocalizedString(name, value); + } + + WebKit::WebString queryLocalizedString( + WebKit::WebLocalizedString::Name name, + const WebKit::WebString& value1, + const WebKit::WebString& value2) { + if (name == WebKit::WebLocalizedString::ValidationTooLong) + return ASCIIToUTF16("too long"); + if (name == WebKit::WebLocalizedString::ValidationStepMismatch) + return ASCIIToUTF16("step mismatch"); + return WebKitClientImpl::queryLocalizedString(name, value1, value2); + } + private: webkit_glue::SimpleWebMimeRegistryImpl mime_registry_; webkit_glue::WebClipboardImpl clipboard_; diff --git a/libcef/browser_webview_delegate.cc b/libcef/browser_webview_delegate.cc index 76b46164d..9caf910b6 100644 --- a/libcef/browser_webview_delegate.cc +++ b/libcef/browser_webview_delegate.cc @@ -9,6 +9,7 @@ #include "browser_webview_delegate.h" #include "browser_appcache_system.h" +#include "browser_file_system.h" #include "browser_impl.h" #include "browser_navigation_controller.h" #include "browser_web_worker.h" @@ -22,6 +23,7 @@ #include "base/process_util.h" #include "base/string_util.h" #include "gfx/point.h" +#include "media/base/filter_collection.h" #include "media/filters/audio_renderer_impl.h" #include "net/base/net_errors.h" #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" @@ -553,30 +555,12 @@ WebWorker* BrowserWebViewDelegate::createWorker( WebMediaPlayer* BrowserWebViewDelegate::createMediaPlayer( WebFrame* frame, WebMediaPlayerClient* client) { - scoped_ptr collection( - new media::MediaFilterCollection()); + scoped_ptr collection( + new media::FilterCollection()); - appcache::WebApplicationCacheHostImpl* appcache_host = - appcache::WebApplicationCacheHostImpl::FromFrame(frame); - - // TODO(hclam): this is the same piece of code as in RenderView, maybe they - // should be grouped together. - webkit_glue::MediaResourceLoaderBridgeFactory* bridge_factory_simple = - new webkit_glue::MediaResourceLoaderBridgeFactory( - GURL(frame->url()), // referrer - "null", // frame origin - "null", // main_frame_origin - base::GetCurrentProcId(), - appcache_host ? appcache_host->host_id() : appcache::kNoHostId, - 0); - webkit_glue::MediaResourceLoaderBridgeFactory* bridge_factory_buffered = - new webkit_glue::MediaResourceLoaderBridgeFactory( - GURL(frame->url()), // referrer - "null", // frame origin - "null", // main_frame_origin - base::GetCurrentProcId(), - appcache_host ? appcache_host->host_id() : appcache::kNoHostId, - 0); + // TODO(annacc): do we still need appcache_host? http://crbug.com/65135 + // appcache::WebApplicationCacheHostImpl* appcache_host = + // appcache::WebApplicationCacheHostImpl::FromFrame(frame); scoped_refptr video_renderer( new webkit_glue::VideoRendererImpl(false)); @@ -585,9 +569,11 @@ WebMediaPlayer* BrowserWebViewDelegate::createMediaPlayer( // Add the audio renderer. collection->AddAudioRenderer(new media::AudioRendererImpl()); - return new webkit_glue::WebMediaPlayerImpl( - client, collection.release(), bridge_factory_simple, - bridge_factory_buffered, false, video_renderer); + scoped_ptr result( + new webkit_glue::WebMediaPlayerImpl(client, collection.release())); + if (!result->Initialize(frame, false, video_renderer)) + return NULL; + return result.release(); } WebApplicationCacheHost* BrowserWebViewDelegate::createApplicationCacheHost( @@ -826,15 +812,9 @@ void BrowserWebViewDelegate::reportFindInPageSelection( void BrowserWebViewDelegate::openFileSystem( WebFrame* frame, WebFileSystem::Type type, long long size, bool create, WebFileSystemCallbacks* callbacks) { - if (browser_->file_system_root().empty()) { - // The FileSystem temp directory was not initialized successfully. - callbacks->didFail(WebKit::WebFileErrorSecurity); - } else { - // TODO(michaeln): need to put origin/type in the path. - callbacks->didOpenFileSystem( - "CefFileSystem", - webkit_glue::FilePathToWebString(browser_->file_system_root())); - } + BrowserFileSystem* fileSystem = static_cast( + WebKit::webKitClient()->fileSystem()); + fileSystem->OpenFileSystem(frame, type, size, create, callbacks); } // Public methods ------------------------------------------------------------ diff --git a/libcef/cef_process_ui_thread.cc b/libcef/cef_process_ui_thread.cc index 9a941a47b..eecf2e06e 100644 --- a/libcef/cef_process_ui_thread.cc +++ b/libcef/cef_process_ui_thread.cc @@ -36,8 +36,8 @@ static int kStatsFileCounters = 200; namespace { -URLRequestJob* BlobURLRequestJobFactory(URLRequest* request, - const std::string& scheme) { +net::URLRequestJob* BlobURLRequestJobFactory(net::URLRequest* request, + const std::string& scheme) { webkit_blob::BlobStorageController* blob_storage_controller = static_cast(request->context())-> blob_storage_controller(); @@ -116,7 +116,7 @@ void CefProcessUIThread::Init() { gfx::InitializeGLBindings(gfx::kGLImplementationDesktopGL); - URLRequest::RegisterProtocolFactory("blob", &BlobURLRequestJobFactory); + net::URLRequest::RegisterProtocolFactory("blob", &BlobURLRequestJobFactory); if (!_Context->cache_path().empty()) { // Create the storage context object. diff --git a/libcef/request_impl.cc b/libcef/request_impl.cc index a2bd4738c..ad1cbaed3 100644 --- a/libcef/request_impl.cc +++ b/libcef/request_impl.cc @@ -96,7 +96,7 @@ void CefRequestImpl::Set(const CefString& url, Unlock(); } -void CefRequestImpl::Set(URLRequest* request) +void CefRequestImpl::Set(net::URLRequest* request) { SetURL(request->url().spec()); SetMethod(request->method()); diff --git a/libcef/request_impl.h b/libcef/request_impl.h index f8e4328f8..cd5b3828e 100644 --- a/libcef/request_impl.h +++ b/libcef/request_impl.h @@ -11,7 +11,9 @@ #include "third_party/WebKit/WebKit/chromium/public/WebHTTPBody.h" #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" +namespace net { class URLRequest; +}; // Implementation of CefRequest class CefRequestImpl : public CefThreadSafeBase @@ -33,7 +35,7 @@ public: CefRefPtr postData, const HeaderMap& headerMap); - void Set(URLRequest* request); + void Set(net::URLRequest* request); static void GetHeaderMap(const net::HttpRequestHeaders& headers, HeaderMap& map); diff --git a/libcef/scheme_impl.cc b/libcef/scheme_impl.cc index 101be6dc9..9cb27085f 100644 --- a/libcef/scheme_impl.cc +++ b/libcef/scheme_impl.cc @@ -43,12 +43,12 @@ static void TrackAdd(CefTrackObject* object) -// URLRequestJob implementation. +// net::URLRequestJob implementation. -class CefUrlRequestJob : public URLRequestJob { +class CefUrlRequestJob : public net::URLRequestJob { public: - CefUrlRequestJob(URLRequest* request, CefRefPtr handler) - : URLRequestJob(request), + CefUrlRequestJob(net::URLRequest* request, CefRefPtr handler) + : net::URLRequestJob(request), handler_(handler), response_length_(0), url_(request->url()), @@ -74,7 +74,7 @@ public: async_resolver_ = NULL; } - URLRequestJob::Kill(); + net::URLRequestJob::Kill(); } virtual bool ReadRawData(net::IOBuffer* dest, int dest_size, int *bytes_read) @@ -229,7 +229,7 @@ private: }; -// URLRequestFilter clone that manages the CefSchemeHandlerFactory pointers. +// net::URLRequestFilter clone that manages the CefSchemeHandlerFactory pointers. class CefUrlRequestFilter { public: @@ -245,7 +245,7 @@ public: return shared_instance_; } - static URLRequestJob* Factory(URLRequest* request, + static net::URLRequestJob* Factory(net::URLRequest* request, const std::string& scheme) { // Returning null here just means that the built-in handler will be used. @@ -259,7 +259,7 @@ public: handler_map_[make_pair(scheme, hostname)] = factory; // Register with the ProtocolFactory. - URLRequest::RegisterProtocolFactory(scheme, + net::URLRequest::RegisterProtocolFactory(scheme, &CefUrlRequestFilter::Factory); } @@ -285,14 +285,14 @@ public: } for (std::set::const_iterator scheme = schemes.begin(); scheme != schemes.end(); ++scheme) { - URLRequest::RegisterProtocolFactory(*scheme, NULL); + net::URLRequest::RegisterProtocolFactory(*scheme, NULL); } handler_map_.clear(); hit_count_ = 0; } - CefSchemeHandlerFactory* FindRequestHandlerFactory(URLRequest* request, + CefSchemeHandlerFactory* FindRequestHandlerFactory(net::URLRequest* request, const std::string& scheme) { CefSchemeHandlerFactory* factory = NULL; @@ -323,10 +323,10 @@ protected: CefUrlRequestFilter() : hit_count_(0) { } // Helper method that looks up the request in the handler_map_. - URLRequestJob* FindRequestHandler(URLRequest* request, + net::URLRequestJob* FindRequestHandler(net::URLRequest* request, const std::string& scheme) { - URLRequestJob* job = NULL; + net::URLRequestJob* job = NULL; CefSchemeHandlerFactory* factory = FindRequestHandlerFactory(request, scheme); if (factory) { @@ -336,7 +336,7 @@ protected: } if (job) { - DLOG(INFO) << "URLRequestFilter hit for " << request->url().spec(); + DLOG(INFO) << "net::URLRequestFilter hit for " << request->url().spec(); hit_count_++; } return job; diff --git a/tests/cefclient/cefclient.cpp b/tests/cefclient/cefclient.cpp index a3d40d1f6..642d1411a 100644 --- a/tests/cefclient/cefclient.cpp +++ b/tests/cefclient/cefclient.cpp @@ -339,3 +339,27 @@ void RunLocalStorageTest(CefRefPtr browser) { browser->GetMainFrame()->LoadURL("http://tests/localstorage"); } + +void RunAccelerated2DCanvasTest(CefRefPtr browser) +{ + browser->GetMainFrame()->LoadURL( + "http://mudcu.be/labs/JS1k/BreathingGalaxies.html"); +} + +void RunAcceleratedLayersTest(CefRefPtr browser) +{ + browser->GetMainFrame()->LoadURL( + "http://webkit.org/blog-files/3d-transforms/poster-circle.html"); +} + +void RunWebGLTest(CefRefPtr browser) +{ + browser->GetMainFrame()->LoadURL( + "http://webglsamples.googlecode.com/hg/field/field.html"); +} + +void RunHTML5VideoTest(CefRefPtr browser) +{ + browser->GetMainFrame()->LoadURL( + "http://www.youtube.com/watch?v=siOHh0uzcuY&html5=True"); +} diff --git a/tests/cefclient/cefclient.h b/tests/cefclient/cefclient.h index c0e6570bd..b2b7b3be9 100644 --- a/tests/cefclient/cefclient.h +++ b/tests/cefclient/cefclient.h @@ -363,5 +363,9 @@ void RunRequestTest(CefRefPtr browser); void RunJavaScriptExecuteTest(CefRefPtr browser); void RunPopupTest(CefRefPtr browser); void RunLocalStorageTest(CefRefPtr browser); +void RunAccelerated2DCanvasTest(CefRefPtr browser); +void RunAcceleratedLayersTest(CefRefPtr browser); +void RunWebGLTest(CefRefPtr browser); +void RunHTML5VideoTest(CefRefPtr browser); #endif // _CEFCLIENT_H diff --git a/tests/cefclient/cefclient.rc b/tests/cefclient/cefclient.rc index b694688ad..2a56487da 100644 --- a/tests/cefclient/cefclient.rc +++ b/tests/cefclient/cefclient.rc @@ -75,6 +75,10 @@ BEGIN MENUITEM "Scheme Handler", ID_TESTS_SCHEME_HANDLER MENUITEM "UI App Example", ID_TESTS_UIAPP MENUITEM "Local Storage", ID_TESTS_LOCALSTORAGE + MENUITEM "Accelerated 2D Canvas", ID_TESTS_ACCELERATED2DCANVAS + MENUITEM "Accelerated Layers", ID_TESTS_ACCELERATEDLAYERS + MENUITEM "WebGL", ID_TESTS_WEBGL + MENUITEM "HTML5 Video", ID_TESTS_HTML5VIDEO END END diff --git a/tests/cefclient/cefclient_win.cpp b/tests/cefclient/cefclient_win.cpp index a9b4156ff..4f464e6a5 100644 --- a/tests/cefclient/cefclient_win.cpp +++ b/tests/cefclient/cefclient_win.cpp @@ -548,6 +548,22 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) if(browser.get()) RunLocalStorageTest(browser); return 0; + case ID_TESTS_ACCELERATED2DCANVAS: // Test accelerated 2d canvas + if(browser.get()) + RunAccelerated2DCanvasTest(browser); + return 0; + case ID_TESTS_ACCELERATEDLAYERS: // Test accelerated layers + if(browser.get()) + RunAcceleratedLayersTest(browser); + return 0; + case ID_TESTS_WEBGL: // Test WebGL + if(browser.get()) + RunWebGLTest(browser); + return 0; + case ID_TESTS_HTML5VIDEO: // Test HTML5 video + if(browser.get()) + RunHTML5VideoTest(browser); + return 0; } } break; diff --git a/tests/cefclient/resource.h b/tests/cefclient/resource.h index 52df939ea..34857b71d 100644 --- a/tests/cefclient/resource.h +++ b/tests/cefclient/resource.h @@ -37,6 +37,10 @@ #define ID_TESTS_SCHEME_HANDLER 32777 #define ID_TESTS_UIAPP 32778 #define ID_TESTS_LOCALSTORAGE 32779 +#define ID_TESTS_ACCELERATED2DCANVAS 32780 +#define ID_TESTS_ACCELERATEDLAYERS 32781 +#define ID_TESTS_WEBGL 32782 +#define ID_TESTS_HTML5VIDEO 32783 #define IDC_STATIC -1 #define IDS_LOGO 1000 #define IDS_UIPLUGIN 1001 diff --git a/tools/patch_build.bat b/tools/patch_build.bat index aa1dcddcf..ade281d22 100644 --- a/tools/patch_build.bat +++ b/tools/patch_build.bat @@ -1,2 +1,2 @@ @echo off -..\third_party\python_24\python.exe tools\patcher.py --patch-config patch/patch_build.cfg \ No newline at end of file +..\third_party\python_26\python.exe tools\patcher.py --patch-config patch/patch_build.cfg \ No newline at end of file diff --git a/tools/patch_source.bat b/tools/patch_source.bat index e256386fb..14d9a6c8a 100644 --- a/tools/patch_source.bat +++ b/tools/patch_source.bat @@ -1,2 +1,2 @@ @echo off -..\third_party\python_24\python.exe tools\patcher.py --patch-config patch/patch_source.cfg \ No newline at end of file +..\third_party\python_26\python.exe tools\patcher.py --patch-config patch/patch_source.cfg \ No newline at end of file diff --git a/tools/translator.bat b/tools/translator.bat index 45141a0d0..6ffe4b752 100644 --- a/tools/translator.bat +++ b/tools/translator.bat @@ -1,3 +1,3 @@ @echo off -..\..\third_party\python_24\python.exe translator.py --cpp-header ..\include\cef.h --capi-header ..\include\cef_capi.h --cpptoc-dir ..\libcef_dll\cpptoc --ctocpp-dir ..\libcef_dll\ctocpp +..\..\third_party\python_26\python.exe translator.py --cpp-header ..\include\cef.h --capi-header ..\include\cef_capi.h --cpptoc-dir ..\libcef_dll\cpptoc --ctocpp-dir ..\libcef_dll\ctocpp pause \ No newline at end of file