diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index 86bc079c4..0e7ff7320 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -54,3 +54,4 @@ Date | CEF Revision | Chromium Revision 2010-08-09 | /trunk@93 | /trunk@55388 2010-09-12 | /trunk@102 | /trunk@59193 2010-10-03 | /trunk@108 | /trunk@61327 +2010-10-15 | /trunk@116 | /trunk@62731 diff --git a/cef.gyp b/cef.gyp index 7b3f051d9..81e3d33e0 100644 --- a/cef.gyp +++ b/cef.gyp @@ -368,6 +368,8 @@ 'libcef/browser_database_system.h', 'libcef/browser_file_system.cc', 'libcef/browser_file_system.h', + 'libcef/browser_file_writer.cc', + 'libcef/browser_file_writer.h', 'libcef/browser_impl.cc', 'libcef/browser_impl.h', 'libcef/browser_impl_win.cc', diff --git a/libcef/browser_file_system.cc b/libcef/browser_file_system.cc index 6c4cd479a..5bcb36f9a 100644 --- a/libcef/browser_file_system.cc +++ b/libcef/browser_file_system.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "browser_file_system.h" +#include "browser_file_writer.h" #include "base/file_path.h" #include "base/message_loop_proxy.h" @@ -16,6 +17,8 @@ using WebKit::WebFileInfo; using WebKit::WebFileSystemCallbacks; using WebKit::WebFileSystemEntry; +using WebKit::WebFileWriter; +using WebKit::WebFileWriterClient; using WebKit::WebString; using WebKit::WebVector; @@ -41,10 +44,10 @@ WebKit::WebFileError PlatformFileErrorToWebFileError( } } -class TestShellFileSystemCallbackDispatcher +class BrowserFileSystemCallbackDispatcher : public fileapi::FileSystemCallbackDispatcher { public: - TestShellFileSystemCallbackDispatcher( + BrowserFileSystemCallbackDispatcher( BrowserFileSystem* file_system, WebFileSystemCallbacks* callbacks) : file_system_(file_system), @@ -61,7 +64,10 @@ class TestShellFileSystemCallbackDispatcher virtual void DidReadMetadata(const base::PlatformFileInfo& info) { 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_); } @@ -92,7 +98,7 @@ class TestShellFileSystemCallbackDispatcher file_system_->RemoveCompletedOperation(request_id_); } - virtual void DidWrite(int64, bool, fileapi::FileSystemOperation*) { + virtual void DidWrite(int64, bool) { NOTREACHED(); } @@ -133,7 +139,14 @@ void BrowserFileSystem::remove( const WebString& path, WebFileSystemCallbacks* callbacks) { FilePath filepath(webkit_glue::WebStringToFilePath(path)); - GetNewOperation(callbacks)->Remove(filepath); + GetNewOperation(callbacks)->Remove(filepath, false /* recursive */); +} + +void BrowserFileSystem::removeRecursively( + const WebString& path, WebFileSystemCallbacks* callbacks) { + FilePath filepath(webkit_glue::WebStringToFilePath(path)); + + GetNewOperation(callbacks)->Remove(filepath, true /* recursive */); } void BrowserFileSystem::readMetadata( @@ -158,7 +171,7 @@ void BrowserFileSystem::createDirectory( } void BrowserFileSystem::fileExists( - const WebString& path, WebFileSystemCallbacks* callbacks) { + const WebString& path, WebFileSystemCallbacks* callbacks) { FilePath filepath(webkit_glue::WebStringToFilePath(path)); GetNewOperation(callbacks)->FileExists(filepath); @@ -178,11 +191,16 @@ void BrowserFileSystem::readDirectory( GetNewOperation(callbacks)->ReadDirectory(filepath); } +WebFileWriter* BrowserFileSystem::createFileWriter( + const WebString& path, WebFileWriterClient* client) { + return new BrowserFileWriter(path, client); +} + fileapi::FileSystemOperation* BrowserFileSystem::GetNewOperation( WebFileSystemCallbacks* callbacks) { // This pointer will be owned by |operation|. - TestShellFileSystemCallbackDispatcher* dispatcher = - new TestShellFileSystemCallbackDispatcher(this, callbacks); + BrowserFileSystemCallbackDispatcher* dispatcher = + new BrowserFileSystemCallbackDispatcher(this, callbacks); fileapi::FileSystemOperation* operation = new fileapi::FileSystemOperation( dispatcher, base::MessageLoopProxy::CreateForCurrentThread()); int32 request_id = operations_.Add(operation); diff --git a/libcef/browser_file_system.h b/libcef/browser_file_system.h index aff0bf4a1..e60229e4a 100644 --- a/libcef/browser_file_system.h +++ b/libcef/browser_file_system.h @@ -1,6 +1,6 @@ -// 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. +// 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_FILE_SYSTEM_H_ #define BROWSER_FILE_SYSTEM_H_ @@ -28,6 +28,8 @@ class BrowserFileSystem : public WebKit::WebFileSystem { WebKit::WebFileSystemCallbacks* callbacks); virtual void remove(const WebKit::WebString& path, WebKit::WebFileSystemCallbacks* callbacks); + virtual void removeRecursively(const WebKit::WebString& path, + WebKit::WebFileSystemCallbacks* callbacks); virtual void readMetadata(const WebKit::WebString& path, WebKit::WebFileSystemCallbacks* callbacks); virtual void createFile(const WebKit::WebString& path, @@ -42,6 +44,8 @@ class BrowserFileSystem : public WebKit::WebFileSystem { WebKit::WebFileSystemCallbacks* callbacks); virtual void readDirectory(const WebKit::WebString& path, WebKit::WebFileSystemCallbacks* callbacks); + virtual WebKit::WebFileWriter* createFileWriter( + const WebKit::WebString& path, WebKit::WebFileWriterClient* client); private: // Helpers. diff --git a/libcef/browser_file_writer.cc b/libcef/browser_file_writer.cc new file mode 100644 index 000000000..929cb19b0 --- /dev/null +++ b/libcef/browser_file_writer.cc @@ -0,0 +1,184 @@ +// 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_file_writer.h" +#include "cef_thread.h" + +#include "base/logging.h" +#include "base/message_loop_proxy.h" +#include "net/url_request/url_request_context.h" +#include "webkit/fileapi/file_system_callback_dispatcher.h" +#include "webkit/fileapi/file_system_operation.h" +#include "webkit/glue/webkit_glue.h" + +using fileapi::FileSystemOperation; +using fileapi::FileSystemCallbackDispatcher; +using fileapi::WebFileWriterBase; +using WebKit::WebFileWriterClient; +using WebKit::WebString; +using WebKit::WebURL; + +URLRequestContext* BrowserFileWriter::request_context_ = NULL; + +// Helper class to proxy the write and truncate calls to the IO thread, +// and to proxy the results back to the main thead. There is a one-to-one +// relationship between BrowserFileWriters and IOThreadBackends. +class BrowserFileWriter::IOThreadProxy + : public base::RefCountedThreadSafe { + public: + explicit IOThreadProxy(const base::WeakPtr& simple_writer) + : simple_writer_(simple_writer) { + io_thread_ = CefThread::GetMessageLoopProxyForThread(CefThread::IO); + main_thread_ = base::MessageLoopProxy::CreateForCurrentThread(); + } + + virtual ~IOThreadProxy() { + } + + void Truncate(const FilePath& path, int64 offset) { + if (!io_thread_->BelongsToCurrentThread()) { + io_thread_->PostTask(FROM_HERE, NewRunnableMethod( + this, &IOThreadProxy::Truncate, path, offset)); + return; + } + DCHECK(!operation_.get()); + operation_.reset(GetNewOperation()); + operation_->Truncate(path, offset); + } + + void Write(const FilePath& path, const GURL& blob_url, int64 offset) { + if (!io_thread_->BelongsToCurrentThread()) { + io_thread_->PostTask(FROM_HERE, NewRunnableMethod( + this, &IOThreadProxy::Write, path, blob_url, offset)); + return; + } + DCHECK(request_context_); + DCHECK(!operation_.get()); + operation_.reset(GetNewOperation()); + operation_->Write(request_context_, path, blob_url, offset); + } + + void Cancel() { + if (!io_thread_->BelongsToCurrentThread()) { + io_thread_->PostTask(FROM_HERE, NewRunnableMethod( + this, &IOThreadProxy::Cancel)); + return; + } + if (!operation_.get()) { + DidFail(base::PLATFORM_FILE_ERROR_INVALID_OPERATION); + return; + } + cancel_operation_.reset(GetNewOperation()); + operation_->Cancel(cancel_operation_.get()); + } + + private: + // Inner class to receive callbacks from FileSystemOperation. + class CallbackDispatcher : public FileSystemCallbackDispatcher { + public: + explicit CallbackDispatcher(IOThreadProxy* proxy) : proxy_(proxy) { + } + + virtual void DidSucceed() { + proxy_->DidSucceed(); + } + + virtual void DidFail(base::PlatformFileError error_code) { + proxy_->DidFail(error_code); + } + + virtual void DidWrite(int64 bytes, bool complete) { + proxy_->DidWrite(bytes, complete); + } + + virtual void DidReadMetadata(const base::PlatformFileInfo&) { + NOTREACHED(); + } + + virtual void DidReadDirectory( + const std::vector& entries, + bool has_more) { + NOTREACHED(); + } + + virtual void DidOpenFileSystem(const std::string& name, + const FilePath& root_path) { + NOTREACHED(); + } + + scoped_refptr proxy_; + }; + + FileSystemOperation* GetNewOperation() { + // The FileSystemOperation takes ownership of the CallbackDispatcher. + return new FileSystemOperation(new CallbackDispatcher(this), io_thread_); + } + + void DidSucceed() { + if (!main_thread_->BelongsToCurrentThread()) { + operation_.reset(); + main_thread_->PostTask(FROM_HERE, NewRunnableMethod( + this, &IOThreadProxy::DidSucceed)); + return; + } + if (simple_writer_) + simple_writer_->DidSucceed(); + } + + void DidFail(base::PlatformFileError error_code) { + if (!main_thread_->BelongsToCurrentThread()) { + operation_.reset(); + main_thread_->PostTask(FROM_HERE, NewRunnableMethod( + this, &IOThreadProxy::DidFail, error_code)); + return; + } + if (simple_writer_) + simple_writer_->DidFail(error_code); + } + + 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; + } + if (simple_writer_) + simple_writer_->DidWrite(bytes, complete); + } + + scoped_refptr io_thread_; + scoped_refptr main_thread_; + + // Only used on the main thread. + base::WeakPtr simple_writer_; + + // Only used on the io thread. + scoped_ptr operation_; + scoped_ptr cancel_operation_; +}; + + +BrowserFileWriter::BrowserFileWriter( + const WebString& path, WebFileWriterClient* client) + : WebFileWriterBase(path, client), + io_thread_proxy_(new IOThreadProxy(AsWeakPtr())) { +} + +BrowserFileWriter::~BrowserFileWriter() { +} + +void BrowserFileWriter::DoTruncate(const FilePath& path, int64 offset) { + io_thread_proxy_->Truncate(path, offset); +} + +void BrowserFileWriter::DoWrite( + const FilePath& path, const GURL& blob_url, int64 offset) { + io_thread_proxy_->Write(path, blob_url, offset); +} + +void BrowserFileWriter::DoCancel() { + io_thread_proxy_->Cancel(); +} diff --git a/libcef/browser_file_writer.h b/libcef/browser_file_writer.h new file mode 100644 index 000000000..63d4ffc9d --- /dev/null +++ b/libcef/browser_file_writer.h @@ -0,0 +1,44 @@ +// 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_FILE_WRITER_H_ +#define BROWSER_FILE_WRITER_H_ + +#include "base/ref_counted.h" +#include "base/weak_ptr.h" +#include "webkit/fileapi/webfilewriter_base.h" + +class URLRequestContext; + + +// An implementation of WebFileWriter for use in test_shell and DRT. +class BrowserFileWriter : public fileapi::WebFileWriterBase, + public base::SupportsWeakPtr { + public: + BrowserFileWriter( + const WebKit::WebString& path, WebKit::WebFileWriterClient* client); + virtual ~BrowserFileWriter(); + + // Called by CefProcessIOThread when the thread is created and destroyed. + static void InitializeOnIOThread(URLRequestContext* request_context) { + request_context_ = request_context; + } + static void CleanupOnIOThread() { + request_context_ = NULL; + } + + protected: + // WebFileWriterBase overrides + virtual void DoTruncate(const FilePath& path, int64 offset); + virtual void DoWrite(const FilePath& path, const GURL& blob_url, + int64 offset); + virtual void DoCancel(); + + private: + class IOThreadProxy; + scoped_refptr io_thread_proxy_; + static URLRequestContext* request_context_; +}; + +#endif // BROWSER_FILE_WRITER_H_ diff --git a/libcef/browser_request_context.cc b/libcef/browser_request_context.cc index 2561133fa..939257bef 100644 --- a/libcef/browser_request_context.cc +++ b/libcef/browser_request_context.cc @@ -20,6 +20,27 @@ #include "webkit/blob/blob_storage_controller.h" #include "webkit/glue/webkit_glue.h" +#if defined(OS_WIN) + +#include +#pragma comment(lib, "winhttp.lib") + +namespace { + +// ProxyConfigService implementation that does nothing. +class ProxyConfigServiceNull : public net::ProxyConfigService { +public: + ProxyConfigServiceNull() {} + virtual void AddObserver(Observer* observer) {} + virtual void RemoveObserver(Observer* observer) {} + virtual bool GetLatestProxyConfig(net::ProxyConfig* config) { return true; } + virtual void OnLazyPoll() {} +}; + +} // namespace + +#endif // defined(OS_WIN) + BrowserRequestContext::BrowserRequestContext() { Init(FilePath(), net::HttpCache::NORMAL, false); } @@ -42,15 +63,34 @@ void BrowserRequestContext::Init( accept_language_ = "en-us,en"; accept_charset_ = "iso-8859-1,*,utf-8"; - // Use the system proxy settings. - scoped_ptr proxy_config_service( - net::ProxyService::CreateSystemProxyConfigService( - MessageLoop::current(), NULL)); +#if defined(OS_WIN) + // Using the system proxy resolver on Windows when "Automatically detect + // settings" (auto-detection) is checked under LAN Settings can hurt resource + // loading performance because the call to WinHttpGetProxyForUrl in + // proxy_resolver_winhttp.cc will block the IO thread. This is especially + // true for Windows 7 where auto-detection is checked by default. To avoid + // slow resource loading on Windows we only use the system proxy resolver if + // auto-detection is unchecked. + WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ie_config = {0}; + if (WinHttpGetIEProxyConfigForCurrentUser(&ie_config) && + ie_config.fAutoDetect == TRUE) { + proxy_service_ = net::ProxyService::CreateWithoutProxyResolver( + new ProxyConfigServiceNull(), NULL); + } +#endif // defined(OS_WIN) + + if (!proxy_service_.get()) { + // Use the system proxy resolver. + scoped_ptr proxy_config_service( + net::ProxyService::CreateSystemProxyConfigService( + MessageLoop::current(), NULL)); + proxy_service_ = net::ProxyService::CreateUsingSystemProxyResolver( + proxy_config_service.release(), 0, NULL); + } + host_resolver_ = 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(); http_auth_handler_factory_ = @@ -61,8 +101,9 @@ void BrowserRequestContext::Init( cache_path, 0, BrowserResourceLoaderBridge::GetCacheThread()); net::HttpCache* cache = - new net::HttpCache(host_resolver_, proxy_service_, ssl_config_service_, - http_auth_handler_factory_, NULL, NULL, backend); + new net::HttpCache(host_resolver_, NULL, proxy_service_, + ssl_config_service_, http_auth_handler_factory_, NULL, + NULL, backend); cache->set_mode(cache_mode); http_transaction_factory_ = cache; diff --git a/libcef/browser_resource_loader_bridge.cc b/libcef/browser_resource_loader_bridge.cc index 089a97afb..fba581fde 100644 --- a/libcef/browser_resource_loader_bridge.cc +++ b/libcef/browser_resource_loader_bridge.cc @@ -79,6 +79,7 @@ using net::HttpResponseHeaders; using net::StaticCookiePolicy; using webkit_blob::DeletableFileReference; using webkit_glue::ResourceLoaderBridge; +using webkit_glue::ResourceResponseInfo; namespace { @@ -147,7 +148,7 @@ class RequestProxy : public URLRequest::Delegate, // these methods asynchronously. void NotifyReceivedRedirect(const GURL& new_url, - const ResourceLoaderBridge::ResponseInfo& info) { + const ResourceResponseInfo& info) { bool has_new_first_party_for_cookies = false; GURL new_first_party_for_cookies; if (peer_ && peer_->OnReceivedRedirect(new_url, info, @@ -161,7 +162,7 @@ class RequestProxy : public URLRequest::Delegate, } } - void NotifyReceivedResponse(const ResourceLoaderBridge::ResponseInfo& info, + void NotifyReceivedResponse(const ResourceResponseInfo& info, bool content_filtered) { if (peer_) peer_->OnReceivedResponse(info, content_filtered); @@ -294,7 +295,7 @@ class RequestProxy : public URLRequest::Delegate, } else if(!redirectUrl.empty()) { // redirect to the specified URL params->url = GURL(WideToUTF8(redirectUrl)); - ResourceLoaderBridge::ResponseInfo info; + ResourceResponseInfo info; bool defer_redirect; OnReceivedRedirect(params->url, info, &defer_redirect); } else if(resourceStream.get()) { @@ -307,7 +308,7 @@ class RequestProxy : public URLRequest::Delegate, resource_stream_ = resourceStream; - ResourceLoaderBridge::ResponseInfo info; + ResourceResponseInfo info; info.content_length = static_cast(offset); if(!mimeType.empty()) info.mime_type = WideToUTF8(mimeType); @@ -418,7 +419,7 @@ class RequestProxy : public URLRequest::Delegate, virtual void OnReceivedRedirect( const GURL& new_url, - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool* defer_redirect) { *defer_redirect = true; // See AsyncFollowDeferredRedirect owner_loop_->PostTask(FROM_HERE, NewRunnableMethod( @@ -426,7 +427,7 @@ class RequestProxy : public URLRequest::Delegate, } virtual void OnReceivedResponse( - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool content_filtered) { owner_loop_->PostTask(FROM_HERE, NewRunnableMethod( this, &RequestProxy::NotifyReceivedResponse, info, content_filtered)); @@ -462,14 +463,14 @@ class RequestProxy : public URLRequest::Delegate, const GURL& new_url, bool* defer_redirect) { DCHECK(request->status().is_success()); - ResourceLoaderBridge::ResponseInfo info; + ResourceResponseInfo info; PopulateResponseInfo(request, &info); OnReceivedRedirect(new_url, info, defer_redirect); } virtual void OnResponseStarted(URLRequest* request) { if (request->status().is_success()) { - ResourceLoaderBridge::ResponseInfo info; + ResourceResponseInfo info; PopulateResponseInfo(request, &info); OnReceivedResponse(info, false); AsyncReadData(); // start reading @@ -549,7 +550,7 @@ class RequestProxy : public URLRequest::Delegate, } void PopulateResponseInfo(URLRequest* request, - ResourceLoaderBridge::ResponseInfo* info) const { + ResourceResponseInfo* info) const { info->request_time = request->request_time(); info->response_time = request->response_time(); info->headers = request->response_headers(); @@ -614,7 +615,7 @@ class SyncRequestProxy : public RequestProxy { virtual void OnReceivedRedirect( const GURL& new_url, - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool* defer_redirect) { // TODO(darin): It would be much better if this could live in WebCore, but // doing so requires API changes at all levels. Similar code exists in @@ -628,9 +629,9 @@ class SyncRequestProxy : public RequestProxy { } virtual void OnReceivedResponse( - const ResourceLoaderBridge::ResponseInfo& info, + const ResourceResponseInfo& info, bool content_filtered) { - *static_cast(result_) = info; + *static_cast(result_) = info; } virtual void OnReceivedData(int bytes_read) { diff --git a/libcef/browser_webblobregistry_impl.cc b/libcef/browser_webblobregistry_impl.cc index 336782234..bf271183c 100644 --- a/libcef/browser_webblobregistry_impl.cc +++ b/libcef/browser_webblobregistry_impl.cc @@ -13,13 +13,16 @@ #include "webkit/blob/blob_storage_controller.h" using WebKit::WebBlobData; -using WebKit::WebBlobStorageData; using WebKit::WebString; using WebKit::WebURL; +namespace { + MessageLoop* g_io_thread; webkit_blob::BlobStorageController* g_blob_storage_controller; +} // namespace + /* static */ void BrowserWebBlobRegistryImpl::InitializeOnIOThread( webkit_blob::BlobStorageController* blob_storage_controller) { @@ -39,15 +42,14 @@ 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( 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())); + NewRunnableMethod( + this, &BrowserWebBlobRegistryImpl::DoRegisterBlobUrl, url, + blob_data.release())); // Released in DoRegisterBlobUrl. } void BrowserWebBlobRegistryImpl::registerBlobURL( diff --git a/libcef/browser_webkit_init.h b/libcef/browser_webkit_init.h index 47e260c7d..fed57ade7 100644 --- a/libcef/browser_webkit_init.h +++ b/libcef/browser_webkit_init.h @@ -7,9 +7,9 @@ #define _BROWSER_WEBKIT_INIT_H #include "base/file_util.h" +#include "base/metrics/stats_counters.h" #include "base/path_service.h" #include "base/scoped_temp_dir.h" -#include "base/stats_counters.h" #include "base/utf_string_conversions.h" #include "media/base/media.h" #include "webkit/appcache/web_application_cache_host_impl.h" @@ -45,7 +45,7 @@ class BrowserWebKitInit : public webkit_glue::WebKitClientImpl { public: explicit BrowserWebKitInit() { - v8::V8::SetCounterFunction(StatsTable::FindLocation); + v8::V8::SetCounterFunction(base::StatsTable::FindLocation); WebKit::initialize(this); WebKit::setLayoutTestMode(false); diff --git a/libcef/browser_webview_delegate.cc b/libcef/browser_webview_delegate.cc index 8daa5a081..5b83d5ec7 100644 --- a/libcef/browser_webview_delegate.cc +++ b/libcef/browser_webview_delegate.cc @@ -523,9 +523,6 @@ WebPlugin* BrowserWebViewDelegate::createPlugin( return NULL; } - if (actual_mime_type.empty()) - actual_mime_type = params.mimeType.utf8(); - return new webkit_glue::WebPluginImpl( frame, params, info.path, actual_mime_type, AsWeakPtr()); } @@ -545,7 +542,7 @@ WebMediaPlayer* BrowserWebViewDelegate::createMediaPlayer( // should be grouped together. webkit_glue::MediaResourceLoaderBridgeFactory* bridge_factory = new webkit_glue::MediaResourceLoaderBridgeFactory( - GURL(), // referrer + GURL(frame->url()), // referrer "null", // frame origin "null", // main_frame_origin base::GetCurrentProcId(), @@ -806,6 +803,7 @@ void BrowserWebViewDelegate::openFileSystem( // 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())); diff --git a/libcef/browser_webview_delegate_win.cc b/libcef/browser_webview_delegate_win.cc index ed444b3ce..287a7cc92 100644 --- a/libcef/browser_webview_delegate_win.cc +++ b/libcef/browser_webview_delegate_win.cc @@ -378,7 +378,7 @@ void BrowserWebViewDelegate::showContextMenu( DestroyMenu(menu); end: - MessageLoop::current()->SetNestableTasksAllowed(old_state); + MessageLoop::current()->SetNestableTasksAllowed(old_state); } // Private methods ------------------------------------------------------------ diff --git a/libcef/cef_process_io_thread.cc b/libcef/cef_process_io_thread.cc index ebbda7add..4382c0788 100644 --- a/libcef/cef_process_io_thread.cc +++ b/libcef/cef_process_io_thread.cc @@ -6,6 +6,7 @@ #include "cef_process_io_thread.h" #include "cef_context.h" #include "browser_appcache_system.h" +#include "browser_file_writer.h" #include "browser_resource_loader_bridge.h" #include "browser_socket_stream_bridge.h" #include "browser_webblobregistry_impl.h" @@ -46,6 +47,7 @@ void CefProcessIOThread::Init() { _Context->set_request_context(request_context_); BrowserAppCacheSystem::InitializeOnIOThread(request_context_); + BrowserFileWriter::InitializeOnIOThread(request_context_); BrowserSocketStreamBridge::InitializeOnIOThread(request_context_); BrowserWebBlobRegistryImpl::InitializeOnIOThread( request_context_->blob_storage_controller()); @@ -57,6 +59,7 @@ void CefProcessIOThread::CleanUp() { // purify leak-test results. MessageLoop::current()->RunAllPending(); + BrowserFileWriter::CleanupOnIOThread(); BrowserSocketStreamBridge::Cleanup(); BrowserWebBlobRegistryImpl::Cleanup(); diff --git a/libcef/cef_process_ui_thread.cc b/libcef/cef_process_ui_thread.cc index 969db858e..a9b84c492 100644 --- a/libcef/cef_process_ui_thread.cc +++ b/libcef/cef_process_ui_thread.cc @@ -13,8 +13,8 @@ #include "base/command_line.h" #include "base/i18n/icu_util.h" +#include "base/metrics/stats_table.h" #include "base/rand_util.h" -#include "base/stats_table.h" #include "base/string_number_conversions.h" #include "build/build_config.h" #include "app/gfx/gl/gl_implementation.h" @@ -128,11 +128,11 @@ void CefProcessUIThread::Init() { // Load and initialize the stats table. Attempt to construct a somewhat // unique name to isolate separate instances from each other. - statstable_ = new StatsTable( + statstable_ = new base::StatsTable( kStatsFilePrefix + base::Uint64ToString(base::RandUint64()), kStatsFileThreads, kStatsFileCounters); - StatsTable::set_current(statstable_); + base::StatsTable::set_current(statstable_); // CEF always exposes the GC. webkit_glue::SetJavaScriptFlags("--expose-gc"); @@ -159,7 +159,7 @@ void CefProcessUIThread::CleanUp() { MessageLoop::current()->RunAllPending(); // Tear down the shared StatsTable. - StatsTable::set_current(NULL); + base::StatsTable::set_current(NULL); delete statstable_; statstable_ = NULL; diff --git a/libcef/cef_process_ui_thread.h b/libcef/cef_process_ui_thread.h index ca3957c2d..cc26ecce3 100644 --- a/libcef/cef_process_ui_thread.h +++ b/libcef/cef_process_ui_thread.h @@ -10,7 +10,9 @@ #include "cef_thread.h" class BrowserWebKitInit; +namespace base { class StatsTable; +} // ---------------------------------------------------------------------------- // CefProcessUIThread @@ -31,7 +33,7 @@ class CefProcessUIThread : public CefThread { virtual void CleanUp(); private: - StatsTable* statstable_; + base::StatsTable* statstable_; // WebKit implementation class. BrowserWebKitInit* webkit_init_; diff --git a/libcef/webwidget_host_win.cc b/libcef/webwidget_host_win.cc index cc265fa8e..ef2cc8273 100644 --- a/libcef/webwidget_host_win.cc +++ b/libcef/webwidget_host_win.cc @@ -304,6 +304,7 @@ void WebWidgetHost::Resize(LPARAM lparam) { void WebWidgetHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) { const WebMouseEvent& event = WebInputEventFactory::mouseEvent( view_, message, wparam, lparam); + webwidget_->handleInputEvent(event); switch (event.type) { case WebInputEvent::MouseMove: TrackMouseLeave(true); @@ -324,7 +325,6 @@ void WebWidgetHost::MouseEvent(UINT message, WPARAM wparam, LPARAM lparam) { ReleaseCapture(); break; } - webwidget_->handleInputEvent(event); } void WebWidgetHost::WheelEvent(WPARAM wparam, LPARAM lparam) { diff --git a/libcef_dll/libcef_dll.cc b/libcef_dll/libcef_dll.cc index 6ba3aea69..939489bad 100644 --- a/libcef_dll/libcef_dll.cc +++ b/libcef_dll/libcef_dll.cc @@ -91,9 +91,9 @@ CEF_EXPORT int cef_register_plugin(const cef_plugin_info_t* plugin_info) std::vector mime_types, file_extensions; std::vector descriptions; - SplitString(plugin_info->mime_types, '|', &mime_types); - SplitString(plugin_info->file_extensions, '|', &file_extensions); - SplitString(plugin_info->type_descriptions, '|', &descriptions); + base::SplitString(plugin_info->mime_types, '|', &mime_types); + base::SplitString(plugin_info->file_extensions, '|', &file_extensions); + base::SplitString(plugin_info->type_descriptions, '|', &descriptions); for (size_t i = 0; i < mime_types.size(); ++i) { CefPluginMimeType mimeType; @@ -101,7 +101,7 @@ CEF_EXPORT int cef_register_plugin(const cef_plugin_info_t* plugin_info) mimeType.mime_type = mime_types[i]; if (file_extensions.size() > i) - SplitString(file_extensions[i], ',', &mimeType.file_extensions); + base::SplitString(file_extensions[i], ',', &mimeType.file_extensions); if (descriptions.size() > i) mimeType.description = descriptions[i]; diff --git a/tests/cefclient/cefclient.cpp b/tests/cefclient/cefclient.cpp index 1f1c59bbd..7ccf1bd80 100644 --- a/tests/cefclient/cefclient.cpp +++ b/tests/cefclient/cefclient.cpp @@ -381,8 +381,8 @@ public: new ClientReadHandler(pBytes, dwSize)); mimeType = L"text/html"; } - } else if(wcsstr(url.c_str(), L"/logo1w.png") != NULL) { - // Any time we find "logo.gif" in the URL substitute in our own image + } else if(wcsstr(url.c_str(), L"/ps_logo2.png") != NULL) { + // Any time we find "ps_logo2.png" in the URL substitute in our own image if(LoadBinaryResource(IDS_LOGO, dwSize, pBytes)) { resourceStream = CefStreamReader::CreateForHandler( new ClientReadHandler(pBytes, dwSize));