From 8cffdf99858d8cff4c416f23f1bdf3e8e3755fa9 Mon Sep 17 00:00:00 2001 From: Google Code Exporter Date: Sun, 10 Jan 2016 07:07:26 -0500 Subject: [PATCH] Migrating wiki contents from Google Code --- API.md | 100 ++++++++ ApplicationSettings.md | 300 ++++++++++++++++++++++++ ArchitectureFeatures.md | 127 +++++++++++ AudioVideo.md | 54 +++++ Browser.md | 442 ++++++++++++++++++++++++++++++++++++ BrowserSettings.md | 258 +++++++++++++++++++++ BuildOnLinux.md | 423 ++++++++++++++++++++++++++++++++++ BuildOnMac.md | 137 +++++++++++ BuildOnWindows.md | 278 +++++++++++++++++++++++ Callback.md | 19 ++ CommandLineSwitches.md | 57 +++++ ContentFilter.md | 21 ++ ContentFilterHandler.md | 28 +++ Cookie.md | 117 ++++++++++ CookieManager.md | 196 ++++++++++++++++ CookieVisitor.md | 23 ++ DisplayHandler.md | 91 ++++++++ Donations.md | 13 ++ DownloadHandler.md | 40 ++++ Download_CEF3_Linux.md | 71 ++++++ Download_CEF3_Mac.md | 53 +++++ Download_CEF3_Windows.md | 57 +++++ DpiAware.md | 72 ++++++ DragData.md | 60 +++++ DragHandler.md | 46 ++++ Frame.md | 172 ++++++++++++++ InnoSetupInstaller.md | 9 + InternalDevelopment.md | 106 +++++++++ JavascriptBindings.md | 120 ++++++++++ JavascriptCallback.md | 30 +++ JavascriptContextHandler.md | 42 ++++ JavascriptDialogHandler.md | 66 ++++++ JavascriptErrors.md | 21 ++ KeyboardHandler.md | 107 +++++++++ Kivy.md | 17 ++ KnowledgeBase.md | 19 ++ LifespanHandler.md | 87 +++++++ LoadHandler.md | 80 +++++++ NetworkError.md | 245 ++++++++++++++++++++ PaintBuffer.md | 21 ++ Panda3D.md | 19 ++ Plugins.md | 43 ++++ ProjectHome.md | 74 ++++++ PyGTK.md | 17 ++ PyQt.md | 17 ++ PySide.md | 17 ++ ReleaseNotes.md | 145 ++++++++++++ RenderHandler.md | 173 ++++++++++++++ Request.md | 321 ++++++++++++++++++++++++++ RequestHandler.md | 224 ++++++++++++++++++ ResourceHandler.md | 63 +++++ Response.md | 107 +++++++++ Security.md | 19 ++ StreamReader.md | 17 ++ StringVisitor.md | 19 ++ VersionNumbering.md | 15 ++ VirtualKey.md | 191 ++++++++++++++++ WebPluginInfo.md | 25 ++ WebRequest.md | 105 +++++++++ WebRequestClient.md | 95 ++++++++ WindowInfo.md | 33 +++ WindowUtils.md | 47 ++++ cefpython.md | 164 +++++++++++++ wxPython.md | 19 ++ 64 files changed, 6194 insertions(+) create mode 100644 API.md create mode 100644 ApplicationSettings.md create mode 100644 ArchitectureFeatures.md create mode 100644 AudioVideo.md create mode 100644 Browser.md create mode 100644 BrowserSettings.md create mode 100644 BuildOnLinux.md create mode 100644 BuildOnMac.md create mode 100644 BuildOnWindows.md create mode 100644 Callback.md create mode 100644 CommandLineSwitches.md create mode 100644 ContentFilter.md create mode 100644 ContentFilterHandler.md create mode 100644 Cookie.md create mode 100644 CookieManager.md create mode 100644 CookieVisitor.md create mode 100644 DisplayHandler.md create mode 100644 Donations.md create mode 100644 DownloadHandler.md create mode 100644 Download_CEF3_Linux.md create mode 100644 Download_CEF3_Mac.md create mode 100644 Download_CEF3_Windows.md create mode 100644 DpiAware.md create mode 100644 DragData.md create mode 100644 DragHandler.md create mode 100644 Frame.md create mode 100644 InnoSetupInstaller.md create mode 100644 InternalDevelopment.md create mode 100644 JavascriptBindings.md create mode 100644 JavascriptCallback.md create mode 100644 JavascriptContextHandler.md create mode 100644 JavascriptDialogHandler.md create mode 100644 JavascriptErrors.md create mode 100644 KeyboardHandler.md create mode 100644 Kivy.md create mode 100644 KnowledgeBase.md create mode 100644 LifespanHandler.md create mode 100644 LoadHandler.md create mode 100644 NetworkError.md create mode 100644 PaintBuffer.md create mode 100644 Panda3D.md create mode 100644 Plugins.md create mode 100644 ProjectHome.md create mode 100644 PyGTK.md create mode 100644 PyQt.md create mode 100644 PySide.md create mode 100644 ReleaseNotes.md create mode 100644 RenderHandler.md create mode 100644 Request.md create mode 100644 RequestHandler.md create mode 100644 ResourceHandler.md create mode 100644 Response.md create mode 100644 Security.md create mode 100644 StreamReader.md create mode 100644 StringVisitor.md create mode 100644 VersionNumbering.md create mode 100644 VirtualKey.md create mode 100644 WebPluginInfo.md create mode 100644 WebRequest.md create mode 100644 WebRequestClient.md create mode 100644 WindowInfo.md create mode 100644 WindowUtils.md create mode 100644 cefpython.md create mode 100644 wxPython.md diff --git a/API.md b/API.md new file mode 100644 index 0000000..7cba897 --- /dev/null +++ b/API.md @@ -0,0 +1,100 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/API + + +--- + + +# API # + +Table of contents: + + +## Introduction ## + +This page puts wiki pages into categories. But not all of them, so see also [all wiki pages](http://code.google.com/p/cefpython/w/list). + +## API search ## + +The best results are when searching wiki pages with google, see [API search](http://www.google.com/search?hl=en&q=site:http://code.google.com/p/cefpython/wiki/). The search form here on Google Code under the top menu gives poor results, it will only find exact words. + +## Examples ## + +See the [Example label](https://code.google.com/p/cefpython/w/list?q=label:Example) for wiki pages. There are also [wxpython-response.py](https://code.google.com/p/cefpython/source/browse/cefpython/cef3/linux/binaries_64bit/wxpython-response.py) and [pywin32.py](https://code.google.com/p/cefpython/source/browse/cefpython/cef3/windows/binaries_32bit/pywin32.py) which are not listed there. + +## Modules ## + +> [cefpython](cefpython.md) module + +## Settings ## + +> [ApplicationSettings](ApplicationSettings.md) dictionary + +> [BrowserSettings](BrowserSettings.md) dictionary + +> [CommandLineSwitches](CommandLineSwitches.md) dictionary + +## Classes & Objects ## + +> [Browser](Browser.md) object + +> [Callback](Callback.md) object + +> [ContentFilter](ContentFilter.md) object + +> [Cookie](Cookie.md) class + +> [CookieManager](CookieManager.md) class + +> [DpiAware](DpiAware.md) class (Win) + +> [DragData](DragData.md) object + +> [Frame](Frame.md) object + +> [JavascriptBindings](JavascriptBindings.md) class + +> [JavascriptCallback](JavascriptCallback.md) object + +> [PaintBuffer](PaintBuffer.md) object + +> [Request](Request.md) class + +> [Response](Response.md) object + +> [StreamReader](StreamReader.md) object + +> [WebPluginInfo](WebPluginInfo.md) object + +> [WebRequest](WebRequest.md) class + +> [WindowInfo](WindowInfo.md) class + +> [WindowUtils](WindowUtils.md) class + +## Client handlers ## + +> [DisplayHandler](DisplayHandler.md) + +> [DownloadHandler](DownloadHandler.md) + +> [DragHandler](DragHandler.md) + +> [JavascriptContextHandler](JavascriptContextHandler.md) (partially implemented) + +> [JavascriptDialogHandler](JavascriptDialogHandler.md) + +> [KeyboardHandler](KeyboardHandler.md) + +> [LifespanHandler](LifespanHandler.md) + +> [LoadHandler](LoadHandler.md) + +> [RenderHandler](RenderHandler.md) + +> [RequestHandler](RequestHandler.md) + +> [ResourceHandler](ResourceHandler.md) + +## Off-screen rendering ## + +See the [OSR label](https://code.google.com/p/cefpython/w/list?q=label:OSR) for wiki pages. \ No newline at end of file diff --git a/ApplicationSettings.md b/ApplicationSettings.md new file mode 100644 index 0000000..011a9c0 --- /dev/null +++ b/ApplicationSettings.md @@ -0,0 +1,300 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/ApplicationSettings + + +--- + + +# Application settings # + +Table of contents: + + +## Introduction ## + +These settings can be passed when calling [cefpython](cefpython.md).`Initialize()` . + +The default values of options that are suggested in descriptions may not always be correct, it may be best to set them explicitily. + +There are hundreds of options that can be set through CEF/Chromium command line switches. These switches can be set programmatically by passing a dictionary with switches as second argument to [cefpython](cefpython.md).Initialize(). See the [CommandLineSwitches](CommandLineSwitches.md) wiki page for more information. + +## Settings ## + +### auto\_detect\_proxy\_settings\_enabled (bool) ### + +> Available only in CEF 1. This is a Windows-only option. + +> Set to True to use the system proxy resolver on Windows when "Automatically detect settings" is checked. This setting is disabled by default for performance reasons. + +### auto\_zooming (string) ### + +> Windows only. Perform automatic zooming of browser contents. Example values for auto\_zooming (numeric value means a zoom level): + + * "system\_dpi" - use system DPI settings, see the DpiAware wiki page for more details. + * "0.0" (96 DPI) + * "1.0" (120 DPI) + * "2.0" (144 DPI) + * "-1.0" (72 DPI) + * "" - if cefpython detects that application is DPI aware it will automatically set `auto_zooming` to "system\_dpi". If you do not wish such behavior set `auto_zooming` to an empty string. See the DpiAware wiki page for more details on that. + +> Example values that can be set in Win7 DPI settings (Control Panel > Appearance and Personalization > Display): + + * Smaller 100% (Default) = 96 DPI = 0.0 zoom level + * Medium 125% = 120 DPI = 1.0 zoom level + * Larger 150% = 144 DPI = 2.0 zoom level + * Custom 75% = 72 DPI = -1.0 zoom level + +### background\_color (int) ### + +> Used on Mac OS X to specify the background color for hardware accelerated +> content. + +> 32-bit ARGB color value, not premultiplied. The color components are always +> in a known order. Equivalent to the `SkColor` type. + +### browser\_subprocess\_path (string) ### + +> Available only in CEF 3. + +> The path to a separate executable that will be launched for sub-processes. +> By default the browser process executable is used. See the comments on +> `CefExecuteProcess()` for details. Also configurable using the +> "browser-subprocess-path" [command-line switch](CommandLineSwitches.md). + +### cache\_path (string) ### + +> The location where cache data will be stored on disk. If empty an in-memory +> cache will be used for some features and a temporary disk cache for others. +> HTML5 databases such as localStorage will only persist across sessions if a +> cache path is specified. + +> CEF flushes cookies or other cache data to disk every 30 seconds, or immediately when [cefpython](cefpython.md).`Shutdown()` is called. + +> When this option is not set (empty string), a unique cache directory will be created in the user's temp directory for each run of the application. + +### command\_line\_args\_disabled (bool) ### + +> Set to true (1) to disable configuration of browser process features using +> standard CEF and Chromium [command-line arguments](CommandLineSwitches.md). Configuration can still +> be specified using CEF data structures or via the +> `CefApp::OnBeforeCommandLineProcessing()` method. + +### context\_menu (dict) ### + +> Configure mouse context menu. All dict values are of type bool and are True by default. + + * `enabled` - whether to enable mouse context menu + * `navigation` - show the "Back", "Forward" and "Reload" items. The "Reload" option calls [Browser](Browser.md).`ReloadIgnoreCache`. + * `print` - show the "Print..." item + * `view_source` - show the "View source" item + * `external_browser` - show the "Open in external browser" and "Open frame in external browser" options. On Linux the external browser is not focused when opening url. + * `devtools` - show the "Developer Tools" option. See also ApplicationSettings.`remote_debugging_port`. + +### context\_safety\_implementation (int) ### + +> Not yet ported to cefpython. + +### downloads\_enabled**= (bool, default True) ###** + +> In CEF Python 3 downloads are handled automatically. A default `SaveAs` file dialog provided by OS is displayed. See also the DownloadHandler wiki page. + +### list **extra\_plugin\_paths (string) ###** + +> Available only in CEF 1. Not yet implemented. + +> List of fully qualified paths to plugins (including plugin name) that will be loaded in addition to any plugins found in the default search paths. + +### graphics\_implementation (int) ### + +> Windows-only option. Available only in CEF 1. + +> The graphics implementation that CEF will use for rendering GPU accelerated content like WebGL, accelerated layers and 3D CSS. Possible values: + +> `cefpython.ANGLE_IN_PROCESS`
+
cefpython.ANGLE_IN_PROCESS_COMMAND_BUFFER
+cefpython.DESKTOP_IN_PROCESS
+cefpython.DESKTOP_IN_PROCESS_COMMAND_BUFFER
+ +

ignore_certificate_errors (bool)

+ +
Set to true (1) to ignore errors related to invalid SSL certificates.
+Enabling this setting can lead to potential security vulnerabilities like
+"man in the middle" attacks. Applications that load content from the
+internet should not enable this setting. Also configurable using the
+"ignore-certificate-errors" command-line switch.
+ +
Important: the official CEF Python binary releases incorporate a patch that changes the caching behavior on sites with SSL certificate errors when used with this setting. Chromium by default disallows caching of content when there is certificate error. CEF Python applies a patch to Chromium sources to allow for caching even when there is certificate error, but only when the "ignore_certificate_errors" option is set to True. When it's set to False then the Chromium's caching behavior does not change. Enabling caching with certificate errors is useful on local private networks that use self-signed SSL certificates. See the referenced CEF topic in Issue 125 for more details.
+ +

javascript_flags (string)

+ +
Custom flags that will be used when initializing the V8 Javascript engine.
+The consequences of using custom flags may not be well tested. Also
+configurable using the "js-flags" command-line switch.
+ +

local_storage_quota (int)

+ +
Available only in CEF 1.
+ +
Quota limit for localStorage data across all origins. Default size is 5MB.
+ +

locale (string)

+ +
The locale string that will be passed to Webkit. If empty the default
+locale of "en-US" will be used. This value is ignored on Linux where locale
+is determined using environment variable parsing with the precedence order:
+LANGUAGE, LC_ALL, LC_MESSAGES and LANG. Also configurable using the "lang"
+command-line switch.
+ +

locales_dir_path (string)

+ +
The fully qualified path for the locales directory. If this value is empty
+the locales directory must be located in the module directory. This value
+is ignored on Mac OS X where pack files are always loaded from the app
+bundle Resources directory. Also configurable using the "locales-dir-path"
+command-line switch.
+ +

debug (bool)

+ +
Whether cefpython should display debug messages in console and write them to "log_file" (see the next option).
+ +
In previous versions of cefpython, this option was set by overwriting module's g_debug global variable, this way of setting is now deprecated.
+ +

log_file (string)

+ +
The directory and file name to use for the debug log. If not set, the
+default name of "debug.log" will be used and the file will be written
+to the application directory. Set it to empty string to not use this file.
+Also configurable using the "log-file" command-line switch.
+ +

log_severity (int)

+ +
The log severity. Only messages of this severity level or higher will be
+logged. Also configurable using the "log-severity" command-line switch with
+a value of "verbose", "info", "warning", "error", "error-report" or
+"disable".
+ +
Accepted values:
+ +
cefpython.LOGSEVERITY_VERBOSE
+cefpython.LOGSEVERITY_INFO
+cefpython.LOGSEVERITY_WARNING
+cefpython.LOGSEVERITY_ERROR
+cefpython.LOGSEVERITY_ERROR_REPORT
+cefpython.LOGSEVERITY_DISABLE
+ +
The default is cefpython.LOGSEVERITY_INFO.
+ +

multi_threaded_message_loop (bool)

+ +
Set to true (1) to have the browser process message loop run in a separate
+thread. If false (0) than the cefpython.MessageLoopWork() function must be
+called from your application message loop.
+ +
This option is not and cannot be supported on OS-X for architectural reasons. This option only works on Windows.
+ +

pack_loading_disabled (bool)

+ +
Set to true (1) to disable loading of pack files for resources and locales.
+A resource bundle handler must be provided for the browser and render
+processes via CefApp::GetResourceBundleHandler() if loading of pack files
+is disabled. Also configurable using the "disable-pack-loading" command-line switch.
+ +

persist_session_cookies (bool)

+ +
Available only in CEF 3.
+ +
To persist session cookies (cookies without an expiry date or validity
+interval) by default when using the global cookie manager set this value to
+true. Session cookies are generally intended to be transient and most Web
+browsers do not persist them. A |cache_path| value must also be specified to
+enable this feature. Also configurable using the "persist-session-cookies"
+command-line switch.
+ +

product_version (string)

+ +
Value that will be inserted as the product portion of the default
+User-Agent string. If empty the Chromium product version will be used. If
+|userAgent| is specified this value will be ignored. Also configurable
+using the "product-version" command-line switch.
+ +

release_dcheck_enabled (bool)

+ +
Enable DCHECK in release mode to ease debugging. Also configurable using the
+"enable-release-dcheck" command-line switch.
+ +
Cefpython binaries are available only using release builds.
+Failed DCHECKs will be displayed to the console or logged to a file,
+this may help identify problems in an application. Do not enable it
+in production as it might hurt performance.
+ +

remote_debugging_port (int)

+ +
Set to a value between 1024 and 65535 to enable remote debugging on the
+specified port. For example, if 8080 is specified the remote debugging URL
+will be http://127.0.0.1:8080. CEF can be remotely debugged from CEF or
+Chrome browser window. Also configurable using the "remote-debugging-port"
+command-line switch.
+ +
A default value of 0 will generate a random port between 49152–65535. A value of -1 will disable remote debugging.
+ +
NOTE: Do not use the --remote-debugging-port command line switch, as it collides with this option.
+ +

resources_dir_path (string)

+ +
The fully qualified path for the resources directory. If this value is
+empty the cef.pak and/or devtools_resources.pak files must be located in
+the module directory on Windows/Linux or the app bundle Resources directory
+on Mac OS X. Also configurable using the "resources-dir-path" command-line switch.
+ +

session_storage_quota (int)

+ +
Available only in CEF 1.
+ +
Quota limit for sessionStorage data per namespace. Default size is 5MB.
+ +

single_process (bool)

+ +
Available only in CEF 3.
+ +
Set to true (1) to use a single process for the browser and renderer. This
+run mode is not officially supported by Chromium and is less stable than
+the multi-process default. Also configurable using the "single-process"
+command-line switch.
+ +

string_encoding (string)

+ +
What kind of encoding should we use when converting unicode string to bytes string? This conversion is done when you pass a unicode string to javascript.
+ +
This encoding is also used when converting bytes to unicode, this includes the post data in the Request object.
+ +
The default is "utf-8".
+ +
The behavior for encode/decode errors is to replace the unknown character with "?", this can be changed in the "string_utils.pyx" file through UNICODE_ENCODE_ERRORS/BYTES_DECODE_ERRORS constants.
+ +

uncaught_exception_stack_size (int)

+ +
The number of stack trace frames to capture for uncaught exceptions.
+Specify a positive value to enable the JavascriptContextHandler.OnUncaughtException() +callback. Specify 0 (default value) and
+OnUncaughtException() will not be called. Also configurable using the
+"uncaught-exception-stack-size" command-line switch.
+ +

unique_request_context_per_browser (bool)

+ +
A request context provides request handling for a set of related browser
+objects. Browser objects with different
+request contexts will never be hosted in the same render process. Browser
+objects with the same request context may or may not be hosted in the same
+render process depending on the process model. Browser objects created
+indirectly via the JavaScript window.open function or targeted links will
+share the same render process and the same request context as the source
+browser.
+ +
To successfully implement separate cookie manager per browser session
+with the use of the RequestHandler.GetCookieManager callback, you have to
+set unique_request_context_per_browser to True.
+ +

user_agent (string)

+ +
Value that will be returned as the User-Agent HTTP header. If empty the
+default User-Agent string will be used. Also configurable using the
+"user-agent" command-line switch. \ No newline at end of file diff --git a/ArchitectureFeatures.md b/ArchitectureFeatures.md new file mode 100644 index 0000000..e336989 --- /dev/null +++ b/ArchitectureFeatures.md @@ -0,0 +1,127 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/ArchitectureFeatures + + +--- + + +# Architecture & Features # + +Table of contents: + +## CEF 3 summary ## + * supports html5 audio/video, good performance of webgl and other accelerated content + * uses multi process architecture and [Chromium Content API](http://www.chromium.org/developers/content-module/content-api), thus giving performance and features similar to Chrome + * V8 engine is runing in a separate process so javascript integration can be done only through asynchronous messaging between processes, in CEF 1 you can call javascript and python back synchronously + * single process is for debugging purposes only, it is unstable, it will likely be fixed in the future as Chromium for mobile devices needs a stable single-process mode + +CEF 3 comes with the the latest version of Chrome. + + +For more information on CEF architecture see this wiki page on the Chromium Embedded project: +http://code.google.com/p/chromiumembedded/wiki/Architecture + +## CEF 3 features ported in CEF Python 3 ## + + * [Frame](Frame.md) object + * [Browser](Browser.md) object + * [ApplicationSettings](ApplicationSettings.md) + * [BrowserSettings](BrowserSettings.md) + * [DownloadHandler](DownloadHandler.md) + * [JavascriptBindings](JavascriptBindings.md) + * [JavascriptCallback](JavascriptCallback.md) + * Python callbacks + * [JavascriptContextHandler](JavascriptContextHandler.md) (partially) + * JavascriptDialogHandler + * [RequestHandler](RequestHandler.md) + * [Request](Request.md) object + * [WebPluginInfo](WebPluginInfo.md) + * [Cookie](Cookie.md) + * [CookieManager](CookieManager.md) + * [CookieVisitor](CookieVisitor.md) + * [LoadHandler](LoadHandler.md) + * [RenderHandler](RenderHandler.md) + * [ResourceHandler](ResourceHandler.md) + * [Response](Response.md) object + * [WebRequest](WebRequest.md) and [WebRequestClient](WebRequestClient.md) + * [LifespanHandler](LifespanHandler.md) (partially) + +## CEF 3 features not yet ported to CEF Python 3 ## + + * [context menu handler](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/include/cef_context_menu_handler.h) & [menu model](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/include/cef_menu_model.h) - API is not provided, but context menu is configurable, see ApplicationSettings.`context_menu` + * [dialog handler](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/include/cef_dialog_handler.h) + * [dom manipulation](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/include/cef_dom.h) - won't be implemented as it was deprecated and has memory leaks. The recommended way is to manipulate DOM through javascript and report to python through javascript bindings. + + * [focus handler](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/include/cef_focus_handler.h) + * [geolocation](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/include/cef_geolocation.h) & [geolocation handler](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/include/cef_geolocation_handler.h) + * [origin whitelist](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/include/cef_origin_whitelist.h) + * [proxy handler](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/include/cef_proxy_handler.h) + * [render process handler](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/include/cef_render_process_handler.h) + * [resource bundle handler](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/include/cef_resource_bundle_handler.h) + * [custom scheme](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/include/cef_scheme.h) + * [stream reader & writer](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/include/cef_stream.h) for request response + * [trace notifications](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/include/cef_trace.h) & [trace event](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/include/cef_trace_event.h) + * [web plugin](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/include/cef_web_plugin.h) (WebPluginInfo already implemented) + * [xml reader](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/include/cef_xml_reader.h) + * [zip reader](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/include/cef_zip_reader.h) + +## CEF 1 summary ## + * single process architecture + * more feature complete API than in CEF 3 (as of the moment) + * html5 audio and video support was removed (see [Issue 18](https://code.google.com/p/cefpython/issues/detail?id=18)) + * uses Webkit API + * reduced memory usage and closer integration with the client application + * [reduced performance](http://code.google.com/p/chromiumembedded/issues/detail?id=304) with certain types of accelerated content and [crashes](http://code.google.com/p/chromiumembedded/issues/detail?id=242) due to plugins like Flash running in the same process. + +CEF 1 is currently in maintenance mode and the latest version available includes Chrome 27. + +## Known problems in CEF 1 ## + +Flash plugin will crash on Linux, see [Issue 553 in CEF Issue Tracker](http://code.google.com/p/chromiumembedded/issues/detail?id=553). However, Pepper Flash Player might work in CEF 3 on Linux (not yet tested). + +## CEF 1 features ported to CEF Python 1 ## + + * [Frame](Frame.md) object + * [Browser](Browser.md) object + * [application settings](ApplicationSettings.md) + * [browser settings](BrowserSettings.md) + * [javascript bindings](JavascriptBindings.md) + * [javascript callbacks](JavascriptCallback.md) & python callbacks + * [display handler](DisplayHandler.md) + * [keyboard handler](KeyboardHandler.md) + * [lifespan handler](LifespanHandler.md) (partially) + * [load handler](LoadHandler.md) + * [render handler](RenderHandler.md) + * [request handler](RequestHandler.md) (partially) + * [Response](Response.md) object + * [javascript context handler](JavascriptContextHandler.md) (partially) + * [ContentFilter](ContentFilter.md) for resource response + * [Request](Request.md) object + * [StreamReader](StreamReader.md) for request response + * [WebRequest](WebRequest.md) + * [Cookie](Cookie.md) class + * [CookieManager](CookieManager.md) class + * [CookieVisitor](CookieVisitor.md) callbacks + * [DownloadHandler](DownloadHandler.md) + * [DragHandler](DragHandler.md) + * [DragData](DragData.md) + +## CEF 1 features not yet ported to CEF Python 1 ## + + * [dom manipulation](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef1/include/cef_dom.h) - won't be implemented as it was deprecated and has memory leaks. The recommended way is to manipulate DOM through javascript and report to python through javascript bindings. + * [find handler](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef1/include/cef_find_handler.h) + * [focus handler](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef1/include/cef_focus_handler.h) + * [geolocation](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef1/include/cef_geolocation.h) & [geolocation handler](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef1/include/cef_geolocation_handler.h) + * [jsdialog handler](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef1/include/cef_jsdialog_handler.h) + * [menu handler](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef1/include/cef_menu_handler.h) + * [plugin info](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef1/include/cef_nplugin.h) + * [origin whitelist](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef1/include/cef_origin_whitelist.h) + * [javascript extensions](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef1/include/cef_v8.h?r=972#53) + * [permission handler for extensions](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef1/include/cef_permission_handler.h) + * [print handler](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef1/include/cef_print_handler.h) + * [proxy handler](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef1/include/cef_proxy_handler.h) + * [resource bundle handler](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef1/include/cef_resource_bundle_handler.h) + * [custom scheme](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef1/include/cef_scheme.h) + * [web plugin](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef1/include/cef_web_plugin.h) + * [xml reader](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef1/include/cef_xml_reader.h) + * [zip reader](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef1/include/cef_zip_reader.h) + * [zoom handler](http://code.google.com/p/chromiumembedded/source/browse/trunk/cef1/include/cef_zoom_handler.h) \ No newline at end of file diff --git a/AudioVideo.md b/AudioVideo.md new file mode 100644 index 0000000..a847c6a --- /dev/null +++ b/AudioVideo.md @@ -0,0 +1,54 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/AudioVideo + + +--- + + +# Audio and Video support # + +Table of contents: + +## CEF 3 ## + +CEF 3 supports WebM & Ogg Theora video codecs. MPEG-4 & H.264 +are proprietary codecs and are not included in Chromium builds, +as there are licensing issues: + +> Codecs like MP3 and AAC are included in Google Chrome releases but +> not Chromium builds. This is because these formats are not open and +> require licensing. Distributing these codecs with your application +> without a licensing agreement may violate the law in certain countries. +> You should discuss with a lawyer if appropriate. + +The quote above is from comment #7 in the CEF [Issue 371](https://code.google.com/p/cefpython/issues/detail?id=371):
+"Cannot play proprietary audio or video formats"
+http://code.google.com/p/chromiumembedded/issues/detail?id=371 + +

Audio support

+ +Open http://html5test.com/ in CEF 3 and go to audio section, results as of cefpython3 v0.12:
+
+audio element - Yes
+PCM audio support - Yes
+AAC support - No
+MP3 support - No
+Ogg Vorbis support - Yes
+Ogg Opus support - No
+WebM support - Yes
+ +

Video support

+ +Open http://html5test.com/ in CEF 3 and go to video section, results as of cefpython3 v0.12:
+
+video element - Yes
+Subtitle support - Yes
+Poster image support - Yes
+MPEG-4 support - No
+H.264 support - No
+Ogg Theora support - Yes
+WebM support - Yes
+ + +

CEF 1

+ +Support for audio & video was removed from CEF 1, see Issue 18. \ No newline at end of file diff --git a/Browser.md b/Browser.md new file mode 100644 index 0000000..6d1e0d4 --- /dev/null +++ b/Browser.md @@ -0,0 +1,442 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/Browser + + +--- + + +# `Browser` object # + +Table of contents: + + +## Notes ## + +**Closing browser cleanly** + +Remember to delete all browser references for the browser to shut down cleanly. For an example see [wxpython.py > MainFrame.OnClose()](https://code.google.com/p/cefpython/source/browse/cefpython/cef3/windows/binaries_32bit/wxpython.py?r=27b90c808fb5#213). + +## Methods ## + +### CanGoBack() (bool) ### + +> Returns true if the browser can navigate backwards. + +### CanGoForward() (bool) ### + +> Returns true if the browser can navigate forwards. + +### ClearHistory() (void) ### + +> Available only in CEF 1. + +> Clear the back/forward browsing history. + +### CloseBrowser(bool `forceClose`) (void) ### + +> Closes the browser. If the window was created explicitily by you (not a popup) you still need to post WM\_DESTROY message to the window. + +> Request that the browser close. The Javascript 'onbeforeunload' event will +> be fired. If |force\_close| is false the event handler, if any, will be +> allowed to prompt the user and the user can optionally cancel the close. +> If |force\_close| is true the prompt will not be displayed and the close +> will proceed. Results in a call to LifespanHandler::`DoClose()` if the +> event handler allows the close or if |force\_close| is true. See +> LifespanHandler::`DoClose()` documentation for additional usage +> information. + +### CloseDevTools() (void) ### + +> Available only in cefpython 1. Not yet implemented in cefpython 3. + +> Explicitly close the developer tools window if one exists for this browser instance. + +### ExecuteFunction(string `funcName`, `[`mixed param `[`, mixed `param` `[, ..]]]`) (void) ### + +> Call javascript function asynchronously. This can also call object's methods, just pass "object.method" as `funcName`. Any valid javascript syntax is allowed as `funcName`, you could even pass an anonymous function here. + +> For a list of allowed types for `mixed` see [JavascriptBindings](JavascriptBindings.md).IsValueAllowed() (except function, method and instance). + +> Passing a python function here is not allowed, it is only possible through JavascriptCallback object. + +### ExecuteJavascript(string `jsCode`, string `scriptURL`=None, int `startLine`=None) (void) ### + +> Execute a string of JavaScript code in this frame. The `sciptURL` parameter is the URL where the script in question can be found, if any. The renderer may request this URL to show the developer the source of the error. The `startLine` parameter is the base line number to use for error reporting. + +> This function executes asynchronously so there is no way to get the returned value. + +> Calling javascript from native code synchronously is not possible in CEF 3. It is also not possible doing it synchronously the other way around ie. js->native. + +### Find(int `searchID`, string `searchText`, bool `forward`, bool `matchCase`, bool `findNext`) (void) ### + +> Search for |searchText|. |searchID| can be custom, it is so that you can have multiple searches running simultaneously. |forward| indicates whether to search forward or backward within the page. |matchCase| indicates whether the search should be case-sensitive. |findNext| indicates whether this is the first request or a follow-up. + +### GetClientCallback(string `name`) (func) ### + +> Get client callback by name. + +### GetClientCallbacksDict() (dict) ### + +> Get client callbacks as a dictionary. + +### GetFocusedFrame() (Frame) ### + +> Returns the focused [frame](Frame.md) for the browser window. In CEF 1 this method should only be called on the UI thread. + +### GetFrame(string `name`) (Frame) ### + +> Returns the [frame](Frame.md) with the specified name, or NULL if not found. In CEF 1 this method should only be called on the UI thread. + +### GetFrameByIdentifier(long identifier) (Frame) ### + +> Available only in CEF 3. Returns the [frame](Frame.md) with the specified identifier, or None if not found. + +### GetFrames() (list) ### + +> Get all frames. This is an internal CEF Python implementation that uses `GetFrameNames()` and `GetFrame()` methods to list through all frames. The main frame is not included in that list. + +### GetFrameCount() (int) ### + +> Available only in CEF 3. Not yet implemented. + +> Returns the number of frames that currently exist. + +### GetFrameIdentifiers() (void) ### + +> Available only in CEF 3. Not yet implemented. + +> Returns the identifiers of all existing frames. + +### GetFrameNames() (string`[]`) ### + +> Returns the names of all existing frames. This list does not include the main frame. In CEF 1 this method should only be called on the UI thread. + +### GetImage(`PaintElementType` `type`, int `width`, int `height`) (`PaintBuffer`) ### + +> Available only in cefpython 1. Not yet implemented in CEF 3. Not supported on Linux. + +> Get the raw image data contained in the specified element without performing validation. The specified |width| and |height| dimensions must match the current element size. On Windows |buffer| must be width\*height\*4 bytes in size and represents a BGRA image with an upper-left origin. This method should only be called on the UI thread. + +> Returns [PaintBuffer](PaintBuffer.md) object. + +### GetJavascriptBindings() (`JavascriptBindings`) ### + +> Returns the [JavascriptBindings](JavascriptBindings.md) object that was passed to [cefpython](cefpython.md).`CreateBrowserSync()`. + +### GetMainFrame() (Frame) ### + +> Returns the main (top-level) [frame](Frame.md) for the browser window. + +### GetNSTextInputContext() (`TextInputContext`) ### + +> Not yet ported. Available only in CEF 3. + +> Get the NSTextInputContext implementation for enabling IME on Mac when +> window rendering is disabled. + +### GetOpenerWindowHandle() (windowHandle) ### + +> Retrieve the CEF-internal (inner or outer) window handle of the browser that opened this browser. Will return None for non-popup windows. See `GetWindowHandle()` for an explanation of inner/outer window handles. + +### GetOuterWindowHandle() (windowHandle) ### + +> Get the most outer window handle. + +### GetSize(int `paintElementType`) (tuple) ### + +> Available only in CEF 1. This method is not available in CEF 3. + +> Get the size of the specified element. This method should only be called on the UI thread. + +> `paintElementType` is one of: + +> cefpython.`PET_VIEW`
+
cefpython.PET_POPUP
+ +
Returns tuple(width, height) or tuple(0, 0) if failed.
+ +

GetUrl() (string)

+ +
Get url of the main frame.
+ +

GetUserData(mixed key) (mixed)

+ +
Get user data. See also SetUserData().
+ +

GetWindowHandle() (windowHandle)

+ +
Returns an inner or outer window handle for the browser. If the browser was created using CreateBrowserSync() then this will return an inner CEF-internal window handle. If this is a popup browser created from javascript using window.open() and its WindowInfo has not been set in LifespanHandler.OnAfterCreated(), then it returns CEF-internal window handle which is the most outer window handle in this case.
+ +

GetIdentifier() (int)

+ +
Returns the globally unique identifier for this browser.
+ +

GetZoomLevel() (float)

+ +
Get the current zoom level. The default zoom level is 0.0. In CEF 1 this method may only be called on the UI thread.
+ +

GoBack() (void)

+ +
Navigate backwards.
+ +

GoForward() (void)

+ +
Navigate forwards.
+ +

HandleKeyEventAfterTextInputClient(eventHandle keyEvent) (void)

+ +
Available only in CEF 3. Not yet implemented.
+ +
Performs any additional actions after NSTextInputClient handles the event.
+ +

HandleKeyEventBeforeTextInputClient() (void)

+ +
Available only in CEF 3. Not yet implemented.
+ +
Handles a keyDown event prior to passing it through the NSTextInputClient
+machinery.
+ +

HasDocument() (bool)

+ +
Returns true if a document has been loaded in the browser.
+ +

HidePopup() (void)

+ +
Available only in CEF 1.
+ +
Hide the currently visible popup, if any.
+ +

Invalidate(list dirtyRect) (void)

+ +
Available only in cefpython 1. Not yet implemented in cefpython 3.
+ +
Invalidate the |dirtyRect| region of the view. This method is only used when window rendering is disabled and will result in a call to HandlePaint().
+ +
dirtyRect is a list: [x, y, width, height].
+ +

IsFullscreen() (void)

+ +
Whether in fullscreen mode, see ToggleFullscreen().
+ +
This function is Windows-only.
+ +

IsLoading() (bool)

+ +
Available only in CEF 3. Not yet implemented.
+ +
Returns true if the browser is currently loading.
+ +

IsMouseCursorChangeDisabled() (bool)

+ +
Available only in CEF 3.
+ +
Returns true if mouse cursor change is disabled.
+ +

IsPopup() (bool)

+ +
Returns true if the window is a popup window.
+ +

IsPopupVisible() (bool)

+ +
Available only in CEF 1.
+ +
Returns true if a popup is currently visible. In CEF 1 this method should only be called on the UI thread.
+ +

IsWindowRenderingDisabled() (bool)

+ +
Returns true if window rendering is disabled.
+ +

LoadUrl(string url) (void)

+ +
Load url in the main frame.
+ +

Navigate(string url) (void)

+ +
This is an alias for the LoadUrl method.
+ +

NotifyScreenInfoChanged() (void)

+ +
Available only in CEF 3.
+ +
Send a notification to the browser that the screen info has changed. The
+browser will then call RenderHandler.GetScreenInfo() to update the
+screen information with the new values. This simulates moving the webview
+window from one display to another, or changing the properties of the
+current display. This method is only used when window rendering is
+disabled.
+ +

ParentWindowWillClose() (void)

+ +
Call this method before destroying a contained browser window. This method
+performs any internal cleanup that may be needed before the browser window
+is destroyed. See LifespanHandler::DoClose() documentation for
+additional usage information.
+ +

Reload() (void)

+ +
Reload the current page.
+ +

ReloadIgnoreCache() (void)

+ +
Reload the current page ignoring any cached data.
+ +

SendKeyEvent(int keyType, tuple keyInfo, int modifiers) (void)

+ +
These arguments and description apply for CEF 1 only. In CEF 3 this
+function has a different number of arguments, see the next function
+listed on this wiki page.
+ +
Sending keyboard input using this function is not trivial, it is
+recommended to use one of SendKeys libraries available on Windows:
+ + + +
Send a key event to the browser.
+ +
keyType may be one of:
+ +
cefpython.KEYTYPE_KEYUP
+cefpython.KEYTYPE_KEYDOWN
+cefpython.KEYTYPE_CHAR
+ +
keyInfo on Windows is a tuple(int key, BOOL sysChar, BOOL imeChar).
+ +
keyInfo on Mac is a tuple(int keyCode, int character, int characterNoModifiers).
+ +
keyInfo on Linux is a tuple(int key).
+ +
key in keyInfo is a VirtualKey.
+ +
modifiers parameter is a VirtualKey.
+ +

SendKeyEvent(KeyEvent event) (void)

+ +
These arguments and description apply for CEF 3 only. In CEF 1 this
+function has a different number of arguments, see the previous
+function listed on this wiki page.
+ +
KeyEvent is a dictionary, see KeyboardHandler.OnPreKeyEvent() +for a description of the available keys.
+ +

SendMouseClickEvent(int x, int y, int mouseButtonType, bool mouseUp, int clickCount) (void)

+ +
Send a mouse click event to the browser. The |x| and |y| coordinates are relative to the upper-left corner of the view.
+ +
mouseButtonType may be one of:
+ +
cefpython.MOUSEBUTTON_LEFT
+cefpython.MOUSEBUTTON_MIDDLE
+cefpython.MOUSEBUTTON_RIGHT
+ +
TODO: allow to pass modifiers which represents bit flags
+describing any pressed modifier keys. Modifiers can also
+be passed to SendMouseMoveEvent(), SendMouseWheelEvent().
+See cef_event_flags_t enum for modifiers values:
+ +
    enum cef_event_flags_t {
+ EVENTFLAG_NONE = 0,
+ EVENTFLAG_CAPS_LOCK_ON = 1 << 0,
+ EVENTFLAG_SHIFT_DOWN = 1 << 1,
+ EVENTFLAG_CONTROL_DOWN = 1 << 2,
+ EVENTFLAG_ALT_DOWN = 1 << 3,
+ EVENTFLAG_LEFT_MOUSE_BUTTON = 1 << 4,
+ EVENTFLAG_MIDDLE_MOUSE_BUTTON = 1 << 5,
+ EVENTFLAG_RIGHT_MOUSE_BUTTON = 1 << 6,
+ // Mac OS-X command key.
+ EVENTFLAG_COMMAND_DOWN = 1 << 7,
+ EVENTFLAG_NUM_LOCK_ON = 1 << 8,
+ EVENTFLAG_IS_KEY_PAD = 1 << 9,
+ EVENTFLAG_IS_LEFT = 1 << 10,
+ EVENTFLAG_IS_RIGHT = 1 << 11,
+
+ +

SendMouseMoveEvent(int x, int y, bool mouseLeave) (void)

+ +
Send a mouse move event to the browser. The |x| and |y| coordinates are relative to the upper-left corner of the view.
+ +

SendMouseWheelEvent(int x, int y, int deltaX, int deltaY) (void)

+ +
Send a mouse wheel event to the browser. The |x| and |y| coordinates are relative to the upper-left corner of the view. The |deltaX| and |deltaY| values represent the movement delta in the X and Y directions respectively. In order to scroll inside select popups with window rendering disabled RenderHandler.GetScreenPoint() should be implemented properly.
+ +

SendFocusEvent(bool setFocus) (void)

+ +
Send a focus event to the browser.
+ +

SendCaptureLostEvent() (void)

+ +
Send a capture lost event to the browser.
+ +

SetClientCallback(string name, function callback) (void)

+ +
Set client callback.
+ +

SetClientHandler(object clientHandler) (void)

+ +
Set client handler object (class instance), its members will be inspected. Private methods that are not meant to be callbacks should have their names prepended with an underscore.
+ +

SetFocus(bool enable) (void)

+ +
Set focus for the browser window. If |enable| is true focus will be set to the window. Otherwise, focus will be removed.
+ +

SetMouseCursorChangeDisabled(bool disabled) (void)

+ +
Available only in CEF 3.
+ +
Set whether mouse cursor change is disabled.
+ +

SetSize(int paintElementType, int width, int height) (void)

+ +
Available only in cefpython 1. Not yet implemented in cefpython 3.
+ +
Set the size of the specified element. This method is only used when window rendering is disabled (off-screen browser). This function is asynchronous, after a call to SetSize() the RenderHandler.OnPaint() event might still have the old size, you would have to ignore it and wait for the next one RenderHandler.OnPaint() event.
+ +
See GetSize() for possible values of paintElementType.
+ +

SetUserData(mixedkey, mixed value) (void)

+ +
Set user data. Use this function to keep data associated with this browser. See also GetUserData().
+ +

SetZoomLevel(float zoomLevel) (void)

+ +
Change the zoom level to the specified value. Specify 0.0 to reset the zoom level. If called on the UI thread the change will be applied immediately. Otherwise, the change will be applied asynchronously on the UI thread.
+ +

ShowDevTools() (void)

+ +
Open developer tools in a popup window.
+ +

StartDownload(string url) (void)

+ +
Available only in CEF 3.
+ +
Download the file at |url| using DownloadHandler.
+ +

StopLoad() (void)

+ +
Stop loading the page.
+ +

StopFinding(bool clearSelection) (void)

+ +
Cancel all searches that are currently going on.
+ +

ToggleFullscreen() (bool)

+ +
Switch between fullscreen mode / windowed mode. To check whether in fullscreen mode call IsFullscreen().
+ +
This function is Windows-only.
+ +

WasResized() (void)

+ +
Notify the browser that the widget has been resized. The browser will
+first call RenderHandler::GetViewRect to get the new size and then
+call RenderHandler::OnPaint asynchronously with the updated regions.
+This method is only used when window rendering is disabled.
+ +

WasHidden(bool hidden) (void)

+ +
Available only in CEF 3.
+ +
Notify the browser that it has been hidden or shown. Layouting and
+RenderHandler::OnPaint notification will stop when the browser is
+hidden. This method is only used when window rendering is disabled. \ No newline at end of file diff --git a/BrowserSettings.md b/BrowserSettings.md new file mode 100644 index 0000000..ae5d346 --- /dev/null +++ b/BrowserSettings.md @@ -0,0 +1,258 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/BrowserSettings + + +--- + + +# Browser settings # + + + +## Introduction ## + +These settings can be passed to [cefpython](cefpython.md).`CreateBrowser()`. + +In some cases, the default values of settings that are suggested by its name may not always be correct. This is because in one of CEF releases naming of these settings changed, and they started to accept states (enabled or disabled), instead of the state being included in its name (some\_option\_disabled). Cefpython tries to be backwards compatible, that's why the old naming convention is still used. Read description of setting and if you see that it mentions command line switch that starts with "disable-", it means that its default state is "enabled". If the command line switch starts with "enable-" then its default state is "disabled". + +## Settings ## + +### accelerated\_compositing\_disabled (bool) ### + +> Available only in CEF 3. + +> Controls whether content that depends on accelerated compositing can be +> used. Note that accelerated compositing requires hardware support and may +> not work on all systems even when enabled. Also configurable using the +> "disable-accelerated-compositing" [command-line switch](CommandLineSwitches.md). + +### accelerated\_compositing\_enabled (bool) ### + +> Available only in CEF 1. + +> 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. + +### accelerated\_layers\_disabled (bool) ### + +> Available only in CEF 1. Set to True to disable accelerated layers. This affects features like 3D CSS transforms. + +### accelerated\_video\_disabled (bool) ### + +> Available only in CEF 1. Set to True to disable accelerated video. + +### accelerated\_2d\_canvas\_disabled (bool) ### + +> Available only in CEF 1. Set to True to disable accelerated 2d canvas. + +### accelerated\_filters\_disabled (bool) ### + +> Available only in CEF 1. Set to True to disable accelerated filters. + +### accelerated\_plugins\_disabled (bool) ### + +> Available only in CEF 1. Set to True to disable accelerated plugins. + +### animation\_frame\_rate (int) ### + +> Available only in CEF 1. The number of frames per second (fps) for animation and windowless rendering. When window rendering is enabled and the JavaScript requestAnimationFrame method is used the browser client area will be invalidated at the rate specified. When window rendering is disabled the CefRenderHandler::OnPaint() method will be called at the rate specified. This value must be between 0 and 90. Specify a value of zero for the default frame rate of 30 fps. Changing this value may affect display performance and/or CPU usage. + +### application\_cache\_disabled (bool) ### + +> Controls whether the application cache can be used. Also configurable using +> the "disable-application-cache" [command-line switch](CommandLineSwitches.md). + +### author\_and\_user\_styles\_disabled (bool) ### + +> Controls whether style sheets can be used. Also configurable using the +> "disable-author-and-user-styles" [command-line switch](CommandLineSwitches.md). + +> This setting was removed in Chrome 33. Soon it will be removed from cefpython as well. + +### caret\_browsing\_enabled (bool) ### + +> Controls whether the caret position will be drawn. Also configurable using +> the "enable-caret-browsing" [command-line switch](CommandLineSwitches.md). + +### databases\_disabled (bool) ### + +> Controls whether databases can be used. Also configurable using the +> "disable-databases" [command-line switch](CommandLineSwitches.md). + +### default\_encoding (string) ### + +> Default encoding for Web content. If empty "ISO-8859-1" will be used. Also +> configurable using the "default-encoding" [command-line switch](CommandLineSwitches.md). + +### developer\_tools\_disabled (bool) ### + +> Available only in CEF 1. + +> Controls whether developer tools (WebKit inspector) can be used. Also +> configurable using the "disable-developer-tools" command-line switch. + +### dom\_paste\_disabled (bool) ### + +> Controls whether DOM pasting is supported in the editor via +> execCommand("paste"). The |javascript\_access\_clipboard\_disallowed| setting must also +> be set (to true or false). Also configurable using the "disable-javascript-dom-paste" +> [command-line switch](CommandLineSwitches.md). + +### drag\_drop\_disabled (bool) ### + +> Available only in CEF 1. Disable drag & drop of URLs from other windows. + +### encoding\_detector\_enabled (bool) ### + +> Available only in CEF 1. Set to True to attempt automatic detection of content encoding + +### file\_access\_from\_file\_urls\_allowed (bool) ### + +> Controls whether file URLs will have access to other file URLs. Also +> configurable using the "allow-access-from-files" [command-line switch](CommandLineSwitches.md). + +> This option seems to be missing in the latest Chromium. New flags are: --allow-file-access and --allow-file-access-from-files. + +### fullscreen\_enabled (bool) ### + +> Available only in CEF 1. Set to True to enable fullscreen mode. To go fullscreen call [Browser](Browser.md).ToggleFullscreen(). + +### history\_disabled (bool) ### + +> Available only in CEF 1. Disable history back/forward navigation. + +### hyperlink\_auditing\_disabled (bool) ### + +> Available only in CEF 1. Set to True to disable hyperlink pings ( and window.sendPing). + +### image\_load\_disabled (bool) ### + +> Controls whether image URLs will be loaded from the network. A cached image +> will still be rendered if requested. Also configurable using the +> "disable-image-loading" [command-line switch](CommandLineSwitches.md). + +### javascript\_disabled (bool) ### + +> Controls whether Javascript can be executed. Also configurable using the +> "disable-javascript" [command-line switch](CommandLineSwitches.md). + +### javascript\_open\_windows\_disallowed (bool) ### + +> Controls whether Javascript can be used for opening windows. Also +> configurable using the "disable-javascript-open-windows" [command-line switch](CommandLineSwitches.md). + +### javascript\_close\_windows\_disallowed (bool) ### + +> Controls whether Javascript can be used to close windows that were not +> opened via Javascript. Javascript can still be used to close windows that +> were opened via Javascript. Also configurable using the +> "disable-javascript-close-windows" [command-line switch](CommandLineSwitches.md). + +### javascript\_access\_clipboard\_disallowed (bool) ### + +> Controls whether Javascript can access the clipboard. Also configurable +> using the "disable-javascript-access-clipboard" [command-line switch](CommandLineSwitches.md). + +### java\_disabled (bool) ### + +> Controls whether the Java plugin will be loaded. Also configurable using +> the "disable-java" [command-line switch](CommandLineSwitches.md). + +### load\_drops\_disabled (bool) ### + +> Available only in CEF 1. Disable default navigation resulting from drag & drop of URLs. + +### local\_storage\_disabled (bool) ### + +> Controls whether local storage can be used. Also configurable using the +> "disable-local-storage" [command-line switch](CommandLineSwitches.md). + +### page\_cache\_disabled (bool) ### + +> Available only in CEF 1. + +> Controls whether the fastback (back/forward) page cache will be used. Also configurable using the "enable-fastback" command-line switch. + +### plugins\_disabled (bool) ### + +> Controls whether any plugins will be loaded. Also configurable using the +> "disable-plugins" [command-line switch](CommandLineSwitches.md). + +### remote\_fonts (bool) ### + +> Available only in CEF 3. + +> Controls the loading of fonts from remote sources. Also configurable using +> the "disable-remote-fonts" [command-line switch](CommandLineSwitches.md). + +### remote\_fonts\_disabled (bool) ### + +> Available only in CEF 1. Set to True to disable loading of fonts from remote sources. + +### shrink\_standalone\_images\_to\_fit (bool) ### + +> Controls whether standalone images will be shrunk to fit the page. Also +> configurable using the "image-shrink-standalone-to-fit" [command-line switch](CommandLineSwitches.md). + +### site\_specific\_quirks\_disabled (bool) ### + +> Available only in CEF 1. Set to True to disable browser backwards compatibility features. + +### tab\_to\_links\_disabled (bool) ### + +> Controls whether the tab key can advance focus to links. Also configurable +> using the "disable-tab-to-links" [command-line switch](CommandLineSwitches.md). + +### text\_area\_resize\_disabled (bool) ### + +> Controls whether text areas can be resized. Also configurable using the +> "disable-text-area-resize" [command-line switch](CommandLineSwitches.md). + +### universal\_access\_from\_file\_urls\_allowed (bool) ### + +> Controls whether file URLs will have access to all URLs. Also configurable +> using the "allow-universal-access-from-files" [command-line switch](CommandLineSwitches.md). + +> This option seems to be missing in the latest Chromium. New flags are: --allow-file-access and --allow-file-access-from-files. + +### user\_style\_sheet\_enabled (bool) ### + +> Available only in CEF 1. Set to True to enable the user style sheet for all pages. + +### user\_style\_sheet\_location (string) ### + +> Location of the user style sheet that will be used for all pages. This must +> be a data URL of the form "data:text/css;charset=utf-8;base64,csscontent" +> where "csscontent" is the base64 encoded contents of the CSS file. Also +> configurable using the "user-style-sheet-location" command-line switch. + +> This setting was removed in Chrome 33. Soon it will be removed from cefpython as well. + +### web\_security\_disabled (bool) ### + +> Controls whether web security restrictions (same-origin policy) will be +> enforced. Disabling this setting is not recommend as it will allow risky +> security behavior such as cross-site scripting (XSS). Also configurable +> using the "disable-web-security" [command-line switch](CommandLineSwitches.md). + +### webgl\_disabled (bool) ### + +> Controls whether WebGL can be used. Note that WebGL requires hardware +> support and may not work on all systems even when enabled. Also +> configurable using the "disable-webgl" [command-line switch](CommandLineSwitches.md). + +### xss\_auditor\_enabled (bool) ### + +> Available only in CEF 1. Set to True to enable console warnings about XSS attempts. + + +## Font settings ## + +### standard\_font\_family (string) ### +### fixed\_font\_family (string) ### +### serif\_font\_family (string) ### +### sans\_serif\_font\_family (string) ### +### cursive\_font\_family (string) ### +### fantasy\_font\_family (string) ### +### default\_font\_size (int) ### +### default\_fixed\_font\_size (int) ### +### minimum\_font\_size (int) ### +### minimum\_logical\_font\_size (int) ### \ No newline at end of file diff --git a/BuildOnLinux.md b/BuildOnLinux.md new file mode 100644 index 0000000..4a39e0b --- /dev/null +++ b/BuildOnLinux.md @@ -0,0 +1,423 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/BuildOnLinux + + +--- + + +# Build instructions for Linux # + +The original instructions on building Chromium/CEF can be found on the CEF project [Branches and Building](https://code.google.com/p/chromiumembedded/wiki/BranchesAndBuilding) wiki page. + +Table of contents: + + +## Preliminary notes ## + + * These instructions were tested on Ubuntu 12.04 and Python 2.7. Python 3.4 is not yet supported ([Issue 121](https://code.google.com/p/cefpython/issues/detail?id=121)) + * The path to chromium directory should not contain any spaces + * If building on Fedora see this comment: https://code.google.com/p/cefpython/issues/detail?id=72#c4 + +## Using precompiled binaries from cefbuilds.com ## + +You can use precompiled binaries from [cefbuilds.com](http://cefbuilds.com/), so that it is not required to compile Chromium/CEF from sources. However this comes with some limitations, as such binaries won't have applied patches provided in the instructions on this page. There are several patches applied when building Chromium/CEF from sources: + * wxpython patch - without this patch you won't be able to run the wxpython examples. However you should be just fine running the `pygtk_.py` example. Not sure about the pyqt/pyside examples, these would need to be tested. + * tcmalloc patch - when this patch is not applied, the cefpython library must be imported the very first in application before any other libraries ([Issue 73](https://code.google.com/p/cefpython/issues/detail?id=73)) + * https caching certificate errors patch - https caching on sites with certificate errors won't be enabled + +CEF branch and revision from cefbuilds.com must match the ones provided in the [BUILD\_COMPATIBILITY.txt](https://code.google.com/p/cefpython/source/browse/cefpython/cef3/BUILD_COMPATIBILITY.txthttps://code.google.com/p/cefpython/source/browse/cefpython/cef3/BUILD_COMPATIBILITY.txt) file. For example in a file named "CEF3.1650.1639", the 1650 number is a branch and the 1639 number is a revision. See also the VersionNumbering wiki page for more details. + +When using precompiled binaries you can ignore steps on this page that refer to building Chromium/CEF that do not apply. + +## Install the necessary tools ## + +1. Make sure you have an up to date version of GIT. As of this writing syncing chromium works fine with GIT 1.7.9.5. + +``` +sudo apt-get install git +git --version +``` + +2. Install depot tools to your chromium directory (includes gclient tool that we'll be using later). + +``` +mkdir ~/chromium/ +cd ~/chromium/ +git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git +``` + +3. Add depot tools to your path for the current terminal session: + +``` +export PATH="$PATH":`pwd`/depot_tools +``` + +4. Check SVN version, it should be 1.6.x, otherwise you will get into troubles. You can install it using "`sudo apt-get install subversion`" command. + +``` +svn --version +``` + +5. Make sure you are running an up to date version of G++, as of this writing compiling works fine with G++ 4.6.3. Install it using "`sudo apt-get install g++`" command. + +``` +g++ --version +``` + +## Configure Chromium to use a specific revision ## + +1. Go open the BUILD\_COMPATIBILITY.txt file. + +For CEF 1: https://code.google.com/p/cefpython/source/browse/cefpython/cef1/BUILD_COMPATIBILITY.txt + +For CEF 3: https://code.google.com/p/cefpython/source/browse/cefpython/cef3/BUILD_COMPATIBILITY.txt + +Later we will need the "Chromium release url" and and the "CEF repository url" so keep it in sight. + +2. Configure Chromium to use a specific revision (through a release url) by running the "gclient config" command, the release url we will be using is from the BUILD\_COMPATIBILITY.txt file: + +``` +cd ~/chromium/ +gclient config {Chromium release url} +``` + +3. Edit the "~/chromium/.gclient" file and modify the "custom\_deps" to reduce the size of the sources to downoad: + +``` + "custom_deps": { + "src/content/test/data/layout_tests/LayoutTests": None, + "src/chrome/tools/test/reference_build/chrome_win": None, + "src/chrome_frame/tools/test/reference_build/chrome_win": None, + "src/chrome/tools/test/reference_build/chrome_linux": None, + "src/chrome/tools/test/reference_build/chrome_mac": None, + "src/third_party/hunspell_dictionaries": None, + }, +``` + +This excludes some directories that contain lots of data (many many gigabytes) that would extend the time significantly when synchronizing Chromium sources with the revision we've selected. + +## Download the Chromium sources ## + +Download the Chromium sources by running the "gclient sync" command. The Chromium sources will be updated to the revision based on the release url we've configured earlier via "gclient config". Read also the "Possible issues" section below in case you encounter errors. + +``` +cd ~/chromium/ +gclient sync --jobs 8 --force +``` + +This can take a while and sometimes it can break with some errors when a download fails. In such case you should run the "gclient sync" command once again. One of the last messages in the console should be: + +``` +Updating projects from gyp files... +``` + +#### Possible issues while running "gclient sync" #### + + * You may encounter an error while checking out the gsutil repo, fix it [by removing gsutil entries from the DEPS file](http://src.chromium.org/viewvc/chrome/releases/33.0.1750.29/DEPS?r1=245305&r2=245304&pathrev=245305). + + * If gclient sync fails with error message saying that "gmodule-2.0" / "gtk+-2.0" / "gthread-2.0" packages are missing, then you will have to run the "install-build-deps.sh" script to install the dependencies. See the next section for details on how to do that. After it's done, run the "gclient sync" command **once again**. + +## Install Chromium build dependencies ## + +1. Install build dependencies by running this script, it might ask you for the root password during installation of libraries, so you might as well run it via "sudo". + + * When it asks for the debug symbols answer "No" + * IMPORTANT: When the "ttf-mscorefonts-installer" graphical installer pops up, click `` when it displays the License file, but later **click `` when it asks to accept the EULA license terms**. If you install these fonts your font experience on websites might deteriorate in Chrome/Firefox/other browsers, as it affects not only CEF (font issues observed on Ubuntu 12.04 32bit). + +``` +cd ~/chromium/src/build/ +sudo ./install-build-deps.sh --no-chromeos-fonts +``` + +If you see the "Installation complete" or "Skipping installation of Chrome OS fonts" messages at the end then everything went well. + +2. Install also the libgtkglext1-dev package that is a dependency of the CEF off-screen rendering. + +``` +sudo apt-get update +sudo apt-get install libgtkglext1-dev +``` + +## Download the CEF sources ## + +Download the CEF sources, the repository url can be found in the BUILD\_COMPATIBILITY.txt file that was mentioned earlier. + +``` +cd ~/chromium/src/ +svn checkout {CEF repository url} cef +``` + +This will download the CEF sources to the "cef" directory. + +## Download the CEF Python sources ## + +Run the "git clone" command for the CEF Python repository. The command below will create "`~/cefpython/`" directory. + +``` +cd ~/ +git clone https://code.google.com/p/cefpython/ +``` + +## Fix the CEF GTK implementation ## + +There are a few problems with the current CEF GTK implementation. There is a bug causing the embedded CEF window to be initially hidden. Another issue is that CEF requires the container to be of type BOX (eg. GtkVBox). In wxPython apps there is even an another issue, each wx control is embraced with a `GtkPizza` window and this needs to be fixed as well. + +Apply the patch in the `"~/chromium/src/cef/`" directory. Modifications are made to the `CefBrowserHostImpl::PlatformCreateWindow` function. + +``` +Index: libcef/browser/browser_host_impl_gtk.cc +=================================================================== +--- browser_host_impl_gtk.cc (revision 1639) ++++ browser_host_impl_gtk.cc (working copy) +@@ -273,8 +273,43 @@ + + // Parent the TabContents to the browser window. + window_info_.widget = web_contents_->GetView()->GetNativeView(); +- gtk_container_add(GTK_CONTAINER(window_info_.parent_widget), +- window_info_.widget); ++ if (GTK_IS_BOX(window_info_.parent_widget)) { ++ gtk_box_pack_start(GTK_BOX(window_info_.parent_widget), ++ window_info_.widget, TRUE, TRUE, 0); ++ } else { ++ // Parent view shouldn't contain any children, but in wxWidgets library ++ // there will be GtkPizza widget for Panel or any other control. ++ GList *children, *iter; ++ children = gtk_container_get_children(GTK_CONTAINER( ++ window_info_.parent_widget)); ++ GtkWidget* child = NULL; ++ GtkWidget* vbox = gtk_vbox_new(FALSE, 0); ++ for (iter = children; iter != NULL; iter = g_list_next(iter)) { ++ child = GTK_WIDGET(iter->data); ++ // We will have to keep a reference to that child that we remove, ++ // otherwise we will get lots of warnings like "invalid unclassed ++ // pointer in cast to `GtkPizza'". First we increase a reference, ++ // we need to do this for a moment before we add this child to the ++ // vbox, then we will decrease that reference. ++ g_object_ref(G_OBJECT(child)); ++ gtk_container_remove(GTK_CONTAINER(window_info_.parent_widget), child); ++ } ++ g_list_free(children); ++ gtk_box_pack_start(GTK_BOX(vbox), window_info_.widget, TRUE, TRUE, 0); ++ if (child != NULL) { ++ // This child is packed to the box only so that its reference lives, ++ // as it might be referenced from other code thus resulting in errors. ++ gtk_box_pack_end(GTK_BOX(vbox), child, FALSE, FALSE, 0); ++ gtk_widget_hide(GTK_WIDGET(child)); ++ g_object_unref(G_OBJECT(child)); ++ } ++ gtk_widget_show(GTK_WIDGET(vbox)); ++ if (GTK_IS_SCROLLED_WINDOW(window_info_.parent_widget)) ++ gtk_scrolled_window_add_with_viewport( ++ GTK_SCROLLED_WINDOW(window_info_.parent_widget), vbox); ++ else ++ gtk_container_add(GTK_CONTAINER(window_info_.parent_widget), vbox); ++ } + + g_signal_connect(G_OBJECT(window_info_.widget), "destroy", + G_CALLBACK(browser_destroy), this); +@@ -293,6 +328,8 @@ + prefs->inactive_selection_bg_color = SkColorSetRGB(200, 200, 200); + prefs->inactive_selection_fg_color = SkColorSetRGB(50, 50, 50); + ++ gtk_widget_show_all(GTK_WIDGET(window_info_.widget)); ++ + return true; + } +``` + +### wxPython auto-focus issue ### + +In wxPython apps, this patch will remove the `GtkPizza` element, and it may cause issues with setting focus on a wx control that embeds the cef browser. However, if you click with a mouse inside the browser window, focus will work fine. It is the automatic focus that will be missing. This could probably be fixed by making a native OS call to focus the window. Although, this would require another dependency, for example this could be accomplished using the `pygtk` package. Another solution would be for cefpython to expose the GTK window focus function to WindowUtils, there are already a few GTK API functions exposed that are used by the pyqt example. + +## Fix HTTPS caching on sites with SSL certificate errors (optional) ## + +This is an optional fix. By default Chromium disables caching when there is certificate error. This patch will fix the HTTPS caching only when [ApplicationSettings](ApplicationSettings.md).ignore\_certificate\_errors is set to True. Official cefpython binaries have this fix applied, starting with the 31.0 release. See also [Issue 125](https://code.google.com/p/cefpython/issues/detail?id=125). + +Apply the patch in the "`~/chromium/src/`" directory. Modifications are made in the `HttpCache::Transaction::WriteResponseInfoToEntry` function. + +``` +Index: net/http/http_cache_transaction.cc +=================================================================== +--- http_cache_transaction.cc (revision 241641) ++++ http_cache_transaction.cc (working copy) +@@ -2240,7 +2240,8 @@ + // reverse-map the cert status to a net error and replay the net error. + if ((cache_->mode() != RECORD && + response_.headers->HasHeaderValue("cache-control", "no-store")) || +- net::IsCertStatusError(response_.ssl_info.cert_status)) { ++ (!cache_->GetSession()->params().ignore_certificate_errors && ++ net::IsCertStatusError(response_.ssl_info.cert_status))) { + DoneWritingToEntry(false); + ReportCacheActionFinish(); + if (net_log_.IsLoggingAllEvents()) +``` + +## Disable the tcmalloc memory allocation global hook (optional, but recommended) ## + +If tcmalloc hook is enabled it will cause troubles when CEF is not the very first library being imported in python scripts. In result of which you could be getting random unrelated segmentation faults all over app. See [Issue 73](https://code.google.com/p/cefpython/issues/detail?id=73) for more details. + +Official cefpython binaries have this fix applied, starting with the 31.0 release. + +To disable tcmalloc: + +1. Create the `~/.gyp/` directory and the `~/.gyp/include.gypi` file. Next edit the file and paste the following contents: + +``` +{ + 'variables': { + 'linux_use_tcmalloc': 0, + 'use_allocator': 'none', + }, +} +``` + +2. Remove the allocator dependency in the "chromium/src/cef/cef.gyp" file. Find the lines below and remove the line containing "`allocator.gyp`". There are two such lines present in this file (for win and linux), you may as well remove both of them. + +``` +[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', { + 'dependencies':[ + '<(DEPTH)/base/allocator/allocator.gyp:allocator', +``` + +## Build CEF binaries and libraries ## + +1. Generate the build files based on the GYP configuration by running the "cef\_create\_projects.sh" script. + +``` +cd ~/chromium/src/cef/ +./cef_create_projects.sh +``` + +The last message should inform about the `~/.gyp/include.gypi` being used (if you decided to disable tcmalloc hook): + +``` +Using overrides found in /home/czarek/.gyp/include.gypi +``` + +2. Build the release version of cefclient. + +``` +cd ~/chromium/src/ +make -j4 BUILDTYPE=Release cefclient +``` + +3. Create the cefclient distribution package. + +``` +cd ~/chromium/src/cef/tools/ +./make_distrib.sh --allow-partial +``` + +4. Go to the `"cef_binary_*/"` directory and build the libcef\_dll\_wrapper project and cefclient projects. + +``` +cd ~/chromium/src/cef/binary_distrib/cef_binary_* +make -j4 BUILDTYPE=Release libcef_dll_wrapper +make -j4 BUILDTYPE=Release cefclient +``` + +The succession of building the projects is important. The libcef\_dll\_wrapper project needs to be build first, before cefclient. Otherwise you will get an error message saying "make: Nothing to be done for libcef\_dll\_wrapper". + +The libcef\_dll\_wrapper project builds a static library for the C++ API of CEF. + +5. Copy the libcef\_dll\_wrapper static library to the cefpython `"lib_64bit"` directory (or 32bit). If the directory doesn't exist create one. You have to copy both the `"libcef_dll_wrapper.a"` file and the `"libcef_dll_wrapper/"` directory containing the ".o" files. + +``` +mkdir ~/cefpython/cefpython/cef3/linux/setup/lib_64bit/ +cd ~/chromium/src/cef/binary_distrib/cef_binary_*/out/Release/obj.target/ +cp -r libcef_dll_wrapper libcef_dll_wrapper.a ~/cefpython/cefpython/cef3/linux/setup/lib_64bit/ +``` + +If you've been building project previously, then remove the contents of the `"lib_64bit"` directory (or 32bit). + +6. Copy the CEF binaries to the cefpython `"binaries_64bit/"` directory (or 32bit), including the README.txt which includes some useful information about required/optional binary files and version of CEF. + +``` +cd ~/chromium/src/cef/binary_distrib/cef_binary_*/out/Release/ +cp -r locales/ files/ cefclient *.pak *.so ~/cefpython/cefpython/cef3/linux/binaries_64bit/ +cp ~/chromium/src/cef/binary_distrib/cef_binary_*/README.txt ~/cefpython/cefpython/cef3/linux/binaries_64bit/ +``` + +If you've been building project previously, then remove the contents of the `"binaries_64bit"` directory (or 32bit), but do not remove the python examples (**.py**.html) nor the LICENSE.txt file. + +The files/ directory contains test files for the cefclient (executable) sample browser. The cefclient executable is an optional binary and may be removed, though it is a good idea to keep it in case there are some issues with CEF Python. In such case reproducing the issue with cefclient is a basis for reporting the issue to upstream CEF. + +## Install Cython ## + +Download Cython 0.19.2 from PYPI: + +https://pypi.python.org/pypi/Cython/0.19.2 + +Extract it, then run "setup.py install" command via sudo: + +``` +sudo python setup.py install +``` + +## Build the CEF Python module ## + +Go to the cefpython "linux/" directory and run the "compile.py" script: + +``` +cd ~/cefpython/cefpython/cef3/linux/ +python compile.py +``` + +Building the makefiles may fail for the first time if the "setup/cefpython.h" is not up-to-date. If this happens you will be asked whether to continue, answer Yes to that. You will be prompted a few times, but don't worry just keep going. The compilation will fail, but the "setup/cefpython.h" file will be generated. Now **compile it again** by running the "python compile.py" command, it should succeed this time. + +If everything went well then the `"cefpython_py27.so"` module should be created in the `"binaries_64bit/"` directory (or 32bit) and the "wxpython.py" example should be launched. + +If you're building on OS other than Ubuntu then you may get errors about the missing header files, for example: + +``` +/usr/include/glib-2.0/glib/gtypes.h:34:24: fatal error: glibconfig.h: No such file or directory +compilation terminated. +``` + +To fix it, find the "glibconfig.h" file somewhere in the "/usr/" directory and add that directory to the includes by editing the "~/cefpython/cefpython/cef3/linux/setup/setup.py" script. Append it to the "include\_dirs" list. + +## Create a portable zip ## + +To create a portable zip just compress the files in the `"binaries_64bit/"` directory (or 32bit). + +## Create a setup package ## + +To create a setup package run the "make-setup.py" script: + +``` +cd ~/cefpython/cefpython/cef3/linux/installer/ +python make-setup.py -v 31.0 +``` + +If everything went fine then you should see a setup package created in the current directory. + +## Create a Debian package ## + +Before creating a debian package some dependencies need to be installed (stdeb version 0.6.0 required): + +``` +sudo apt-get install python-support python-pip fakeroot +sudo pip install stdeb==0.6.0 +``` + +If you were updating CEF version then you may need to generate package dependencies. It will save results to deps.txt file which later will be used by make-deb.py. + +``` +cd ~/cefpython/cefpython/cef3/linux/installer/ +python find-deps.py +``` + +After that run the "make-deb.py" script: + +``` +cd ~/cefpython/cefpython/cef3/linux/installer/ +python make-deb.py -v 31.0 +``` + +If debian package build succeeded the last two messages from the console should be: + +``` +dpkg-deb: building package `python-cefpython3' in `./python-cefpython3_31.0-1_amd64.deb'. +[make-deb.py] DONE +``` + +The debian package should be created in the `deb_archive/` directory. \ No newline at end of file diff --git a/BuildOnMac.md b/BuildOnMac.md new file mode 100644 index 0000000..b952295 --- /dev/null +++ b/BuildOnMac.md @@ -0,0 +1,137 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/BuildOnMac + + +--- + + +# Build instructions for Mac # + +The original instructions on building Chromium/CEF can be found on the CEF project [Branches and Building](https://code.google.com/p/chromiumembedded/wiki/BranchesAndBuilding) wiki page. + +Table of contents: + + +## Preliminary notes ## + + * These instructions were tested using: + * OS X 10.9.4 Mavericks + * Fresh install of Python 2.7.9 from python.org + * XCode 4.6.3 + * Command Line Tools for XCode, Apr 2014 + * XCode 6 is not supported by CEF (officially) + +## TODO ## + + * Fix HTTPS caching on sites with SSL certificate errors (optional) + * Disable the tcmalloc memory allocation global hook (optional, but recommended) - [Issue 155](https://code.google.com/p/cefpython/issues/detail?id=155) + +## Prepare environment ## + +You need to set the following environment variables: + * CC=gcc + * CXX=g++ + * CEF\_CCFLAGS and ARCHFLAGS - either "-arch i386" when building 32bit or "-arch x86\_64" for 64bit + +If you're building 32bit on 64bit then: + * Create an alias python="arch -i386 python" + * Set the `CEF_CCFLAGS` and `ARCHFLAGS` env variables to `"-arch i386"` + +### An example script to prepare 32-bit environment ### + +Save it as mac32.sh and type "`source mac32.sh`". + +``` +#!/bin/bash + +PATH=/usr/local/bin:$PATH +export PATH +alias python="arch -i386 python" + +CEF_CCFLAGS="-arch i386" +export CEF_CCFLAGS + +ARCHFLAGS="-arch i386" +export ARCHFLAGS + +export CC=gcc +export CXX=g++ +``` + +### An example script to prepare 64-bit environment ### + +Save it as mac64.sh and type "`source mac64.sh`". + +``` +#!/bin/bash + +PATH=/usr/local/bin:$PATH +export PATH + +CEF_CCFLAGS="-arch x86_64" +export CEF_CCFLAGS + +ARCHFLAGS="-arch x86_64" +export ARCHFLAGS + +export CC=gcc +export CXX=g++ +``` + + +## Install Cython ## + +Download Cython 0.19.2 from PYPI. Latest versions are not supported, see [Issue 110](https://code.google.com/p/cefpython/issues/detail?id=110). + +https://pypi.python.org/pypi/Cython/0.19.2 + +Extract it and install. Before installing make sure you have exported the CC, CXX and ARCHFLAGS environment variables. Cython compilation will fail if it tries to compile for both 32bit and 64bit, that's why it is required to set ARCHFLAGS to either 32bit or 64bit architecture. + +``` +python setup.py install +``` + +## Download CEF binaries and build cefclient ## + +Download CEF ready binaries from [cefbuilds.com](http://cefbuilds.com/). The branch and revision must match with the ones provided in the [BUILD\_COMPATIBILITY.txt](https://code.google.com/p/cefpython/source/browse/cefpython/cef3/BUILD_COMPATIBILITY.txt) file. + +Extract the archive. In our case this will create the `cef_binary_3.1650.1639_macosx32` directory to which we will later reference as the `cef_binary` directory. + +Open the cefclient.xcodeproj project. When using Xcode 4.2 or newer you will need to change the "Compiler for C/C++/Objective-C" setting to "LLVM GCC 4.2" under "Build Settings" for each target. + +Change build configuration to Release. From menu: Product > Scheme > Edit Scheme > Run > Build configuration: Release and OK. Click the Run button to build the project. + +If there are errors while compiling `cefclient_osr_widget_mac.mm` then fix them: + * Remove the `"(readwrite, atomic)"` string that appears before `"bool was_last_mouse_down_on_view"` + * Move the `sendScrollWheelEvet` method up in the source file before it is referenced by the `shortCircuitScrollWheelEvent` method + +Go to the `xcodebuild/Release/` directory and run `cefclient.app` to see if everything works fine. + +## Download the CEF Python sources ## + +``` +git clone https://code.google.com/p/cefpython/ cefpython/ +``` + +## Copy CEF binaries and libraries to the CEF Python directories ## + + * Copy "cef\_binary/xcodebuild/Release/libcef\_dll\_wrapper.a" to "cefpython/cef3/mac/setup/lib\_32bit/" + * Copy "`cef_binary/Release/*.dylib|so`" to "cefpython/cef3/mac/binaries\_32bit/" + * Copy "cef\_binary/Resources/" to "cefpython/cef3/mac/binaries\_32bit/Resources/" + +## Build the CEF Python module ## + +``` +cd cefpython/cef3/mac/ +python compile.py +``` + +## Build packages for distribution ## + +``` +cd cefpython/cef3/mac/installer/ +./build_all.sh +``` + +This should create dist/ directory with a Python Wheel package and a Distutils source package. + +If you've built the cefpython module for both 32bit and 64bit and binaries are available in both mac/binaries\_32bit/ and mac/binaries\_64bit/ directories, then the setup script will create packages with fat binaries that can run on both 32bit and 64bit. \ No newline at end of file diff --git a/BuildOnWindows.md b/BuildOnWindows.md new file mode 100644 index 0000000..6453317 --- /dev/null +++ b/BuildOnWindows.md @@ -0,0 +1,278 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/BuildOnWindows + + +--- + + +# Build instructions for Windows # + +The original instructions on building Chromium/CEF can be found on the CEF project [Branches and Building](https://code.google.com/p/chromiumembedded/wiki/BranchesAndBuilding) wiki page. + +Table of contents: + + +## Preliminary notes ## + + * The steps of downloading and building Chromium from sources may be skipped by downloading CEF ready binaries from [cefbuilds.com](http://cefbuilds.com/). The branch and revision must match with the ones provided in the [BUILD\_COMPATIBILITY.txt](https://code.google.com/p/cefpython/source/browse/cefpython/cef3/BUILD_COMPATIBILITY.txt) file. + * The path to the chromium directory should not contain any spaces + * Compiling cefpython was tested with Python 2.7 / 3.2 (32bit). See [Issue 121](https://code.google.com/p/cefpython/issues/detail?id=121) for Python 3.4 support. + * To build Chromium you will need Windows 7 64-bit or later. + * The result binaries require at least Windows XP SP3 to run. + * To build 64-bit binaries you will need VS2008 Pro. The Express edition cannot is missing the x64 platform configuration. + +## Install the Chromium tools ## + +1. See the "Build environment" section on the Chromium project site, the instructions are available for Visual Studio 2010 and for the Express edition which is free: + +(link seems no more relevant, as Chrome now officially uses VS 2013, but CEF Python probably still requires VS 2010 as it uses an older version of Chrome) + +http://www.chromium.org/developers/how-tos/build-instructions-windows#TOC-Build-environment + +You have to install Visual Studio 2010 with Service Packs and x64 compiler tools, Windows SDK and DirectX SDK. Do not install the Cygwin. + +2. Install depot\_tools: + +``` +git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git +``` + +If you do not have git installed download and extract depot\_tools from here: + +https://src.chromium.org/svn/trunk/tools/depot_tools.zip + +3. Add depot\_tools directory to your system PATH (Advanced System Settings > Environment Variables > System variables > PATH). + +4. Run the gclient once command: + +``` +gclient once +``` + +This will install git, svn and python to the depot\_tools directory. + +5. Python 2.6.2 has been installed to the depot\_tools directory that shall be used from now on by gclient and the CEF tools, if you have some other python in your system PATH then this may cause conflicts, remove it or add depot\_tools at the beginning of the system PATH. After the PATH is modified make sure you're running the python from depot tools by running the command: + +``` +python --version +``` + +It should display "Python 2.6.2". + +## Configure Chromium to use a specific revision ## + +1. Go open the BUILD\_COMPATIBILITY.txt file. + +For CEF 1: https://code.google.com/p/cefpython/source/browse/cefpython/cef1/BUILD_COMPATIBILITY.txt + +For CEF 3: https://code.google.com/p/cefpython/source/browse/cefpython/cef3/BUILD_COMPATIBILITY.txt + +Later we will need the "Chromium release url" and and the "CEF repository url" so keep it in sight. + +2. Create the "chromium" directory: + +``` +mkdir chromium +``` + +3. Configure Chromium to use a specific revision (through a release url) by running the "gclient config" command, the release url we will be using is from the BUILD\_COMPATIBILITY.txt file: + +``` +cd chromium/ +gclient config {Chromium release url} +``` + +4. Edit the "chromium/.gclient" and edit the "custom\_deps" to reduce the size of the sources to downoad: + +``` + "custom_deps": { + "src/content/test/data/layout_tests/LayoutTests": None, + "src/chrome/tools/test/reference_build/chrome_win": None, + "src/chrome_frame/tools/test/reference_build/chrome_win": None, + "src/chrome/tools/test/reference_build/chrome_linux": None, + "src/chrome/tools/test/reference_build/chrome_mac": None, + "src/third_party/hunspell_dictionaries": None, + }, +``` + +This excludes some directories that contain lots of data (many many gigabytes) that would extend the time significantly when synchronizing Chromium sources with the revision we've selected. + +5. Type the "svn ls" command and permanently accept the SSL certificate if it appears: + +``` +svn ls https://src.chromium.org/chrome +``` + +## Download the Chromium sources ## + +Download the Chromium sources by running the "gclient sync" command. The Chromium sources will be updated to the revision based on the release url we've configured earlier via "gclient config". Read also the "Possible issues" section below in case you encounter errors. + +``` +cd chromium/ +gclient sync --jobs 8 --force +``` + +This can take a while and sometimes it can break with some errors when a download fails. In such case you should run the "gclient sync" command once again. One of the last messages in the console should be: + +``` +Updating projects from gyp files... +``` + +#### Possible issues while running "gclient sync" #### + + * You may encounter an error while checking out the gsutil repo, fix it [by removing gsutil entries from the DEPS file](http://src.chromium.org/viewvc/chrome/releases/33.0.1750.29/DEPS?r1=245305&r2=245304&pathrev=245305). + +## Download the CEF sources ## + +Download the CEF sources, the repository url can be found in the BUILD\_COMPATIBILITY.txt file. + +``` +cd chromium/src/ +svn checkout {CEF repository url} cef +``` + +This will download the CEF sources to the "cef" directory inside the Chromium "src" directory. + +## Download the CEF Python sources ## + +Run the "git clone" command for the CEF Python repository. This download can take hundreds of megabytes. + +``` +git clone https://code.google.com/p/cefpython/ +``` + +## Fix HTTPS caching on sites with SSL certificate errors (optional) ## + +This is an optional fix. By default Chromium disables caching when there is certificate error. This patch will fix the HTTPS caching only when [ApplicationSettings](ApplicationSettings.md).ignore\_certificate\_errors is set to True. Official cefpython binaries have this fix applied, starting with the 31.0 release. See also [Issue 125](https://code.google.com/p/cefpython/issues/detail?id=125). + +Apply the patch in the "`~/chromium/src/`" directory. Modifications are made in the `HttpCache::Transaction::WriteResponseInfoToEntry` function. + +``` +Index: net/http/http_cache_transaction.cc +=================================================================== +--- http_cache_transaction.cc (revision 241641) ++++ http_cache_transaction.cc (working copy) +@@ -2240,7 +2240,8 @@ + // reverse-map the cert status to a net error and replay the net error. + if ((cache_->mode() != RECORD && + response_.headers->HasHeaderValue("cache-control", "no-store")) || +- net::IsCertStatusError(response_.ssl_info.cert_status)) { ++ (!cache_->GetSession()->params().ignore_certificate_errors && ++ net::IsCertStatusError(response_.ssl_info.cert_status))) { + DoneWritingToEntry(false); + ReportCacheActionFinish(); + if (net_log_.IsLoggingAllEvents()) +``` + + + +## Build CEF binaries and libraries ## + +1. Set the "GYP\_MSVS\_VERSION" environment variable depending on version of Visual Studio you are using. For Visual Studio 2010 set it to "2010", for the Express edition set it to "2010e". + +2. Generate the build files based on the GYP configuration by running the "cef\_create\_projects.bat" script. + +``` +cd chromium/src/cef/ +cef_create_projects.bat +``` + +3. Open the "cef.sln" solution file, change the configuration to Release mode and build it. + +``` +cd chromium/src/cef/ +cef.sln +``` + +After it's built you can close the solution. + +4. Run the "make\_distrib.bat" script. + +``` +cd chromium/src/cef/tools/ +make_distrib.bat --allow-partial +``` + +5. Go to the "chromium/src/cef/binary\_distrib/cef\_binary\_xxxx\_windows/" directory, for the next few steps we will be calling this directory the "cef\_binary" directory. + +6. Open the "cef\_binary/cefclient2010.sln" solution, change the configuration to Release mode and build it. + +7. Copy the "cef\_binary/README.txt" file to the "cefpython/cef3/windows/binaries\_32bit/" directory. + +8. Go to the "cef\_binary/Release/" directory and copy the "libcef.lib" file to the "cefpython/cef3/windows/setup/" directory. + +9. Go to the "cef\_binary/out/Release/" directory, copy the following files: + + * locales/ directory + * all the .exe, .dll and .pak files + +Copy them to the "cefpython/cef3/windows/binaries\_32bit/" directory. + +If you already had any binaries in the "binaries\_32bit/" directory from the previous build process then delete them first, but do not delete the visual c runtime dlls (msvcm90.dll, msvcp90.dll, msvcr90.dll). + +It might be useful to copy also the debug symbols for the CEF library, so that you can debug the stack trace when there is an error in the CEF library. To copy the debug symbols go to the "chromium/src/cef/binary\_distrib/cef\_binary\_3.1650.1646\_windows32\_release\_symbols/" directory and copy the "libcef.dll.pdb" file to the "cefpython/cef3/windows/binaries\_32bit/" directory. + +## Install CEF Python build dependencies ## + +1. Install Visual Studio 2008 with Service Pack 1 or the Express edition which is free. Building Python is supported only on VS2008, thus the same requirement stands for Cython. + +2. Install [Windows SDK 7.0](http://www.microsoft.com/en-us/download/confirmation.aspx?id=18950) to the default location. + +GRMSDK\_EN\_DVD.iso - for Windows 32bit
+GRMSDKX_EN_DVD.iso - for Windows 64bit
+
+3. Download
Cython 0.19.2 from PYPI. Later version are not supported by cefpython. Extract it and install:
+
python setup.py install
+
+ +4. (Optional) Install the pywin32 extension to run the pywin32 example.
+
+

Build the CEF Python static libraries

+ +1. Before building static libraries you have to set the "PYTHON_INCLUDE_PATH" environment variable, it should point to the include/ directory in the python installation directory. If you have python installed to the "C:\Python27\" directory (or "C:\Python34\", "C:\Python27_x64\", "C:\Python27_amd64", "C:\Python27_64", "C:\Python34_x64\" etc.), then setting the "PYTHON_INCLUDE_PATH" environment variable is not required.
+
+2. Go to the "chromium/src/cef/binary_distrib/cef_binary/" directory, open the "libcef_dll_wrapper.vcproj" project file in Visual Studio 2008 (not VS2010) and change the configuration to Release mode.
+
+2a. Change the properties of the "libcef_dll_wrapper" project:
+
  • Set the "C/C++ > Output files > Program Database File Name" option an empty string. This will get rid of warnings during cython compilation
+ +Build it. Go to the cef_binary/out/Release/lib/ directory and rename "libcef_dll_wrapper.lib" to "libcef_dll_wrapper_mt.lib". Copy it to the cefpython/cef3/windows/setup/lib_32bit/ directory.
+
+2b. Change the properties of the "libcef_dll_wrapper" project:
+
  • Set the "C/C++ > Code Generation > Runtime Library" to "Multi-threaded DLL (/MD)".
    +
  • In "C/C++ > Command Line" add a flag: "-D_HAS_EXCEPTIONS=1" (or set "multi_threaded_dll" in your GYP configuration, see CEF Issue 970).
+ +Build it. After it's built, go to the "cef_binary/out/Release/lib/" directory. Rename "libcef_dll_wrapper.lib" to "libcef_dll_wrapper_md.lib" and copy it to the "cefpython/cef3/windows/setup/lib_32bit/" directory.
+
+

Build the CEF Python module

+ +Go to the "cefpython/cef3/windows/" directory.
+
+There is one thing to do before building. An up-to-date "cefpython.h" file needs to be generated, signatures of the Cython public functions are there. To generate this file you need to run the compile.bat script and ignore any errors you see. When asked whether to continue press "y" (yes). The compile.bat script expects first argument to be release version number:
+
compile.bat 31.2
+
+ +After cefpython.h was generated run the compile.bat script once again.
+
+If everything went fine then the "cefpython_py27.pyd" (or py34.pyd) module should be created in the "cefpython/cef3/windows/binaries_32bit/" directory and the "wxpython.py" example should be launched automatically.
+
+The compile.bat script also accepts additional flags that can be passed after the version argument:
+
  • --rebuild - to rebuild vcproj builds
    +
  • --py27-32bit, --py27-64bit, --py34-32bit, --py34-64bit - these allow to set PATH for specific Python version. This path contains minimum set of directories to allow detecting possible issues early.
+ +

Build packages for distribution

+ +To be able to build the inno setup installer you have to install Inno Setup 5. It should be installed to the deafault location "c:\Program Files (x86)\Inno Setup 5\ISCC.exe", otherwise you will have to edit the "make-installer.py" script and change the path. To disable creation of inno setup installer package pass the "--disable-inno-setup" flag after the version number argument.
+
+You will also need the pip package manager, please see here on how to install it on Windows. It needs to be a recent version of pip, so that Python Wheels are supported. The build_all.bat script will install some dependencies (setuptools, wheel) if they are missing. If you have some old versions of pip/setuptools/wheel installed, then you need to upgrade them by typing these commands:
+
+
pip install --upgrade pip
+pip install --upgrade setuptools
+pip install --upgrade wheel
+
+ +To create multiple packages run the build_all.bat script. The first argument is a version number. There are also optional flags that you can pass after the version argument: --disable-inno-setup, --py27-32bit, --py27-64bit, --py34-32bit, --py34-64bit.
+
cd cefpython/cef3/windows/installer/
+build_all.bat win32 31.2
+
+ +If everything went fine then you should see multiple distributions created in the dist/ directory. \ No newline at end of file diff --git a/Callback.md b/Callback.md new file mode 100644 index 0000000..15cf843 --- /dev/null +++ b/Callback.md @@ -0,0 +1,19 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/Callback + + +--- + + +# Callback object # + +Generic callback interface used for asynchronous continuation. + +## CEF 3 ## + +void **Continue**() + +> Continue processing. + +void **Cancel**() + +> Cancel processing. \ No newline at end of file diff --git a/CommandLineSwitches.md b/CommandLineSwitches.md new file mode 100644 index 0000000..b4768e9 --- /dev/null +++ b/CommandLineSwitches.md @@ -0,0 +1,57 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/CommandLineSwitches + + +--- + + +# Command line switches # + +There are many settings that can be customized through Chromium command line switches. These switches can only be set programmatically by passing a dictionary of switches as a second argument to [cefpython](cefpython.md).Initialize(applicationSettings, commandLineSwitches). The `commandLineSwitches param` is a dictionary with switch name as a key. The switch name should not contain the "-" or "--" prefix, otherwise it will be ignored. Switch value may be an empty string, if the switch doesn't require a value. These switches are set for the main process and all subprocesses. See the description of the [cefpython](cefpython.md).Initialize() function to see how to preview the final command line strings formed by CEF. + +There are two types of switches, Chromium switches and CEF switches: + * An assembled list of all Chromium switches can be found on this webite: [peter.sh/experiments/chromium-command-line-switches](http://peter.sh/experiments/chromium-command-line-switches/) + * A list of all CEF switches can be found in [cef\_switches.cc](https://code.google.com/p/chromiumembedded/source/browse/trunk/cef3/libcef/common/cef_switches.cc) + +Some of the switches in Chromium are experimental, and may crash application if used inappropriately. + +## Example switches ## + +### enable-media-stream ### + +To enable media (WebRTC audio/video) streaming set the "enable-media-stream" CEF switch. This will enable the `getUserMedia` function in javascript. + +### proxy-server ### + +To set custom proxy set the "proxy-server" Chromium switch to "socks5://127.0.0.1:8888" for example. See also [Proxy Resolution](https://code.google.com/p/chromiumembedded/wiki/GeneralUsage#Proxy_Resolution) page. + +### no-proxy-server ### + +By default Chromium uses the IE proxy settings (set in Internet Explorer options), to disable that set the "no-proxy-server" Chromium switch. See also [Proxy Resolution](https://code.google.com/p/chromiumembedded/wiki/GeneralUsage#Proxy_Resolution) page. + +### disable-gpu ### + +Disable GPU rendering and switch to CPU software rendering. This flag can fix the [black/white browser screen](https://code.google.com/p/cefpython/wiki/KnowledgeBase#Black/White_browser_screen) issue. + +## Chromium switches by category ## + +The peter.sh website should list all Chromium switches that are assembled from many Chromium files. Though, some switches may be missing there. Here is a list (in some way categorized) of all Chromium source files that define switches (list assembled on January 16, 2014): + + * [apps/switches.cc](https://src.chromium.org/svn/trunk/src/apps/switches.cc) + * [ash/ash\_switches.cc](https://src.chromium.org/svn/trunk/src/ash/ash_switches.cc) + * [base/base\_switches.cc](https://src.chromium.org/svn/trunk/src/base/base_switches.cc) + * [cc/base/switches.cc](https://src.chromium.org/svn/trunk/src/cc/base/switches.cc) + * [chrome/common/chrome\_switches.cc](https://src.chromium.org/svn/trunk/src/chrome/common/chrome_switches.cc) + * [components/autofill/core/common/autofill\_switches.cc](https://src.chromium.org/svn/trunk/src/components/autofill/core/common/autofill_switches.cc) + * [components/nacl/common/nacl\_switches.cc](https://src.chromium.org/svn/trunk/src/components/nacl/common/nacl_switches.cc) + * [content/public/common/content\_switches.cc](https://src.chromium.org/svn/trunk/src/content/public/common/content_switches.cc) + * [google\_apis/gaia/gaia\_switches.cc](https://src.chromium.org/svn/trunk/src/google_apis/gaia/gaia_switches.cc) + * [gpu/command\_buffer/service/gpu\_switches.cc](https://src.chromium.org/svn/trunk/src/gpu/command_buffer/service/gpu_switches.cc) + * [ipc/ipc\_switches.cc](https://src.chromium.org/svn/trunk/src/ipc/ipc_switches.cc) + * [media/base/media\_switches.cc](https://src.chromium.org/svn/trunk/src/media/base/media_switches.cc) + * [ppapi/shared\_impl/ppapi\_switches.cc](https://src.chromium.org/svn/trunk/src/ppapi/shared_impl/ppapi_switches.cc) + * [ui/base/ui\_base\_switches.cc](https://src.chromium.org/svn/trunk/src/ui/base/ui_base_switches.cc) + * [ui/base/ui\_base\_switches\_util.cc](https://src.chromium.org/svn/trunk/src/ui/base/ui_base_switches_util.cc) + * [ui/compositor/compositor\_switches.cc](https://src.chromium.org/svn/trunk/src/ui/compositor/compositor_switches.cc) + * [ui/gfx/switches.cc](https://src.chromium.org/svn/trunk/src/ui/gfx/switches.cc) + * [ui/gl/gl\_switches.cc](https://src.chromium.org/svn/trunk/src/ui/gl/gl_switches.cc) + * [ui/keyboard/keyboard\_switches.cc](https://src.chromium.org/svn/trunk/src/ui/keyboard/keyboard_switches.cc) \ No newline at end of file diff --git a/ContentFilter.md b/ContentFilter.md new file mode 100644 index 0000000..7b76abf --- /dev/null +++ b/ContentFilter.md @@ -0,0 +1,21 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/ContentFilter + + +--- + + +# ContentFilter object # + +See [RequestHandler](RequestHandler.md).`OnResourceResponse()`. + +## CEF 1 ## + +void **SetHandler**([ContentFilterHandler](ContentFilterHandler.md) handler) + +> The `handler` is a python class that implements +> one or all of the [ContentFilterHandler](ContentFilterHandler.md) callbacks. + +> You must keep a strong reference to the [ContentFilterHandler](ContentFilterHandler.md) +> object, otherwise it gets destroyed and callbacks won't get called, +> CEF Python keeps only a weak reference to the [ContentFilterHandler](ContentFilterHandler.md) +> object. \ No newline at end of file diff --git a/ContentFilterHandler.md b/ContentFilterHandler.md new file mode 100644 index 0000000..fdf7ee6 --- /dev/null +++ b/ContentFilterHandler.md @@ -0,0 +1,28 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/ContentFilterHandler + + +--- + + +# ContentFilterHandler callbacks # + +See the [ContentFilter](ContentFilter.md) object. + +You must keep a strong reference to the [ContentFilterHandler](ContentFilterHandler.md) +object, otherwise it gets destroyed and callbacks are not called, +CEF Python keeps only a weak reference to this object. + +## CEF 1 ## + +The methods of this handler will always be called on the UI thread. + +void **OnData**(str data, [StreamReader](StreamReader.md) substitute\_data) + +> Set |substitute\_data| to the replacement for the data in |data| if data +> should be modified. + +void **OnDrain**([StreamReader](StreamReader.md) remainder) + +> Called when there is no more data to be processed. It is expected +> that whatever data was retained in the last `OnData()` call, +> it should be returned now by setting |remainder| if appropriate. \ No newline at end of file diff --git a/Cookie.md b/Cookie.md new file mode 100644 index 0000000..5e81566 --- /dev/null +++ b/Cookie.md @@ -0,0 +1,117 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/Cookie + + +--- + + +# Cookie class # + +See also [CookieManager](CookieManager.md).`SetCookie()` and [CookieVisitor](CookieVisitor.md).`Visit()`. + +## CEF 1, CEF 3 ## + +void **Set**(dict cookie) + +> Set cookie properties via a dict. + +> The cookie may have the following keys:
+
- name (str)
+- value (str)
+- domain (str)
+- path (str)
+- secure (bool)
+- httpOnly (bool)
+- creation (datetime.datetime)
+- lastAccess (datetime.datetime)
+- hasExpires (bool)
+- expires (datetime.datetime)
+ +dict Get()
+
+
Get all cookie properties as a dict.
+ +void SetName(string name)
+
+
Set the cookie name.
+ +string GetName()
+
+
Get the cookie name.
+ +void SetValue(string value)
+
+
Set the cookie value.
+ +string GetValue()
+
+
Get the cookie value.
+ +void SetDomain(string domain)
+
+
If |domain| is empty a host cookie will be
+created instead of a domain cookie. Domain cookies are stored with a
+leading "." and are visible to sub-domains whereas host cookies are
+not.
+ +string GetDomain()
+
+
Get the cookie domain.
+ +void SetPath(string path)
+
+
If |path| is non-empty only URLs at or below the path will get the
+cookie value.
+ +string GetPath()
+
+
Get the cookie path.
+ +void SetSecure(bool secure)
+
+
If |secure| is true the cookie will only be sent for HTTPS requests.
+ +bool GetSecure()
+
+
Get the secure property.
+ +void SetHttpOnly(bool httpOnly)
+
+
If |httponly| is true the cookie will only be sent for HTTP requests.
+ +bool GetHttpOnly()
+
+
Get the httpOnly property.
+ +void SetCreation(datetime.datetime creation)
+
+
The cookie creation date. This is automatically populated by the system on
+cookie creation.
+ +datetime.datetime GetCreation()
+
+
Get the creation property.
+ +void SetLastAccess(datetime.datetime lastAccess)
+
+
The cookie last access date. This is automatically populated by the system
+on access.
+ +datetime.datetime GetLastAccess()
+
+
Get the lastAccess property.
+ +void SetHasExpires(bool hasExpires)
+
+
The cookie expiration date is only valid if |hasExpires| is true.
+ +bool GetHasExpires()
+
+
Get the hasExpires property.
+ +void SetExpires(datetime.datetime expires)
+
+
Set the cookie expiration date. You should also call SetHasExpires().
+ +datetime.datetime GetExpires()
+
+
Get the expires property. \ No newline at end of file diff --git a/CookieManager.md b/CookieManager.md new file mode 100644 index 0000000..6341111 --- /dev/null +++ b/CookieManager.md @@ -0,0 +1,196 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/CookieManager + + +--- + + +# CookieManager class # + +This class cannot be instantiated directly, use the `CreateManager()` +static method for this purpose. + +The cookie tests can be found in the wxpython.py script. + +## CEF 3 ## + +static [CookieManager](CookieManager.md) **GetGlobalManager**() + +> Returns the global cookie manager. By default data will be stored at +> [ApplicationSettings](ApplicationSettings.md).cache\_path if specified or in memory otherwise. + +static [CookieManager](CookieManager.md) **CreateManager**(string path, bool `persistSessionCookies`=False) + +> Creates a new cookie manager. Otherwise, data will be stored at the +> specified |path|. To persist session cookies (cookies without an expiry +> date or validity interval) set |persistSessionCookies| +> to true. If using global manager then see the [ApplicationSettings](ApplicationSettings.md).`persist_session_cookies` +> option. Session cookies are generally intended to be transient and most +> Web browsers do not persist them. Returns None if creation fails. + +> You can have a separate cookie manager for each browser, +> see [RequestHandler](RequestHandler.md).`GetCookieManager()`. + +void **SetSupportedSchemes**(list schemes) + +> Set the schemes supported by this manager. By default only "http" and +> "https" schemes are supported. Must be called before any cookies are +> accessed. + +bool **VisitAllCookies**([CookieVisitor](CookieVisitor.md) object) + +> Visit all cookies. The returned cookies are ordered by longest path, +> then by earliest creation date. Returns false if cookies cannot be +> accessed. + +> The `CookieVisitor` object is a python class that implements the `CookieVisitor` +> callbacks. You must keep a strong reference to the `CookieVisitor` object while +> visiting cookies, otherwise it gets destroyed and the `CookieVisitor` callbacks +> won't be called. + +bool **VisitUrlCookies**(string url, bool includeHttpOnly, [CookieVisitor](CookieVisitor.md) object) + +> Visit a subset of cookies. The results are filtered by the given url +> scheme, host, domain and path. If |includeHttpOnly| is true HTTP-only +> cookies will also be included in the results. The returned cookies are +> ordered by longest path, then by earliest creation date. Returns false +> if cookies cannot be accessed. + +> The `CookieVisitor` object is a python class that implements the `CookieVisitor` +> callbacks. You must keep a strong reference to the `CookieVisitor` object while +> visiting cookies, otherwise it gets destroyed and the `CookieVisitor` callbacks +> won't be called. + +void **SetCookie**(string url, [Cookie](Cookie.md) cookie) + +> Sets a cookie given a valid URL and a `Cookie` object. +> It will check for disallowed characters (e.g. the ';' character is disallowed +> within the cookie value attribute) and will not set the cookie if such +> characters are found. + +> The CEF C++ equivalent function will be called on the IO thread, thus it executes +> asynchronously, when this method returns the cookie will not yet be set. + +> TODO: the CEF C++ function returns a true or false value depending on whether it +> succeeded or failed, the return value is not yet implemented in CEF Python, +> as there is currently no API exposed to CEF Python for posting tasks on various threads. + +void **DeleteCookies**(string url, string cookie\_name) + +> Delete all cookies that match the specified parameters. If both |url| and +> values |cookie\_name| are specified all host and domain cookies matching +> both will be deleted. If only |url| is specified all host cookies (but not +> domain cookies) irrespective of path will be deleted. If |url| is empty all +> cookies for all hosts and domains will be deleted. Deleting cookies will fail +> if a non-empty invalid URL is specified or if cookies cannot be accessed. + +> The CEF C++ equivalent function will be called on the IO thread, thus it executes +> asynchronously, when this method returns the cookies will not yet be deleted. + +> TODO: the CEF C++ function returns a true or false value depending on whether it +> succeeded or failed, the return value is not yet implemented in CEF Python, +> as there is currently no API exposed to CEF Python for posting tasks on various threads. + +bool **SetStoragePath**(string `path`, bool `persist_session_cookies`=False) + +> Sets the directory path that will be used for storing cookie data. If +> |path| is empty data will be stored in memory only. Otherwise, data will be +> stored at the specified |path|. To persist session cookies (cookies without +> an expiry date or validity interval) set |persist\_session\_cookies| to true. +> Session cookies are generally intended to be transient and most Web browsers +> do not persist them. Returns false if cookies cannot be accessed. + +bool **FlushStore**(`CompletionHandler` handler) + +> Not yet implemented. + +> Flush the backing store (if any) to disk and execute the specified +> |handler| on the IO thread when done. Returns false if cookies cannot be +> accessed. + +## CEF 1 ## + +static [CookieManager](CookieManager.md) **GetGlobalManager**() + +> Returns the global cookie manager. By default data will be stored at +> [ApplicationSettings](ApplicationSettings.md).cache\_path if specified or in memory otherwise. + +static [CookieManager](CookieManager.md) **CreateManager**(string path) + +> Creates a new cookie manager. Otherwise, data will be stored at the +> specified |path|. To persist session cookies (cookies without an expiry +> date or validity interval) set |persist\_session\_cookies| +> to true. If using global manager then see the [ApplicationSettings](ApplicationSettings.md).`persist_session_cookies` +> option. Session cookies are generally intended to be transient and most +> Web browsers do not persist them. Returns None if creation fails. + +> You can have a separate cookie manager for each browser, +> see [RequestHandler](RequestHandler.md).`GetCookieManager()`. + +void **SetSupportedSchemes**(list schemes) + +> Set the schemes supported by this manager. By default only "http" and +> "https" schemes are supported. Must be called before any cookies are +> accessed. + +bool **VisitAllCookies**([CookieVisitor](CookieVisitor.md) object) + +> Visit all cookies. The returned cookies are ordered by longest path, +> then by earliest creation date. Returns false if cookies cannot be +> accessed. + +> The `CookieVisitor` object is a python class that implements the `CookieVisitor` +> callbacks. You must keep a strong reference to the `CookieVisitor` object while +> visiting cookies, otherwise it gets destroyed and the `CookieVisitor` callbacks +> won't be called. + +bool **VisitUrlCookies**(string url, bool includeHttpOnly, [CookieVisitor](CookieVisitor.md) object) + +> Visit a subset of cookies. The results are filtered by the given url +> scheme, host, domain and path. If |includeHttpOnly| is true HTTP-only +> cookies will also be included in the results. The returned cookies are +> ordered by longest path, then by earliest creation date. Returns false +> if cookies cannot be accessed. + +> The `CookieVisitor` object is a python class that implements the `CookieVisitor` +> callbacks. You must keep a strong reference to the `CookieVisitor` object while +> visiting cookies, otherwise it gets destroyed and the `CookieVisitor` callbacks +> won't be called. + +void **SetCookie**(string url, [Cookie](Cookie.md) cookie) + +> Sets a cookie given a valid URL and a `Cookie` object. +> It will check for disallowed characters (e.g. the ';' character is disallowed +> within the cookie value attribute) and will not set the cookie if such +> characters are found. + +> The CEF C++ equivalent function will be called on the IO thread, thus it executes +> asynchronously, when this method returns the cookie will not yet be set. + +> TODO: the CEF C++ function returns a true or false value depending on whether it +> succeeded or failed, the return value is not yet implemented in CEF Python, +> as there is currently no API exposed to CEF Python for posting tasks on various threads. + +void **DeleteCookies**(string url, string cookie\_name) + +> Delete all cookies that match the specified parameters. If both |url| and +> values |cookie\_name| are specified all host and domain cookies matching +> both will be deleted. If only |url| is specified all host cookies (but not +> domain cookies) irrespective of path will be deleted. If |url| is empty all +> cookies for all hosts and domains will be deleted. Deleting cookies will fail +> if a non-empty invalid URL is specified or if cookies cannot be accessed. + +> The CEF C++ equivalent function will be called on the IO thread, thus it executes +> asynchronously, when this method returns the cookies will not yet be deleted. + +> TODO: the CEF C++ function returns a true or false value depending on whether it +> succeeded or failed, the return value is not yet implemented in CEF Python, +> as there is currently no API exposed to CEF Python for posting tasks on various threads. + +bool **SetStoragePath**(string `path`, bool `persistSessionCookies`=False) + +> Sets the directory path that will be used for storing cookie data. If +> |path| is empty data will be stored in memory only. Otherwise, data will be +> stored at the specified |path|. To persist session cookies (cookies without +> an expiry date or validity interval) set |persistSessionCookies| to true. +> Session cookies are generally intended to be transient and most Web browsers +> do not persist them. Returns false if cookies cannot be accessed. \ No newline at end of file diff --git a/CookieVisitor.md b/CookieVisitor.md new file mode 100644 index 0000000..abe81ea --- /dev/null +++ b/CookieVisitor.md @@ -0,0 +1,23 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/CookieVisitor + + +--- + + +# CookieVisitor callbacks # + +See [CookieManager](CookieManager.md).`VisitAllCookies()` and [CookieManager](CookieManager.md).`VisitUrlCookies()`. + +You must keep a strong reference to the [CookieVisitor](CookieVisitor.md) object +while visiting cookies, otherwise it gets destroyed and the +[CookieVisitor](CookieVisitor.md) callbacks won't be called. + +## CEF 1, CEF 3 ## + +bool **Visit**([Cookie](Cookie.md) cookie, int count, int total, list deleteCookie) + +> Method that will be called once for each cookie. |count| is the 0-based +> index for the current cookie. |total| is the total number of cookies. +> Set |`deleteCookie[0]`| to True to delete the cookie currently being visited. +> Return False to stop visiting cookies, True to continue. This method may +> never be called if no cookies are found. \ No newline at end of file diff --git a/DisplayHandler.md b/DisplayHandler.md new file mode 100644 index 0000000..46bb915 --- /dev/null +++ b/DisplayHandler.md @@ -0,0 +1,91 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/DisplayHandler + + +--- + + +# DisplayHandler callbacks # + +Implement this interface to handle events related to browser display state. The methods of this class will be called on the UI thread. + +For an example of how to implement handler see [cefpython](cefpython.md).CreateBrowser(). For a list of all handler interfaces see [API > Client handlers](API#Client_handlers.md). + +## CEF 3 ## + +void **OnAddressChange**([Browser](Browser.md) browser, [Frame](Frame.md) frame, string url) + +> Called when a frame's address has changed. + +void **OnTitleChange**([Browser](Browser.md) browser, string title) + +> Called when the page title changes. + +bool **OnTooltip**([Browser](Browser.md) browser, `list& textOut`) + +> Called when the browser is about to display a tooltip. `textOut[0]` contains the +> text that will be displayed in the tooltip. To handle the display of the +> tooltip yourself return true. Otherwise, you can optionally modify `textOut[0]` +> and then return false to allow the browser to display the tooltip. +> When window rendering is disabled the application is responsible for +> drawing tooltips and the return value is ignored. + +void **OnStatusMessage**([Browser](Browser.md) browser, string value) + +> Called when the browser receives a status message. + +bool **OnConsoleMessage**([Browser](Browser.md) browser, string message, string source, int line) + +> Called to display a console message. Return true to stop the message from +> being output to the console. + +## CEF 1 ## + +void **OnAddressChange**([Browser](Browser.md) `browser`, [Frame](Frame.md) `frame`, string `url`) + +> Called when a frame's address has changed. + +bool **OnConsoleMessage**([Browser](Browser.md) `browser`, string `message`, string `source`, int `line`) + +> Called to display a console message. Return true to stop the message from being output to the console. + +> From testing it seems that this function gets called only for console.log(), console.warn(), console.error() and console.info(). You will not get all the messages that appear in developer tools console, see this thread: http://magpcss.org/ceforum/viewtopic.php?f=6&t=3347 + +void **OnContentsSizeChange**([Browser](Browser.md) `browser`, [Frame](Frame.md) `frame`, int `width`, int `height`) + +> Called when the size of the content area has changed. + +void **OnFaviconUrlChange**([Browser](Browser.md) `browser`, string`[]`& `icon_urls`) + +> Not yet implemented in CEF Python. + +void **OnNavStateChange**([Browser](Browser.md) `browser`, bool `canGoBack`, bool `canGoForward`) + +> Called when the navigation state has changed. + +void **OnStatusMessage**([Browser](Browser.md) `browser`, string `text`, int `statusType`) + +> Called when the browser receives a status message. |text| contains the text that will be displayed in the status message and |statusType| indicates the status message type. + +> `statusType` can be one of: + +> cefpython.`STATUSTYPE_TEXT`
+
cefpython.STATUSTYPE_MOUSEOVER_URL
+cefpython.STATUSTYPE_KEYBOARD_FOCUS_URL
+ +bool OnTitleChange(Browser browser, string title)
+
+
Called when the page title changes. Implement this function to handle window titles for popup windows.
+ +
There is a default implementation of this function that sets titles for popup windows, otherwise they appeared on the taskbar with no title:
+
	cefpython.WindowUtils.SetTitle(browser, title)
+ cefpython.WindowUtils.SetIcon(browser, "inherit")
+
+ +
Return True to call these two functions automatically, otherwise return False.
+ +
If you would like to implement it differently, have a look at the default implementation of SetTitle() & SetIcon() in WindowUtils:
+http://code.google.com/p/cefpython/source/browse/cefpython/window_utils_win.pyx
+ +bool OnTooltip(Browser browser, string &text[0])
+
+
Called when the browser is about to display a tooltip. |text| contains the text that will be displayed in the tooltip. To handle the display of the tooltip yourself return true. Otherwise, you can optionally modify |text| and then return false to allow the browser to display the tooltip. \ No newline at end of file diff --git a/Donations.md b/Donations.md new file mode 100644 index 0000000..2f4af5b --- /dev/null +++ b/Donations.md @@ -0,0 +1,13 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/Donations + + +--- + + +# Donations # + +CEF Python is an open source project founded by [Czarek Tomczak](http://www.linkedin.com/in/czarektomczak) in 2012 to provide python bindings for the [Chromium Embedded Framework](http://code.google.com/p/chromiumembedded/). If you would like to support general CEF Python development efforts by making a donation please click the Paypal "Donate" button below: + + + +At this time CEF Python is unable to accept donations that sponsor the development of specific features. If you are interested in sponsorship opportunities please contact Czarek directly. \ No newline at end of file diff --git a/DownloadHandler.md b/DownloadHandler.md new file mode 100644 index 0000000..97a7671 --- /dev/null +++ b/DownloadHandler.md @@ -0,0 +1,40 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/DownloadHandler + + +--- + + +# DownloadHandler callbacks # + +See also [Browser](Browser.md).`StartDownload()`. + +## CEF 3 ## + +In CEF 3 downloads are handled automatically if ApplicationSettings.`downloads_enabled` is set to True (default). A default `SaveAs` file dialog provided by OS is displayed. If the download is aborted by user LoadHandler.`OnLoadError` will get called with errorCode ERR\_ABORTED. + +There is no download progress available. If you need such feature you will have to create a custom implementation of downloads. It would need to be investigated which callbacks from client handlers would allow for such implementation. Take a look at RequestHandler.`OnBeforeBrowse`, `OnBeforeResourceLoad`, and/or ResourceHandler. + +On Linux there is a bug and ERR\_ABORTED is reported even for successful downloads. See the comments in the wxpython.py example. + +A download handler with callbacks like `OnBeforeDownload` and +`OnDownloadUpdated` may be exposed to CEF Python in the future. + +## CEF 1 ## + +See [RequestHandler](RequestHandler.md).`GetDownloadHandler()`. + +You must keep a strong reference to the `DownloadHandler` object while downloading, otherwise it gets destroyed and the `DownloadHandler` callbacks won't be called. + +The callbacks of the `DownloadHandler` class will always be called on the UI thread. + +An example `DownloadHandler` can be found in the wxpython.py script. + +bool **OnData**(str data) + +> A portion of the file contents have been received. This method will be +> called multiple times until the download is complete. Return |True| to +> continue receiving data and |False| to cancel. + +void **OnComplete**() + +> The download is complete. \ No newline at end of file diff --git a/Download_CEF3_Linux.md b/Download_CEF3_Linux.md new file mode 100644 index 0000000..cbcbba1 --- /dev/null +++ b/Download_CEF3_Linux.md @@ -0,0 +1,71 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/Download_CEF3_Linux + + +--- + + +# Download CEF Python 3 for Linux # + +Table of contents: + + +## Introduction ## + +The binaries were built by following the instructions on the [BuildOnLinux](BuildOnLinux.md) wiki page.
+Linux release is sponsored by Cyan Inc. + +Version information
+The latest version is 31.2 (stable), released on January 10, 2015.
+The Chrome version is 31.0.1650.69. Based on CEF 3 branch 1650 rev. 1639.
+For an explanation of these numbers see the VersionNumbering wiki page.
+
+Release notes
+For a list of changes in current and past binary distributions see
+the ReleaseNotes wiki page.
+
+

Downloads

+ +There are two distributions available for linux: a Debian package and a Distutils Setup. Both 32-bit and 64-bit platforms are supported. Only Python 2.7 downloads are available. Python 3.4 is not yet supported, see Issue 121.
+
+Download from Google Drive.
+
+Download from Dropbox.
+
+

Install location on Ubuntu

+ +Debian package installs to:
+
/usr/share/pyshared/cefpython3/
+/usr/lib/pymodules/python2.7/cefpython3/ (symbolic links to /usr/share/pyshared/cefpthon3/)
+
+ +Distutils package installs to:
+
/usr/local/lib/python2.7/dist-packages/cefpython3/
+
+ +Note that if you've installed both the Debian package and the Distutils package, then the Distutils package will take precedence when importing the cefpython3 module.
+
+

Examples

+ +Go to examples/ directory that is inside cefpython3/ package. For location of this directory see the previous section "Install location on Ubuntu".
+
+It is recommended to run the wxpython.py example which presents the most features. To install wx toolkit type:
+
sudo apt-get install python-wxtools
+
+ + + +

Uninstall

+ +To uninstall the Debian package type:
+
sudo apt-get remove python-cefpython3
+
+ +To uninstall the Distutils package type:
+
sudo rm -rf /usr/local/lib/python2.7/dist-packages/cefpython3*
+
\ No newline at end of file diff --git a/Download_CEF3_Mac.md b/Download_CEF3_Mac.md new file mode 100644 index 0000000..5ed010c --- /dev/null +++ b/Download_CEF3_Mac.md @@ -0,0 +1,53 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/Download_CEF3_Mac + + +--- + + +# Download CEF Python 3 for Mac # + +Table of contents: + + +## Introduction ## + +The binaries were built by following the instructions on the [BuildOnMac](BuildOnMac.md) wiki page.
+ +Version information
+The latest version is 31.2 for OSX 10.7+, released on January 13, 2015.
+Chrome version is 31.0.1650.69. Based on CEF 3 branch 1650 rev. 1639.
+For an explanation of these numbers see the VersionNumbering wiki page.
+
+Release notes
+For a list of changes in current and past binary distributions see
+the ReleaseNotes wiki page.
+
+Stability note
+Chrome switched to only 64-bit builds on Mac starting with Chrome 39. Earlier versions of Chrome 64bit are not considered stable. CEF Python currently ships Chrome 31 and during testing everything worked fine. But if you want the best stability it is recommended that you use 32bit binaries.
+
+

Install from PyPI

+ +To install the PyPI/cefpython3 package using the pip package manager type:
+
pip install cefpython3
+
+ +If there are problems installing the cefpython3 package, then it might be caused by an old version of pip which may not support Python Wheels. To upgrade pip type: "pip install --upgrade pip".
+
+When using preinstalled Python that ships with OS X, to install pip type "sudo easy_install pip" and to install the cefpython3 package type "sudo pip install cefpython3".
+
+

Downloads

+ +Packages are available only for Python 2.7. All packages contain fat binaries and can run on both 32bit and 64bit. Python 3.4 is not yet supported, see Issue 121.
+
+Download from Google Drive.
+
+Download from Dropbox.
+
+

Examples

+ +To run some examples go to the examples/ directory that is inside the cefpython3 package. Type "pip show cefpython3" to see where the cefpython3 package was installed. It is recommended to run the wxpython.py example which presents the most features.
+
+ + +Note that when using preinstalled Python that ships with OS X and running examples from the "/Library/Python/2.7/site-packages/cefpython3/examples" directory, you might encounter an error "Segmentation fault: 11". This will occur if app doesn't have permission to write to the "debug.log" file. To fix it run the "sudo chmod 666 debug.log wx/debug.log" command in the examples/ directory. This is to be fixed in Issue 164. \ No newline at end of file diff --git a/Download_CEF3_Windows.md b/Download_CEF3_Windows.md new file mode 100644 index 0000000..98f63bd --- /dev/null +++ b/Download_CEF3_Windows.md @@ -0,0 +1,57 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/Download_CEF3_Windows + + +--- + + +# Download CEF Python 3 for Windows # + +Table of contents: + + +## Introduction ## + +The binaries were built by following the instructions on the [BuildOnWindows](BuildOnWindows.md) wiki page.
+ +Version information
+The latest version is 31.2, released on January 10, 2015.
+Chrome version is 31.0.1650.69. Based on CEF 3 branch 1650 rev. 1639.
+For an explanation of these numbers see the VersionNumbering wiki page.
+
+Release notes
+For a list of changes in current and past binary distributions see
+the ReleaseNotes wiki page.
+
+Stability note
+For best stability please use 32bit binaries. 64bit binaries do work fine, but are not yet considered stable in upstream CEF/Chromium.
+
+

Install from PyPI

+ +To install the PyPI/cefpython3 package using the pip package manager (see how to install pip), type:
+
pip install cefpython3
+
+ +If there are problems installing the cefpython3 package, then it might be caused by an old version of pip which may not support Python Wheels. To upgrade pip type: "pip install --upgrade pip".
+
+

Downloads

+ +Python 2.7 32-bit and 64-bit downloads are available. Python 3.4 is not yet supported, see Issue 121.
+
+Download from Google Drive.
+
+Download from Dropbox.
+
+

Examples

+ +To run some examples go to the examples/ directory that is inside the cefpython3 package. Type "pip show cefpython3" to see where the cefpython3 package was installed. It is recommended to run the wxpython.py example which presents the most features.
+
+
  • wxpython.py - example of embedding using the wxPython GUI toolkit. Includes many tests of advanced features.
    +
  • pywin32.py - example of embeddig using the pywin32 extension.
    +
  • pygtk_.py - example of embedding using the PyGTK GUI toolkit
    +
  • pyqt.py - example of embedding using the PyQt UI framework
    +
  • pyside.py - example of embedding using the PySide UI framework
    +
  • The Inno setup and Distutils distributions come with the cefpython3.wx module with more wxPython examples. See sample1.py, sample2.py, sample3.py.
+ +

Notes

+ +
  • 64bit binaries do not have applied the patch that fixes HTTPS caching on sites with SSL certificate errors (Issue 125). \ No newline at end of file diff --git a/DpiAware.md b/DpiAware.md new file mode 100644 index 0000000..cfcd528 --- /dev/null +++ b/DpiAware.md @@ -0,0 +1,72 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/DpiAware + + +--- + + +# `DpiAware` class # + +Available only on Windows. All methods of this class are static, access them through [cefpython](cefpython.md).`WindowUtils`. + +Example usage of High DPI support is in the wxpython.py example. + +## Introduction ## + +> By default if DPI awareness is not enabled in application, then OS performs display scaling. That causes text to look fuzzy on high DPI displays. The solution is to enable DPI awareness and use the ApplicationSettings.`auto_zooming` option. High DPI support is available only on Windows. + +> Enabling High DPI support in app can be done by embedding a DPI awareness xml manifest in executable (see [Issue 112](https://code.google.com/p/cefpython/issues/detail?id=112) comment #2), or by calling the `DpiAware.SetProcessDpiAware` method. Embedding xml manifest is the most reliable method. There is also an another way by writing registry key, but we won't discuss this method here. + +> The downside of calling `SetProcessDpiAware` is that scrollbar in CEF browser is very small. This is because DPI awareness was set too late, after executable and the CEF dll was loaded. To fix that embed DPI awareness xml manifest in the .exe file. + +> Additionally you have to set the ApplicationSettings.`auto_zomming` option to "system\_dpi". This will cause browser content to be zoomed automatically using system DPI settings. On Win7 these can be set in: Control Panel > Appearance and Personalization > Display. + +> When cefpyhon detects that application is DPI aware, it will automatically set ApplicationSettings."auto\_zooming" to "system\_dpi". User can manually enable DPI awareness in application by going to .exe properties > Compatibility tab > and checking the box labeled "Disable display scaling on high DPI settings". If you wish to not enable auto zooming in such case then set "auto\_zooming" to an empty string. + +### Screenshot ### + +> This screenshot shows the difference between native OS display scaling and High DPI support. Tested on a laptop with 1920x1080 resolution with Win7 DPI settings being set to "Larger 150%". The window on the left is using OS display scaling. The window on the right has enabled DPI awareness and "auto\_zooming" option set to "system\_dpi". + +![http://cefpython.googlecode.com/git/cefpython/var/dpi-aware.png](http://cefpython.googlecode.com/git/cefpython/var/dpi-aware.png) + +## Static methods ## + + +tuple **CalculateWindowSize**(int width, int height) + +> This utility function will adjust width/height using +> OS DPI settings. For 800/600 with Win7 DPI settings +> being set to "Larger 150%" will return 1200/900. + +> Calculation for DPI < 96 is not yet supported. Use +> the `GetSystemDpi` method for that. + + + +tuple **GetSystemDpi**(): + +> Returns tuple(int dpix, int dpiy). + +> Win7 DPI (Control Panel > Appearance and Personalization > Display): + + * text size Larger 150% => dpix/dpiy 144 + * text size Medium 125% => dpix/dpiy 120 + * text size Smaller 100% => dpix/dpiy 96 + +> Example zoom levels based on DPI. For use with the ApplicationSettings.`auto_zooming` option. + + * dpix=96 zoomlevel=0.0 + * dpix=120 zoomlevel=1.0 + * dpix=144 zoomlevel=2.0 + * dpix=72 zoomlevel=-1.0 + +> If DPI awareness wasn't yet enabled, then `GetSystemDpi` will always return a default 96 DPI. + +bool **IsProcessDpiAware**() + +> To check whether OS display scaling on high DPI settings was disabled. DPI awareness may be enabled by calling `SetProcessDpiAware`. It may also be enabled manually by user by changing options in .exe properties > Compatibility tab. + +> On Win8 this will return True if DPI awareness is set to either "System DPI aware" or "Per monitor DPI aware". + +void **SetProcessDpiAware**() + +> Enables DPI awareness for the running process. Embedding a DPI manifest in .exe is the prefered way, as it gives more reliable results, otherwise some display bugs may appear (discussed in the "Introduction" section on this page). \ No newline at end of file diff --git a/DragData.md b/DragData.md new file mode 100644 index 0000000..9b3f047 --- /dev/null +++ b/DragData.md @@ -0,0 +1,60 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/DragData + + +--- + + +# DragData object # + +Object used to represent drag data. The methods of this class +may be called on any thread. + +See [DragHandler](DragHandler.md).`OnDragStart()` and [DragHandler](DragHandler.md).`OnDragEnter`. + +## CEF 1 ## + +bool **IsLink**() + +> Returns true if the drag data is a link. + +bool **IsFragment**() + +> Returns true if the drag data is a text or html fragment. + +bool **IsFile**() + +> Returns true if the drag data is a file. + +str **GetLinkUrl**() + +> Return the link url that is being dragged. + +str **GetLinkTitle**() + +> Return the metadata, if any, associated with the link being dragged. + +str **GetLinkMetadata**() + +> Return the metadata, if any, associated with the link being dragged. + +str **GetFragmentText**() + +> Return the plain text fragment that is being dragged. + +str **GetFragmentHtml**() + +> Return the text/html fragment that is being dragged. + +str **GetFragmentBaseUrl**() + +> Return the base url that the fragment came from. This value is +> used for resolving relative urls and may be empty. + +str **GetFile**() + +> Return the file being dragged out of the browser window. + +list **GetFiles**() + +> Retrieve the list of files that are being dragged into the browser +> window. \ No newline at end of file diff --git a/DragHandler.md b/DragHandler.md new file mode 100644 index 0000000..50be76c --- /dev/null +++ b/DragHandler.md @@ -0,0 +1,46 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/DragHandler + + +--- + + + +# DragHandler callbacks # + +Implement this interface to handle events related to dragging. The +methods of this class will be called on the UI thread. + +For an example of how to implement a handler see [cefpython](cefpython.md).`CreateBrowser()`. For a list of all handler interfaces +see [API > Client handlers](API#Client_handlers.md). + +The `DragHandler` tests can be found in the wxpython.py script. + +## CEF 1 ## + +bool **OnDragStart**([Browser](Browser.md) browser, [DragData](DragData.md) dragData, `DragOperation` mask) + +> Called when the browser window initiates a drag event. |dragData| +> contains the drag event data and |mask| represents the type of drag +> operation. Return false for default drag handling behavior or true to +> cancel the drag event. + +> The `DragOperation` mask can be checked against `cefpython.Drag.Operation` +> dictionary that consists of following keys: + +> None
    +
    Copy
    +Link
    +Generic
    +Private
    +Move
    +Delete
    +Every
    + +bool OnDragEnter(Browser browser, DragData dragData, DragOperation mask)
    +
    +
    Called when an external drag event enters the browser window. |dragData|
    +contains the drag event data and |mask| represents the type of drag
    +operation. Return false for default drag handling behavior or true to
    +cancel the drag event.
    + +
    For the DragOperation mask values see the OnDragStart() description. \ No newline at end of file diff --git a/Frame.md b/Frame.md new file mode 100644 index 0000000..48be344 --- /dev/null +++ b/Frame.md @@ -0,0 +1,172 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/Frame + + +--- + + + +# `Frame` object # + + + +## Methods ## + +### Copy() (void) ### + +> Execute copy in this frame. + +### Cut() (void) ### + +> Execute cut in this frame. + +### Delete() (void) ### + +> Execute delete in this frame. + +### ExecuteFunction(string `funcName`, `[`mixed param `[`, mixed `param` `[, ..]]]`) (void) ### + +> Call javascript function asynchronously. This can also call object's methods, just pass "object.method" as `funcName`. Any valid javascript syntax is allowed as `funcName`, you could even pass an anonymous function here. + +> For a list of allowed types for `mixed` see [JavascriptBindings](JavascriptBindings.md).IsValueAllowed() (except function, method and instance). + +> Passing a python function here is not allowed, it is only possible through JavascriptCallback object. + +### ExecuteJavascript(string `jsCode`, string `scriptURL`=None, int `startLine`=None) (void) ### + +> Execute a string of JavaScript code in this frame. The `sciptURL` parameter is the URL where the script in question can be found, if any. The renderer may request this URL to show the developer the source of the error. The `startLine` parameter is the base line number to use for error reporting. + +> This function executes asynchronously so there is no way to get the returned value. + +> Calling javascript from native code synchronously is not possible in CEF 3. It is also not possible doing it synchronously the other way around ie. js->native. + +### GetBrowser() (Browser) ### + +> Returns the [browser](Browser.md) that this frame belongs to. + +### GetParent() (Frame) ### + +> Returns the parent of this [frame](Frame.md) or None if this is the main (top-level) frame. + +### GetIdentifier() (int) ### + +> Frame identifiers are unique per render process, they are not +> globally unique. + +### GetBrowserIdentifier() (int) ### + +> Returns the globally unique identifier for the browser hosting this frame. + +### GetName() (string) ### + +> Returns the name for this frame. If the frame has an assigned name (for example, set via the iframe "name" attribute) then that value will be returned. Otherwise a unique name will be constructed based on the frame parent hierarchy. The main (top-level) frame will always have an empty name value. + +### GetParent() (Frame) ### + +> Not yet implemented. Returns the parent of this frame or None if this is the main (top-level) frame. This method should only be called on the UI thread. + +### GetProperty(string name) (mixed) ### + +> Get property of the `window` object in javascript. + +> For a list of allowed types for `mixed` see [JavascriptBindings](JavascriptBindings.md).IsValueAllowed() (except function, method and instance). + +> If you try to get some javascript native property that its value cannot be converted to the python types above, you will get an error. + +### GetSource(`StringVisitor` visitor) (void) ### + +> CEF 3. Retrieve this frame's HTML source as a string sent to the specified +> visitor. See [StringVisitor](StringVisitor.md) interface. + +### GetText(`StringVisitor` visitor) (void) ### + +> CEF 3. Retrieve this frame's display text as a string sent to the specified +> visitor. See [StringVisitor](StringVisitor.md) interface. + +### GetSource() (string) ### + +> CEF 1. Returns this frame's HTML source as a string. This method should only be called on the UI thread. + +### GetText() (string) ### + +> CEF 1. Returns this frame's display text as a string. This method should only be called on the UI thread. + +### GetUrl() (string) ### + +> Returns the url currently loaded in this frame. + +### IsFocused() (bool) ### + +> Returns true if this is the focused frame. This method should only be called on the UI thread. + +### IsMain() (bool) ### + +> Returns true if this is the main (top-level) frame. + +### IsValid() (bool) ### + +> Available only in CEF 3. + +> True if this object is currently attached to a valid frame. + +### LoadRequest(Request `request`) (void) ### + +> Not yet ported. + +> Load the request represented by the |request| object. This is similar to `LoadUrl()`, but gives you possibility to set custom headears, make a POST request and set the post data. See the [Request](Request.md) class. + +### LoadStream(StreamReader `stream`, string `url`) (void) ### + +> Not yet ported. + +> Load the contents of |stream| with the optional dummy target |url|. + +### LoadString(string `value`, string `url`) (void) ### + +> Load the contents of |value| with the specified dummy |url|. |url| +> should have a standard scheme (for example, http scheme) or behaviors like +> link clicks and web security restrictions may not behave as expected. + +> In CEF 3 `LoadString()` can be called only after the Renderer process has been created. + +### LoadUrl(string `url`) (void) ### + +> Load the specified |url|. + +### Paste() (void) ### + +> Execute paste in this frame. + +### Print() (void) ### + +> Available only in CEF 1. In CEF 3 use [Browser](Browser.md).`Print()`. + +> Execute printing in the this frame. The user will be prompted with the print dialog appropriate to the operating system. + +### Redo() (void) ### + +> Execute redo in this frame. + +### SelectAll() (void) ### + +> Execute select all in this frame. + +### SetProperty(string name, mixed value) (void) ### + +> Set property of the `window` object in javascript. You can also set properties before browser is created by using [JavascriptBindings](JavascriptBindings.md).SetProperty(). + +> For a list of allowed types for `mixed` see [JavascriptBindings](JavascriptBindings.md).IsValueAllowed() (except instance). + +### Undo() (void) ### + +> Execute undo in this frame. + +### ViewSource() (void) ### + +> Save this frame's HTML source to a temporary file and open it in the default text viewing application. + +### VisitDom(DomVisitor `visitor`) (void) ### + +> Not yet ported. CEF DOM handling is prone to memory leaks, thus this function most probably won't be ported. It is recommended to the DOM management through javascript and communicate with the native code through [javascript bindings](JavascriptBindings.md). + +> Visit the DOM document. + diff --git a/InnoSetupInstaller.md b/InnoSetupInstaller.md new file mode 100644 index 0000000..3d45d5c --- /dev/null +++ b/InnoSetupInstaller.md @@ -0,0 +1,9 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/InnoSetupInstaller + + +--- + + +# Inno Setup installer on Windows # + +Inno setup can be installed from command line without user interaction by passing the /SILENT flag. See all [command line parameters](http://www.jrsoftware.org/ishelp/topic_setupcmdline.htm) that can be passed to the inno setup installer. See also Inno Setup website: http://www.jrsoftware.org/isinfo.php \ No newline at end of file diff --git a/InternalDevelopment.md b/InternalDevelopment.md new file mode 100644 index 0000000..bfb6b10 --- /dev/null +++ b/InternalDevelopment.md @@ -0,0 +1,106 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/InternalDevelopment + + +--- + + +# Internal development # + +Table of contents: + + +## Build instructions ## + +See build instructions on these wiki pages: + * [BuildOnWindows](BuildOnWindows.md) + * [BuildOnLinux](BuildOnLinux.md) + * [BuildOnMac](BuildOnMac.md) + +## Sending patches ## + +When attaching a patch in the Issue Tracker please also provide tests for the new functionality if applies. It can be a manual test added to the wxpython.py example or a unit test (see [Issue 59](https://code.google.com/p/cefpython/issues/detail?id=59)). Please ensure that all new functionality was tested. + +See also code style guidelines below. + +## Python/Cython style guidelines ## + + * try to comply with the [PEP 8 style guide](http://www.python.org/dev/peps/pep-0008/) + * use 4 spaces for indentation + * commit unix-style newlines (\n) + * limit all lines to a maximum of 79 characters (comments should be shorter, max 60-65 chars) + * do your best for the new code to be consistent with existing code base + +## Track project updates ## + +To track Git commits subscribe to [this RSS feed](https://code.google.com/feeds/p/cefpython/gitchanges/basic). + +To track the Issue Tracker updates subscribe to [this RSS feed](https://code.google.com/feeds/p/cefpython/issueupdates/basic). + +## Debug CEF stack trace ## + + 1. Install gdb with the command "sudo apt-get install gdb" + 1. Type "gdb python" + 1. Inside gdb type "run pyqt.py" + 1. On segmentation fault to display stack trace type "bt" + +## Debug Cython ## + +Debugging Cython is currently supported only on Linux. + +Before you can debug you have to install the following packages: + +``` +python-dbg +python-wxgtk2.8-dbg +``` + +Install Cython with the debug version of Python: +``` +cd Cython-0.19.2/ +sudo python-dbg setup.py install +``` + +To debug CEF Python add the "debug" argument to the "compile.py" script: + +``` +python-dbg compile.py 99.99 --debug +``` + +After a while you should see a GDB console awaiting a command, to run the app type: + +``` +cy run +``` + +To get the stack trace type: + +``` +cy backtrace +``` + +The command for running and debugging script is: +``` +cygdb . --args python-dbg wxpython.py +``` + +To run commands automatically in gdb add "-x gdb.cmds" flag. An example gdb.cmds file: +``` +cy run +quit +``` + +The final command would look like: +``` +cygdb . -x gdb.cmds --args python-dbg wxpython.py +``` + +For more commands see the "Using the debugger" section in the Cython documentation: +http://docs.cython.org/src/userguide/debugging.html#using-the-debugger + +## Updating to a newer CEF version ## + +To see changes in the CEF API compare "cefpython/ce3/include/" directory with the new CEF "include/" directory. When doing so compare the CEF header files downloaded directly from the CEF SVN repository, as the CEF "include/" directory obtained from binary build will not include platform specific header files. For example to fetch CEF 3 branch 1650 revision `1639` use this command: + +``` +svn checkout http://chromiumembedded.googlecode.com/svn/branches/1650@1639 cef3-b1650-r1639 +``` \ No newline at end of file diff --git a/JavascriptBindings.md b/JavascriptBindings.md new file mode 100644 index 0000000..5f7ca7c --- /dev/null +++ b/JavascriptBindings.md @@ -0,0 +1,120 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/JavascriptBindings + + +--- + + +# `JavascriptBindings` class # + +Table of contents: + + +## Introduction ## + +With this class you can expose python functions, objects and data. Binding is made to javascript "window" object. Instantiate this class and pass it to [cefpython](cefpython.md).CreateBrowserSync(). See also [javascript callbacks](JavascriptCallback.md). + +To initiate communication from python, when there is no javascript callback available yet, use [Frame](Frame.md).`ExecuteJavascript()` or [Frame](Frame.md).`ExecuteFunction()`. To get main frame for browser call [Browser](Browser.md).`GetMainFrame()`. + +When integrating javascript with python, javascript exceptions may become python exceptions when using javascript or python callbacks. Read more about javascript errors handling [here](JavascriptErrors.md). + +In CEF 3 communication between javascript and python can only be asynchronous. It is due multi-process architecture. Javascript runs in the renderer process, while python runs in the browser process. Communication is done using IPC messaging between processes. When you need to return value in a python or javascript function, then the solution is to use [callbacks](https://en.wikipedia.org/wiki/Callback_(computer_programming)). Both python callbacks and javascript callbacks are supported. + +There are plans to support binding data by reference (a list, dict or object's properties). This would be possible with the use of CefRegisterExtension(). + +## Example usage ## + +See the [wxpython.py](https://code.google.com/p/cefpython/source/browse/cefpython/cef3/windows/binaries_32bit/wxpython.py) example for an example usage of javascript bindings, javascript callbacks and python callbacks. + +## Methods ## + +### `__`init`__`(bool bindToFrames=False, bool bindToPopups=False) (void) ### + +> By default we bind only to top frame. + +> `bindToFrames` option - whether bindings are accessible inside iframes and frameset. + +> `bindToPopups` option - whether bindings are accessible from popups. + +### IsValueAllowed(mixed value) (bool) ### + +> Whether you are allowed to bind this value to javascript, value may be one of: + +> - list
    +
    - bool
    +- float
    +- int
    +- long
    +- None (null in js)
    +- dict (object in js)
    +- string
    +- unicode
    +- tuple
    +- function
    +- instancemethod (an object's method)
    + +
    If long value is outside of int32 limits (-2147483647..2147483647) then it will be converted to string in javascript (it should really be -2147483648, but then Cython complains about it).
    + +

    Rebind() (void)

    + +
    Call this to rebind javascript bindings. This is useful when using reload() on python's module, you can make changes to application and see it instantly without having to re-launch application. After you reload() module set all the bindings again using SetFunction/SetObject/SetProperty methods, then call Rebind() to rebind it to javascript. See Issue 12 (reload_example.zip) for an example.
    + +
    There is an another way of doing rebinding, you can call Frame.SetProperty(), but this is not best performant way as it creates a C++ class V8FunctionHandler for each function, when doing Rebind() there is only one such class created. Frame.SetProperty() is also more limited, you cannot bind objects using it, though it could be supported, I'm wondering whether there is a need for that, it would allow to pass objects as arguments to javascript callbacks so maybe it will be implemented in the future. Also Rebind() does bindings to frames and popups automatically according to bindToFrames and bindToPopups constructor options, while using Frame.SetProperty() you would need to take care of that by yourself.
    + +
    Rebind does not solve all scenarios, take for example: what happens if you pass a python callback to javascript and then do rebindings? You still get old function referenced in javascript.
    + +

    SetFunction(string name, function|method func) (void)

    + +
    This function will be binded to window object in html, you can call it in two ways:
    + +
    	window.myfunc()
    + myfunc() # window properties are global
    +
    + +
    You can use SetFunction() to overwrite native javascript function, for example if you would like to implement your own version of "window.alert" do this:
    + +
    	def PyAlert(msg):
    + win32gui.MessageBox(__browser.GetWindowID(), msg, "PyAlert()", win32con.MB_ICONQUESTION)
    +
    + bindings = cefpython.JavascriptBindings(bindToFrames=True, bindToPopups=True)
    + bindings.SetFunction("alert", PyAlert)
    +
    + +
    This function is dummy, it really calls SetProperty(), you might use it as well to bind functions.
    + +

    SetObject(string name, instance object) (void)

    + +
    Currently this function binds only methods of an object. Example:
    + +
    	# In python:
    + bindings.SetObject("myobject", myobject)
    + // In javasript:
    + window.myobject.someMethod();
    + // or:
    + myobject.someMethod();
    +
    + +
    Currently when binding object only methods are binded, I decided not to bind properties of the object, as they would be binded by copying value and this might be confusing, as accessing object's property from javascript might give a different value during runtime then the real value when getting the property from python runtime. Only object's methods and functions can be binded by reference. Still you can bind object's properties if you like, you can find useful method IsValueAllowed() to check which properties can be binded, of course doing it this way will not allow you to access properties through "window.myobject.property", you can only bind to the "window" object so you should imitate some kind of namespace, so that accessing property would be through "window.myobject_property" or "myobject_property" as window prefix is always optional. Use dir() function to list object's properties. Example code:
    + +
    	import types
    +
    + for name in dir(myobject):
    + if name[0] == '_': # ignore private attributes
    + continue
    + attr = getattr(myobject, name)
    + # Do not bind: functions, methods - this check is necessary as IsValueAllowed is true for these.
    + if type(attr) not in (types.FunctionType, types.MethodType):
    + if bindings.IsValueAllowed(attr):
    + bindings.SetProperty("myobject_"+name, attr)
    +
    + +
    There is a plan for the future to support binding object's properties by reference, it would be possible with the use of CefRegisterExtension().
    + +

    SetProperty(string name, mixed value) (void)

    + +
    Set some value to property of the window object in html. This propertiy for example can hold configuration options or some other data required at startup of your application.
    + +
    Mixed type is one that can be converted to javascript types, see IsValueAllowed() for a full list.
    + +
    To get the value during runtime (as it might been changed via javascript) call Frame.GetProperty().
    + +
    This function copies the values and converts them to V8 Javascript values (the only exception are functions and methods), if you pass a Dictionary don't expect that if you change it later and then call Frame.GetProperty that you will get the modified value. \ No newline at end of file diff --git a/JavascriptCallback.md b/JavascriptCallback.md new file mode 100644 index 0000000..b92a7b3 --- /dev/null +++ b/JavascriptCallback.md @@ -0,0 +1,30 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/JavascriptCallback + + +--- + + + +# `JavascriptCallback` object # + +You can pass a callback function from Javascript to Python, when you do that, what you get in Python is a `JavascriptCallback` object that you can use to call javascript function back. + +If you call the javascript callback and it fails, instead of js exception what you get is a python exception that exits the application by default (see sys.excepthook in examples), if you want to know more read about [Javascript Errors](JavascriptErrors.md). + +See also [JavascriptBindings](JavascriptBindings.md). + +See also [Issue 11](https://code.google.com/p/cefpython/issues/detail?id=11) (Throw JS / Python exceptions according to execution context). + + +--- + + +mixed **Call**(`[`mixed `param` `[`, mixed `param` `[`, ..`]]]`) + +> Call the javascript callback function. + +> For a list of allowed types for `mixed` see [JavascriptBindings](JavascriptBindings.md).IsValueAllowed(). + +string **GetName**() + +> Get the javascript function's name. If that is an anonymous function you will get some random name like "É☺«". \ No newline at end of file diff --git a/JavascriptContextHandler.md b/JavascriptContextHandler.md new file mode 100644 index 0000000..6827a56 --- /dev/null +++ b/JavascriptContextHandler.md @@ -0,0 +1,42 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/JavascriptContextHandler + + +--- + + +# JavascriptContextHandler callbacks # + +Implement this interface to handle javascript exceptions globally. + +For an example of how to implement handler see [cefpython](cefpython.md).CreateBrowser(). For a list of all handler interfaces see [API > Client handlers](API#Client_handlers.md). + +void **OnContextCreated**([Browser](Browser.md) `browser`, [Frame](Frame.md) `frame`) + +> In CEF 1 called immediately after the V8 context for a frame has been created. + +> In CEF 3 called shortly after (process message delay) the V8 context for a frame has been created. + +void **OnContextReleased**([Browser](Browser.md) `browser`, [Frame](Frame.md) `frame`) + +> In CEF 1 called immediately before the V8 context for a frame is released. + +> In CEF 3 called shortly after (process message delay) the V8 context for a frame was released. + +> Due to multi-process architecture in CEF 3, this function won't +> get called for the main frame in main browser. To send a message +> from the renderer process a parent browser is used. If this is +> the main frame then this would mean that the browser is being +> destroyed, thus we can't send a process message using this browser. +> There is no guarantee that this will get called for frames in the +> main browser, if the browser is destroyed shortly after the frames +> were released. + +void **OnUncaughtException**([Browser](Browser.md) `browser`, [Frame](Frame.md) `frame`, dict `exception`, list `stackTrace`) + +> Not yet implemented in CEF Python 3. + +> Called for global uncaught exceptions. Execution of this callback is disabled by default. To enable set ApplicationSettings.uncaught\_exception\_stack\_size > 0. + +> `exception` is a dictionary with following keys: lineNumber, message, scriptResourceName, sourceLine. + +> `stackTrace` is in the same format as returned by [cefpython](cefpython.md).GetJavascriptStackTrace(), see description of that function for more details. To get a string call [cefpython](cefpython.md).FormatJavascriptStackTrace(). \ No newline at end of file diff --git a/JavascriptDialogHandler.md b/JavascriptDialogHandler.md new file mode 100644 index 0000000..dacf161 --- /dev/null +++ b/JavascriptDialogHandler.md @@ -0,0 +1,66 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/JavascriptDialogHandler + + +--- + + +# Javascript Dialog handler # + +Implement this interface to handle events related to Javascript dialogs. The methods of this class will be called on the UI thread. + +## JavascriptDialogCallback ## + +Callback interface used for asynchronous continuation of Javascript dialog +requests. + +void **Continue**(bool allow, str userInput) + +> Continue the javascript dialog request. Set |allow| to true if the OK button was +> pressed. The |userInput| value should be specified for prompt dialogs. + + +## Callbacks ## + +bool **OnJavascriptDialog**([Browser](Browser.md) browser, str origin\_url, str accept\_lang, int dialog\_type, str message\_text, str default\_prompt\_text, `JavascriptDialogCallback` callback, bool& suppress\_message`[0]`) + +> Called to run a Javascript dialog. The |default\_prompt\_text| value will be +> specified for prompt dialogs only. Set |suppress\_message| to true and +> return false to suppress the message (suppressing messages is preferable +> to immediately executing the callback as this is used to detect presumably +> malicious behavior like spamming alert messages in onbeforeunload). Set +> |suppress\_message| to false and return false to use the default +> implementation (the default implementation will show one modal dialog at a +> time and suppress any additional dialog requests until the displayed dialog +> is dismissed). Return true if the application will use a custom dialog or +> if the callback has been executed immediately. Custom dialogs may be either +> modal or modeless. If a custom dialog is used the application must execute +> |callback| once the custom dialog is dismissed. + +> The `dialog_type` param may be one of: +``` +cefpython.JSDIALOGTYPE_ALERT +cefpython.JSDIALOGTYPE_CONFIRM +cefpython.JSDIALOGTYPE_PROMPT +``` + + +bool **OnBeforeUnloadJavascriptDialog**([Browser](Browser.md) browser, str message\_text, bool is\_reload, `JavascriptDialogCallback` callback) + +> Called to run a dialog asking the user if they want to leave a page. Return +> false to use the default dialog implementation. Return true if the +> application will use a custom dialog or if the callback has been executed +> immediately. Custom dialogs may be either modal or modeless. If a custom +> dialog is used the application must execute |callback| once the custom +> dialog is dismissed. + + +void **OnResetJavascriptDialogState**([Browser](Browser.md) browser) + +> Called to cancel any pending dialogs and reset any saved dialog state. Will +> be called due to events like page navigation irregardless of whether any +> dialogs are currently pending. + + +void **OnJavascriptDialogClosed**([Browser](Browser.md) browser) + +> Called when the default implementation dialog is closed. \ No newline at end of file diff --git a/JavascriptErrors.md b/JavascriptErrors.md new file mode 100644 index 0000000..9b6f3a8 --- /dev/null +++ b/JavascriptErrors.md @@ -0,0 +1,21 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/JavascriptErrors + + +--- + + +# Javascript Errors # + +Typically when you browse a webpage your javascript errors appear in the developer tools javascript console. In cefadvanced.py example there is a binding to F12 key for opening developer tools. + +## Catching errors programmatically ## + +To catch errors programmatically implement [JavascriptContextHandler](JavascriptContextHandler.md).`OnUncaughtException()`. + +## Javascript bindings and callbacks ## + +When a python function is invoked from javascript and it fails, a python exception is thrown. It is written to the console and logged to the "error.log" file, then application exits. You may change this behavior by modifying `ExceptHook` function found in examples. + +A python exception might be thrown when in a context of a javascript callback. For example: javascript invokes a python function and passes a javascript callback to it, which is later called when python function finishes its job, if there is a javascript exception thrown during execution of the javascript callback, then a python exception will be thrown. + +See also [Issue 11](https://code.google.com/p/cefpython/issues/detail?id=11) - "Throw JS / Python exceptions according to execution context". \ No newline at end of file diff --git a/KeyboardHandler.md b/KeyboardHandler.md new file mode 100644 index 0000000..07f7ea6 --- /dev/null +++ b/KeyboardHandler.md @@ -0,0 +1,107 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/KeyboardHandler + + +--- + + +# KeyboardHandler callbacks # + +This handler allows you to handle events related to keyboard input and is called only for the main frame. + +For an example of how to implement handler see [cefpython](cefpython.md).CreateBrowser(). For a list of all handler interfaces see [API > Client handlers](API#Client_handlers.md). + +## CEF 3 ## + +bool **OnPreKeyEvent**([Browser](Browser.md) browser, `KeyEvent` event, `MSG*|GdkEvent*|NSEvent*` eventHandle, list& isKeyboardShortcutOut) + +> Called before a keyboard event is sent to the renderer. |event| contains +> information about the keyboard event. |eventHandle| is the operating system +> event message, if any. Return true if the event was handled or false +> otherwise. If the event will be handled in `OnKeyEvent()` as a keyboard +> shortcut, set `isKeyboardShortcutOut[0]` to true and return false. + +> `KeyEvent` is a dictionary with the following keys: + + * "**type**" (`KeyEventType`) - The type of keyboard event + * "**modifiers**" (uint32) - Bit flags describing any pressed modifier keys. See `KeyEventFlags` for values. + * "**windows\_key\_code**" (int) - The Windows key code for the key event. This value is used by the DOM specification. Sometimes it comes directly from the event (i.e. on Windows) and sometimes it's determined using a mapping function. See `"WebCore/platform/chromium/KeyboardCodes.h"` for the list of values. + * "**native\_key\_code**" (int) - The actual key code genenerated by the platform. + * "**is\_system\_key**" (int) - Indicates whether the event is considered a "system key" event (see http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for details). This value will always be false on non-Windows platforms. + * "**character**" (wchar\_t or unsigned short) - The character generated by the keystroke. + * "**unmodified\_character**" (wchar\_t or unsigned short) - Same as |character| but unmodified by any concurrently-held modifiers (except shift). This is useful for working out shortcut keys. + * "**focus\_on\_editable\_field**" (bool) - True if the focus is currently on an editable field on the page. This is useful for determining if standard key events should be intercepted. + +> `KeyEventType` is one of: + +> `cefpython.KEYEVENT_RAWKEYDOWN`
    +
    cefpython.KEYEVENT_KEYDOWN
    +cefpython.KEYEVENT_KEYUP
    +cefpython.KEYEVENT_CHAR
    + +
    KeyEventFlags constants ("modifiers" key):
    + +
    cefpython.EVENTFLAG_NONE
    +cefpython.EVENTFLAG_CAPS_LOCK_ON
    +cefpython.EVENTFLAG_SHIFT_DOWN
    +cefpython.EVENTFLAG_CONTROL_DOWN
    +cefpython.EVENTFLAG_ALT_DOWN
    +cefpython.EVENTFLAG_LEFT_MOUSE_BUTTON
    +cefpython.EVENTFLAG_MIDDLE_MOUSE_BUTTON
    +cefpython.EVENTFLAG_RIGHT_MOUSE_BUTTON
    +// Mac OS-X command key.
    +cefpython.EVENTFLAG_COMMAND_DOWN
    +cefpython.EVENTFLAG_NUM_LOCK_ON
    +cefpython.EVENTFLAG_IS_KEY_PAD
    +cefpython.EVENTFLAG_IS_LEFT
    +cefpython.EVENTFLAG_IS_RIGHT
    + + +bool OnKeyEvent(Browser browser, KeyEvent event, MSG*|GdkEvent*|NSEvent* eventHandle)
    +
    +
    Called after the renderer and JavaScript in the page has had a chance to
    +handle the event. |event| contains information about the keyboard event.
    +|os_event| is the operating system event message, if any. Return true if
    +the keyboard event was handled or false otherwise.
    + +
    Description of the KeyEvent type is in the OnPreKeyEvent() callback.
    + +

    CEF 1

    + +bool OnKeyEvent(Browser browser, int eventType, VirtualKey keyCode, int modifiers, bool isSystemKey, bool isAfterJavascript)
    +
    +
    Called when the browser component receives a keyboard event. This method
    +is called both before the event is passed to the renderer and after
    +javascript in the page has had a chance to handle the event. |type| is the type of keyboard event, |code| is the windows scan-code for the event, |modifiers| is a set of bit- flags describing any pressed modifier keys and |isSystemKey| is true if Windows considers this a WM_SYSKEYDOWN message.
    + +
    If |isAfterJavaScript| is true then javascript in the page has had a chance to handle the event and has chosen not to. Only KEYEVENT_RAWKEYDOWN, KEYEVENT_KEYDOWN and
    +KEYEVENT_CHAR events will be sent with |isAfterJavaScript| set to true. Return true if the keyboard event was handled or false to allow continued handling of the event by the renderer.
    + +
    |eventType| constants:
    + +
    cefpython.KEYEVENT_RAWKEYDOWN
    +cefpython.KEYEVENT_KEYDOWN
    +cefpython.KEYEVENT_KEYUP
    +cefpython.KEYEVENT_CHAR
    + +
    Example of implementing KeyboardHandler:
    + +
    	def OnKeyEvent(browser, eventType, keyCode, modifiers, isSystemKey, isAfterJavascript):
    + # Let's bind developer tools to F12 key.
    + if keyCode == cefpython.VK_F12 and eventType == cefpython.KEYEVENT_RAWKEYDOWN and cefpython.IsKeyModifier(cefpython.KEY_NONE, modifiers) and not isSystemKey:
    + browser.ShowDevTools()
    + return True
    + # Bind F5 to refresh browser window.
    + if keyCode == cefpython.VK_F5 and eventType == cefpython.KEYEVENT_RAWKEYDOWN and cefpython.IsKeyModifier(cefpython.KEY_NONE, modifiers) and not isSystemKey:
    + browser.ReloadIgnoreCache()
    + return True
    + return False
    +
    + +
    To check against |modifiers| you can use function cefpython.IsKeyModifier(KEY_*, modifiers) where KEY_* is one of:
    + +
    cefpython.KEY_NONE # neither of alt/shift/ctrl is pressed
    +cefpython.KEY_SHIFT
    +cefpython.KEY_CTRL
    +cefpython.KEY_ALT
    +cefpython.KEY_META
    +cefpython.KEY_KEYPAD
    \ No newline at end of file diff --git a/Kivy.md b/Kivy.md new file mode 100644 index 0000000..8202ebb --- /dev/null +++ b/Kivy.md @@ -0,0 +1,17 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/Kivy + + +--- + + +# Kivy example # + +Example of embedding an off-screen rendered browser using the [Kivy](http://kivy.org/) framework. See also [garden.cefpython](https://github.com/kivy-garden/garden.cefpython) on github. + +## Source ## + +https://code.google.com/p/cefpython/source/browse/cefpython/cef3/linux/binaries_64bit/kivy_.py + +## Screenshot ## + +![https://cefpython.googlecode.com/git/cefpython/var/kivy-screenshot.png](https://cefpython.googlecode.com/git/cefpython/var/kivy-screenshot.png) \ No newline at end of file diff --git a/KnowledgeBase.md b/KnowledgeBase.md new file mode 100644 index 0000000..677513c --- /dev/null +++ b/KnowledgeBase.md @@ -0,0 +1,19 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/KnowledgeBase + + +--- + + +# Knowledge Base # + +## Black/White browser screen ## + +If you get a black or white screen then this may be caused by incompatible GPU (video card) drivers. There are following solutions to this: + +1. When CEF Python is updated to a newer Chrome version then the problem may be fixed. Check with current Google Chrome if this is the case. + +2. Try updating your video card drivers to the latest version available. + +3. You can disable GPU hardware acceleration by adding the "disable-gpu" and "disable-gpu-compositing" command line switches. See the CommandLineSwitches wiki page. Note that this will degrade performance if you're using any advanced 3D features. It will affect 2d accelerated content as well. + +Note that when web page uses WebGL then the black screen may still appear even after disabling GPU hardware acceleration. However that shouldn't be a concern as it's not supposed to work anyway. Though you may not see a nice message about WebGL not being supported. All other websites that do not use webgl will work fine. \ No newline at end of file diff --git a/LifespanHandler.md b/LifespanHandler.md new file mode 100644 index 0000000..1f85dd8 --- /dev/null +++ b/LifespanHandler.md @@ -0,0 +1,87 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/LifespanHandler + + +--- + + +# LifespanHandler callbacks # + +Implement this interface to handle events related to browser life span. The methods of this class will be called on the UI thread. + +For an example of how to implement a handler see [cefpython](cefpython.md).CreateBrowser(). For a list of all handler interfaces see [API > Client handlers](API#Client_handlers.md). + +## CEF 3 ## + +bool **OnBeforePopup**([Browser](Browser.md) browser, [Frame](Frame.md) frame, string targetUrl, string targetFrameName, dict popupFeatures, list out windowInfo, object client, list out browserSettings, list out noJavascriptAccess) + +> Called on the IO thread before a new popup window is created. The |browser| +> and |frame| parameters represent the source of the popup request. The +> |targetUrl| and |targetFrameName| values may be empty if none were +> specified with the request. The |popupFeatures| structure contains +> information about the requested popup window. To allow creation of the +> popup window optionally modify |windowInfo`[0]`| (see WindowInfo), |client|, |browserSettings`[0]`| (see BrowserSettings) and +> |noJavascriptAccess`[0]`| and return false. To cancel creation of the popup +> window return true. The |client| and |settings| values will default to the +> source browser's values. The |`noJavascriptAccess[0]`| value indicates whether +> the new browser window should be scriptable and in the same process as the +> source browser. + +> Note that if you return True and create the popup window yourself, then the popup window and parent window will not be able to script each other. There will be no "window.opener" property available in the popup window. + +> Arguments not yet ported (None value): popupFeatures, windowInfo, client, browserSettings. + +void **`_`OnAfterCreated**([Browser](Browser.md) browser) + +> Called after a new browser is created. + +> This callback will be executed during browser creation, thus you must call [cefpython](cefpython.md).`SetGlobalClientCallback()` to use it. The callback name was prefixed with "`_`" to distinguish this special behavior. + +bool **RunModal**([Browser](Browser.md) browser) + +> Called when a modal window is about to display and the modal loop should +> begin running. Return false to use the default modal loop implementation or +> true to use a custom implementation. + +bool **DoClose**([Browser](Browser.md) browser) + +> Called when a browser has recieved a request to close. This may result +> directly from a call to [Browser](Browser.md).`CloseBrowser` or indirectly if the +> browser is a top-level OS window created by CEF and the user attempts to +> close the window. This method will be called after the Javascript +> 'onunload' event has been fired. It will not be called for browsers after +> the associated OS window has been destroyed (for those browsers it is no +> longer possible to cancel the close). + +> See complete description of this callback in [cef\_life\_span\_handler.h](https://code.google.com/p/cefpython/source/browse/cefpython/cef3/include/cef_life_span_handler.h#93). + +void **OnBeforeClose**([Browser](Browser.md) browser) + +> Called just before a browser is destroyed. Release all references to the +> browser object and do not attempt to execute any methods on the browser +> object after this callback returns. If this is a modal window and a custom +> modal loop implementation was provided in `RunModal()` this callback should +> be used to exit the custom modal loop. See `DoClose()` documentation for +> additional usage information. + + +## CEF 1 ## + +bool **DoClose**([Browser](Browser.md) `browser`) + +> Called when a window has recieved a request to close. Return false to proceed with the window close or true to cancel the window close. If this is a modal window and a custom modal loop implementation was provided in RunModal() this callback should be used to restore the opener window to a usable state. + +void **OnAfterCreated**([Browser](Browser.md) `browser`) + +> Called after a new window is created. + +void **OnBeforeClose**([Browser](Browser.md) `browser`) + +> Called just before a window is closed. If this is a modal window and a custom modal loop implementation was provided in RunModal() this callback should be used to exit the custom modal loop. + +bool **OnBeforePopup**([Browser](Browser.md) `parentBrowser`, CefPopupFeatures& `popupFeatures`, CefWindowInfo &`windowInfo`, string &`url`, [BrowserSettings](BrowserSettings.md) &`settings`) + +> Not yet implemented. Called before a new popup window is created. The |parentBrowser| parameter will point to the parent browser window. The |popupFeatures| parameter will contain information about the style of popup window requested. Return false to have the framework create the new popup window based on the parameters in |windowInfo|. Return true to cancel creation of the popup window. By default, a newly created popup window will have the same client and settings as the parent window. To change the client for the new window modify the object that |client| points to. To change the settings for the new window modify the |settings| structure. + +bool **RunModal**([Browser](Browser.md) `browser`) + +> Called when a modal window is about to display and the modal loop should begin running. Return false to use the default modal loop implementation or true to use a custom implementation. \ No newline at end of file diff --git a/LoadHandler.md b/LoadHandler.md new file mode 100644 index 0000000..4562eb4 --- /dev/null +++ b/LoadHandler.md @@ -0,0 +1,80 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/LoadHandler + + +--- + + +# LoadHandler callbacks # + +Implement this interface to handle events related to browser load status. The methods of this class will be called on the UI thread. + +For an example of how to implement handler see [cefpython](cefpython.md).CreateBrowser(). For a list of all handler interfaces see [API > Client handlers](API#Client_handlers.md). + +## CEF 3 ## + +void **OnLoadingStateChange**([Browser](Browser.md) browser, bool isLoading, bool canGoBack, bool canGoForward) + +> Called when the loading state has changed. This callback will be executed +> twice. Once when loading is initiated either programmatically or by user +> action, and once when loading is terminated due to completion, cancellation +> of failure. + +void **OnLoadStart**([Browser](Browser.md) browser, [Frame](Frame.md) frame) + +> Called when the browser begins loading a frame. The |frame| value will +> never be empty -- call the IsMain() method to check if this frame is the +> main frame. Multiple frames may be loading at the same time. Sub-frames may +> start or continue loading after the main frame load has ended. This method +> may not be called for a particular frame if the load request for that frame +> fails. For notification of overall browser load status use +> [DisplayHandler](DisplayHandler.md).`OnLoadingStateChange` instead. + +void **OnDomReady**() + +> Not yet implemented. See [Issue 32](https://code.google.com/p/cefpython/issues/detail?id=32). + +void **OnLoadEnd**([Browser](Browser.md) browser, [Frame](Frame.md) frame, int httpStatusCode) + +> Called when the browser is done loading a frame. The |frame| value will +> never be empty -- call the IsMain() method to check if this frame is the +> main frame. Multiple frames may be loading at the same time. Sub-frames may +> start or continue loading after the main frame load has ended. This method +> will always be called for all frames irrespective of whether the request +> completes successfully. + +> This event behaves like window.onload, it waits for all the content to load (e.g. images), there is currently no callback for a DOMContentLoaded event, see [Issue 32](https://code.google.com/p/cefpython/issues/detail?id=32). + +> There are some cases when this callback won't get called, see this topic: http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=10906 + +void **OnLoadError**([Browser](Browser.md) browser, [Frame](Frame.md) frame, [NetworkError](NetworkError.md) errorCode, list& errorText, string failedUrl) + +> Called when the resource load for a navigation fails or is canceled. +> |errorCode| is the error code number, |`errorText[0]`| is the error text and +> |failedUrl| is the URL that failed to load. See net\base\net\_error\_list.h +> for complete descriptions of the error codes. + +> This callback may get called when [Browser](Browser.md).`StopLoad` is called, or when file download is aborted (see DownloadHandler). + +## CEF 1 ## + +void **OnDomReady**() + +> Not yet implemented. See [Issue 32](https://code.google.com/p/cefpython/issues/detail?id=32). + +void **OnLoadEnd**([Browser](Browser.md) `browser`, [Frame](Frame.md) `frame`, int `httpStatusCode`) + +> Called when the browser is done loading a frame (top frame, iframe, frameset, popup). The |Frame| value will never be empty -- call the IsMain() method to check if this frame is the main frame. Multiple frames may be loading at the same time. Sub-frames may start or continue loading after the main frame load has ended. This method will always be called for all frames irrespective of whether the request completes successfully. + +> This event behaves like window.onload, it waits for all the content to load (e.g. images), there is currently no callback for a DOMContentLoaded event, see [Issue 32](https://code.google.com/p/cefpython/issues/detail?id=32). + +> There are some cases when this callback won't get called, see this topic: http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=10906 + +bool **OnLoadError**([Browser](Browser.md) `browser`, [Frame](Frame.md) `frame`, int [errorCode](NetworkError.md), string `failedURL`, string list &`errorText`) + +> Called when the browser fails to load a frame (top frame, iframe, frameset, popup). |errorCode| is the error code number and |failedUrl| is the URL that failed to load. To provide custom error text assign the text to `errorText[0]` and return true. Otherwise, return false for the default error text. + +> OnLoadError may be called very early in the navigation process before |frame| or its GetURL() value has been set, thus the availability of additional parameter `failedURL`. + +void **OnLoadStart**([Browser](Browser.md), [Frame](Frame.md)) + +> Called when the browser begins loading a frame (top frame, iframe, frameset, popup). The |Frame| value will never be empty -- call the IsMain() method to check if this frame is the main frame. Multiple frames may be loading at the same time. Sub-frames may start or continue loading after the main frame load has ended. This method may not be called for a particular frame if the load request for that frame fails. \ No newline at end of file diff --git a/NetworkError.md b/NetworkError.md new file mode 100644 index 0000000..b248361 --- /dev/null +++ b/NetworkError.md @@ -0,0 +1,245 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/NetworkError + + +--- + + +# Network error constants # + +These constants are for use with: [LoadHandler](LoadHandler.md).`OnLoadError()`, [WebRequestClient](WebRequestClient.md).`OnError()`, [RequestHandler](RequestHandler.md).`OnCertificateError()`. + +For an up-to-date list of error codes see "net\_error\_list.h" in the Chromium trunk: http://src.chromium.org/viewvc/chrome/trunk/src/net/base/net_error_list.h?view=markup + +cefpython.**ERR\_NONE** + +> No error. + +cefpython.**ERR\_ABORTED** + +> An operation was aborted (due to user action). + +cefpython.**ERR\_ACCESS\_DENIED** + +> Permission to access a resource, other than the network, was denied. + +cefpython.**ERR\_ADDRESS\_INVALID** + +> The IP address or port number is invalid (e.g., cannot connect to the IP address 0 or the port 0). + +cefpython.**ERR\_ADDRESS\_UNREACHABLE** + +> The IP address is unreachable. This usually means that there is no route to the specified host or network. + +cefpython.**ERR\_CACHE\_MISS** + +> The cache does not have the requested entry. + +cefpython.**ERR\_CERT\_AUTHORITY\_INVALID** + +> The server responded with a certificate that is signed by an authority +> we don't trust. That could mean: + + 1. An attacker has substituted the real certificate for a cert that contains his public key and is signed by his cousin. + 1. The server operator has a legitimate certificate from a CA we don't know about, but should trust. + 1. The server is presenting a self-signed certificate, providing no defense against active attackers (but foiling passive attackers). + +cefpython.**ERR\_CERT\_COMMON\_NAME\_INVALID** + +> The server responded with a certificate whose common name did not match +> the host name. This could mean: + + 1. An attacker has redirected our traffic to his server and is presenting a certificate for which he knows the private key. + 1. The server is misconfigured and responding with the wrong cert. + 1. The user is on a wireless network and is being redirected to the network's login page. + 1. The OS has used a DNS search suffix and the server doesn't have a certificate for the abbreviated name in the address bar. + +cefpython.**ERR\_CERT\_CONTAINS\_ERRORS** + +> The server responded with a certificate that contains errors. +> This error is not recoverable. MSDN describes this error as follows: +> "The SSL certificate contains errors." +> NOTE: It's unclear how this differs from ERR\_CERT\_INVALID. For consistency, +> use that code instead of this one from now on. + +cefpython.**ERR\_CERT\_DATE\_INVALID** + +> The server responded with a certificate that, by our clock, appears to +> either not yet be valid or to have expired. This could mean: + + 1. An attacker is presenting an old certificate for which he has managed to obtain the private key. + 1. The server is misconfigured and is not presenting a valid cert. + 1. Our clock is wrong. + +cefpython.**ERR\_CERT\_END** + +> The value immediately past the last certificate error code. + +cefpython.**ERR\_CERT\_INVALID** + +> The server responded with a certificate that is invalid. +> This error is not recoverable. +> MSDN describes this error as follows: +> "The SSL certificate is invalid." + +cefpython.**ERR\_CERT\_NO\_REVOCATION\_MECHANISM** + +> The certificate has no mechanism for determining if it is revoked. In +> effect, this certificate cannot be revoked. + +cefpython.**ERR\_CERT\_REVOKED** + +> The server responded with a certificate has been revoked. +> We have the capability to ignore this error, but it is probably not the +> thing to do. + +cefpython.**ERR\_CERT\_UNABLE\_TO\_CHECK\_REVOCATION** + +> Revocation information for the security certificate for this site is not +> available. This could mean: + + 1. An attacker has compromised the private key in the certificate and is blocking our attempt to find out that the cert was revoked. + 1. The certificate is unrevoked, but the revocation server is busy or unavailable. + +cefpython.**ERR\_CONNECTION\_ABORTED** + +> A connection timed out as a result of not receiving an ACK for data sent. +> This can include a FIN packet that did not get ACK'd. + +cefpython.**ERR\_CONNECTION\_CLOSED** + +> A connection was closed (corresponding to a TCP FIN). + +cefpython.**ERR\_CONNECTION\_FAILED** + +> A connection attempt failed. + +cefpython.**ERR\_CONNECTION\_REFUSED** + +> A connection attempt was refused. + +cefpython.**ERR\_CONNECTION\_RESET** + +> A connection was reset (corresponding to a TCP RST). + +cefpython.**ERR\_DISALLOWED\_URL\_SCHEME** + +> The scheme of the URL is disallowed. + +cefpython.**ERR\_EMPTY\_RESPONSE** + +> The server closed the connection without sending any data. + +cefpython.**ERR\_FAILED** + +> A generic failure occurred. + +cefpython.**ERR\_FILE\_NOT\_FOUND** + +> The file or directory cannot be found. + +cefpython.**ERR\_FILE\_TOO\_BIG** + +> The file is too large. + +cefpython.**ERR\_INSECURE\_RESPONSE** + +> The server's response was insecure (e.g. there was a cert error). + +cefpython.**ERR\_INTERNET\_DISCONNECTED** + +> The Internet connection has been lost. + +cefpython.**ERR\_INVALID\_ARGUMENT** + +> An argument to the function is incorrect. + +cefpython.**ERR\_INVALID\_CHUNKED\_ENCODING** + +> Error in chunked transfer encoding. + +cefpython.**ERR\_INVALID\_HANDLE** + +> The handle or file descriptor is invalid. + +cefpython.**ERR\_INVALID\_RESPONSE** + +> The server's response was invalid. + +cefpython.**ERR\_INVALID\_URL** + +> The URL is invalid. + +cefpython.**ERR\_METHOD\_NOT\_SUPPORTED** + +> The server did not support the request method. + +cefpython.**ERR\_NAME\_NOT\_RESOLVED** + +> The host name could not be resolved. + +cefpython.**ERR\_NO\_SSL\_VERSIONS\_ENABLED** + +> No SSL protocol versions are enabled. + +cefpython.**ERR\_NOT\_IMPLEMENTED** + +> The operation failed because of unimplemented functionality. + +cefpython.**ERR\_RESPONSE\_HEADERS\_TOO\_BIG** + +> The headers section of the response is too large. + +cefpython.**ERR\_SSL\_CLIENT\_AUTH\_CERT\_NEEDED** + +> The server requested a client certificate for SSL client authentication. + +cefpython.**ERR\_SSL\_PROTOCOL\_ERROR** + +> An SSL protocol error occurred. + +cefpython.**ERR\_SSL\_RENEGOTIATION\_REQUESTED** + +> The server requested a renegotiation (rehandshake). + +cefpython.**ERR\_SSL\_VERSION\_OR\_CIPHER\_MISMATCH** + +> The client and server don't support a common SSL protocol version or +> cipher suite. + +cefpython.**ERR\_TIMED\_OUT** + +> An operation timed out. + +cefpython.**ERR\_TOO\_MANY\_REDIRECTS** + +> Attempting to load an URL resulted in too many redirects. + +cefpython.**ERR\_TUNNEL\_CONNECTION\_FAILED** + +> A tunnel connection through the proxy could not be established. + +cefpython.**ERR\_UNEXPECTED** + +> An unexpected error. This may be caused by a programming mistake or an +> invalid assumption. + +cefpython.**ERR\_UNEXPECTED\_PROXY\_AUTH** + +> The response was 407 (Proxy Authentication Required), yet we did not send +> the request to a proxy. + +cefpython.**ERR\_UNKNOWN\_URL\_SCHEME** + +> The scheme of the URL is unknown. + +cefpython.**ERR\_UNSAFE\_PORT** + +> Attempting to load an URL with an unsafe port number. These are port +> numbers that correspond to services, which are not robust to spurious input +> that may be constructed as a result of an allowed web construct (e.g., HTTP +> looks a lot like SMTP, so form submission to port 25 is denied). + +cefpython.**ERR\_UNSAFE\_REDIRECT** + +> Attempting to load an URL resulted in an unsafe redirect (e.g., a redirect +> to file:// is considered unsafe). \ No newline at end of file diff --git a/PaintBuffer.md b/PaintBuffer.md new file mode 100644 index 0000000..7b0a9c1 --- /dev/null +++ b/PaintBuffer.md @@ -0,0 +1,21 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/PaintBuffer + + +--- + + +# PaintBuffer object # + +This object is related to: [Browser](Browser.md).GetImage() and [RenderHandler](RenderHandler.md).OnPaint(). + +long **GetIntPointer**() + +> Get int pointer to the `void*` buffer. + +object **GetString**(string `mode`="bgra", string `origin`="top-left") + +> Converts the `void*` buffer to string. In Py2 returns 'str' type, in Py3 returns 'bytes' type. + +> `origin` may be one of: "top-left", "bottom-left". + +> `mode` may be one of: "bgra", "rgba". \ No newline at end of file diff --git a/Panda3D.md b/Panda3D.md new file mode 100644 index 0000000..937ac07 --- /dev/null +++ b/Panda3D.md @@ -0,0 +1,19 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/Panda3D + + +--- + + +# Panda3D example # + +An example of CEF off-screen rendering using the [Panda3D](http://www.panda3d.org/) game engine. See [this video](http://www.youtube.com/watch?v=tV7ei1Z40fQ) for an example of how cool it might look in a game. + +## Source ## + +An example for CEF 3 is an externally maintained package. See the [basic.py](https://gist.github.com/croxis/9789973) gist. For more details see [this topic](http://www.panda3d.org/forums/viewtopic.php?f=8&t=16861) on the Panda3D forum. + +The official example ships only with the CEF 1 binaries and wasn't yet ported to CEF 3. See [panda3d\_.py](https://code.google.com/p/cefpython/source/browse/cefpython/cef1/windows/binaries/panda3d_.py?r=27b90c808fb5). + +## Screenshot ## + +![http://cefpython.googlecode.com/git/cefpython/var/panda3d.png](http://cefpython.googlecode.com/git/cefpython/var/panda3d.png) \ No newline at end of file diff --git a/Plugins.md b/Plugins.md new file mode 100644 index 0000000..57dac80 --- /dev/null +++ b/Plugins.md @@ -0,0 +1,43 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/Plugins + + +--- + + +# Plugins # + +CEF Python automatically loads plugins installed on your system, it works similarly to Chrome. To disable loading of plugins you have to set BrowserSettings.`plugins_disabled` to True for each browser you create. + +Both CEF 1 & CEF 3 support NPAPI plugins. CEF 3 supports also PPAPI plugins, but it is not yet fully tested. + +To see a list of plugins that are being loaded run `cefclient.exe`, a test browser that is included in cefpython binary zip, from the menu select Tests > Plugin Info. + +## Enable Flash Player ## + +To enable Flash player in CEF Python you have to install NPAPI version of Flash in your OS: + + 1. Go to http://get.adobe.com/flashplayer/otherversions/ + 1. Select your operating system + 1. Select NPAPI version of plugin (for Firefox) + +After that run cefclient.exe > Tests > Plugin Info and you should see: + +``` +Flash is installed! +Name: Shockwave Flash +Description: Shockwave Flash 11.5 r502 +Version: 11,5,502,110 +Path: C:\Windows\SysWOW64\Macromed\Flash\NPSWF32_11_5_502_110.dll +``` + +## Flash on Linux ## + +Flash plugin will crash on Linux in CEF 1, see [Issue 553 in CEF Issue Tracker](http://code.google.com/p/chromiumembedded/issues/detail?id=553). + +## Custom plugins ## + +With CEF you can load custom plugin by providing a path to it. In CEF 1 you can do this through ApplicationSettings.`extra_plugin_paths` option, but it is not yet implemented in cefpython 1. In CEF 3 there are functions `CefAddWebPluginPath()` & `CefAddWebPluginDirectory()` defined in `cef_web_plugin.h`, but it is also not yet implemented in cefpython 3. + +Google Chrome comes with an internal flash player called Pepper Flash Player (a PPAPI plugin), it can be found in `"c:\Program Files (x86)\Google\Chrome\Application\23.0.1271.91\PepperFlash"`, but to be able to distribute it with your app you need a licensing agreement in place with Adobe. + +There is an api in CEF for getting info about a plugin, the file is "include/cef\_web\_plugin.h", it is not yet implemented in cefpython. \ No newline at end of file diff --git a/ProjectHome.md b/ProjectHome.md new file mode 100644 index 0000000..929a6f8 --- /dev/null +++ b/ProjectHome.md @@ -0,0 +1,74 @@ +Project will move to github: https://github.com/cztomczak/cefpython + + +--- + + + + + +
    +

    CEF Python

    +
    +
    + + + +
    + +## Introduction ## + +CEF Python is an open source project founded by [Czarek Tomczak](http://www.linkedin.com/in/czarektomczak) in 2012 to provide python bindings for the [Chromium Embedded Framework](http://code.google.com/p/chromiumembedded/). See the growing list of [applications using CEF](http://en.wikipedia.org/wiki/Chromium_Embedded_Framework#Applications_using_CEF) on wikipedia. Examples of embedding CEF browser are available for many popular GUI toolkits including: [wxPython](wxPython.md), [PyGTK](PyGTK.md), [PyQt](PyQt.md), [PySide](PySide.md), [Kivy](Kivy.md), [Panda3D](Panda3D.md) and [PyWin32](https://code.google.com/p/cefpython/source/browse/cefpython/cef3/windows/binaries_32bit/pywin32.py). + +Some use cases for CEF: + * Embed a web browser control with great HTML5 support (based on Chromium) + * Use it to create a HTML5 based GUI in an application. This can act as a replacement for GUI toolkits like wxWidgets/Qt/Gtk. For native communication between javascript and python use [javascript bindings](JavascriptBindings.md). Another option is to run an internal python web server and use websockets/XMLHttpRequest for js<>python communication. This way you can write a desktop app in the same way you write web apps. + * Render web content off-screen in applications that use custom drawing frameworks. See the [Kivy](Kivy.md) and [Panda3D](Panda3D.md) examples. + * Use it for automated testing of existing web applications. Use it for web scraping, or as a web crawler or other kind of internet bots. + +## Supported Python versions and platforms ## + + * Supported Python versions: 2.7 (Python 3.4 will be supported soon, see [Issue 121](https://code.google.com/p/cefpython/issues/detail?id=121)) + * Supported platforms: Windows, Linux, Mac (both 32bit and 64bit binaries are available for all platforms) + +## Downloads ## + + * For Windows: see the [Download\_CEF3\_Windows](Download_CEF3_Windows.md) wiki page. + * For Linux: see the [Download\_CEF3\_Linux](Download_CEF3_Linux.md) wiki page. + * For Mac: see the [Download\_CEF3\_Mac](Download_CEF3_Mac.md) wiki page. + +## Help ## + + * Documentation is on the [wiki pages](http://code.google.com/p/cefpython/w/list). Start with the [API](API.md) page. + * Ask questions and report problems on the [CEF Python Forum](https://groups.google.com/group/cefpython). + * Please do not use the [Issue Tracker](http://code.google.com/p/cefpython/issues/list) for asking questions. + * Instructions on how to enable Flash Player are on the [Plugins](Plugins.md) wiki page. + * Having problems with playing audio or video? See the [AudioVideo](AudioVideo.md) wiki page. + +## Watch the project ## + + * To watch all issues updates subscribe to the [issueupdates RSS feed](https://code.google.com/feeds/p/cefpython/issueupdates/basic) + * To watch Git commits subscribe to the [gitchanges RSS feed](https://code.google.com/feeds/p/cefpython/gitchanges/basic) + * Starring issue gets you email notifications when issue is updated + * Join the [Forum](http://groups.google.com/group/cefpython) and set membership settings to send Daily summaries via email + +## Support development ## + + If you are interested in donating time to help with the CEF Python development please see the [InternalDevelopment](InternalDevelopment.md) wiki page. If you would like to support general CEF Python development efforts by making a donation please click the Paypal "Donate" button to the right. At this time CEF Python is unable to accept donations that sponsor the development of specific features. If you are interested in sponsorship opportunities please contact Czarek directly. + +### Thanks ### + + * Thanks to the numerous individuals that made a Paypal donation: Walter Purvis, Rokas Stupuras, Alex Rattray, Greg Kacy, Paul Korzhyk. + * Thanks to those that have donated their time through code contributions: see the [AUTHORS.txt](https://code.google.com/p/cefpython/source/browse/cefpython/AUTHORS.txt) file. Patches can be attached in the issue tracker. + * Many thanks to [Cyan Inc.](http://www.cyaninc.com/) for sponsoring this project, making CEF Python 3 more mature. Lots of new features were added, including javascript bindings and Linux support. + * Thanks to [Rentouch GmbH](http://www.rentouch.ch/) for sponsoring the development of the off-screen rendering support in CEF Python 3. + * Thanks to Thomas Wusatiuk for sponsoring the development of the web response reading features in CEF Python 3. + * Thanks to Adam Duston for donating a Macbook to aid the development of the Mac port. + +## Built a cool app? ## + +Built a cool app using CEF Python and would like to share info with the community? Talk about it on the [CEF Python Forum](https://groups.google.com/group/cefpython?hl=en). + +## Familiar with PHP or Go? ## + +The author of CEF Python is also working on CEF bindings for other languages such as PHP and Go. For PHP take a look at the [PHP Desktop](http://code.google.com/p/phpdesktop/) project. For Go see the [CEF2go](https://github.com/CzarekTomczak/cef2go) project on GitHub. \ No newline at end of file diff --git a/PyGTK.md b/PyGTK.md new file mode 100644 index 0000000..9623846 --- /dev/null +++ b/PyGTK.md @@ -0,0 +1,17 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/PyGTK + + +--- + + +# PyGTK example # + +An example of embedding CEF browser in a PyGTK application. + +## Source ## + +http://code.google.com/p/cefpython/source/browse/cefpython/cef3/windows/binaries_32bit/pygtk_.py + +## Screenshot ## + +![http://cefpython.googlecode.com/git/cefpython/var/pygtk.png](http://cefpython.googlecode.com/git/cefpython/var/pygtk.png) \ No newline at end of file diff --git a/PyQt.md b/PyQt.md new file mode 100644 index 0000000..1eed1f5 --- /dev/null +++ b/PyQt.md @@ -0,0 +1,17 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/PyQt + + +--- + + +# PyQt example # + +An example of embedding CEF Python in a PyQt application. + +## Source ## + +http://code.google.com/p/cefpython/source/browse/cefpython/cef3/windows/binaries_32bit/pyqt.py + +## Screenshot ## + +![http://cefpython.googlecode.com/git/cefpython/var/pyqt.png](http://cefpython.googlecode.com/git/cefpython/var/pyqt.png) \ No newline at end of file diff --git a/PySide.md b/PySide.md new file mode 100644 index 0000000..2f2ae14 --- /dev/null +++ b/PySide.md @@ -0,0 +1,17 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/PySide + + +--- + + +# PySide example # + +An example of embedding CEF Python in a PySide application. + +## Source ## + +http://code.google.com/p/cefpython/source/browse/cefpython/cef3/windows/binaries_32bit/pyside.py + +## Screenshot ## + +![http://cefpython.googlecode.com/git/cefpython/var/pyside.png](http://cefpython.googlecode.com/git/cefpython/var/pyside.png) \ No newline at end of file diff --git a/ReleaseNotes.md b/ReleaseNotes.md new file mode 100644 index 0000000..6fa2341 --- /dev/null +++ b/ReleaseNotes.md @@ -0,0 +1,145 @@ +Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/ReleaseNotes + + +--- + + +# Release notes # + +Version 31.3 not yet released. + * Added `__version__` attribute in the cefpython3.cefpython module ([Issue 167](https://code.google.com/p/cefpython/issues/detail?id=167)) + * Added methods [Browser](Browser.md).`ExecuteFunction()` / `ExecuteJavascript()` which are wrappers for calling [Browser](Browser.md).`GetMainFrame()`.`ExecuteFunction()` / `ExecuteJavascript()`. + * Added functions [cefpython](cefpython.md).`GetAppSetting()` / `GetCommandLineSwitch()` + +Version 31.2 released on January 10, 2015. + * Initial release of Windows 64bit binaries ([Issue 82](https://code.google.com/p/cefpython/issues/detail?id=82)) + * Initial release for Mac ([Issue 21](https://code.google.com/p/cefpython/issues/detail?id=21)). See the [Download\_CEF3\_Mac](Download_CEF3_Mac.md) and BuildOnMac wiki pages. + * Fixed BC break in cefpython.wx.chromectrl introduced in 31.1 + * Windows binaries do not ship the msvcr90.dll and Microsoft.VC90.CRT.manifest files anymore. The subprocess.exe executable does not depend on msvcr90.dll anymore. + +Version 31.1 released on December 4, 2014. + * (Windows) When cefpython detects that application is DPI aware (may be enabled by user in .exe properties) then it will set ApplicationSettings."auto\_zooming" to "system\_dpi" automatically. Added the DpiAware.`IsProcessDpiAware` method. See revision c11190523824. + * Added new callbacks to LifespanHandler: `_OnAfterCreated`, `RunModal`, `DoClose`, `OnBeforeClose`. Thanks to Simon Hatt for the patch ([Issue 139](https://code.google.com/p/cefpython/issues/detail?id=139)). + * Fixed issue with `GetApplicationPath()` returning wrong directory in some cases. All examples have been updated. See revision 6b141a8f54b4. + * Improvements to Linux installers (debian package, setup.py). See [Issue 149](https://code.google.com/p/cefpython/issues/detail?id=149), [Issue 147](https://code.google.com/p/cefpython/issues/detail?id=147), [Issue 145](https://code.google.com/p/cefpython/issues/detail?id=145), [Issue 105](https://code.google.com/p/cefpython/issues/detail?id=105), [Issue 99](https://code.google.com/p/cefpython/issues/detail?id=99). + * Windows users can now install cefpython3 package from PyPI. [Issue 144](https://code.google.com/p/cefpython/issues/detail?id=144). + +Version 31.0 released on August 1, 2014. + * Updated Chrome to version 31.0.1650.69 ([Issue 124](https://code.google.com/p/cefpython/issues/detail?id=124)) + * Added Qt example on Linux ([Issue 88](https://code.google.com/p/cefpython/issues/detail?id=88)) + * Added GTK example on Linux ([Issue 95](https://code.google.com/p/cefpython/issues/detail?id=95)) + * Added High DPI support on Windows. See the DpiAware wiki page and the ApplicationSettings.`auto_zooming` option. Example usage is in the wxpython.py example. See [Issue 112](https://code.google.com/p/cefpython/issues/detail?id=112), [Issue 128](https://code.google.com/p/cefpython/issues/detail?id=128). + * Added Developer Tools support. See [Browser](Browser.md).`ShowDevTools`. Can be launched from mouse context menu as well. See also ApplicationSettings.`remote_debugging_port`, a default value of 0 enables devtools, to disable set it to -1. ([Issue 81](https://code.google.com/p/cefpython/issues/detail?id=81)) + * Mouse context menu is now configurable, see ApplicationSettings.`context_menu`. New menu items added: "Reload", "Open in external browser", "Developer Tools". ([Issue 122](https://code.google.com/p/cefpython/issues/detail?id=122)) + * Implemented a default DownloadHandler. File downloads are handled automatically with no additional code required. Added new option ApplicationSettings.`downloads_enabled`. ([Issue 87](https://code.google.com/p/cefpython/issues/detail?id=87)) + * Exposed API for execution of tasks on various threads. This fixes problems with keyboard in popups in the wxpython.py example on Windows, an example usage is there. See [cefpython](cefpython.md).`PostTask`. See [Issue 61](https://code.google.com/p/cefpython/issues/detail?id=61), [Issue 80](https://code.google.com/p/cefpython/issues/detail?id=80). + * Fixed issues with embedding multiple browsers in tabs ([Issue 97](https://code.google.com/p/cefpython/issues/detail?id=97)) + * Fixed CEF message loop processing in wx.chromectrl, it could cause performance penalties when opening multiple browser tabs/windows ([Issue 129](https://code.google.com/p/cefpython/issues/detail?id=129)) + * Fixed the browser cleanup code in the `OnClose` event in the wxpython examples, it could possibly cause crashes during shutdown ([Issue 107](https://code.google.com/p/cefpython/issues/detail?id=107)) + * Fixed a crash in V8 javascript bindings when a call to [Frame](Frame.md).`LoadUrl` changed origin (scheme + domain). For example when a redirect to a different domain was being made. This problem occured only when javascript bindings were set ([Issue 130](https://code.google.com/p/cefpython/issues/detail?id=130)). + * Enabled caching on HTTPS even when there is certificate error, but only when ApplicationSettings.`ignore_certificate_errors` is set to True ([Issue 125](https://code.google.com/p/cefpython/issues/detail?id=125)) + * Disabled tcmalloc hook on Linux in the CEF Python official binaries. It caused crashes when cefpython was not the very first library being imported ([Issue 73](https://code.google.com/p/cefpython/issues/detail?id=73)). + * Added the JavascriptDialogHandler ([Issue 118](https://code.google.com/p/cefpython/issues/detail?id=118)) + * Added new option ApplicationSettings.unique\_request\_context\_per\_browser + * Fixed problems with unique cookie manager per browser session. See notes in the RequestHandler.`GetCookieManager` callback ([Issue 126](https://code.google.com/p/cefpython/issues/detail?id=126)). + * Fixed cookie problems during POST requests in the ResourceHandler example on Linux ([Issue 127](https://code.google.com/p/cefpython/issues/detail?id=127)) + * Fixed loading of local file urls that contained hash ([Issue 114](https://code.google.com/p/cefpython/issues/detail?id=114)) + * Added the [Browser](Browser.md).`GetUrl` and `LoadUrl` methods + * Redesigned the wxpython.py example. Added table of contents and source code highlighting among others. + * Moved DisplayHandler.`OnLoadingStateChange` to LoadHandler (does not affect code) + * Moved LoadHandler.`OnRendererProcessTerminated` and `OnPluginCrashed` to RequestHandler (does not affect code) + * Updated descriptions many of the settings on the [ApplicationSettings](ApplicationSettings.md) and [BrowserSettings](BrowserSettings.md) wiki pages. A certain set of options can now also be set using command line switches. + * Added new option ApplicationSettings.background\_color + +Version 29.4 released on January 15, 2014. + * Added `commandLineSwitches` param to [cefpython](cefpython.md).Initialize(). See the [CommandLineSwitches](CommandLineSwitches.md) wiki page. Thanks to Finn Hughes for the patch. See [Issue 65](https://code.google.com/p/cefpython/issues/detail?id=65). + * Debug options set in python (debug and log\_file) are now shared with the C++ browser process code. See [Issue 98](https://code.google.com/p/cefpython/issues/detail?id=98). + * Added new option "debug" to ApplicationSettings. Overwriting the g\_debug global variable in the cefpython module is now deprecated. See [Issue 100](https://code.google.com/p/cefpython/issues/detail?id=100). + * See revisions: [fd0ed30fb387](https://code.google.com/p/cefpython/source/detail?r=fd0ed30fb387d515986b2d20b635a8f90a715c66) + +Version 29.3 released on January 13, 2014. + * `CreateBrowserSync()`, `Shutdown()` and others are now called without GIL (global interpreter lock), to avoid deadlocks, see [Issue 102](https://code.google.com/p/cefpython/issues/detail?id=102). + * Added support for Distutils setup on Windows. Created MSI installer and Self-extracting zip for distribution using Distutils setup, see the BuildOnWindows wiki page for instructions ([Issue 108](https://code.google.com/p/cefpython/issues/detail?id=108)). + * See revisions: [ec1ce788373b](https://code.google.com/p/cefpython/source/detail?r=ec1ce788373bb9e0fd2cedd71e900c3877e9185a), [00f8606dbebc](https://code.google.com/p/cefpython/source/detail?r=00f8606dbebc40a061049b213271d3a4fb3b04e3), [75a19a8a9a1a](https://code.google.com/p/cefpython/source/detail?r=75a19a8a9a1a9eeb92d98464bd040892430b6eac) + +Version 29.2 released on December 26, 2013. + * Debian packages support on Linux, see the ["Create a Debian package"](https://code.google.com/p/cefpython/wiki/BuildOnLinux#Create_a_Debian_package) section on the BuildOnLinux wiki page + * Fixes to [package installer on Windows](PackageInstallerOnWindows.md). Do not show examples in explorer window after installation has completed, when in /SILENT mode. + * Added LifespanHandler.`OnBeforePopup`, see [Issue 93](https://code.google.com/p/cefpython/issues/detail?id=93). Thanks to Greg Farrell for the patch. + * Added RequestHandler.`OnBeforeBrowse`, see [Issue 94](https://code.google.com/p/cefpython/issues/detail?id=94). Thanks to Greg Farrell for the patch. + * Added new methods to [Frame](Frame.md): `GetSource()` and `GetText()`. See [Issue 96](https://code.google.com/p/cefpython/issues/detail?id=96). Thanks to Greg Farrell for the patch. + * See revisions: [13c472369c35](https://code.google.com/p/cefpython/source/detail?r=13c472369c356e41eda4caf82bcbe494a4cf6835), [f8abf0d73a64](https://code.google.com/p/cefpython/source/detail?r=f8abf0d73a646993e67065f1138e24bf9ae3691a), [893f4659f8e5](https://code.google.com/p/cefpython/source/detail?r=893f4659f8e570c334571ac0aa5c94b7b861856a), [be7029d302f3](https://code.google.com/p/cefpython/source/detail?r=be7029d302f36065dd7aa091d82987f7c6b18eb6), [dcbbd8edf0a0](https://code.google.com/p/cefpython/source/detail?r=dcbbd8edf0a0fec617fa7e4acb41a318755ae84e) + +Version 29.1 released on December 15, 2013 + * Updated Package Installer (Inno Setup Exe), the command line installation process with /SILENT flag does not require user interaction anymore. Also by default it will uninstall any existing cefpython3 package. + * Fixes to the wx examples (both wxpython.py and wx.chromectrl), changed behavior of browser cleanup on close. By default a timer is used to process CEF message loop work, earlier it was EVT\_IDLE. + * See revision [9bc68b3954ae](https://code.google.com/p/cefpython/source/detail?r=9bc68b3954ae0ac1a889060e756335bedfbda435) + +Version 29.0 released on November 1, 2013. + * Updated to Chrome 29.0.1547.80 CEF rev. 1491 + * Added [cefpython](cefpython.md).`SetOsModalLoop()`. + * Added [Browser](Browser.md).`Print()`, `Find()`, `StopFinding()`. + +Version 27.6 released on September 24, 2013. + * Implemented response reading features: [RequestHandler](RequestHandler.md).`GetResourceHandler()`, [ResourceHandler](ResourceHandler.md), [Response](Response.md), [WebRequest](WebRequest.md), [WebRequestClient](WebRequestClient.md), [Callback](Callback.md). + * Added [wxpython-response.py](https://code.google.com/p/cefpython/source/browse/cefpython/cef3/linux/binaries_64bit/wxpython-response.py?r=c08fc026e625) script that emulates `OnResourceResponse` callback (not yet available in CEF 3) by utilizing [ResourceHandler](ResourceHandler.md) and [WebRequest](WebRequest.md). + * This release was sponsored by Thomas Wusatiuk + +Version 27.5 released on September 18, 2013. + * Added support for the `