diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index eeeb2548..86895e92 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -64,3 +64,4 @@ Date | CEF Revision | Chromium Revision 2011-01-11 | /trunk@162 | /trunk@71081 2011-02-15 | /trunk@186 | /trunk@74933 2011-04-05 | /trunk@213 | /trunk@80310 +2011-05-16 | /trunk@233 | /trunk@85305 diff --git a/cef.gyp b/cef.gyp index c800bbdb..633a42d9 100644 --- a/cef.gyp +++ b/cef.gyp @@ -268,6 +268,7 @@ '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg', '../third_party/icu/icu.gyp:icui18n', '../third_party/icu/icu.gyp:icuuc', + '../third_party/leveldb/leveldb.gyp:leveldb', '../third_party/libjpeg_turbo/libjpeg.gyp:libjpeg', '../third_party/libpng/libpng.gyp:libpng', '../third_party/libxml/libxml.gyp:libxml', @@ -395,6 +396,8 @@ ['OS=="win"', { 'dependencies': [ '../breakpad/breakpad.gyp:breakpad_handler', + '../third_party/angle/src/build_angle.gyp:libEGL', + '../third_party/angle/src/build_angle.gyp:libGLESv2', '../views/views.gyp:views', ], 'sources': [ @@ -526,6 +529,7 @@ '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg', '../third_party/icu/icu.gyp:icui18n', '../third_party/icu/icu.gyp:icuuc', + '../third_party/leveldb/leveldb.gyp:leveldb', '../third_party/libjpeg_turbo/libjpeg.gyp:libjpeg', '../third_party/libpng/libpng.gyp:libpng', '../third_party/libxml/libxml.gyp:libxml', @@ -662,6 +666,8 @@ ['OS=="win"', { 'dependencies': [ '../breakpad/breakpad.gyp:breakpad_handler', + '../third_party/angle/src/build_angle.gyp:libEGL', + '../third_party/angle/src/build_angle.gyp:libGLESv2', '../views/views.gyp:views', ], 'sources': [ diff --git a/libcef/browser_database_system.cc b/libcef/browser_database_system.cc index e95f633f..b9455272 100644 --- a/libcef/browser_database_system.cc +++ b/libcef/browser_database_system.cc @@ -29,12 +29,12 @@ BrowserDatabaseSystem* BrowserDatabaseSystem::GetInstance() { } BrowserDatabaseSystem::BrowserDatabaseSystem() - : db_thread_("SimpleDBThread"), + : db_thread_("BrowserDBThread"), open_connections_(new webkit_database::DatabaseConnectionsWrapper) { DCHECK(!instance_); instance_ = this; CHECK(temp_dir_.CreateUniqueTempDir()); - db_tracker_ = new DatabaseTracker(temp_dir_.path(), false, NULL); + db_tracker_ = new DatabaseTracker(temp_dir_.path(), false, NULL, NULL, NULL); db_tracker_->AddObserver(this); db_thread_.Start(); db_thread_proxy_ = db_thread_.message_loop_proxy(); diff --git a/libcef/browser_file_system.cc b/libcef/browser_file_system.cc index 869892be..8012701e 100644 --- a/libcef/browser_file_system.cc +++ b/libcef/browser_file_system.cc @@ -64,6 +64,11 @@ class BrowserFileSystemCallbackDispatcher callbacks_->didSucceed(); } + // Callback to report information for a file. + virtual void DidGetLocalPath(const FilePath& local_path) { + NOTREACHED(); + } + virtual void DidReadMetadata(const base::PlatformFileInfo& info, const FilePath& platform_path) { DCHECK(file_system_); @@ -95,13 +100,13 @@ class BrowserFileSystemCallbackDispatcher } virtual void DidOpenFileSystem( - const std::string& name, const FilePath& path) { + const std::string& name, const GURL& root) { DCHECK(file_system_); - if (path.empty()) + if (!root.is_valid()) callbacks_->didFail(WebKit::WebFileErrorSecurity); else callbacks_->didOpenFileSystem( - UTF8ToUTF16(name), webkit_glue::FilePathToWebString(path)); + WebString::fromUTF8(name), WebString::fromUTF8(root.spec())); } virtual void DidFail(base::PlatformFileError error_code) { @@ -127,10 +132,12 @@ BrowserFileSystem::BrowserFileSystem() { base::MessageLoopProxy::CreateForCurrentThread(), base::MessageLoopProxy::CreateForCurrentThread(), NULL /* special storage policy */, + NULL /* quota manager */, file_system_dir_.path(), false /* incognito */, true /* allow_file_access */, - true /* unlimited_quota */); + true /* unlimited_quota */, + NULL); } else { LOG(WARNING) << "Failed to create a temp dir for the filesystem." "FileSystem feature will be disabled."; @@ -155,6 +162,8 @@ void BrowserFileSystem::OpenFileSystem( type = fileapi::kFileSystemTypeTemporary; else if (web_filesystem_type == WebFileSystem::TypePersistent) type = fileapi::kFileSystemTypePersistent; + else if (web_filesystem_type == WebFileSystem::TypeExternal) + type = fileapi::kFileSystemTypeExternal; else { // Unknown type filesystem is requested. callbacks->didFail(WebKit::WebFileErrorSecurity); @@ -168,80 +177,58 @@ void BrowserFileSystem::OpenFileSystem( void BrowserFileSystem::move( const WebString& src_path, const WebString& dest_path, WebFileSystemCallbacks* callbacks) { - FilePath dest_filepath(webkit_glue::WebStringToFilePath(dest_path)); - FilePath src_filepath(webkit_glue::WebStringToFilePath(src_path)); - - GetNewOperation(callbacks)->Move(src_filepath, dest_filepath); + GetNewOperation(callbacks)->Move(GURL(src_path), GURL(dest_path)); } void BrowserFileSystem::copy( const WebString& src_path, const WebString& dest_path, WebFileSystemCallbacks* callbacks) { - FilePath dest_filepath(webkit_glue::WebStringToFilePath(dest_path)); - FilePath src_filepath(webkit_glue::WebStringToFilePath(src_path)); - - GetNewOperation(callbacks)->Copy(src_filepath, dest_filepath); + GetNewOperation(callbacks)->Copy(GURL(src_path), GURL(dest_path)); } void BrowserFileSystem::remove( const WebString& path, WebFileSystemCallbacks* callbacks) { - FilePath filepath(webkit_glue::WebStringToFilePath(path)); - - GetNewOperation(callbacks)->Remove(filepath, false /* recursive */); + GetNewOperation(callbacks)->Remove(GURL(path), false /* recursive */); } void BrowserFileSystem::removeRecursively( const WebString& path, WebFileSystemCallbacks* callbacks) { - FilePath filepath(webkit_glue::WebStringToFilePath(path)); - - GetNewOperation(callbacks)->Remove(filepath, true /* recursive */); + GetNewOperation(callbacks)->Remove(GURL(path), true /* recursive */); } void BrowserFileSystem::readMetadata( const WebString& path, WebFileSystemCallbacks* callbacks) { - FilePath filepath(webkit_glue::WebStringToFilePath(path)); - - GetNewOperation(callbacks)->GetMetadata(filepath); + GetNewOperation(callbacks)->GetMetadata(GURL(path)); } void BrowserFileSystem::createFile( const WebString& path, bool exclusive, WebFileSystemCallbacks* callbacks) { - FilePath filepath(webkit_glue::WebStringToFilePath(path)); - - GetNewOperation(callbacks)->CreateFile(filepath, exclusive); + GetNewOperation(callbacks)->CreateFile(GURL(path), exclusive); } void BrowserFileSystem::createDirectory( const WebString& path, bool exclusive, WebFileSystemCallbacks* callbacks) { - FilePath filepath(webkit_glue::WebStringToFilePath(path)); - - GetNewOperation(callbacks)->CreateDirectory(filepath, exclusive, false); + GetNewOperation(callbacks)->CreateDirectory(GURL(path), exclusive, false); } void BrowserFileSystem::fileExists( const WebString& path, WebFileSystemCallbacks* callbacks) { - FilePath filepath(webkit_glue::WebStringToFilePath(path)); - - GetNewOperation(callbacks)->FileExists(filepath); + GetNewOperation(callbacks)->FileExists(GURL(path)); } void BrowserFileSystem::directoryExists( const WebString& path, WebFileSystemCallbacks* callbacks) { - FilePath filepath(webkit_glue::WebStringToFilePath(path)); - - GetNewOperation(callbacks)->DirectoryExists(filepath); + GetNewOperation(callbacks)->DirectoryExists(GURL(path)); } void BrowserFileSystem::readDirectory( const WebString& path, WebFileSystemCallbacks* callbacks) { - FilePath filepath(webkit_glue::WebStringToFilePath(path)); - - GetNewOperation(callbacks)->ReadDirectory(filepath); + GetNewOperation(callbacks)->ReadDirectory(GURL(path)); } WebFileWriter* BrowserFileSystem::createFileWriter( const WebString& path, WebFileWriterClient* client) { - return new BrowserFileWriter(path, client, file_system_context_.get()); + return new BrowserFileWriter(GURL(path), client, file_system_context_.get()); } FileSystemOperation* BrowserFileSystem::GetNewOperation( diff --git a/libcef/browser_file_writer.cc b/libcef/browser_file_writer.cc index 25fc5107..a637878c 100644 --- a/libcef/browser_file_writer.cc +++ b/libcef/browser_file_writer.cc @@ -43,7 +43,7 @@ class BrowserFileWriter::IOThreadProxy virtual ~IOThreadProxy() { } - void Truncate(const FilePath& path, int64 offset) { + void Truncate(const GURL& path, int64 offset) { if (!io_thread_->BelongsToCurrentThread()) { io_thread_->PostTask(FROM_HERE, NewRunnableMethod( this, &IOThreadProxy::Truncate, path, offset)); @@ -54,7 +54,7 @@ class BrowserFileWriter::IOThreadProxy operation_->Truncate(path, offset); } - void Write(const FilePath& path, const GURL& blob_url, int64 offset) { + void Write(const GURL& path, const GURL& blob_url, int64 offset) { if (!io_thread_->BelongsToCurrentThread()) { io_thread_->PostTask(FROM_HERE, NewRunnableMethod( this, &IOThreadProxy::Write, path, blob_url, offset)); @@ -94,6 +94,10 @@ class BrowserFileWriter::IOThreadProxy proxy_->DidSucceed(); } + virtual void DidGetLocalPath(const FilePath& local_path) { + NOTREACHED(); + } + virtual void DidFail(base::PlatformFileError error_code) { proxy_->DidFail(error_code); } @@ -116,7 +120,7 @@ class BrowserFileWriter::IOThreadProxy virtual void DidOpenFileSystem( const std::string& name, - const FilePath& root_path) { + const GURL& root) { NOTREACHED(); } @@ -179,7 +183,7 @@ class BrowserFileWriter::IOThreadProxy BrowserFileWriter::BrowserFileWriter( - const WebString& path, + const GURL& path, WebFileWriterClient* client, FileSystemContext* file_system_context) : WebFileWriterBase(path, client), @@ -189,12 +193,12 @@ BrowserFileWriter::BrowserFileWriter( BrowserFileWriter::~BrowserFileWriter() { } -void BrowserFileWriter::DoTruncate(const FilePath& path, int64 offset) { +void BrowserFileWriter::DoTruncate(const GURL& path, int64 offset) { io_thread_proxy_->Truncate(path, offset); } void BrowserFileWriter::DoWrite( - const FilePath& path, const GURL& blob_url, int64 offset) { + const GURL& path, const GURL& blob_url, int64 offset) { io_thread_proxy_->Write(path, blob_url, offset); } diff --git a/libcef/browser_file_writer.h b/libcef/browser_file_writer.h index bf9a7935..d4f59715 100644 --- a/libcef/browser_file_writer.h +++ b/libcef/browser_file_writer.h @@ -19,10 +19,10 @@ class FileSystemContext; // An implementation of WebFileWriter for use in test_shell and DRT. class BrowserFileWriter : public fileapi::WebFileWriterBase, - public base::SupportsWeakPtr { + public base::SupportsWeakPtr { public: BrowserFileWriter( - const WebKit::WebString& path, + const GURL& path, WebKit::WebFileWriterClient* client, fileapi::FileSystemContext* file_system_context); virtual ~BrowserFileWriter(); @@ -37,8 +37,8 @@ class BrowserFileWriter : public fileapi::WebFileWriterBase, protected: // WebFileWriterBase overrides - virtual void DoTruncate(const FilePath& path, int64 offset); - virtual void DoWrite(const FilePath& path, const GURL& blob_url, + virtual void DoTruncate(const GURL& path, int64 offset); + virtual void DoWrite(const GURL& path, const GURL& blob_url, int64 offset); virtual void DoCancel(); diff --git a/libcef/browser_impl_win.cc b/libcef/browser_impl_win.cc index a4025549..3a533f8d 100644 --- a/libcef/browser_impl_win.cc +++ b/libcef/browser_impl_win.cc @@ -9,7 +9,7 @@ #include "printing/units.h" #include "skia/ext/vector_canvas.h" -#include "skia/ext/vector_platform_device_win.h" +#include "skia/ext/vector_platform_device_emf_win.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" @@ -263,9 +263,9 @@ void CefBrowserImpl::UIT_PrintPage(int page_number, int total_pages, DCHECK_NE(saved_state, 0); skia::PlatformDevice* device = - skia::VectorPlatformDeviceFactory::CreateDevice(dest_size_x, - dest_size_y, - true, hDC); + skia::VectorPlatformDeviceEmfFactory::CreateDevice(dest_size_x, + dest_size_y, + true, hDC); DCHECK(device); skia::VectorCanvas canvas(device); diff --git a/libcef/browser_persistent_cookie_store.cc b/libcef/browser_persistent_cookie_store.cc index 9986495a..392f05f7 100644 --- a/libcef/browser_persistent_cookie_store.cc +++ b/libcef/browser_persistent_cookie_store.cc @@ -185,12 +185,14 @@ bool BrowserPersistentCookieStore::Backend::Load( smt.ColumnString(3), // value smt.ColumnString(1), // domain smt.ColumnString(4), // path + std::string(), // TODO(abarth): Persist mac_key + std::string(), // TODO(abarth): Persist mac_algorithm + Time::FromInternalValue(smt.ColumnInt64(0)), // creation_utc + Time::FromInternalValue(smt.ColumnInt64(5)), // expires_utc + Time::FromInternalValue(smt.ColumnInt64(8)), // last_access_utc smt.ColumnInt(6) != 0, // secure smt.ColumnInt(7) != 0, // httponly - Time::FromInternalValue(smt.ColumnInt64(0)), // creation_utc - Time::FromInternalValue(smt.ColumnInt64(8)), // last_access_utc - true, // has_expires - Time::FromInternalValue(smt.ColumnInt64(5)))); // expires_utc + true)); // has_ DLOG_IF(WARNING, cc->CreationDate() > Time::Now()) << L"CreationDate too recent"; cookies->push_back(cc.release()); diff --git a/libcef/browser_request_context.cc b/libcef/browser_request_context.cc index c3ce689e..ff2dfc2f 100644 --- a/libcef/browser_request_context.cc +++ b/libcef/browser_request_context.cc @@ -9,13 +9,13 @@ #include "browser_resource_loader_bridge.h" #include "build/build_config.h" +#include "base/compiler_specific.h" #include "base/file_path.h" #include "base/file_util.h" #include "net/base/cert_verifier.h" #include "net/base/cookie_monster.h" #include "net/base/host_resolver.h" -#include "net/base/ssl_config_service.h" -#include "net/base/static_cookie_policy.h" +#include "net/base/ssl_config_service_defaults.h" #include "net/ftp/ftp_network_layer.h" #include "net/http/http_auth_handler_factory.h" #include "net/proxy/proxy_config_service.h" @@ -40,7 +40,9 @@ public: ProxyConfigServiceNull() {} virtual void AddObserver(Observer* observer) {} virtual void RemoveObserver(Observer* observer) {} - virtual bool GetLatestProxyConfig(net::ProxyConfig* config) { return true; } + virtual ProxyConfigService::ConfigAvailability + GetLatestProxyConfig(net::ProxyConfig* config) + { return ProxyConfigService::CONFIG_VALID; } virtual void OnLazyPoll() {} }; @@ -48,14 +50,18 @@ public: #endif // defined(OS_WIN) -BrowserRequestContext::BrowserRequestContext() { +BrowserRequestContext::BrowserRequestContext() + : ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)), + accept_all_cookies_(true) { Init(FilePath(), net::HttpCache::NORMAL, false); } BrowserRequestContext::BrowserRequestContext( const FilePath& cache_path, net::HttpCache::Mode cache_mode, - bool no_proxy) { + bool no_proxy) + : ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)), + accept_all_cookies_(true) { Init(cache_path, cache_mode, no_proxy); } @@ -78,8 +84,8 @@ void BrowserRequestContext::Init( persistent_store = new BrowserPersistentCookieStore(cookie_path); } - set_cookie_store(new net::CookieMonster(persistent_store.get(), NULL)); - set_cookie_policy(new net::StaticCookiePolicy()); + storage_.set_cookie_store( + new net::CookieMonster(persistent_store.get(), NULL)); // hard-code A-L and A-C for test shells set_accept_language("en-us,en"); @@ -96,7 +102,7 @@ void BrowserRequestContext::Init( WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ie_config = {0}; if (WinHttpGetIEProxyConfigForCurrentUser(&ie_config)) { if (ie_config.fAutoDetect == TRUE) { - set_proxy_service(net::ProxyService::CreateWithoutProxyResolver( + storage_.set_proxy_service(net::ProxyService::CreateWithoutProxyResolver( new ProxyConfigServiceNull(), NULL)); } @@ -114,15 +120,15 @@ void BrowserRequestContext::Init( scoped_ptr proxy_config_service( net::ProxyService::CreateSystemProxyConfigService( MessageLoop::current(), NULL)); - set_proxy_service(net::ProxyService::CreateUsingSystemProxyResolver( + storage_.set_proxy_service(net::ProxyService::CreateUsingSystemProxyResolver( proxy_config_service.release(), 0, NULL)); } - set_host_resolver( + storage_.set_host_resolver( net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, - NULL, NULL)); - set_cert_verifier(new net::CertVerifier); - set_ssl_config_service(net::SSLConfigService::CreateSystemSSLConfigService()); + NULL)); + storage_.set_cert_verifier(new net::CertVerifier); + storage_.set_ssl_config_service(new net::SSLConfigServiceDefaults); // Add support for single sign-on. url_security_manager_.reset(net::URLSecurityManager::Create(NULL, NULL)); @@ -133,7 +139,7 @@ void BrowserRequestContext::Init( supported_schemes.push_back("ntlm"); supported_schemes.push_back("negotiate"); - set_http_auth_handler_factory( + storage_.set_http_auth_handler_factory( net::HttpAuthHandlerRegistryFactory::Create(supported_schemes, url_security_manager_.get(), host_resolver(), @@ -151,9 +157,10 @@ void BrowserRequestContext::Init( http_auth_handler_factory(), NULL, NULL, backend); cache->set_mode(cache_mode); - set_http_transaction_factory(cache); + storage_.set_http_transaction_factory(cache); - set_ftp_transaction_factory(new net::FtpNetworkLayer(host_resolver())); + storage_.set_ftp_transaction_factory( + new net::FtpNetworkLayer(host_resolver())); blob_storage_controller_.reset(new webkit_blob::BlobStorageController()); file_system_context_ = static_cast( @@ -161,19 +168,14 @@ void BrowserRequestContext::Init( } BrowserRequestContext::~BrowserRequestContext() { - delete ftp_transaction_factory(); - delete http_transaction_factory(); - delete http_auth_handler_factory(); - delete cookie_policy(); - delete cert_verifier(); - delete host_resolver(); } void BrowserRequestContext::SetAcceptAllCookies(bool accept_all_cookies) { - net::StaticCookiePolicy::Type policy_type = accept_all_cookies ? - net::StaticCookiePolicy::ALLOW_ALL_COOKIES : - net::StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES; - static_cast(cookie_policy())->set_type(policy_type); + accept_all_cookies_ = accept_all_cookies; +} + +bool BrowserRequestContext::AcceptAllCookies() { + return accept_all_cookies_; } const std::string& BrowserRequestContext::GetUserAgent( diff --git a/libcef/browser_request_context.h b/libcef/browser_request_context.h index f134d56e..077787bf 100644 --- a/libcef/browser_request_context.h +++ b/libcef/browser_request_context.h @@ -9,6 +9,7 @@ #include "net/http/http_cache.h" #include "net/http/url_security_manager.h" #include "net/url_request/url_request_context.h" +#include "net/url_request/url_request_context_storage.h" class FilePath; @@ -36,6 +37,7 @@ class BrowserRequestContext : public net::URLRequestContext { virtual const std::string& GetUserAgent(const GURL& url) const; void SetAcceptAllCookies(bool accept_all_cookies); + bool AcceptAllCookies(); webkit_blob::BlobStorageController* blob_storage_controller() const { return blob_storage_controller_.get(); @@ -49,9 +51,11 @@ class BrowserRequestContext : public net::URLRequestContext { void Init(const FilePath& cache_path, net::HttpCache::Mode cache_mode, bool no_proxy); + net::URLRequestContextStorage storage_; scoped_ptr blob_storage_controller_; scoped_refptr file_system_context_; scoped_ptr url_security_manager_; + bool accept_all_cookies_; }; #endif // _BROWSER_REQUEST_CONTEXT_H diff --git a/libcef/browser_resource_loader_bridge.cc b/libcef/browser_resource_loader_bridge.cc index 13ac1c7a..10e5f908 100644 --- a/libcef/browser_resource_loader_bridge.cc +++ b/libcef/browser_resource_loader_bridge.cc @@ -50,9 +50,6 @@ #include "base/memory/ref_counted.h" #include "base/message_loop.h" #include "base/message_loop_proxy.h" -#if defined(OS_MACOSX) || defined(OS_WIN) -#include "base/nss_util.h" -#endif #include "base/synchronization/waitable_event.h" #include "base/time.h" #include "base/timer.h" @@ -80,6 +77,10 @@ #include "webkit/fileapi/file_system_url_request_job.h" #include "webkit/glue/resource_loader_bridge.h" +#if defined(OS_MACOSX) || defined(OS_WIN) +#include "crypto/nss_util.h" +#endif + using net::HttpResponseHeaders; using net::StaticCookiePolicy; using net::URLRequestStatus; @@ -243,7 +244,7 @@ class RequestProxy : public net::URLRequest::Delegate, this, &RequestProxy::AsyncCancel)); } - peer_->OnReceivedData(buf_copy.get(), bytes_read); + peer_->OnReceivedData(buf_copy.get(), bytes_read, -1); } void NotifyDownloadedData(int bytes_read) { @@ -622,6 +623,32 @@ class RequestProxy : public net::URLRequest::Delegate, request->ContinueDespiteLastError(); } + virtual bool CanGetCookies(net::URLRequest* request) { + StaticCookiePolicy::Type policy_type = + _Context->request_context()->AcceptAllCookies() ? + StaticCookiePolicy::ALLOW_ALL_COOKIES : + StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES; + + StaticCookiePolicy policy(policy_type); + int rv = policy.CanGetCookies( + request->url(), request->first_party_for_cookies()); + return rv == net::OK; + } + + virtual bool CanSetCookie(net::URLRequest* request, + const std::string& cookie_line, + net::CookieOptions* options) { + StaticCookiePolicy::Type policy_type = + _Context->request_context()->AcceptAllCookies() ? + StaticCookiePolicy::ALLOW_ALL_COOKIES : + StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES; + + StaticCookiePolicy policy(policy_type); + int rv = policy.CanSetCookie( + request->url(), request->first_party_for_cookies(), cookie_line); + return rv == net::OK; + } + virtual void OnReadCompleted(net::URLRequest* request, int bytes_read) { if (request->status().is_success() && bytes_read > 0) { OnReceivedData(bytes_read); diff --git a/libcef/browser_socket_stream_bridge.cc b/libcef/browser_socket_stream_bridge.cc index 26e74418..b3989c7d 100644 --- a/libcef/browser_socket_stream_bridge.cc +++ b/libcef/browser_socket_stream_bridge.cc @@ -157,7 +157,9 @@ void WebSocketStreamHandleBridgeImpl::OnClose(net::SocketStream* socket) { void WebSocketStreamHandleBridgeImpl::DoConnect(const GURL& url) { DCHECK(MessageLoop::current() == g_io_thread); - socket_ = net::SocketStreamJob::CreateSocketStreamJob(url, this); + socket_ = net::SocketStreamJob::CreateSocketStreamJob( + url, this, g_request_context->transport_security_state(), + g_request_context->ssl_config_service()); socket_->set_context(g_request_context); socket_->Connect(); } diff --git a/libcef/browser_webblobregistry_impl.cc b/libcef/browser_webblobregistry_impl.cc index fe503b73..095a5c8d 100644 --- a/libcef/browser_webblobregistry_impl.cc +++ b/libcef/browser_webblobregistry_impl.cc @@ -1,12 +1,14 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "browser_webblobregistry_impl.h" #include "base/message_loop.h" +#include "base/task.h" #include "googleurl/src/gurl.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebBlobData.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebCString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" #include "webkit/blob/blob_data.h" @@ -21,6 +23,17 @@ namespace { MessageLoop* g_io_thread; webkit_blob::BlobStorageController* g_blob_storage_controller; +// WebURL contains a WebCString object that is ref-counted, +// but not thread-safe ref-counted. +// "Normal" copying of WebURL results in a copy that is not thread-safe. +// This method creates a deep copy of WebURL. +WebURL GetWebURLThreadsafeCopy(const WebURL& source) { + const WebKit::WebCString spec(source.spec()); + const url_parse::Parsed& parsed(source.parsed()); + const bool is_valid = source.isValid(); + return WebURL(spec, parsed, is_valid); +} + } // namespace /* static */ @@ -42,34 +55,55 @@ BrowserWebBlobRegistryImpl::BrowserWebBlobRegistryImpl() { void BrowserWebBlobRegistryImpl::registerBlobURL( const WebURL& url, WebBlobData& data) { DCHECK(g_io_thread); - // Note: BlobData is not refcounted thread safe. - scoped_refptr blob_data( + CancelableTask* task; + { + scoped_refptr blob_data( new webkit_blob::BlobData(data)); - g_io_thread->PostTask( - FROM_HERE, + WebURL url_copy = GetWebURLThreadsafeCopy(url); + task = NewRunnableMethod( - this, &BrowserWebBlobRegistryImpl::DoRegisterBlobUrl, url, - blob_data)); + this, &BrowserWebBlobRegistryImpl::DoRegisterBlobUrl, url_copy, + blob_data); + // After this block exits, url_copy is disposed, and + // the underlying WebCString will have a refcount=1 and will + // only be accessible from the task object. + } + g_io_thread->PostTask(FROM_HERE, task); } void BrowserWebBlobRegistryImpl::registerBlobURL( const WebURL& url, const WebURL& src_url) { DCHECK(g_io_thread); - g_io_thread->PostTask( - FROM_HERE, + CancelableTask* task; + { + WebURL url_copy = GetWebURLThreadsafeCopy(url); + WebURL src_url_copy = GetWebURLThreadsafeCopy(src_url); + task = NewRunnableMethod(this, &BrowserWebBlobRegistryImpl::DoRegisterBlobUrlFrom, - url, - src_url)); + url_copy, + src_url_copy); + // After this block exits, url_copy and src_url_copy are disposed, and + // the underlying WebCStrings will have a refcount=1 and will + // only be accessible from the task object. + } + g_io_thread->PostTask(FROM_HERE, task); } void BrowserWebBlobRegistryImpl::unregisterBlobURL(const WebURL& url) { DCHECK(g_io_thread); - g_io_thread->PostTask( - FROM_HERE, + CancelableTask* task; + { + WebURL url_copy = GetWebURLThreadsafeCopy(url); + task = NewRunnableMethod(this, &BrowserWebBlobRegistryImpl::DoUnregisterBlobUrl, - url)); + url_copy); + // After this block exits, url_copy is disposed, and + // the underlying WebCString will have a refcount=1 and will + // only be accessible from the task object. + } + g_io_thread->PostTask(FROM_HERE, task); } void BrowserWebBlobRegistryImpl::DoRegisterBlobUrl( diff --git a/libcef/browser_webkit_glue.cc b/libcef/browser_webkit_glue.cc index 8cd32e2a..c54428d6 100644 --- a/libcef/browser_webkit_glue.cc +++ b/libcef/browser_webkit_glue.cc @@ -45,12 +45,6 @@ bool IsMediaPlayerAvailable() { return true; } -void PrecacheUrl(const char16* url, int url_length) {} - -void AppendToLog(const char* file, int line, const char* msg) { - logging::LogMessage(file, line).stream() << msg; -} - bool GetApplicationDirectory(FilePath* path) { return PathService::Get(base::DIR_EXE, path); } @@ -126,7 +120,9 @@ std::string GetProductVersion() { if (settings.product_version.length > 0) { return CefString(&settings.product_version); } - return "Chrome/7.0.517.0"; + // Keep synchronized with the newest Beta Channel release announced at + // http://googlechromereleases.blogspot.com/ + return "Chrome/12.0.742.53"; } bool IsSingleProcess() { diff --git a/libcef/browser_webkit_init.h b/libcef/browser_webkit_init.h index 30b01823..aaf2b541 100644 --- a/libcef/browser_webkit_init.h +++ b/libcef/browser_webkit_init.h @@ -36,6 +36,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebSerializedScriptValue.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageNamespace.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" +#include "ui/gfx/gl/gl_bindings_skia_in_process.h" #include "webkit/glue/simple_webmimeregistry_impl.h" #include "webkit/glue/webclipboard_impl.h" #include "webkit/glue/webfileutilities_impl.h" @@ -233,6 +234,7 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl { } virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D() { + gfx::BindSkiaToInProcessGL(); return new webkit::gpu::WebGraphicsContext3DInProcessImpl(); } diff --git a/libcef/browser_webview_delegate.cc b/libcef/browser_webview_delegate.cc index 62fc4ac3..bbcb1a55 100644 --- a/libcef/browser_webview_delegate.cc +++ b/libcef/browser_webview_delegate.cc @@ -818,7 +818,7 @@ void BrowserWebViewDelegate::didClearWindowObject(WebFrame* frame) { } void BrowserWebViewDelegate::didReceiveTitle( - WebFrame* frame, const WebString& title) { + WebFrame* frame, const WebString& title, WebTextDirection direction) { bool is_main_frame = (frame->parent() == 0); if (is_main_frame) { CefString titleStr = string16(title); diff --git a/libcef/browser_webview_delegate.h b/libcef/browser_webview_delegate.h index 30b3b190..4c18d0a2 100644 --- a/libcef/browser_webview_delegate.h +++ b/libcef/browser_webview_delegate.h @@ -164,7 +164,8 @@ class BrowserWebViewDelegate : public WebKit::WebViewClient, WebKit::WebFrame*, bool is_new_navigation); virtual void didClearWindowObject(WebKit::WebFrame*); virtual void didReceiveTitle( - WebKit::WebFrame*, const WebKit::WebString& title); + WebKit::WebFrame*, const WebKit::WebString& title, + WebKit::WebTextDirection direction); virtual void didFailLoad( WebKit::WebFrame*, const WebKit::WebURLError&); virtual void didFinishLoad(WebKit::WebFrame*); diff --git a/libcef/cef_context.cc b/libcef/cef_context.cc index 87dfd209..baad557c 100644 --- a/libcef/cef_context.cc +++ b/libcef/cef_context.cc @@ -10,13 +10,15 @@ #include "../include/cef_nplugin.h" #include "base/file_util.h" -#if defined(OS_MACOSX) || defined(OS_WIN) -#include "base/nss_util.h" -#endif #include "base/stringprintf.h" +#include "base/synchronization/waitable_event.h" #include "net/base/cookie_monster.h" #include "webkit/plugins/npapi/plugin_list.h" +#if defined(OS_MACOSX) || defined(OS_WIN) +#include "crypto/nss_util.h" +#endif + // Both the CefContext constuctor and the CefContext::RemoveBrowser method need // to initialize or reset to the same value. const int kNextBrowserIdReset = 1; @@ -485,7 +487,7 @@ bool CefContext::Initialize(const CefSettings& settings, #if defined(OS_MACOSX) || defined(OS_WIN) // We want to be sure to init NSPR on the main thread. - base::EnsureNSPRInit(); + crypto::EnsureNSPRInit(); #endif process_ = new CefProcess(settings_.multi_threaded_message_loop); diff --git a/libcef/cef_process_io_thread.cc b/libcef/cef_process_io_thread.cc index b5d1b5c4..3c2923f9 100644 --- a/libcef/cef_process_io_thread.cc +++ b/libcef/cef_process_io_thread.cc @@ -12,6 +12,7 @@ #include "browser_webblobregistry_impl.h" #include "build/build_config.h" +#include "net/socket/client_socket_pool_manager.h" #if defined(OS_WIN) #include @@ -34,7 +35,11 @@ void CefProcessIOThread::Init() { // Initializes the COM library on the current thread. CoInitialize(NULL); #endif - + + // Increase max sockets per group as a workaround for the SyncRequestProxy + // deadlock problem (issue #192). + net::ClientSocketPoolManager::set_max_sockets_per_group(15); + FilePath cache_path(_Context->cache_path()); request_context_ = new BrowserRequestContext(cache_path, net::HttpCache::NORMAL, false); diff --git a/libcef/cef_process_ui_thread.cc b/libcef/cef_process_ui_thread.cc index db15e8a5..c213b48a 100644 --- a/libcef/cef_process_ui_thread.cc +++ b/libcef/cef_process_ui_thread.cc @@ -64,12 +64,12 @@ net::URLRequestJob* FileSystemURLRequestJobFactory(net::URLRequest* request, if (!path.empty() && path[path.size() - 1] == '/') { return new fileapi::FileSystemDirURLRequestJob( request, - fs_context->path_manager(), + fs_context, CefThread::GetMessageLoopProxyForThread(CefThread::FILE)); } return new fileapi::FileSystemURLRequestJob( request, - fs_context->path_manager(), + fs_context, CefThread::GetMessageLoopProxyForThread(CefThread::FILE)); } @@ -148,7 +148,7 @@ void CefProcessUIThread::Init() { WebKit::WebScriptController::registerExtension( extensions_v8::GCExtension::Get()); - gfx::InitializeGLBindings(gfx::kGLImplementationDesktopGL); + gfx::InitializeGLBindings(gfx::kGLImplementationEGLGLES2); net::URLRequest::RegisterProtocolFactory("blob", &BlobURLRequestJobFactory); net::URLRequest::RegisterProtocolFactory("filesystem", diff --git a/libcef/dom_storage_area.cc b/libcef/dom_storage_area.cc index a6f9a0fc..ece2b6f4 100644 --- a/libcef/dom_storage_area.cc +++ b/libcef/dom_storage_area.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -50,11 +50,6 @@ NullableString16 DOMStorageArea::GetItem(const string16& key) { NullableString16 DOMStorageArea::SetItem( const string16& key, const string16& value, WebStorageArea::Result* result) { - if (!CheckContentSetting(key, value)) { - *result = WebStorageArea::ResultBlockedByPolicy; - return NullableString16(true); // Ignored if the content was blocked. - } - CreateWebStorageAreaIfNecessary(); WebString old_value; storage_area_->setItem(key, value, WebURL(), *result, old_value); @@ -83,9 +78,3 @@ void DOMStorageArea::CreateWebStorageAreaIfNecessary() { if (!storage_area_.get()) storage_area_.reset(owner_->CreateWebStorageArea(origin_)); } - -bool DOMStorageArea::CheckContentSetting( - const string16& key, const string16& value) { - // TODO(cef): Potentially give the host an option to deny write access. - return true; -} diff --git a/libcef/dom_storage_area.h b/libcef/dom_storage_area.h index 5793a084..4e5789f1 100644 --- a/libcef/dom_storage_area.h +++ b/libcef/dom_storage_area.h @@ -1,9 +1,10 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef _DOM_STORAGE_AREA_H #define _DOM_STORAGE_AREA_H +#pragma once #include "base/hash_tables.h" #include "base/memory/ref_counted.h" @@ -14,7 +15,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageArea.h" class DOMStorageNamespace; - // Only use on the WebKit thread. DOMStorageNamespace manages our registration // with DOMStorageContext. class DOMStorageArea { @@ -42,9 +42,6 @@ class DOMStorageArea { // Creates the underlying WebStorageArea on demand. void CreateWebStorageAreaIfNecessary(); - // Used to see if setItem has permission to do its thing. - bool CheckContentSetting(const string16& key, const string16& value); - // The origin this storage area represents. string16 origin_; GURL origin_url_; diff --git a/libcef/simple_clipboard_impl.cc b/libcef/simple_clipboard_impl.cc index a6180995..2bb35dfc 100644 --- a/libcef/simple_clipboard_impl.cc +++ b/libcef/simple_clipboard_impl.cc @@ -7,10 +7,14 @@ #include #include "base/lazy_instance.h" +#include "base/stl_util-inl.h" #include "base/string16.h" #include "googleurl/src/gurl.h" #include "third_party/skia/include/core/SkBitmap.h" +#include "third_party/zlib/zlib.h" #include "ui/base/clipboard/clipboard.h" +#include "ui/gfx/codec/png_codec.h" +#include "ui/gfx/size.h" #include "webkit/glue/scoped_clipboard_writer_glue.h" // Clipboard glue @@ -36,6 +40,13 @@ bool ClipboardIsFormatAvailable(const ui::Clipboard::FormatType& format, return ClipboardGetClipboard()->IsFormatAvailable(format, buffer); } +// TODO(dcheng): Implement. +void ClipboardReadAvailableTypes(ui::Clipboard::Buffer buffer, + std::vector* types, + bool* contains_filenames) { + return; +} + void ClipboardReadText(ui::Clipboard::Buffer buffer, string16* result) { ClipboardGetClipboard()->ReadText(buffer, result); } @@ -52,15 +63,25 @@ void ClipboardReadHTML(ui::Clipboard::Buffer buffer, string16* markup, *url = GURL(url_str); } -// TODO(dcheng): Implement. -void ClipboardReadAvailableTypes(ui::Clipboard::Buffer buffer, - std::vector* types, - bool* contains_filenames) { - return; -} - void ClipboardReadImage(ui::Clipboard::Buffer buffer, std::string* data) { - ClipboardGetClipboard()->ReadImage(buffer, data); + SkBitmap bitmap = ClipboardGetClipboard()->ReadImage(buffer); + if (bitmap.isNull()) + return; + + std::vector png_data; + SkAutoLockPixels lock(bitmap); + if (gfx::PNGCodec::EncodeWithCompressionLevel( + static_cast(bitmap.getPixels()), + gfx::PNGCodec::FORMAT_BGRA, + gfx::Size(bitmap.width(), bitmap.height()), + bitmap.rowBytes(), + false, + std::vector(), + Z_BEST_SPEED, + &png_data)) { + data->assign(reinterpret_cast(vector_as_array(&png_data)), + png_data.size()); + } } bool ClipboardReadData(ui::Clipboard::Buffer buffer, const string16& type, diff --git a/libcef/web_urlrequest_impl.cc b/libcef/web_urlrequest_impl.cc index 214d8aec..62915d72 100644 --- a/libcef/web_urlrequest_impl.cc +++ b/libcef/web_urlrequest_impl.cc @@ -142,9 +142,8 @@ public: } // Called when a chunk of response data is received. - // FIXME(vsevik): rename once original didReceiveData() is removed. - virtual void didReceiveData2(WebURLLoader*, const char* data, int dataLength, - int lengthReceived) + virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength, + int lengthReceived) { REQUIRE_UIT(); if(!context_) diff --git a/libcef/webwidget_host_win.cc b/libcef/webwidget_host_win.cc index 847a3ab2..63b814a2 100644 --- a/libcef/webwidget_host_win.cc +++ b/libcef/webwidget_host_win.cc @@ -304,12 +304,13 @@ void WebWidgetHost::Paint() { // Scroll the canvas if necessary scroll_rect_ = client_rect.Intersect(scroll_rect_); if (!scroll_rect_.IsEmpty()) { - HDC hdc = canvas_->getTopPlatformDevice().getBitmapDC(); + HDC hdc = canvas_->beginPlatformPaint(); RECT damaged_scroll_rect, r = scroll_rect_.ToRECT(); ScrollDC(hdc, scroll_dx_, scroll_dy_, NULL, &r, NULL, &damaged_scroll_rect); PaintRect(gfx::Rect(damaged_scroll_rect)); + canvas_->endPlatformPaint(); } ResetScrollRect(); diff --git a/patch/patches/base.patch b/patch/patches/base.patch index 2032690b..cd2d5871 100644 --- a/patch/patches/base.patch +++ b/patch/patches/base.patch @@ -1,8 +1,8 @@ Index: message_loop.cc =================================================================== ---- message_loop.cc (revision 80310) +--- message_loop.cc (revision 85124) +++ message_loop.cc (working copy) -@@ -295,9 +295,13 @@ +@@ -387,9 +387,13 @@ } void MessageLoop::AssertIdle() const { @@ -19,9 +19,9 @@ Index: message_loop.cc //------------------------------------------------------------------------------ Index: message_loop.h =================================================================== ---- message_loop.h (revision 80310) +--- message_loop.h (revision 85124) +++ message_loop.h (working copy) -@@ -320,6 +320,9 @@ +@@ -351,6 +351,9 @@ // Asserts that the MessageLoop is "idle". void AssertIdle() const; diff --git a/patch/patches/build.patch b/patch/patches/build.patch index 58645254..3f08f6b7 100644 --- a/patch/patches/build.patch +++ b/patch/patches/build.patch @@ -1,6 +1,6 @@ Index: common.gypi =================================================================== ---- common.gypi (revision 70742) +--- common.gypi (revision 85124) +++ common.gypi (working copy) @@ -9,6 +9,9 @@ # Variables expected to be overriden on the GYP command line (-D) or by @@ -14,7 +14,7 @@ Index: common.gypi # variables within the outer variables dict here. This is necessary Index: win/system.gyp =================================================================== ---- win/system.gyp (revision 70742) +--- win/system.gyp (revision 85124) +++ win/system.gyp (working copy) @@ -22,6 +22,13 @@ 'action': ['', '<@(_inputs)'], diff --git a/tests/cefclient/clientplugin.cpp b/tests/cefclient/clientplugin.cpp index 0713b2c2..b4e26117 100644 --- a/tests/cefclient/clientplugin.cpp +++ b/tests/cefclient/clientplugin.cpp @@ -10,9 +10,10 @@ // Initialized in NP_Initialize. NPNetscapeFuncs* g_browser = NULL; -static -NPError NPP_New(NPMIMEType plugin_type, NPP instance, uint16 mode, int16 argc, - char* argn[], char* argv[], NPSavedData* saved) { +namespace { + +NPError NPP_ClientNew(NPMIMEType plugin_type, NPP instance, uint16_t mode, + int16_t argc, char* argn[], char* argv[], NPSavedData* saved) { if (instance == NULL) return NPERR_INVALID_INSTANCE_ERROR; @@ -23,8 +24,7 @@ NPError NPP_New(NPMIMEType plugin_type, NPP instance, uint16 mode, int16 argc, return NPERR_NO_ERROR; } -static -NPError NPP_Destroy(NPP instance, NPSavedData** save) { +NPError NPP_ClientDestroy(NPP instance, NPSavedData** save) { ClientPlugin* plugin_impl = reinterpret_cast(instance->pdata); if (plugin_impl) { @@ -35,8 +35,7 @@ NPError NPP_Destroy(NPP instance, NPSavedData** save) { return NPERR_NO_ERROR; } -static -NPError NPP_SetWindow(NPP instance, NPWindow* window_info) { +NPError NPP_ClientSetWindow(NPP instance, NPWindow* window_info) { if (instance == NULL) return NPERR_INVALID_INSTANCE_ERROR; @@ -57,21 +56,23 @@ NPError NPP_SetWindow(NPP instance, NPWindow* window_info) { return NPERR_NO_ERROR; } -NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* pFuncs) +} // anonymous + +NPError API_CALL NP_ClientGetEntryPoints(NPPluginFuncs* pFuncs) { - pFuncs->newp = NPP_New; - pFuncs->destroy = NPP_Destroy; - pFuncs->setwindow = NPP_SetWindow; + pFuncs->newp = NPP_ClientNew; + pFuncs->destroy = NPP_ClientDestroy; + pFuncs->setwindow = NPP_ClientSetWindow; return NPERR_NO_ERROR; } -NPError API_CALL NP_Initialize(NPNetscapeFuncs* pFuncs) +NPError API_CALL NP_ClientInitialize(NPNetscapeFuncs* pFuncs) { g_browser = pFuncs; return NPERR_NO_ERROR; } -NPError API_CALL NP_Shutdown(void) +NPError API_CALL NP_ClientShutdown(void) { g_browser = NULL; return NPERR_NO_ERROR; diff --git a/tests/cefclient/clientplugin.h b/tests/cefclient/clientplugin.h index 71b95c59..de2fd1e9 100644 --- a/tests/cefclient/clientplugin.h +++ b/tests/cefclient/clientplugin.h @@ -17,9 +17,9 @@ extern NPNetscapeFuncs* g_browser; -NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* pFuncs); -NPError API_CALL NP_Initialize(NPNetscapeFuncs* pFuncs); -NPError API_CALL NP_Shutdown(void); +NPError API_CALL NP_ClientGetEntryPoints(NPPluginFuncs* pFuncs); +NPError API_CALL NP_ClientInitialize(NPNetscapeFuncs* pFuncs); +NPError API_CALL NP_ClientShutdown(void); // Provides the client plugin functionality. diff --git a/tests/cefclient/plugin_test.cpp b/tests/cefclient/plugin_test.cpp index 560b5d22..02d554a4 100644 --- a/tests/cefclient/plugin_test.cpp +++ b/tests/cefclient/plugin_test.cpp @@ -14,9 +14,9 @@ void InitPluginTest() CefString(&plugin_info.description).FromASCII("My Example Client Plugin"); CefString(&plugin_info.mime_type).FromASCII("application/x-client-plugin"); - plugin_info.np_getentrypoints = NP_GetEntryPoints; - plugin_info.np_initialize = NP_Initialize; - plugin_info.np_shutdown = NP_Shutdown; + plugin_info.np_getentrypoints = NP_ClientGetEntryPoints; + plugin_info.np_initialize = NP_ClientInitialize; + plugin_info.np_shutdown = NP_ClientShutdown; // Register the internal client plugin CefRegisterPlugin(plugin_info);