diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index 28bbf514d..b4a08ffca 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -66,3 +66,4 @@ Date | CEF Revision | Chromium Revision 2011-04-05 | /trunk@213 | /trunk@80310 2011-05-16 | /trunk@233 | /trunk@85305 2011-07-02 | /trunk@263 | /trunk@91424 +2011-09-10 | /trunk@284 | /trunk@100584 diff --git a/cef.gyp b/cef.gyp index b33918fd0..b540c7b91 100644 --- a/cef.gyp +++ b/cef.gyp @@ -87,7 +87,6 @@ ], }, 'sources': [ - 'tests/cefclient/cefclient.ico', 'tests/cefclient/cefclient.rc', 'tests/cefclient/cefclient_win.cpp', 'tests/cefclient/client_handler_win.cpp', @@ -101,8 +100,8 @@ 'tests/cefclient/plugin_test.h', 'tests/cefclient/Resource.h', 'tests/cefclient/res/cefclient.ico', - 'tests/cefclient/res/logo.jpg', - 'tests/cefclient/res/logoball.jpg', + 'tests/cefclient/res/logo.png', + 'tests/cefclient/res/logoball.png', 'tests/cefclient/res/small.ico', 'tests/cefclient/res/uiplugin.html', 'tests/cefclient/resource_util_win.cpp', @@ -115,7 +114,7 @@ [ 'OS=="mac"', { 'product_name': 'cefclient', 'variables': { - 'repack_path': '../tools/data_pack/repack.py', + 'repack_path': '../tools/grit/grit/format/repack.py', }, 'actions': [ { @@ -148,7 +147,7 @@ 'destination': '<(PRODUCT_DIR)/cefclient.app/Contents/MacOS/', 'files': [ '<(PRODUCT_DIR)/libcef.dylib', - '<(PRODUCT_DIR)/libffmpegsumo.dylib', + '<(PRODUCT_DIR)/ffmpegsumo.so', ], }, { @@ -214,54 +213,11 @@ '..', ], }, - { - 'target_name': 'patcher', - 'type': 'none', - 'msvs_guid': 'A6D0953E-899E-4C60-AB6B-CAE75A44B8E6', - 'conditions': [ - ['OS=="win"', { - 'actions': [{ - 'action_name': 'patch_source', - 'msvs_cygwin_shell': 0, - 'inputs': [ - 'tools/patch_source.bat', - ], - 'outputs': [ - 'tools/patch_source.bat.output', - ], - 'action': ['', '<@(_inputs)'], - }, - { - 'action_name': 'make_version_header', - 'msvs_cygwin_shell': 0, - 'inputs': [ - 'tools/make_version_header.bat', - ], - 'outputs': [ - 'tools/make_version_header.bat.output', - ], - 'action': ['', '<@(_inputs)'], - }], - }, { # OS!="win" - 'actions': [{ - 'action_name': 'patch_source', - 'inputs': [ - 'tools/patch_source.sh', - ], - 'outputs': [ - 'tools/patch_source.sh.output', - ], - 'action': ['<@(_inputs)'], - }], - }], - ], - }, { 'target_name': 'libcef', 'type': 'shared_library', 'msvs_guid': 'C13650D5-CF1A-4259-BE45-B1EBA6280E47', 'dependencies': [ - '../app/app.gyp:app_base', '../base/base.gyp:base', '../base/base.gyp:base_i18n', '../build/temp_gyp/googleurl.gyp:googleurl', @@ -275,7 +231,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/leveldatabase/leveldatabase.gyp:leveldatabase', '../third_party/libjpeg_turbo/libjpeg.gyp:libjpeg', '../third_party/libpng/libpng.gyp:libpng', '../third_party/libxml/libxml.gyp:libxml', @@ -289,8 +245,8 @@ '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:webkit', '../third_party/zlib/zlib.gyp:zlib', '../ui/ui.gyp:gfx_resources', - '../ui/ui.gyp:ui_base', - '../ui/ui.gyp:ui_gfx', + '../ui/ui.gyp:ui', + '../v8/tools/gyp/v8.gyp:v8', '../webkit/support/webkit_support.gyp:appcache', '../webkit/support/webkit_support.gyp:blob', '../webkit/support/webkit_support.gyp:database', @@ -438,8 +394,8 @@ '$(OutDir)/obj/global_intermediate/webkit/webkit_chromium_resources.rc', '$(OutDir)/obj/global_intermediate/webkit/webkit_resources.rc', '$(OutDir)/obj/global_intermediate/webkit/webkit_strings_en-US.rc', - 'include/cef_types_win.h', - 'include/cef_win.h', + 'include/internal/cef_types_win.h', + 'include/internal/cef_win.h', 'libcef_dll/libcef_dll.rc', ], 'link_settings': { @@ -585,7 +541,6 @@ '../third_party/WebKit/Source/WebKit/chromium/public' ], 'dependencies': [ - '../app/app.gyp:app_base', '../base/base.gyp:base', '../base/base.gyp:base_i18n', '../build/temp_gyp/googleurl.gyp:googleurl', @@ -599,7 +554,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/leveldatabase/leveldatabase.gyp:leveldatabase', '../third_party/libjpeg_turbo/libjpeg.gyp:libjpeg', '../third_party/libpng/libpng.gyp:libpng', '../third_party/libxml/libxml.gyp:libxml', @@ -609,8 +564,8 @@ '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:webkit', '../third_party/zlib/zlib.gyp:zlib', '../ui/ui.gyp:gfx_resources', - '../ui/ui.gyp:ui_base', - '../ui/ui.gyp:ui_gfx', + '../ui/ui.gyp:ui', + '../v8/tools/gyp/v8.gyp:v8', '../webkit/support/webkit_support.gyp:appcache', '../webkit/support/webkit_support.gyp:blob', '../webkit/support/webkit_support.gyp:database', @@ -674,6 +629,7 @@ 'libcef/browser_webstoragenamespace_impl.h', 'libcef/browser_webkit_glue.cc', 'libcef/browser_webkit_glue.h', + 'libcef/browser_webkit_init.cc', 'libcef/browser_webkit_init.h', 'libcef/browser_webview_delegate.cc', 'libcef/browser_webview_delegate.h', diff --git a/include/internal/cef_types.h b/include/internal/cef_types.h index 7e53e6ada..695d2d8da 100644 --- a/include/internal/cef_types.h +++ b/include/internal/cef_types.h @@ -135,6 +135,12 @@ typedef struct _cef_settings_t // logged. /// cef_log_severity_t log_severity; + + /// + // The graphics implementation that CEF will use for rendering GPU accelerated + // content like WebGL, accelerated layers and 3D CSS. + /// + cef_graphics_implementation_t graphics_implementation; } cef_settings_t; /// @@ -321,9 +327,11 @@ typedef struct _cef_browser_settings_t bool webgl_disabled; /// - // Set to true (1) to disable accelerated compositing. + // Set to true (1) to enable accelerated compositing. This is turned off by + // default because the current in-process GPU implementation does not + // support it correctly. /// - bool accelerated_compositing_disabled; + bool accelerated_compositing_enabled; /// // Set to true (1) to disable accelerated layers. This affects features like diff --git a/include/internal/cef_types_linux.h b/include/internal/cef_types_linux.h index d718e1543..42da97ace 100644 --- a/include/internal/cef_types_linux.h +++ b/include/internal/cef_types_linux.h @@ -43,6 +43,15 @@ extern "C" { #define cef_window_handle_t GtkWidget* #define cef_cursor_handle_t void* +/// +// Supported graphics implementations. +/// +enum cef_graphics_implementation_t +{ + DESKTOP_IN_PROCESS = 0, + DESKTOP_IN_PROCESS_COMMAND_BUFFER, +}; + /// // Class representing window information. /// diff --git a/include/internal/cef_types_mac.h b/include/internal/cef_types_mac.h index e23a4d6f6..0773a9772 100644 --- a/include/internal/cef_types_mac.h +++ b/include/internal/cef_types_mac.h @@ -51,6 +51,15 @@ class NSView; extern "C" { #endif +/// +// Supported graphics implementations. +/// +enum cef_graphics_implementation_t +{ + DESKTOP_IN_PROCESS = 0, + DESKTOP_IN_PROCESS_COMMAND_BUFFER, +}; + /// // Class representing window information. /// diff --git a/include/internal/cef_types_win.h b/include/internal/cef_types_win.h index e752f585d..7ea35a5a7 100644 --- a/include/internal/cef_types_win.h +++ b/include/internal/cef_types_win.h @@ -43,6 +43,17 @@ extern "C" { #define cef_window_handle_t HWND #define cef_cursor_handle_t HCURSOR +/// +// Supported graphics implementations. +/// +enum cef_graphics_implementation_t +{ + ANGLE_IN_PROCESS = 0, + ANGLE_IN_PROCESS_COMMAND_BUFFER, + DESKTOP_IN_PROCESS, + DESKTOP_IN_PROCESS_COMMAND_BUFFER, +}; + /// // Class representing window information. /// diff --git a/include/internal/cef_types_wrappers.h b/include/internal/cef_types_wrappers.h index 8e87901bc..353b17c7d 100644 --- a/include/internal/cef_types_wrappers.h +++ b/include/internal/cef_types_wrappers.h @@ -280,6 +280,7 @@ struct CefSettingsTraits { cef_string_set(src->log_file.str, src->log_file.length, &target->log_file, copy); target->log_severity = src->log_severity; + target->graphics_implementation = src->graphics_implementation; } }; @@ -374,8 +375,8 @@ struct CefBrowserSettingsTraits { target->databases_disabled = src->databases_disabled; target->application_cache_disabled = src->application_cache_disabled; target->webgl_disabled = src->webgl_disabled; - target->accelerated_compositing_disabled = - src->accelerated_compositing_disabled; + target->accelerated_compositing_enabled = + src->accelerated_compositing_enabled; target->accelerated_layers_disabled = src->accelerated_layers_disabled; target->accelerated_video_disabled = src->accelerated_video_disabled; target->accelerated_2d_canvas_disabled = diff --git a/libcef/browser_database_system.cc b/libcef/browser_database_system.cc index c0b69ada7..31fa78844 100644 --- a/libcef/browser_database_system.cc +++ b/libcef/browser_database_system.cc @@ -36,7 +36,8 @@ BrowserDatabaseSystem::BrowserDatabaseSystem() DCHECK(!instance_); instance_ = this; CHECK(temp_dir_.CreateUniqueTempDir()); - db_tracker_ = new DatabaseTracker(temp_dir_.path(), false, NULL, NULL, NULL); + db_tracker_ = + new DatabaseTracker(temp_dir_.path(), false, false, NULL, NULL, NULL); db_tracker_->AddObserver(this); db_thread_.Start(); db_thread_proxy_ = db_thread_.message_loop_proxy(); diff --git a/libcef/browser_drag_delegate_win.cc b/libcef/browser_drag_delegate_win.cc index 64233e6be..375b848b7 100644 --- a/libcef/browser_drag_delegate_win.cc +++ b/libcef/browser_drag_delegate_win.cc @@ -236,7 +236,7 @@ void BrowserDragDelegate::PrepareDragForFileContents( if (file_name.value().empty()) { // Retrieve the name from the URL. file_name = FilePath( - net::GetSuggestedFilename(drop_data.url, "", "", "", string16())); + net::GetSuggestedFilename(drop_data.url, "", "", "", "", string16())); if (file_name.value().size() + drop_data.file_extension.size() + 1 > MAX_PATH) { file_name = FilePath(file_name.value().substr( diff --git a/libcef/browser_file_system.cc b/libcef/browser_file_system.cc index 5d61d631b..5d4563f44 100644 --- a/libcef/browser_file_system.cc +++ b/libcef/browser_file_system.cc @@ -22,7 +22,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" #include "webkit/fileapi/file_system_callback_dispatcher.h" #include "webkit/fileapi/file_system_context.h" -#include "webkit/fileapi/file_system_file_util.h" #include "webkit/fileapi/file_system_operation.h" #include "webkit/fileapi/file_system_path_manager.h" #include "webkit/fileapi/file_system_types.h" @@ -44,7 +43,6 @@ using WebKit::WebVector; using fileapi::FileSystemCallbackDispatcher; using fileapi::FileSystemContext; -using fileapi::FileSystemFileUtil; using fileapi::FileSystemOperation; namespace { @@ -103,13 +101,7 @@ class BrowserFileSystemCallbackDispatcher if (!root.is_valid()) callbacks_->didFail(WebKit::WebFileErrorSecurity); else -// Temporary hack to ease a 4-phase Chromium/WebKit commit. -#ifdef WEBFILESYSTEMCALLBACKS_USE_URL_NOT_STRING callbacks_->didOpenFileSystem(WebString::fromUTF8(name), root); -#else - callbacks_->didOpenFileSystem( - WebString::fromUTF8(name), WebString::fromUTF8(root.spec())); -#endif } virtual void DidFail(base::PlatformFileError error_code) { @@ -132,8 +124,8 @@ class BrowserFileSystemCallbackDispatcher BrowserFileSystem::BrowserFileSystem() { if (file_system_dir_.CreateUniqueTempDir()) { file_system_context_ = new FileSystemContext( - base::MessageLoopProxy::CreateForCurrentThread(), - base::MessageLoopProxy::CreateForCurrentThread(), + base::MessageLoopProxy::current(), + base::MessageLoopProxy::current(), NULL /* special storage policy */, NULL /* quota manager */, file_system_dir_.path(), @@ -177,65 +169,6 @@ void BrowserFileSystem::OpenFileSystem( GetNewOperation(callbacks)->OpenFileSystem(origin_url, type, create); } -void BrowserFileSystem::move(const WebString& src_path, - const WebString& dest_path, - WebFileSystemCallbacks* callbacks) { - move(GURL(src_path), GURL(dest_path), callbacks); -} - -void BrowserFileSystem::copy(const WebString& src_path, - const WebString& dest_path, - WebFileSystemCallbacks* callbacks) { - copy(GURL(src_path), GURL(dest_path), callbacks); -} - -void BrowserFileSystem::remove(const WebString& path, - WebFileSystemCallbacks* callbacks) { - remove(GURL(path), callbacks); -} - -void BrowserFileSystem::removeRecursively(const WebString& path, - WebFileSystemCallbacks* callbacks) { - removeRecursively(GURL(path), callbacks); -} - -void BrowserFileSystem::readMetadata(const WebString& path, - WebFileSystemCallbacks* callbacks) { - readMetadata(GURL(path), callbacks); -} - -void BrowserFileSystem::createFile(const WebString& path, - bool exclusive, - WebFileSystemCallbacks* callbacks) { - createFile(GURL(path), exclusive, callbacks); -} - -void BrowserFileSystem::createDirectory(const WebString& path, - bool exclusive, - WebFileSystemCallbacks* callbacks) { - createDirectory(GURL(path), exclusive, callbacks); -} - -void BrowserFileSystem::fileExists(const WebString& path, - WebFileSystemCallbacks* callbacks) { - fileExists(GURL(path), callbacks); -} - -void BrowserFileSystem::directoryExists(const WebString& path, - WebFileSystemCallbacks* callbacks) { - directoryExists(GURL(path), callbacks); -} - -void BrowserFileSystem::readDirectory(const WebString& path, - WebFileSystemCallbacks* callbacks) { - readDirectory(GURL(path), callbacks); -} - -WebKit::WebFileWriter* BrowserFileSystem::createFileWriter( - const WebString& path, WebKit::WebFileWriterClient* client) { - return createFileWriter(GURL(path), client); -} - void BrowserFileSystem::move( const WebURL& src_path, const WebURL& dest_path, WebFileSystemCallbacks* callbacks) { @@ -298,7 +231,7 @@ FileSystemOperation* BrowserFileSystem::GetNewOperation( BrowserFileSystemCallbackDispatcher* dispatcher = new BrowserFileSystemCallbackDispatcher(AsWeakPtr(), callbacks); FileSystemOperation* operation = new FileSystemOperation( - dispatcher, base::MessageLoopProxy::CreateForCurrentThread(), + dispatcher, base::MessageLoopProxy::current(), file_system_context_.get(), NULL); return operation; -} +} \ No newline at end of file diff --git a/libcef/browser_file_system.h b/libcef/browser_file_system.h index c2eb4227e..c237988fd 100644 --- a/libcef/browser_file_system.h +++ b/libcef/browser_file_system.h @@ -41,81 +41,43 @@ class BrowserFileSystem return file_system_context_.get(); } - // New WebKit::WebFileSystem overrides. + // WebKit::WebFileSystem implementation. virtual void move( const WebKit::WebURL& src_path, const WebKit::WebURL& dest_path, - WebKit::WebFileSystemCallbacks*); - + WebKit::WebFileSystemCallbacks*) OVERRIDE; virtual void copy( const WebKit::WebURL& src_path, const WebKit::WebURL& dest_path, - WebKit::WebFileSystemCallbacks*); - + WebKit::WebFileSystemCallbacks*) OVERRIDE; virtual void remove( const WebKit::WebURL& path, - WebKit::WebFileSystemCallbacks*); - + WebKit::WebFileSystemCallbacks*) OVERRIDE; virtual void removeRecursively( const WebKit::WebURL& path, - WebKit::WebFileSystemCallbacks*); - + WebKit::WebFileSystemCallbacks*) OVERRIDE; virtual void readMetadata( const WebKit::WebURL& path, - WebKit::WebFileSystemCallbacks*); - + WebKit::WebFileSystemCallbacks*) OVERRIDE; virtual void createFile( const WebKit::WebURL& path, bool exclusive, - WebKit::WebFileSystemCallbacks*); - + WebKit::WebFileSystemCallbacks*) OVERRIDE; virtual void createDirectory( const WebKit::WebURL& path, bool exclusive, - WebKit::WebFileSystemCallbacks*); - + WebKit::WebFileSystemCallbacks*) OVERRIDE; virtual void fileExists( const WebKit::WebURL& path, - WebKit::WebFileSystemCallbacks*); - + WebKit::WebFileSystemCallbacks*) OVERRIDE; virtual void directoryExists( const WebKit::WebURL& path, - WebKit::WebFileSystemCallbacks*); - + WebKit::WebFileSystemCallbacks*) OVERRIDE; virtual void readDirectory( const WebKit::WebURL& path, - WebKit::WebFileSystemCallbacks*); - + WebKit::WebFileSystemCallbacks*) OVERRIDE; virtual WebKit::WebFileWriter* createFileWriter( - const WebKit::WebURL& path, WebKit::WebFileWriterClient*); - - // Old WebKit::WebFileSystem overrides, soon to go away. - virtual void move(const WebKit::WebString& src_path, - const WebKit::WebString& dest_path, - WebKit::WebFileSystemCallbacks* callbacks); - virtual void copy(const WebKit::WebString& src_path, - const WebKit::WebString& dest_path, - 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, - bool exclusive, - WebKit::WebFileSystemCallbacks* callbacks); - virtual void createDirectory(const WebKit::WebString& path, - bool exclusive, - WebKit::WebFileSystemCallbacks* callbacks); - virtual void fileExists(const WebKit::WebString& path, - WebKit::WebFileSystemCallbacks* callbacks); - virtual void directoryExists(const WebKit::WebString& path, - WebKit::WebFileSystemCallbacks* callbacks); - virtual void readDirectory(const WebKit::WebString& path, - WebKit::WebFileSystemCallbacks* callbacks); - virtual WebKit::WebFileWriter* createFileWriter( - const WebKit::WebString& path, WebKit::WebFileWriterClient* client); + const WebKit::WebURL& path, WebKit::WebFileWriterClient*) OVERRIDE; private: // Helpers. diff --git a/libcef/browser_file_writer.cc b/libcef/browser_file_writer.cc index 5835a8546..f8513173e 100644 --- a/libcef/browser_file_writer.cc +++ b/libcef/browser_file_writer.cc @@ -10,13 +10,11 @@ #include "net/url_request/url_request_context.h" #include "webkit/fileapi/file_system_callback_dispatcher.h" #include "webkit/fileapi/file_system_context.h" -#include "webkit/fileapi/file_system_file_util.h" #include "webkit/fileapi/file_system_operation.h" #include "webkit/glue/webkit_glue.h" using fileapi::FileSystemCallbackDispatcher; using fileapi::FileSystemContext; -using fileapi::FileSystemFileUtil; using fileapi::FileSystemOperation; using fileapi::WebFileWriterBase; using WebKit::WebFileWriterClient; @@ -31,13 +29,13 @@ net::URLRequestContext* BrowserFileWriter::request_context_ = NULL; class BrowserFileWriter::IOThreadProxy : public base::RefCountedThreadSafe { public: - explicit IOThreadProxy(const base::WeakPtr& simple_writer, - FileSystemContext* file_system_context) + IOThreadProxy(const base::WeakPtr& simple_writer, + FileSystemContext* file_system_context) : simple_writer_(simple_writer), operation_(NULL), file_system_context_(file_system_context) { io_thread_ = CefThread::GetMessageLoopProxyForThread(CefThread::IO); - main_thread_ = base::MessageLoopProxy::CreateForCurrentThread(); + main_thread_ = base::MessageLoopProxy::current(); } virtual ~IOThreadProxy() { diff --git a/libcef/browser_impl.cc b/libcef/browser_impl.cc index bfbbcf380..7b8efc0dd 100644 --- a/libcef/browser_impl.cc +++ b/libcef/browser_impl.cc @@ -1238,19 +1238,19 @@ void CefBrowserImpl::UIT_Find(int identifier, const CefString& search_text, if (main_frame->document().isPluginDocument()) { WebPlugin* plugin = main_frame->document().to().plugin(); - webkit::npapi::WebPluginDelegate* delegate = - static_cast(plugin)->delegate(); - if (options.findNext) { - // Just navigate back/forward. - delegate->SelectFindResult(options.forward); - } else { - if (delegate->StartFind(searchText, options.matchCase, identifier)) { + if (plugin) { + if (options.findNext) { + // Just navigate back/forward. + plugin->selectFindResult(options.forward); } else { - // No find results. - UIT_NotifyFindStatus(identifier, 0, gfx::Rect(), 0, true); + if (plugin->startFind(searchText, options.matchCase, identifier)) { + } else { + // No find results. + UIT_NotifyFindStatus(identifier, 0, gfx::Rect(), 0, true); + } } + return; } - return; } WebFrame* frame_after_main = main_frame->traverseNext(true); @@ -1358,11 +1358,10 @@ void CefBrowserImpl::UIT_StopFinding(bool clear_selection) WebDocument doc = view->mainFrame()->document(); if (doc.isPluginDocument()) { - WebPlugin* plugin = view->mainFrame()->document(). - to().plugin(); - webkit::npapi::WebPluginDelegate* delegate = - static_cast(plugin)->delegate(); - delegate->StopFind(); + WebPlugin* plugin = + view->mainFrame()->document().to().plugin(); + if (plugin) + plugin->stopFind(); return; } diff --git a/libcef/browser_impl_win.cc b/libcef/browser_impl_win.cc index ce635ce76..886ed490b 100644 --- a/libcef/browser_impl_win.cc +++ b/libcef/browser_impl_win.cc @@ -296,10 +296,9 @@ void CefBrowserImpl::UIT_PrintPage(int page_number, int total_pages, int saved_state = SaveDC(hDC); DCHECK_NE(saved_state, 0); - skia::PlatformDevice* device = - skia::VectorPlatformDeviceEmfFactory::CreateDevice(dest_size_x, - dest_size_y, - true, hDC); + SkDevice* device = skia::VectorPlatformDeviceEmf::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 392f05f73..a739c9c81 100644 --- a/libcef/browser_persistent_cookie_store.cc +++ b/libcef/browser_persistent_cookie_store.cc @@ -8,9 +8,9 @@ #include #include "cef_thread.h" -#include "app/sql/meta_table.h" -#include "app/sql/statement.h" -#include "app/sql/transaction.h" +#include "sql/meta_table.h" +#include "sql/statement.h" +#include "sql/transaction.h" #include "base/file_path.h" #include "base/file_util.h" #include "googleurl/src/gurl.h" diff --git a/libcef/browser_request_context.cc b/libcef/browser_request_context.cc index 983a1dd40..29d573a32 100644 --- a/libcef/browser_request_context.cc +++ b/libcef/browser_request_context.cc @@ -15,7 +15,9 @@ #include "build/build_config.h" #include "net/base/cert_verifier.h" #include "net/base/cookie_monster.h" +#include "net/base/default_origin_bound_cert_store.h" #include "net/base/host_resolver.h" +#include "net/base/origin_bound_cert_service.h" #include "net/base/ssl_config_service_defaults.h" #include "net/ftp/ftp_network_layer.h" #include "net/http/http_auth_handler_factory.h" @@ -24,7 +26,7 @@ #include "net/proxy/proxy_service.h" #include "net/url_request/url_request_job_factory.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebKitClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebKitPlatformSupport.h" #include "webkit/blob/blob_storage_controller.h" #include "webkit/blob/blob_url_request_job_factory.h" #include "webkit/fileapi/file_system_context.h" @@ -90,6 +92,8 @@ void BrowserRequestContext::Init( storage_.set_cookie_store( new net::CookieMonster(persistent_store.get(), NULL)); + storage_.set_origin_bound_cert_service(new net::OriginBoundCertService( + new net::DefaultOriginBoundCertStore(NULL))); // hard-code A-L and A-C for test shells set_accept_language("en-us,en"); @@ -157,7 +161,8 @@ void BrowserRequestContext::Init( cache_path, 0, BrowserResourceLoaderBridge::GetCacheThread()); net::HttpCache* cache = - new net::HttpCache(host_resolver(), cert_verifier(), NULL, NULL, + new net::HttpCache(host_resolver(), cert_verifier(), + origin_bound_cert_service(), NULL, NULL, proxy_service(), ssl_config_service(), http_auth_handler_factory(), NULL, NULL, backend); @@ -169,7 +174,7 @@ void BrowserRequestContext::Init( blob_storage_controller_.reset(new webkit_blob::BlobStorageController()); file_system_context_ = static_cast( - WebKit::webKitClient()->fileSystem())->file_system_context(); + WebKit::webKitPlatformSupport()->fileSystem())->file_system_context(); net::URLRequestJobFactory* job_factory = new net::URLRequestJobFactory; job_factory->SetProtocolHandler( diff --git a/libcef/browser_resource_loader_bridge.cc b/libcef/browser_resource_loader_bridge.cc index 522f749d0..34afb4603 100644 --- a/libcef/browser_resource_loader_bridge.cc +++ b/libcef/browser_resource_loader_bridge.cc @@ -234,7 +234,8 @@ class RequestProxy : public net::URLRequest::Delegate, if (allow_download && webkit_glue::ShouldDownload(content_disposition, info.mime_type)) { string16 filename = net::GetSuggestedFilename(url, - content_disposition, info.charset, "", ASCIIToUTF16("download")); + content_disposition, info.charset, "", info.mime_type, + ASCIIToUTF16("download")); CefRefPtr dl_handler; if (handler->GetDownloadHandler(browser_, info.mime_type, filename, info.content_length, @@ -521,7 +522,7 @@ class RequestProxy : public net::URLRequest::Delegate, FilePath path; if (file_util::CreateTemporaryFile(&path)) { downloaded_file_ = DeletableFileReference::GetOrCreate( - path, base::MessageLoopProxy::CreateForCurrentThread()); + path, base::MessageLoopProxy::current()); file_stream_.Open( path, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE); } @@ -531,7 +532,7 @@ class RequestProxy : public net::URLRequest::Delegate, if (request_.get() && request_->has_upload() && params->load_flags & net::LOAD_ENABLE_UPLOAD_PROGRESS) { - upload_progress_timer_.Start( + upload_progress_timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds( kUpdateUploadProgressIntervalMsec), this, &RequestProxy::MaybeUpdateUploadProgress); @@ -653,14 +654,14 @@ class RequestProxy : public net::URLRequest::Delegate, virtual void OnReceivedRedirect(net::URLRequest* request, const GURL& new_url, - bool* defer_redirect) { + bool* defer_redirect) OVERRIDE { DCHECK(request->status().is_success()); ResourceResponseInfo info; PopulateResponseInfo(request, &info); OnReceivedRedirect(new_url, info, defer_redirect); } - virtual void OnResponseStarted(net::URLRequest* request) { + virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE { if (request->status().is_success()) { ResourceResponseInfo info; PopulateResponseInfo(request, &info); @@ -672,7 +673,7 @@ class RequestProxy : public net::URLRequest::Delegate, } virtual void OnAuthRequired(net::URLRequest* request, - net::AuthChallengeInfo* auth_info) { + net::AuthChallengeInfo* auth_info) OVERRIDE { if (browser_.get()) { CefRefPtr client = browser_->GetClient(); if (client.get()) { @@ -695,12 +696,14 @@ class RequestProxy : public net::URLRequest::Delegate, virtual void OnSSLCertificateError(net::URLRequest* request, int cert_error, - net::X509Certificate* cert) { + net::X509Certificate* cert) OVERRIDE { // Allow all certificate errors. request->ContinueDespiteLastError(); } - virtual bool CanGetCookies(net::URLRequest* request) { + virtual bool CanGetCookies( + const net::URLRequest* request, + const net::CookieList& cookie_list) const OVERRIDE { StaticCookiePolicy::Type policy_type = _Context->request_context()->AcceptAllCookies() ? StaticCookiePolicy::ALLOW_ALL_COOKIES : @@ -712,9 +715,9 @@ class RequestProxy : public net::URLRequest::Delegate, return rv == net::OK; } - virtual bool CanSetCookie(net::URLRequest* request, + virtual bool CanSetCookie(const net::URLRequest* request, const std::string& cookie_line, - net::CookieOptions* options) { + net::CookieOptions* options) const OVERRIDE { StaticCookiePolicy::Type policy_type = _Context->request_context()->AcceptAllCookies() ? StaticCookiePolicy::ALLOW_ALL_COOKIES : @@ -726,7 +729,8 @@ class RequestProxy : public net::URLRequest::Delegate, return rv == net::OK; } - virtual void OnReadCompleted(net::URLRequest* request, int bytes_read) { + virtual void OnReadCompleted(net::URLRequest* request, + int bytes_read) OVERRIDE { if (request->status().is_success() && bytes_read > 0) { OnReceivedData(bytes_read); } else { @@ -938,7 +942,7 @@ class ResourceLoaderBridgeImpl : public ResourceLoaderBridge { // -------------------------------------------------------------------------- // ResourceLoaderBridge implementation: - virtual void AppendDataToUpload(const char* data, int data_len) { + virtual void AppendDataToUpload(const char* data, int data_len) OVERRIDE { DCHECK(params_.get()); if (!params_->upload) params_->upload = new net::UploadData(); @@ -949,7 +953,7 @@ class ResourceLoaderBridgeImpl : public ResourceLoaderBridge { const FilePath& file_path, uint64 offset, uint64 length, - const base::Time& expected_modification_time) { + const base::Time& expected_modification_time) OVERRIDE { DCHECK(params_.get()); if (!params_->upload) params_->upload = new net::UploadData(); @@ -957,21 +961,21 @@ class ResourceLoaderBridgeImpl : public ResourceLoaderBridge { expected_modification_time); } - virtual void AppendBlobToUpload(const GURL& blob_url) { + virtual void AppendBlobToUpload(const GURL& blob_url) OVERRIDE { DCHECK(params_.get()); if (!params_->upload) params_->upload = new net::UploadData(); params_->upload->AppendBlob(blob_url); } - virtual void SetUploadIdentifier(int64 identifier) { + virtual void SetUploadIdentifier(int64 identifier) OVERRIDE { DCHECK(params_.get()); if (!params_->upload) params_->upload = new net::UploadData(); params_->upload->set_identifier(identifier); } - virtual bool Start(Peer* peer) { + virtual bool Start(Peer* peer) OVERRIDE { DCHECK(!proxy_); proxy_ = new RequestProxy(browser_); @@ -982,16 +986,16 @@ class ResourceLoaderBridgeImpl : public ResourceLoaderBridge { return true; // Any errors will be reported asynchronously. } - virtual void Cancel() { + virtual void Cancel() OVERRIDE { DCHECK(proxy_); proxy_->Cancel(); } - virtual void SetDefersLoading(bool value) { + virtual void SetDefersLoading(bool value) OVERRIDE { // TODO(darin): implement me } - virtual void SyncLoad(SyncLoadResponse* response) { + virtual void SyncLoad(SyncLoadResponse* response) OVERRIDE { DCHECK(!proxy_); // this may change as the result of a redirect @@ -1005,6 +1009,8 @@ class ResourceLoaderBridgeImpl : public ResourceLoaderBridge { static_cast(proxy_)->WaitForCompletion(); } + virtual void UpdateRoutingId(int new_routing_id) OVERRIDE {} + private: CefRefPtr browser_; @@ -1076,26 +1082,6 @@ ResourceLoaderBridge* ResourceLoaderBridge::Create( return new ResourceLoaderBridgeImpl(browser.get(), request_info); } -// Issue the proxy resolve request on the io thread, and wait -// for the result. -bool FindProxyForUrl(const GURL& url, std::string* proxy_list) { - DCHECK(_Context->request_context()); - - scoped_refptr sync_proxy_service( - new net::SyncProxyServiceHelper( - _Context->process()->io_thread()->message_loop(), - _Context->request_context()->proxy_service())); - - net::ProxyInfo proxy_info; - int rv = sync_proxy_service->ResolveProxy(url, &proxy_info, - net::BoundNetLog()); - if (rv == net::OK) { - *proxy_list = proxy_info.ToPacString(); - } - - return rv == net::OK; -} - } // namespace webkit_glue //----------------------------------------------------------------------------- diff --git a/libcef/browser_settings.cc b/libcef/browser_settings.cc index f4a4946e2..e160cd8d7 100644 --- a/libcef/browser_settings.cc +++ b/libcef/browser_settings.cc @@ -124,7 +124,7 @@ void BrowserToWebSettings(const CefBrowserSettings& cef, WebPreferences& web) web.allow_file_access_from_file_urls = cef.file_access_from_file_urls_allowed; web.experimental_webgl_enabled = !cef.webgl_disabled; web.show_composited_layer_borders = false; - web.accelerated_compositing_enabled = !cef.accelerated_compositing_disabled; + web.accelerated_compositing_enabled = cef.accelerated_compositing_enabled; web.accelerated_layers_enabled = !cef.accelerated_layers_disabled; web.accelerated_video_enabled = !cef.accelerated_video_disabled; web.accelerated_2d_canvas_enabled = !cef.accelerated_2d_canvas_disabled; diff --git a/libcef/browser_socket_stream_bridge.cc b/libcef/browser_socket_stream_bridge.cc index b3989c7d3..55bf36302 100644 --- a/libcef/browser_socket_stream_bridge.cc +++ b/libcef/browser_socket_stream_bridge.cc @@ -6,6 +6,7 @@ #include "browser_socket_stream_bridge.h" +#include "base/atomicops.h" #include "base/memory/ref_counted.h" #include "base/message_loop.h" #include "googleurl/src/gurl.h" @@ -69,7 +70,7 @@ class WebSocketStreamHandleBridgeImpl scoped_refptr socket_; // Number of pending tasks to handle net::SocketStream::Delegate methods. - int num_pending_tasks_; + base::subtle::Atomic32 num_pending_tasks_; DISALLOW_COPY_AND_ASSIGN(WebSocketStreamHandleBridgeImpl); }; @@ -119,7 +120,7 @@ void WebSocketStreamHandleBridgeImpl::Close() { void WebSocketStreamHandleBridgeImpl::OnConnected( net::SocketStream* socket, int max_pending_send_allowed) { - ++num_pending_tasks_; + base::subtle::NoBarrier_AtomicIncrement(&num_pending_tasks_, 1); message_loop_->PostTask( FROM_HERE, NewRunnableMethod(this, &WebSocketStreamHandleBridgeImpl::DoOnConnected, @@ -128,7 +129,7 @@ void WebSocketStreamHandleBridgeImpl::OnConnected( void WebSocketStreamHandleBridgeImpl::OnSentData( net::SocketStream* socket, int amount_sent) { - ++num_pending_tasks_; + base::subtle::NoBarrier_AtomicIncrement(&num_pending_tasks_, 1); message_loop_->PostTask( FROM_HERE, NewRunnableMethod(this, &WebSocketStreamHandleBridgeImpl::DoOnSentData, @@ -137,7 +138,7 @@ void WebSocketStreamHandleBridgeImpl::OnSentData( void WebSocketStreamHandleBridgeImpl::OnReceivedData( net::SocketStream* socket, const char* data, int len) { - ++num_pending_tasks_; + base::subtle::NoBarrier_AtomicIncrement(&num_pending_tasks_, 1); message_loop_->PostTask( FROM_HERE, NewRunnableMethod(this, @@ -146,7 +147,7 @@ void WebSocketStreamHandleBridgeImpl::OnReceivedData( } void WebSocketStreamHandleBridgeImpl::OnClose(net::SocketStream* socket) { - ++num_pending_tasks_; + base::subtle::NoBarrier_AtomicIncrement(&num_pending_tasks_, 1); // Release socket_ on IO thread. socket_ = NULL; socket_id_ = kNoSocketId; @@ -183,14 +184,14 @@ void WebSocketStreamHandleBridgeImpl::DoClose() { void WebSocketStreamHandleBridgeImpl::DoOnConnected( int max_pending_send_allowed) { DCHECK(MessageLoop::current() == message_loop_); - --num_pending_tasks_; + base::subtle::NoBarrier_AtomicIncrement(&num_pending_tasks_, -1); if (delegate_) delegate_->DidOpenStream(handle_, max_pending_send_allowed); } void WebSocketStreamHandleBridgeImpl::DoOnSentData(int amount_sent) { DCHECK(MessageLoop::current() == message_loop_); - --num_pending_tasks_; + base::subtle::NoBarrier_AtomicIncrement(&num_pending_tasks_, -1); if (delegate_) delegate_->DidSendData(handle_, amount_sent); } @@ -198,7 +199,7 @@ void WebSocketStreamHandleBridgeImpl::DoOnSentData(int amount_sent) { void WebSocketStreamHandleBridgeImpl::DoOnReceivedData( std::vector* data) { DCHECK(MessageLoop::current() == message_loop_); - --num_pending_tasks_; + base::subtle::NoBarrier_AtomicIncrement(&num_pending_tasks_, -1); scoped_ptr > scoped_data(data); if (delegate_) delegate_->DidReceiveData(handle_, &(data->at(0)), data->size()); @@ -206,7 +207,7 @@ void WebSocketStreamHandleBridgeImpl::DoOnReceivedData( void WebSocketStreamHandleBridgeImpl::DoOnClose() { DCHECK(MessageLoop::current() == message_loop_); - --num_pending_tasks_; + base::subtle::NoBarrier_AtomicIncrement(&num_pending_tasks_, -1); // Don't handle OnClose if there are pending tasks. DCHECK_EQ(num_pending_tasks_, 0); DCHECK(!socket_); diff --git a/libcef/browser_webblobregistry_impl.cc b/libcef/browser_webblobregistry_impl.cc index 095a5c8dc..3d24d5d8a 100644 --- a/libcef/browser_webblobregistry_impl.cc +++ b/libcef/browser_webblobregistry_impl.cc @@ -28,7 +28,7 @@ webkit_blob::BlobStorageController* g_blob_storage_controller; // "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 WebKit::WebCString spec(source.spec().data(), source.spec().length()); const url_parse::Parsed& parsed(source.parsed()); const bool is_valid = source.isValid(); return WebURL(spec, parsed, is_valid); diff --git a/libcef/browser_webkit_glue.cc b/libcef/browser_webkit_glue.cc index 345f6a621..2283b9e0d 100644 --- a/libcef/browser_webkit_glue.cc +++ b/libcef/browser_webkit_glue.cc @@ -15,25 +15,21 @@ MSVC_PUSH_WARNING_LEVEL(0); #include "third_party/WebKit/Source/WebKit/chromium/src/WebFrameImpl.h" MSVC_POP_WARNING(); #undef LOG -#include "base/string_util.h" -#include "net/base/mime_util.h" -#include "webkit/plugins/npapi/plugin_list.h" #include "browser_webkit_glue.h" - -#undef LOG #include "cef_context.h" #include "base/logging.h" #include "base/path_service.h" #include "base/scoped_ptr.h" +#include "base/string_util.h" #include "base/string16.h" #include "net/base/mime_util.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" #include "webkit/glue/user_agent.h" #include "webkit/glue/webkit_glue.h" -#include "webkit/glue/plugins/plugin_list.h" +#include "webkit/plugins/npapi/plugin_list.h" // Generated by GRIT #include "grit/webkit_resources.h" @@ -47,8 +43,10 @@ bool IsMediaPlayerAvailable() { } void GetPlugins(bool refresh, - std::vector* plugins) { - webkit::npapi::PluginList::Singleton()->GetPlugins(refresh, plugins); + std::vector* plugins) { + if (refresh) + webkit::npapi::PluginList::Singleton()->RefreshPlugins(); + webkit::npapi::PluginList::Singleton()->GetPlugins(plugins); } bool IsProtocolSupportedForMedia(const GURL& url) { @@ -172,12 +170,22 @@ bool ShouldDownload(const std::string& content_disposition, if (type.empty() || net::IsSupportedMimeType(type)) return false; - //// Finally, check the plugin list. - webkit::npapi::WebPluginInfo info; - bool allow_wildcard = false; - return !webkit::npapi::PluginList::Singleton()->GetPluginInfo( - GURL(), type, allow_wildcard, &info, NULL) || - !webkit::npapi::IsPluginEnabled(info); + // Finally, check the plugin list. + bool allow_wildcard = true; + std::vector plugins; + webkit::npapi::PluginList::Singleton()->GetPluginInfoArray( + GURL(), type, allow_wildcard, NULL, &plugins, NULL); + + // If any associated plugins exist and are enabled don't allow the download. + if (!plugins.empty()) { + std::vector::const_iterator it = plugins.begin(); + for (; it != plugins.end(); ++it) { + if (webkit::IsPluginEnabled(*it)) + return false; + } + } + + return true; } } // namespace webkit_glue diff --git a/libcef/browser_webkit_glue_win.cc b/libcef/browser_webkit_glue_win.cc index dc300ed01..5ece604c5 100644 --- a/libcef/browser_webkit_glue_win.cc +++ b/libcef/browser_webkit_glue_win.cc @@ -18,7 +18,7 @@ MSVC_POP_WARNING(); #undef LOG #include "base/logging.h" -#include "base/resource_util.h" +#include "base/win/resource_util.h" #include "skia/ext/platform_canvas.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSize.h" @@ -48,8 +48,8 @@ string16 GetLocalizedString(int message_id) { base::StringPiece GetRawDataResource(HMODULE module, int resource_id) { void* data_ptr; size_t data_size; - return base::GetDataResourceFromModule(module, resource_id, &data_ptr, - &data_size) + return base::win::GetDataResourceFromModule(module, resource_id, &data_ptr, + &data_size) ? base::StringPiece(static_cast(data_ptr), data_size) : base::StringPiece(); } diff --git a/libcef/browser_webkit_init.cc b/libcef/browser_webkit_init.cc new file mode 100644 index 000000000..ec3dd15b7 --- /dev/null +++ b/libcef/browser_webkit_init.cc @@ -0,0 +1,286 @@ +// Copyright (c) 2011 The Chromium Embedded Framework Authors. +// Portions copyright (c) 2009 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_webkit_init.h" +#include "browser_webstoragenamespace_impl.h" +#include "cef_context.h" + +#include "base/metrics/stats_counters.h" +#include "base/path_service.h" +#include "base/utf_string_conversions.h" +#include "media/base/media.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h" +#include "v8/include/v8.h" +#include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" +#include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" + + +BrowserWebKitInit::BrowserWebKitInit() { + v8::V8::SetCounterFunction(base::StatsTable::FindLocation); + + WebKit::initialize(this); + WebKit::setLayoutTestMode(false); + WebKit::WebRuntimeFeatures::enableSockets(true); + WebKit::WebRuntimeFeatures::enableApplicationCache(true); + WebKit::WebRuntimeFeatures::enableDatabase(true); + WebKit::WebRuntimeFeatures::enablePushState(true); + WebKit::WebRuntimeFeatures::enableIndexedDatabase(true); + WebKit::WebRuntimeFeatures::enableFileSystem(true); + + // TODO: Enable these once the implementation supports it. + WebKit::WebRuntimeFeatures::enableNotifications(false); + WebKit::WebRuntimeFeatures::enableGeolocation(false); + WebKit::WebRuntimeFeatures::enableSpeechInput(false); + WebKit::WebRuntimeFeatures::enableTouch(false); + WebKit::WebRuntimeFeatures::enableDeviceMotion(false); + WebKit::WebRuntimeFeatures::enableDeviceOrientation(false); + + // Load libraries for media and enable the media player. + FilePath module_path; + WebKit::WebRuntimeFeatures::enableMediaPlayer( + PathService::Get(base::DIR_MODULE, &module_path) && + media::InitializeMediaLibrary(module_path)); + + // Construct and initialize an appcache system for this scope. + // A new empty temp directory is created to house any cached + // content during the run. Upon exit that directory is deleted. + // If we can't create a tempdir, we'll use in-memory storage. + if (!appcache_dir_.CreateUniqueTempDir()) { + LOG(WARNING) << "Failed to create a temp dir for the appcache, " + "using in-memory storage."; + DCHECK(appcache_dir_.path().empty()); + } + BrowserAppCacheSystem::InitializeOnUIThread(appcache_dir_.path()); + + WebKit::WebDatabase::setObserver(&database_system_); + + blob_registry_ = new BrowserWebBlobRegistryImpl(); + + file_utilities_.set_sandbox_enabled(sandboxEnabled()); +} + +BrowserWebKitInit::~BrowserWebKitInit() { + WebKit::shutdown(); +} + +WebKit::WebMimeRegistry* BrowserWebKitInit::mimeRegistry() { + return &mime_registry_; +} + +WebKit::WebClipboard* BrowserWebKitInit::clipboard() { + return &clipboard_; +} + +WebKit::WebFileUtilities* BrowserWebKitInit::fileUtilities() { + return &file_utilities_; +} + +WebKit::WebSandboxSupport* BrowserWebKitInit::sandboxSupport() { + return NULL; +} + +WebKit::WebBlobRegistry* BrowserWebKitInit::blobRegistry() { + return blob_registry_.get(); +} + +WebKit::WebCookieJar* BrowserWebKitInit::cookieJar() { + return &cookie_jar_; +} + +WebKit::WebFileSystem* BrowserWebKitInit::fileSystem() { + return &file_system_; +} + +bool BrowserWebKitInit::sandboxEnabled() { + return false; +} + +WebKit::WebKitPlatformSupport::FileHandle +BrowserWebKitInit::databaseOpenFile( + const WebKit::WebString& vfs_file_name, int desired_flags) { + return BrowserDatabaseSystem::GetInstance()->OpenFile( + vfs_file_name, desired_flags); +} + +int BrowserWebKitInit::databaseDeleteFile( + const WebKit::WebString& vfs_file_name, bool sync_dir) { + return BrowserDatabaseSystem::GetInstance()->DeleteFile( + vfs_file_name, sync_dir); +} + +long BrowserWebKitInit::databaseGetFileAttributes( + const WebKit::WebString& vfs_file_name) { + return BrowserDatabaseSystem::GetInstance()->GetFileAttributes( + vfs_file_name); +} + +long long BrowserWebKitInit::databaseGetFileSize( + const WebKit::WebString& vfs_file_name) { + return BrowserDatabaseSystem::GetInstance()->GetFileSize(vfs_file_name); +} + +long long BrowserWebKitInit::databaseGetSpaceAvailableForOrigin( + const WebKit::WebString& origin_identifier) { + return BrowserDatabaseSystem::GetInstance()->GetSpaceAvailable( + origin_identifier); +} + +unsigned long long BrowserWebKitInit::visitedLinkHash( + const char* canonicalURL, size_t length) { + return 0; +} + +bool BrowserWebKitInit::isLinkVisited(unsigned long long linkHash) { + return false; +} + +WebKit::WebMessagePortChannel* +BrowserWebKitInit::createMessagePortChannel() { + return NULL; +} + +void BrowserWebKitInit::prefetchHostName(const WebKit::WebString&) { +} + +WebKit::WebData BrowserWebKitInit::loadResource(const char* name) { + if (!strcmp(name, "deleteButton")) { + // Create a red 30x30 square. + const char red_square[] = + "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52" + "\x00\x00\x00\x1e\x00\x00\x00\x1e\x04\x03\x00\x00\x00\xc9\x1e\xb3" + "\x91\x00\x00\x00\x30\x50\x4c\x54\x45\x00\x00\x00\x80\x00\x00\x00" + "\x80\x00\x80\x80\x00\x00\x00\x80\x80\x00\x80\x00\x80\x80\x80\x80" + "\x80\xc0\xc0\xc0\xff\x00\x00\x00\xff\x00\xff\xff\x00\x00\x00\xff" + "\xff\x00\xff\x00\xff\xff\xff\xff\xff\x7b\x1f\xb1\xc4\x00\x00\x00" + "\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a" + "\x9c\x18\x00\x00\x00\x17\x49\x44\x41\x54\x78\x01\x63\x98\x89\x0a" + "\x18\x50\xb9\x33\x47\xf9\xa8\x01\x32\xd4\xc2\x03\x00\x33\x84\x0d" + "\x02\x3a\x91\xeb\xa5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60" + "\x82"; + return WebKit::WebData(red_square, arraysize(red_square)); + } + return webkit_glue::WebKitPlatformSupportImpl::loadResource(name); +} + +WebKit::WebString BrowserWebKitInit::defaultLocale() { + return ASCIIToUTF16("en-US"); +} + +WebKit::WebStorageNamespace* BrowserWebKitInit::createLocalStorageNamespace( + const WebKit::WebString& path, unsigned quota) { + if (BrowserWebStorageNamespaceImpl::IsStorageActive()) { + // Use the localStorage implementation that writes data to disk. + return new BrowserWebStorageNamespaceImpl(DOM_STORAGE_LOCAL); + } + + // Use the default localStorage implementation. + return WebKit::WebStorageNamespace::createLocalStorageNamespace(path, + WebKit::WebStorageNamespace::m_localStorageQuota); +} + +void BrowserWebKitInit::dispatchStorageEvent(const WebKit::WebString& key, + const WebKit::WebString& old_value, const WebKit::WebString& new_value, + const WebKit::WebString& origin, const WebKit::WebURL& url, + bool is_local_storage) { + // The event is dispatched by the proxy. +} + +WebKit::WebIDBFactory* BrowserWebKitInit::idbFactory() { + return WebKit::WebIDBFactory::create(); +} + +void BrowserWebKitInit::createIDBKeysFromSerializedValuesAndKeyPath( + const WebKit::WebVector& values, + const WebKit::WebString& keyPath, + WebKit::WebVector& keys_out) { + WebKit::WebVector keys(values.size()); + for (size_t i = 0; i < values.size(); ++i) { + keys[i] = WebKit::WebIDBKey::createFromValueAndKeyPath( + values[i], WebKit::WebIDBKeyPath::create(keyPath)); + } + keys_out.swap(keys); +} + +WebKit::WebSerializedScriptValue +BrowserWebKitInit::injectIDBKeyIntoSerializedValue( + const WebKit::WebIDBKey& key, + const WebKit::WebSerializedScriptValue& value, + const WebKit::WebString& keyPath) { + return WebKit::WebIDBKey::injectIDBKeyIntoSerializedValue( + key, value, WebKit::WebIDBKeyPath::create(keyPath)); +} + +WebKit::WebGraphicsContext3D* BrowserWebKitInit::createGraphicsContext3D() { + const CefSettings& settings = _Context->settings(); +#if defined(OS_WIN) + bool use_command_buffer = + (settings.graphics_implementation == ANGLE_IN_PROCESS_COMMAND_BUFFER || + settings.graphics_implementation == DESKTOP_IN_PROCESS_COMMAND_BUFFER); +#else + bool use_command_buffer = + (settings.graphics_implementation == DESKTOP_IN_PROCESS_COMMAND_BUFFER); +#endif + + if (use_command_buffer) + return new webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl(); + else + return new webkit::gpu::WebGraphicsContext3DInProcessImpl(); +} + +WebKit::WebString BrowserWebKitInit::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 WebKitPlatformSupportImpl::queryLocalizedString(name); + } +} + +WebKit::WebString BrowserWebKitInit::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 WebKitPlatformSupportImpl::queryLocalizedString(name, value); +} + +WebKit::WebString BrowserWebKitInit::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 WebKitPlatformSupportImpl::queryLocalizedString( + name, value1, value2); +} diff --git a/libcef/browser_webkit_init.h b/libcef/browser_webkit_init.h index 6308e8bdb..f1351b145 100644 --- a/libcef/browser_webkit_init.h +++ b/libcef/browser_webkit_init.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Embedded Framework Authors. +// Copyright (c) 2011 The Chromium Embedded Framework Authors. // Portions copyright (c) 2009 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. @@ -9,291 +9,71 @@ #include "browser_appcache_system.h" #include "browser_database_system.h" #include "browser_file_system.h" -#include "browser_resource_loader_bridge.h" #include "browser_webblobregistry_impl.h" #include "browser_webcookiejar_impl.h" -#include "browser_webstoragenamespace_impl.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/utf_string_conversions.h" -#include "media/base/media.h" -#include "webkit/appcache/web_application_cache_host_impl.h" -#include "webkit/database/vfs_backend.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebData.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebDatabase.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebRuntimeFeatures.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageArea.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageEventDispatcher.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBFactory.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h" -#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" -#include "webkit/glue/webkit_glue.h" -#include "webkit/glue/webkitclient_impl.h" -#include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" +#include "webkit/glue/webkitplatformsupport_impl.h" -class BrowserWebKitInit : public webkit_glue::WebKitClientImpl { +class BrowserWebKitInit : public webkit_glue::WebKitPlatformSupportImpl { public: - explicit BrowserWebKitInit() { - v8::V8::SetCounterFunction(base::StatsTable::FindLocation); - - WebKit::initialize(this); - WebKit::setLayoutTestMode(false); - WebKit::WebRuntimeFeatures::enableSockets(true); - WebKit::WebRuntimeFeatures::enableApplicationCache(true); - WebKit::WebRuntimeFeatures::enableDatabase(true); - WebKit::WebRuntimeFeatures::enablePushState(true); - WebKit::WebRuntimeFeatures::enableIndexedDatabase(true); - WebKit::WebRuntimeFeatures::enableFileSystem(true); - - // TODO: Enable these once the implementation supports it. - WebKit::WebRuntimeFeatures::enableNotifications(false); - WebKit::WebRuntimeFeatures::enableGeolocation(false); - WebKit::WebRuntimeFeatures::enableSpeechInput(false); - WebKit::WebRuntimeFeatures::enableTouch(false); - WebKit::WebRuntimeFeatures::enableDeviceMotion(false); - WebKit::WebRuntimeFeatures::enableDeviceOrientation(false); - - // Load libraries for media and enable the media player. - FilePath module_path; - WebKit::WebRuntimeFeatures::enableMediaPlayer( - PathService::Get(base::DIR_MODULE, &module_path) && - media::InitializeMediaLibrary(module_path)); - - // Construct and initialize an appcache system for this scope. - // A new empty temp directory is created to house any cached - // content during the run. Upon exit that directory is deleted. - // If we can't create a tempdir, we'll use in-memory storage. - if (!appcache_dir_.CreateUniqueTempDir()) { - LOG(WARNING) << "Failed to create a temp dir for the appcache, " - "using in-memory storage."; - DCHECK(appcache_dir_.path().empty()); - } - BrowserAppCacheSystem::InitializeOnUIThread(appcache_dir_.path()); - - WebKit::WebDatabase::setObserver(&database_system_); - - blob_registry_ = new BrowserWebBlobRegistryImpl(); - - file_utilities_.set_sandbox_enabled(false); - } - - virtual ~BrowserWebKitInit() { - WebKit::shutdown(); - } - - virtual WebKit::WebMimeRegistry* mimeRegistry() OVERRIDE { - return &mime_registry_; - } - - virtual WebKit::WebClipboard* clipboard() OVERRIDE { - return &clipboard_; - } - - virtual WebKit::WebFileUtilities* fileUtilities() OVERRIDE { - return &file_utilities_; - } - - virtual WebKit::WebSandboxSupport* sandboxSupport() OVERRIDE { - return NULL; - } - - virtual WebKit::WebBlobRegistry* blobRegistry() OVERRIDE { - return blob_registry_.get(); - } - - virtual WebKit::WebCookieJar* cookieJar() OVERRIDE { - return &cookie_jar_; - } - - virtual WebKit::WebFileSystem* fileSystem() OVERRIDE { - return &file_system_; - } - - virtual bool sandboxEnabled() OVERRIDE { - return true; - } - - virtual WebKit::WebKitClient::FileHandle databaseOpenFile( - const WebKit::WebString& vfs_file_name, int desired_flags) OVERRIDE { - return BrowserDatabaseSystem::GetInstance()->OpenFile( - vfs_file_name, desired_flags); - } + BrowserWebKitInit(); + virtual ~BrowserWebKitInit(); + virtual WebKit::WebMimeRegistry* mimeRegistry() OVERRIDE; + virtual WebKit::WebClipboard* clipboard() OVERRIDE; + virtual WebKit::WebFileUtilities* fileUtilities() OVERRIDE; + virtual WebKit::WebSandboxSupport* sandboxSupport() OVERRIDE; + virtual WebKit::WebBlobRegistry* blobRegistry() OVERRIDE; + virtual WebKit::WebCookieJar* cookieJar() OVERRIDE; + virtual WebKit::WebFileSystem* fileSystem() OVERRIDE ; + virtual bool sandboxEnabled() OVERRIDE; + virtual WebKit::WebKitPlatformSupport::FileHandle databaseOpenFile( + const WebKit::WebString& vfs_file_name, int desired_flags) OVERRIDE; virtual int databaseDeleteFile(const WebKit::WebString& vfs_file_name, - bool sync_dir) OVERRIDE { - return BrowserDatabaseSystem::GetInstance()->DeleteFile( - vfs_file_name, sync_dir); - } - + bool sync_dir) OVERRIDE; virtual long databaseGetFileAttributes( - const WebKit::WebString& vfs_file_name) OVERRIDE { - return BrowserDatabaseSystem::GetInstance()->GetFileAttributes( - vfs_file_name); - } - + const WebKit::WebString& vfs_file_name) OVERRIDE; virtual long long databaseGetFileSize( - const WebKit::WebString& vfs_file_name) OVERRIDE { - return BrowserDatabaseSystem::GetInstance()->GetFileSize(vfs_file_name); - } - + const WebKit::WebString& vfs_file_name) OVERRIDE; virtual long long databaseGetSpaceAvailableForOrigin( - const WebKit::WebString& origin_identifier) { - return BrowserDatabaseSystem::GetInstance()->GetSpaceAvailable( - origin_identifier); - } - + const WebKit::WebString& origin_identifier) OVERRIDE; virtual unsigned long long visitedLinkHash(const char* canonicalURL, - size_t length) OVERRIDE { - return 0; - } - - virtual bool isLinkVisited(unsigned long long linkHash) OVERRIDE { - return false; - } - - virtual WebKit::WebMessagePortChannel* createMessagePortChannel() OVERRIDE { - return NULL; - } - - virtual void prefetchHostName(const WebKit::WebString&) OVERRIDE { - } - - virtual WebKit::WebData loadResource(const char* name) OVERRIDE { - if (!strcmp(name, "deleteButton")) { - // Create a red 30x30 square. - const char red_square[] = - "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52" - "\x00\x00\x00\x1e\x00\x00\x00\x1e\x04\x03\x00\x00\x00\xc9\x1e\xb3" - "\x91\x00\x00\x00\x30\x50\x4c\x54\x45\x00\x00\x00\x80\x00\x00\x00" - "\x80\x00\x80\x80\x00\x00\x00\x80\x80\x00\x80\x00\x80\x80\x80\x80" - "\x80\xc0\xc0\xc0\xff\x00\x00\x00\xff\x00\xff\xff\x00\x00\x00\xff" - "\xff\x00\xff\x00\xff\xff\xff\xff\xff\x7b\x1f\xb1\xc4\x00\x00\x00" - "\x09\x70\x48\x59\x73\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a" - "\x9c\x18\x00\x00\x00\x17\x49\x44\x41\x54\x78\x01\x63\x98\x89\x0a" - "\x18\x50\xb9\x33\x47\xf9\xa8\x01\x32\xd4\xc2\x03\x00\x33\x84\x0d" - "\x02\x3a\x91\xeb\xa5\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60" - "\x82"; - return WebKit::WebData(red_square, arraysize(red_square)); - } - return webkit_glue::WebKitClientImpl::loadResource(name); - } - - virtual WebKit::WebString defaultLocale() OVERRIDE { - return ASCIIToUTF16("en-US"); - } - + size_t length) OVERRIDE; + virtual bool isLinkVisited(unsigned long long linkHash) OVERRIDE; + virtual WebKit::WebMessagePortChannel* createMessagePortChannel() OVERRIDE; + virtual void prefetchHostName(const WebKit::WebString&) OVERRIDE; + virtual WebKit::WebData loadResource(const char* name) OVERRIDE; + virtual WebKit::WebString defaultLocale() OVERRIDE; virtual WebKit::WebStorageNamespace* createLocalStorageNamespace( - const WebKit::WebString& path, unsigned quota) OVERRIDE { - if (BrowserWebStorageNamespaceImpl::IsStorageActive()) { - // Use the localStorage implementation that writes data to disk. - return new BrowserWebStorageNamespaceImpl(DOM_STORAGE_LOCAL); - } - - // Use the default localStorage implementation. - return WebKit::WebStorageNamespace::createLocalStorageNamespace(path, - WebKit::WebStorageNamespace::m_localStorageQuota); - } - + const WebKit::WebString& path, unsigned quota) OVERRIDE; void dispatchStorageEvent(const WebKit::WebString& key, const WebKit::WebString& old_value, const WebKit::WebString& new_value, const WebKit::WebString& origin, const WebKit::WebURL& url, - bool is_local_storage) OVERRIDE { - // The event is dispatched by the proxy. - } - - virtual WebKit::WebIDBFactory* idbFactory() OVERRIDE { - return WebKit::WebIDBFactory::create(); - } - + bool is_local_storage) OVERRIDE; + virtual WebKit::WebIDBFactory* idbFactory() OVERRIDE; virtual void createIDBKeysFromSerializedValuesAndKeyPath( const WebKit::WebVector& values, const WebKit::WebString& keyPath, - WebKit::WebVector& keys_out) OVERRIDE { - WebKit::WebVector keys(values.size()); - for (size_t i = 0; i < values.size(); ++i) { - keys[i] = WebKit::WebIDBKey::createFromValueAndKeyPath( - values[i], WebKit::WebIDBKeyPath::create(keyPath)); - } - keys_out.swap(keys); - } - + WebKit::WebVector& keys_out) OVERRIDE; virtual WebKit::WebSerializedScriptValue injectIDBKeyIntoSerializedValue( const WebKit::WebIDBKey& key, const WebKit::WebSerializedScriptValue& value, - const WebKit::WebString& keyPath) OVERRIDE { - return WebKit::WebIDBKey::injectIDBKeyIntoSerializedValue( - key, value, WebKit::WebIDBKeyPath::create(keyPath)); - } - - virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D() OVERRIDE { - gfx::BindSkiaToInProcessGL(); - return new webkit::gpu::WebGraphicsContext3DInProcessImpl(); - } - - WebKit::WebString queryLocalizedString( - WebKit::WebLocalizedString::Name name) OVERRIDE { - 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( + const WebKit::WebString& keyPath) OVERRIDE; + virtual WebKit::WebGraphicsContext3D* createGraphicsContext3D() OVERRIDE; + virtual WebKit::WebString queryLocalizedString( + WebKit::WebLocalizedString::Name name) OVERRIDE; + virtual WebKit::WebString queryLocalizedString( WebKit::WebLocalizedString::Name name, const WebKit::WebString& value) - OVERRIDE { - 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( + OVERRIDE; + virtual WebKit::WebString queryLocalizedString( WebKit::WebLocalizedString::Name name, const WebKit::WebString& value1, - const WebKit::WebString& value2) OVERRIDE { - if (name == WebKit::WebLocalizedString::ValidationTooLong) - return ASCIIToUTF16("too long"); - if (name == WebKit::WebLocalizedString::ValidationStepMismatch) - return ASCIIToUTF16("step mismatch"); - return WebKitClientImpl::queryLocalizedString(name, value1, value2); - } + const WebKit::WebString& value2) OVERRIDE; private: webkit_glue::SimpleWebMimeRegistryImpl mime_registry_; diff --git a/libcef/browser_webview_delegate.cc b/libcef/browser_webview_delegate.cc index 89b9be510..cc402227c 100644 --- a/libcef/browser_webview_delegate.cc +++ b/libcef/browser_webview_delegate.cc @@ -24,7 +24,9 @@ #include "base/message_loop.h" #include "base/process_util.h" #include "base/string_util.h" +#include "base/stringprintf.h" #include "media/base/filter_collection.h" +#include "media/base/media_log.h" #include "media/base/message_loop_factory_impl.h" #include "media/filters/audio_renderer_impl.h" #include "net/base/net_errors.h" @@ -39,7 +41,7 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" -#include "third_party/WebKit/Source/WebKit/chromium/public/WebKitClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebKitPlatformSupport.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" @@ -481,7 +483,7 @@ int BrowserWebViewDelegate::historyForwardListCount() { // WebPluginPageDelegate ----------------------------------------------------- WebCookieJar* BrowserWebViewDelegate::GetCookieJar() { - return WebKit::webKitClient()->cookieJar(); + return WebKit::webKitPlatformSupport()->cookieJar(); } // WebWidgetClient ----------------------------------------------------------- @@ -574,15 +576,22 @@ WebScreenInfo BrowserWebViewDelegate::screenInfo() { WebPlugin* BrowserWebViewDelegate::createPlugin( WebFrame* frame, const WebPluginParams& params) { bool allow_wildcard = true; - webkit::npapi::WebPluginInfo info; - std::string actual_mime_type; - if (!webkit::npapi::PluginList::Singleton()->GetPluginInfo( - params.url, params.mimeType.utf8(), allow_wildcard, &info, - &actual_mime_type) || !webkit::npapi::IsPluginEnabled(info)) { + std::vector plugins; + std::vector mime_types; + webkit::npapi::PluginList::Singleton()->GetPluginInfoArray( + params.url, params.mimeType.utf8(), allow_wildcard, + NULL, &plugins, &mime_types); + if (plugins.empty()) return NULL; - } + +#if defined(OS_MACOSX) + // Mac does not supported windowed plugins. + bool force_windowless = true; +#else + bool force_windowless = browser_->IsWindowRenderingDisabled(); +#endif - if (browser_->IsWindowRenderingDisabled()) { + if (force_windowless) { bool flash = LowerCaseEqualsASCII(params.mimeType.utf8(), "application/x-shockwave-flash"); bool silverlight = StartsWithASCII(params.mimeType.utf8(), @@ -613,12 +622,13 @@ WebPlugin* BrowserWebViewDelegate::createPlugin( new_params.attributeValues.swap(new_values); return new webkit::npapi::WebPluginImpl( - frame, new_params, info.path, actual_mime_type, AsWeakPtr()); + frame, new_params, plugins.front().path, mime_types.front(), + AsWeakPtr()); } } return new webkit::npapi::WebPluginImpl( - frame, params, info.path, actual_mime_type, AsWeakPtr()); + frame, params, plugins.front().path, mime_types.front(), AsWeakPtr()); } WebWorker* BrowserWebViewDelegate::createWorker( @@ -644,7 +654,9 @@ WebMediaPlayer* BrowserWebViewDelegate::createMediaPlayer( scoped_ptr result( new webkit_glue::WebMediaPlayerImpl(client, collection.release(), - message_loop_factory.release())); + message_loop_factory.release(), + NULL, + new media::MediaLog())); if (!result->Initialize(frame, false, video_renderer)) return NULL; return result.release(); @@ -793,7 +805,7 @@ void BrowserWebViewDelegate::didFailProvisionalLoad( if(handled && !errorStr.empty()) { error_text = errorStr; } else { - error_text = StringPrintf("Error %d when loading url %s", + error_text = base::StringPrintf("Error %d when loading url %s", error.reason, failed_ds->request().url().spec().data()); } @@ -920,7 +932,7 @@ void BrowserWebViewDelegate::openFileSystem( WebFrame* frame, WebFileSystem::Type type, long long size, bool create, WebFileSystemCallbacks* callbacks) { BrowserFileSystem* fileSystem = static_cast( - WebKit::webKitClient()->fileSystem()); + WebKit::webKitPlatformSupport()->fileSystem()); fileSystem->OpenFileSystem(frame, type, size, create, callbacks); } diff --git a/libcef/browser_webview_delegate_mac.mm b/libcef/browser_webview_delegate_mac.mm index e496b6543..b5ac19179 100644 --- a/libcef/browser_webview_delegate_mac.mm +++ b/libcef/browser_webview_delegate_mac.mm @@ -25,6 +25,7 @@ #include "webkit/plugins/npapi/webplugin_delegate_impl.h" #include "webkit/glue/webmenurunner_mac.h" +using webkit::npapi::WebPluginDelegateImpl; using WebKit::WebCursorInfo; using WebKit::WebDragData; using WebKit::WebDragOperationsMask; @@ -192,8 +193,11 @@ webkit::npapi::WebPluginDelegate* BrowserWebViewDelegate::CreatePluginDelegate( return NULL; gfx::PluginWindowHandle containing_view = NULL; - return webkit::npapi::WebPluginDelegateImpl::Create( + WebPluginDelegateImpl* delegate = WebPluginDelegateImpl::Create( path, mime_type, containing_view); + if (delegate) + delegate->SetNoBufferContext(); + return delegate; } void BrowserWebViewDelegate::CreatedPluginWindow( diff --git a/libcef/cef_context.cc b/libcef/cef_context.cc index 8d3fad8b1..e0038958a 100644 --- a/libcef/cef_context.cc +++ b/libcef/cef_context.cc @@ -33,7 +33,7 @@ void UIT_RegisterPlugin(CefPluginInfo* plugin_info) { REQUIRE_UIT(); - webkit::npapi::WebPluginInfo info; + webkit::WebPluginInfo info; FilePath filename = FilePath(CefString(&plugin_info->unique_name)); std::string name = CefString(&plugin_info->display_name); diff --git a/libcef/cef_process_ui_thread.cc b/libcef/cef_process_ui_thread.cc index ae8ffd056..0be697e19 100644 --- a/libcef/cef_process_ui_thread.cc +++ b/libcef/cef_process_ui_thread.cc @@ -16,8 +16,10 @@ #include "build/build_config.h" #include "net/base/net_module.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebNetworkStateNotifier.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h" #include "ui/gfx/gl/gl_implementation.h" #include "webkit/extensions/v8/gc_extension.h" +#include "webkit/glue/webkit_glue.h" #include "webkit/plugins/npapi/plugin_list.h" #if defined(OS_WIN) @@ -102,7 +104,12 @@ void CefProcessUIThread::Init() { extensions_v8::GCExtension::Get()); #if defined(OS_WIN) - gfx::InitializeGLBindings(gfx::kGLImplementationEGLGLES2); + if (settings.graphics_implementation == ANGLE_IN_PROCESS || + settings.graphics_implementation == ANGLE_IN_PROCESS_COMMAND_BUFFER) { + gfx::InitializeGLBindings(gfx::kGLImplementationEGLGLES2); + } else { + gfx::InitializeGLBindings(gfx::kGLImplementationDesktopGL); + } #else gfx::InitializeGLBindings(gfx::kGLImplementationDesktopGL); #endif diff --git a/libcef/cef_thread.cc b/libcef/cef_thread.cc index 7a5e347c6..b157b0d3f 100644 --- a/libcef/cef_thread.cc +++ b/libcef/cef_thread.cc @@ -5,6 +5,7 @@ #include "cef_thread.h" +#include "base/compiler_specific.h" #include "base/message_loop.h" #include "base/message_loop_proxy.h" @@ -27,28 +28,53 @@ class CefThreadMessageLoopProxy : public MessageLoopProxy { // MessageLoopProxy implementation. virtual bool PostTask(const tracked_objects::Location& from_here, - Task* task) { + Task* task) OVERRIDE { return CefThread::PostTask(id_, from_here, task); } virtual bool PostDelayedTask(const tracked_objects::Location& from_here, - Task* task, int64 delay_ms) { + Task* task, int64 delay_ms) OVERRIDE { return CefThread::PostDelayedTask(id_, from_here, task, delay_ms); } virtual bool PostNonNestableTask(const tracked_objects::Location& from_here, - Task* task) { + Task* task) OVERRIDE { return CefThread::PostNonNestableTask(id_, from_here, task); } virtual bool PostNonNestableDelayedTask( const tracked_objects::Location& from_here, Task* task, - int64 delay_ms) { + int64 delay_ms) OVERRIDE { return CefThread::PostNonNestableDelayedTask(id_, from_here, task, delay_ms); } - virtual bool BelongsToCurrentThread() { + + virtual bool PostTask(const tracked_objects::Location& from_here, + const base::Closure& task) OVERRIDE { + return CefThread::PostTask(id_, from_here, task); + } + + virtual bool PostDelayedTask(const tracked_objects::Location& from_here, + const base::Closure& task, + int64 delay_ms) OVERRIDE { + return CefThread::PostDelayedTask(id_, from_here, task, delay_ms); + } + + virtual bool PostNonNestableTask(const tracked_objects::Location& from_here, + const base::Closure& task) OVERRIDE { + return CefThread::PostNonNestableTask(id_, from_here, task); + } + + virtual bool PostNonNestableDelayedTask( + const tracked_objects::Location& from_here, + const base::Closure& task, + int64 delay_ms) OVERRIDE { + return CefThread::PostNonNestableDelayedTask(id_, from_here, task, + delay_ms); + } + + virtual bool BelongsToCurrentThread() OVERRIDE { return CefThread::CurrentlyOn(id_); } @@ -117,16 +143,16 @@ bool CefThread::CurrentlyOn(ID identifier) { // static bool CefThread::PostTask(ID identifier, - const tracked_objects::Location& from_here, - Task* task) { + const tracked_objects::Location& from_here, + Task* task) { return PostTaskHelper(identifier, from_here, task, 0, true); } // static bool CefThread::PostDelayedTask(ID identifier, - const tracked_objects::Location& from_here, - Task* task, - int64 delay_ms) { + const tracked_objects::Location& from_here, + Task* task, + int64 delay_ms) { return PostTaskHelper(identifier, from_here, task, delay_ms, true); } @@ -147,6 +173,38 @@ bool CefThread::PostNonNestableDelayedTask( return PostTaskHelper(identifier, from_here, task, delay_ms, false); } +// static +bool CefThread::PostTask(ID identifier, + const tracked_objects::Location& from_here, + const base::Closure& task) { + return PostTaskHelper(identifier, from_here, task, 0, true); +} + +// static +bool CefThread::PostDelayedTask(ID identifier, + const tracked_objects::Location& from_here, + const base::Closure& task, + int64 delay_ms) { + return PostTaskHelper(identifier, from_here, task, delay_ms, true); +} + +// static +bool CefThread::PostNonNestableTask( + ID identifier, + const tracked_objects::Location& from_here, + const base::Closure& task) { + return PostTaskHelper(identifier, from_here, task, 0, false); +} + +// static +bool CefThread::PostNonNestableDelayedTask( + ID identifier, + const tracked_objects::Location& from_here, + const base::Closure& task, + int64 delay_ms) { + return PostTaskHelper(identifier, from_here, task, delay_ms, false); +} + // static bool CefThread::GetCurrentThreadIdentifier(ID* identifier) { MessageLoop* cur_message_loop = MessageLoop::current(); @@ -208,3 +266,42 @@ bool CefThread::PostTaskHelper( return !!message_loop; } + + +// static +bool CefThread::PostTaskHelper( + ID identifier, + const tracked_objects::Location& from_here, + const base::Closure& task, + int64 delay_ms, + bool nestable) { + DCHECK(identifier >= 0 && identifier < ID_COUNT); + // Optimization: to avoid unnecessary locks, we listed the ID enumeration in + // order of lifetime. So no need to lock if we know that the other thread + // outlives this one. + // Note: since the array is so small, ok to loop instead of creating a map, + // which would require a lock because std::map isn't thread safe, defeating + // the whole purpose of this optimization. + ID current_thread; + bool guaranteed_to_outlive_target_thread = + GetCurrentThreadIdentifier(¤t_thread) && + current_thread >= identifier; + + if (!guaranteed_to_outlive_target_thread) + lock_.Acquire(); + + MessageLoop* message_loop = cef_threads_[identifier] ? + cef_threads_[identifier]->message_loop() : NULL; + if (message_loop) { + if (nestable) { + message_loop->PostDelayedTask(from_here, task, delay_ms); + } else { + message_loop->PostNonNestableDelayedTask(from_here, task, delay_ms); + } + } + + if (!guaranteed_to_outlive_target_thread) + lock_.Release(); + + return !!message_loop; +} diff --git a/libcef/cef_thread.h b/libcef/cef_thread.h index 4609ab41d..6cd29f065 100644 --- a/libcef/cef_thread.h +++ b/libcef/cef_thread.h @@ -65,11 +65,14 @@ class CefThread : public base::Thread { virtual ~CefThread(); - // These are the same methods in message_loop.h, but are guaranteed to either - // get posted to the MessageLoop if it's still alive, or be deleted otherwise. + // These methods are the same as in message_loop.h, but are guaranteed to + // either post the Task to the MessageLoop (if it's still alive), or to + // delete the Task otherwise. // They return true if the thread existed and the task was posted. Note that - // even if the task is posted, there's no guarantee that it will run, since - // the target thread may already have a Quit message in its queue. + // even if the task is posted, there's no guarantee that it will run; for + // example the target loop may already be quitting, or in the case of a + // delayed task a Quit message may preempt it in the message loop queue. + // Conversely, a return value of false is a guarantee the task will not run. static bool PostTask(ID identifier, const tracked_objects::Location& from_here, Task* task); @@ -85,6 +88,29 @@ class CefThread : public base::Thread { const tracked_objects::Location& from_here, Task* task, int64 delay_ms); + + // TODO(ajwong): Remove the functions above once the Task -> Closure migration + // is complete. + // + // There are 2 sets of Post*Task functions, one which takes the older Task* + // function object representation, and one that takes the newer base::Closure. + // We have this overload to allow a staged transition between the two systems. + // Once the transition is done, the functions above should be deleted. + static bool PostTask(ID identifier, + const tracked_objects::Location& from_here, + const base::Closure& task); + static bool PostDelayedTask(ID identifier, + const tracked_objects::Location& from_here, + const base::Closure& task, + int64 delay_ms); + static bool PostNonNestableTask(ID identifier, + const tracked_objects::Location& from_here, + const base::Closure& task); + static bool PostNonNestableDelayedTask( + ID identifier, + const tracked_objects::Location& from_here, + const base::Closure& task, + int64 delay_ms); template static bool DeleteSoon(ID identifier, @@ -164,6 +190,13 @@ class CefThread : public base::Thread { int64 delay_ms, bool nestable); + static bool PostTaskHelper( + ID identifier, + const tracked_objects::Location& from_here, + const base::Closure& task, + int64 delay_ms, + bool nestable); + // The identifier of this thread. Only one thread can exist with a given // identifier at a given time. ID identifier_; diff --git a/libcef/dom_node_impl.cc b/libcef/dom_node_impl.cc index 961245bcc..8f5d7224b 100644 --- a/libcef/dom_node_impl.cc +++ b/libcef/dom_node_impl.cc @@ -10,6 +10,8 @@ #include "tracker.h" #include "base/logging.h" +#include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebAttribute.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMEvent.h" @@ -17,10 +19,11 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebNamedNodeMap.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebSelectElement.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" -#include "webkit/glue/form_field.h" using WebKit::WebAttribute; using WebKit::WebDocument; @@ -29,8 +32,10 @@ using WebKit::WebDOMEventListener; using WebKit::WebElement; using WebKit::WebFrame; using WebKit::WebFormControlElement; +using WebKit::WebInputElement; using WebKit::WebNamedNodeMap; using WebKit::WebNode; +using WebKit::WebSelectElement; using WebKit::WebString; @@ -186,14 +191,26 @@ CefString CefDOMNodeImpl::GetValue() return str; if (node_.isElementNode()) { - const WebElement& element = node_.to(); + const WebElement& element = node_.toConst(); if (element.isFormControlElement()) { // Retrieve the value from the form control element. const WebFormControlElement& formElement = - node_.to(); + node_.toConst(); - webkit_glue::FormField formField(formElement); - str = formField.value; + string16 value; + const string16& form_control_type = formElement.formControlType(); + if (form_control_type == ASCIIToUTF16("text")) { + const WebInputElement& input_element = + formElement.toConst(); + value = input_element.value(); + } else if (form_control_type == ASCIIToUTF16("select-one")) { + const WebSelectElement& select_element = + formElement.toConst(); + value = select_element.value(); + } + + TrimWhitespace(value, TRIM_LEADING, &value); + str = value; } } @@ -310,7 +327,7 @@ CefString CefDOMNodeImpl::GetElementTagName() return str; } - const WebElement& element = node_.to(); + const WebElement& element = node_.toConst(); const WebString& tagname = element.tagName(); if (!tagname.isNull()) str = tagname; @@ -328,7 +345,7 @@ bool CefDOMNodeImpl::HasElementAttributes() return false; } - const WebElement& element = node_.to(); + const WebElement& element = node_.toConst(); return (element.attributes().length() > 0); } @@ -342,7 +359,7 @@ bool CefDOMNodeImpl::HasElementAttribute(const CefString& attrName) return false; } - const WebElement& element = node_.to(); + const WebElement& element = node_.toConst(); return element.hasAttribute(string16(attrName)); } @@ -357,7 +374,7 @@ CefString CefDOMNodeImpl::GetElementAttribute(const CefString& attrName) return str; } - const WebElement& element = node_.to(); + const WebElement& element = node_.toConst(); const WebString& attr = element.getAttribute(string16(attrName)); if (!attr.isNull()) str = attr; @@ -375,7 +392,7 @@ void CefDOMNodeImpl::GetElementAttributes(AttributeMap& attrMap) return; } - const WebElement& element = node_.to(); + const WebElement& element = node_.toConst(); const WebNamedNodeMap& map = element.attributes(); unsigned int len = map.length(); if (len == 0) @@ -423,7 +440,7 @@ CefString CefDOMNodeImpl::GetElementInnerText() return str; } - const WebElement& element = node_.to(); + WebElement element = node_.to(); const WebString& text = element.innerText(); if (!text.isNull()) str = text; diff --git a/libcef/download_util.cc b/libcef/download_util.cc index 3b5a6821b..82333778f 100644 --- a/libcef/download_util.cc +++ b/libcef/download_util.cc @@ -168,6 +168,7 @@ void GenerateFileName(const GURL& url, content_disposition, referrer_charset, suggested_name, + mime_type, ASCIIToUTF16("download")); // TODO(evan): this code is totally wrong -- we should just generate diff --git a/libcef/printing/win_printing_context.cc b/libcef/printing/win_printing_context.cc index 2688a1541..29c1d1213 100644 --- a/libcef/printing/win_printing_context.cc +++ b/libcef/printing/win_printing_context.cc @@ -10,7 +10,7 @@ #include "base/i18n/time_formatting.h" #include "base/message_loop.h" #include "base/time.h" -#include "skia/ext/platform_device_win.h" +#include "skia/ext/bitmap_platform_device_win.h" #include "printing/units.h" diff --git a/libcef/scheme_impl.cc b/libcef/scheme_impl.cc index c58efbaa6..e161f6247 100644 --- a/libcef/scheme_impl.cc +++ b/libcef/scheme_impl.cc @@ -28,6 +28,7 @@ #include "net/url_request/url_request_ftp_job.h" #include "net/url_request/url_request_http_job.h" #include "net/url_request/url_request_job.h" +#include "net/url_request/url_request_job_factory.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityPolicy.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" @@ -360,6 +361,27 @@ private: // Class that manages the CefSchemeHandlerFactory instances. class CefUrlRequestManager { +protected: + // Class used for creating URLRequestJob instances. The lifespan of this + // object is managed by URLRequestJobFactory. + class ProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { + public: + ProtocolHandler(const std::string& scheme) + : scheme_(scheme) {} + + // From net::URLRequestJobFactory::ProtocolHandler + virtual net::URLRequestJob* MaybeCreateJob( + net::URLRequest* request) const OVERRIDE + { + REQUIRE_IOT(); + return CefUrlRequestManager::GetInstance()->GetRequestJob(request, + scheme_); + } + + private: + std::string scheme_; + }; + public: CefUrlRequestManager() {} @@ -386,9 +408,12 @@ public: handler_map_[make_pair(scheme_lower, domain_lower)] = factory; - // Register with the ProtocolFactory. - net::URLRequest::RegisterProtocolFactory(scheme_lower, - &CefUrlRequestManager::Factory); + net::URLRequestJobFactory* job_factory = + const_cast( + _Context->request_context()->job_factory()); + + job_factory->SetProtocolHandler(scheme_lower, + new ProtocolHandler(scheme_lower)); return true; } @@ -416,6 +441,10 @@ public: { REQUIRE_IOT(); + net::URLRequestJobFactory* job_factory = + const_cast( + _Context->request_context()->job_factory()); + // Unregister with the ProtocolFactory. std::set schemes; for (HandlerMap::const_iterator i = handler_map_.begin(); @@ -424,7 +453,7 @@ public: } for (std::set::const_iterator scheme = schemes.begin(); scheme != schemes.end(); ++scheme) { - net::URLRequest::RegisterProtocolFactory(*scheme, NULL); + job_factory->SetProtocolHandler(*scheme, NULL); } handler_map_.clear(); @@ -532,15 +561,6 @@ private: return job; } - // Factory method called by the ProtocolFactory. |scheme| will already be in - // lower case. - static net::URLRequestJob* Factory(net::URLRequest* request, - const std::string& scheme) - { - REQUIRE_IOT(); - return GetInstance()->GetRequestJob(request, scheme); - } - // Map (scheme, domain) to factories. This map will only be accessed on the IO // thread. typedef std::map, diff --git a/libcef/simple_clipboard_impl.cc b/libcef/simple_clipboard_impl.cc index 77910d022..4cac61b54 100644 --- a/libcef/simple_clipboard_impl.cc +++ b/libcef/simple_clipboard_impl.cc @@ -7,7 +7,7 @@ #include #include "base/lazy_instance.h" -#include "base/stl_util-inl.h" +#include "base/stl_util.h" #include "base/string16.h" #include "googleurl/src/gurl.h" #include "third_party/skia/include/core/SkBitmap.h" diff --git a/libcef/webview_host_gtk.cc b/libcef/webview_host_gtk.cc index 5b0a1573a..eeaa2e09e 100644 --- a/libcef/webview_host_gtk.cc +++ b/libcef/webview_host_gtk.cc @@ -8,7 +8,6 @@ #include "browser_webview_delegate.h" #include "base/logging.h" -#include "skia/ext/platform_canvas.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" #include "ui/gfx/rect.h" #include "ui/gfx/size.h" diff --git a/libcef/webwidget_host_gtk.cc b/libcef/webwidget_host_gtk.cc index c4023218b..d142cdc85 100644 --- a/libcef/webwidget_host_gtk.cc +++ b/libcef/webwidget_host_gtk.cc @@ -75,7 +75,7 @@ class WebWidgetHostGtkWidget { GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK); - GTK_WIDGET_SET_FLAGS(widget, GTK_CAN_FOCUS); + gtk_widget_set_can_focus(widget, TRUE); g_signal_connect(widget, "size-request", G_CALLBACK(&HandleSizeRequest), host); g_signal_connect(widget, "size-allocate", diff --git a/patch/README.txt b/patch/README.txt index a422f54af..f96fe36a4 100644 --- a/patch/README.txt +++ b/patch/README.txt @@ -1,20 +1,13 @@ -CEF development has faced delays in the past due to the time lapse between -submitting patches to the Chromium and WebKit projects and having those patches -accepted. A CEF developer will hopefully earn Chromium commit access at some -point which should partly mitigate this problem but will not eliminate it -completely. There may still be instances where CEF requires changes to the -Chromium/WebKit code base that are not desired by the Chromium/WebKit projects -as a whole. To address this situation in the near term and with a minimum of -maintenance headaches (i.e. without forking) this project adds a patch -capability as part of the CEF build process. The patch capability works as -follows: +There may be instances where CEF requires changes to the Chromium/WebKit code +base that are not desired by the Chromium/WebKit projects as a whole. To address +this situation the CEF project adds a patch capability as part of the CEF GYP +project generation step. The patch capability works as follows: 1. The CEF developer creates one or more patch files containing all required changes to the Chromium/WebKit code base and places those patch files in the "patches" subdirectory. 2. The CEF developer adds an entry for each patch file in the "patch.cfg" file. -3. The CEF "patch" project, which is a build dependency for the "webkit\config" - project, applies the patches to the Chromium/WebKit source tree using the +3. CEF applies the patches to the Chromium/WebKit source tree using the patcher.py tool in the tools directory. If necessary the patcher.py tool also rewrites the "patch_state.h" file which defines the CEF_PATCHES_APPLIED preprocessor value. diff --git a/patch/patch.cfg b/patch/patch.cfg new file mode 100644 index 000000000..b578ffb62 --- /dev/null +++ b/patch/patch.cfg @@ -0,0 +1,9 @@ +# An element of this array associates a patch file with a target directory. +# All paths in the patch file must be relative to that directory. Each patch +# file entry for source code changes should be proceeded by the code review +# or bug report link that it relates to. +patches = { + 'build' : '../build/', + # http://codereview.chromium.org/6730028/ + 'base' : '../base/', +} diff --git a/patch/patch.vcproj b/patch/patch.vcproj deleted file mode 100644 index 961f80d75..000000000 --- a/patch/patch.vcproj +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/patch/patch_build.cfg b/patch/patch_build.cfg deleted file mode 100644 index c616ff34a..000000000 --- a/patch/patch_build.cfg +++ /dev/null @@ -1,5 +0,0 @@ -# An element of this array associates a patch file with a target directory. -# All paths in the patch file must be relative to that directory. -patches = { - 'build' : '../build/' -} diff --git a/patch/patch_source.cfg b/patch/patch_source.cfg deleted file mode 100644 index 5bb0376ee..000000000 --- a/patch/patch_source.cfg +++ /dev/null @@ -1,10 +0,0 @@ -# An element of this array associates a patch file with a target directory. -# All paths in the patch file must be relative to that directory. Each patch -# file entry should be proceeded by the code review or bug report link that it -# relates to. -patches = { - # http://codereview.chromium.org/6730028/ - 'base' : '../base/', - # http://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/3d1f12409578cbf4 - 'skia_gpu' : '../third_party/skia/gpu/', -} diff --git a/patch/patches/base.patch b/patch/patches/base.patch index dd96a0fbc..70b7e75a7 100644 --- a/patch/patches/base.patch +++ b/patch/patches/base.patch @@ -1,8 +1,8 @@ Index: message_loop.cc =================================================================== ---- message_loop.cc (revision 91424) +--- message_loop.cc (revision 99561) +++ message_loop.cc (working copy) -@@ -401,9 +401,13 @@ +@@ -393,9 +393,13 @@ } void MessageLoop::AssertIdle() const { @@ -19,9 +19,9 @@ Index: message_loop.cc //------------------------------------------------------------------------------ Index: message_loop.h =================================================================== ---- message_loop.h (revision 91424) +--- message_loop.h (revision 99561) +++ message_loop.h (working copy) -@@ -349,6 +349,9 @@ +@@ -363,6 +363,9 @@ // Asserts that the MessageLoop is "idle". void AssertIdle() const; diff --git a/patch/patches/build.patch b/patch/patches/build.patch index 3f08f6b74..6e77f59b9 100644 --- a/patch/patches/build.patch +++ b/patch/patches/build.patch @@ -12,21 +12,3 @@ Index: common.gypi # Putting a variables dict inside another variables dict looks kind of # weird. This is done so that 'host_arch', 'chromeos', etc are defined as # variables within the outer variables dict here. This is necessary -Index: win/system.gyp -=================================================================== ---- win/system.gyp (revision 85124) -+++ win/system.gyp (working copy) -@@ -22,6 +22,13 @@ - 'action': ['', '<@(_inputs)'], - }, - ], -+ 'conditions': [ -+ ['cef_directory!=""', { -+ 'dependencies': [ -+ '../../<(cef_directory)/cef.gyp:patcher', -+ ], -+ }], -+ ], - }, - ], - } diff --git a/patch/patches/skia_gpu.patch b/patch/patches/skia_gpu.patch deleted file mode 100644 index 49eba85fa..000000000 --- a/patch/patches/skia_gpu.patch +++ /dev/null @@ -1,12 +0,0 @@ -Index: src/GrGpuGL.cpp -=================================================================== ---- src/GrGpuGL.cpp (revision 1763) -+++ src/GrGpuGL.cpp (working copy) -@@ -707,7 +707,6 @@ - static const StencilFormat esStencilFormats[] = { - {GR_GL_STENCIL_INDEX8, 8, false}, - {GR_GL_DEPTH24_STENCIL8, 8, true }, -- {GR_GL_STENCIL_INDEX4, 4, false}, - }; - - if (GR_GL_SUPPORT_DESKTOP) { diff --git a/tools/gclient_hook.py b/tools/gclient_hook.py index 9accbfab5..7ae71934d 100644 --- a/tools/gclient_hook.py +++ b/tools/gclient_hook.py @@ -47,9 +47,9 @@ def RunAction(dir, command): print >> sys.stderr, 'Error: %s' % str(e) sys.exit(2) -print "\nPatching build configuration files for CEF..." +print "\nPatching build configuration and source files for CEF..." patcher = [ 'python', 'tools/patcher.py', - '--patch-config', 'patch/patch_build.cfg' ]; + '--patch-config', 'patch/patch.cfg' ]; RunAction(cef_dir, patcher); print "\nGenerating CEF project files..." diff --git a/tools/gyp_cef b/tools/gyp_cef index 9e882a16b..f24dc89e0 100644 --- a/tools/gyp_cef +++ b/tools/gyp_cef @@ -23,8 +23,9 @@ chrome_src = os.path.abspath(os.path.join(cef_dir, os.pardir)) sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib')) import gyp -# Add tools/grit so that pymod_do_main(grit_info ...) can find grit_info.py. +# Add paths so that pymod_do_main(grit_info ...) can import files. sys.path.insert(1, os.path.join(chrome_src, 'tools', 'grit')) +sys.path.insert(1, os.path.join(chrome_src, 'chrome', 'tools', 'build')) # On Windows, Psyco shortens warm runs of build/gyp_chromium by about diff --git a/tools/patch_build.bat b/tools/patch.bat similarity index 73% rename from tools/patch_build.bat rename to tools/patch.bat index ade281d22..b21981a0d 100644 --- a/tools/patch_build.bat +++ b/tools/patch.bat @@ -1,2 +1,2 @@ @echo off -..\third_party\python_26\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.cfg \ No newline at end of file diff --git a/tools/patch.sh b/tools/patch.sh new file mode 100755 index 000000000..b9dde9bc0 --- /dev/null +++ b/tools/patch.sh @@ -0,0 +1,2 @@ +#!/bin/sh +python tools/patcher.py --patch-config patch/patch.cfg diff --git a/tools/patch_build.sh b/tools/patch_build.sh deleted file mode 100755 index e48399e45..000000000 --- a/tools/patch_build.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -python tools/patcher.py --patch-config patch/patch_build.cfg diff --git a/tools/patch_source.bat b/tools/patch_source.bat deleted file mode 100644 index 14d9a6c8a..000000000 --- a/tools/patch_source.bat +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -..\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/patch_source.sh b/tools/patch_source.sh deleted file mode 100755 index 36aff0d00..000000000 --- a/tools/patch_source.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -python tools/patcher.py --patch-config patch/patch_source.cfg