diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..bef11220
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+cef3-trunk
+svn-win32-1.8.5
+cefpython.wiki
+.tags*
+/cython-version.*
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..305a79c8
--- /dev/null
+++ b/README.md
@@ -0,0 +1,58 @@
+# CEF Python
+
+Table of contents:
+ * [Introduction](#introduction)
+ * [Supported Python versions and platforms](#supported-python-versions-and-platforms)
+ * [Downloads](#downloads)
+ * [Help and documentation](#help-and-documentation)
+ * [Support development](#support-development)
+ * [Thanks](#thanks)
+
+## 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](https://bitbucket.org/chromiumembedded/cef). 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](../../wiki/wxPython), [PyGTK](../../wiki/PyGTK), [PyQt](../../wiki/PyQt), [PySide](../../wiki/PySide), [Kivy](../../wiki/Kivy), [Panda3D](../../wiki/Panda3D) and [PyWin32](../master/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](../../wiki/JavascriptBindings). 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](../../wiki/Kivy) and [Panda3D](../../wiki/Panda3D) 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](../../issues/121))
+* Supported platforms: Windows, Linux, Mac (both 32bit and 64bit binaries are available for all platforms)
+
+## Downloads
+
+* For Windows: see the [Download_CEF3_Windows](../../wiki/Download_CEF3_Windows) wiki page.
+* For Linux: see the [Download_CEF3_Linux](../../wiki/Download_CEF3_Linux) wiki page.
+* For Mac: see the [Download_CEF3_Mac](../../wiki/Download_CEF3_Mac) wiki page.
+
+## Help and documentation
+
+* See the [Help and search](../../wiki/Help-and-search) wiki page
+* Documentation and API is available on [Wiki Pages](../../wiki)
+* Please do not use the [Issue Tracker](../../issues) for asking questions
+
+## Support development
+
+
If you are interested in donating time to help with the CEF Python development please see the [Internal development](../../wiki/InternalDevelopment) 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](../master/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).
+
+## 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](https://github.com/cztomczak/phpdesktop) project. For Go see the [CEF2go](https://github.com/cztomczak/cef2go) project on GitHub.
diff --git a/cefpython/.gitignore b/cefpython/.gitignore
new file mode 100644
index 00000000..af3ba3c4
--- /dev/null
+++ b/cefpython/.gitignore
@@ -0,0 +1,47 @@
+/cef1/windows/setup/build/
+*.pyc
+
+# If you want to ignore an already commited directory run:
+# git rm --cached -r .idea
+
+/.idea/
+debug.log
+error.log
+console.log
+
+# WingIDE project files
+/wingide.wpr
+/wingide.wpu
+
+*.ncb
+*.suo
+*.user
+*.aps
+*.sdf
+*.sln
+Debug*/
+Release*/
+*.pdb
+
+ctags
+
+/cef1/windows/installer/Output/
+/cef3/windows/installer/Output/
+
+# Inno setup files generated from a template
+*.generated
+
+cython_debug/
+
+cefpython_py27.pyd
+cefpython_py32.pyd
+cefpython_py27.so
+cefpython_py32.so
+
+cython_includes/compile_time_constants.pxi
+
+debug_32bit/
+debug_64bit/
+
+libcef_debug/
+libcef_release/
diff --git a/cefpython/AUTHORS.txt b/cefpython/AUTHORS.txt
new file mode 100644
index 00000000..ac6d79e2
--- /dev/null
+++ b/cefpython/AUTHORS.txt
@@ -0,0 +1,17 @@
+Core developers:
+
+ Czarek Tomczak
+
+Contributors (in order of first commit):
+
+ 老农 cjjer
+ Richard Rodriguez
+ Roman Plášil
+ Rokas Stupuras
+ Greg Kacy
+ Thomas Dähling
+ Dominique Burnand
+ Greg Farrell
+ Finn Hughes
+ Marcelo Fernandez
+ Simon Hatt <9hatt2@@gmail.com>
diff --git a/cefpython/LICENSE.txt b/cefpython/LICENSE.txt
new file mode 100644
index 00000000..ba1b96ff
--- /dev/null
+++ b/cefpython/LICENSE.txt
@@ -0,0 +1,39 @@
+Copyright (c) 2012-2014 The CEF Python authors. All rights
+reserved. Website: http://code.google.com/p/cefpython/
+
+This product includes the following third party libraries:
+* Chromium Embedded Framework licensed under the BSD 3-clause
+ license. Website: http://code.google.com/p/chromiumembedded/
+
+Redistribution and use in source and binary forms, with
+or without modification, are permitted provided that the
+following conditions are met:
+
+* Redistributions of source code must retain the above
+ copyright notice, this list of conditions and the
+ following disclaimer.
+
+* Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+* Neither the name of Google Inc. nor the name Chromium
+ Embedded Framework nor the name of CEF Python nor the
+ names of its contributors may be used to endorse or
+ promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/cefpython/app.pyx b/cefpython/app.pyx
new file mode 100644
index 00000000..ef1e8795
--- /dev/null
+++ b/cefpython/app.pyx
@@ -0,0 +1,14 @@
+# Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.
+# License: New BSD License.
+# Website: http://code.google.com/p/cefpython/
+
+cdef public void App_OnBeforeCommandLineProcessing_BrowserProcess(
+ CefRefPtr[CefCommandLine] cefCommandLine
+ ) except * with gil:
+ global g_commandLineSwitches
+ try:
+ AppendSwitchesToCommandLine(cefCommandLine, g_commandLineSwitches)
+ Debug("App_OnBeforeCommandLineProcessing_BrowserProcess()")
+ except:
+ (exc_type, exc_value, exc_trace) = sys.exc_info()
+ sys.excepthook(exc_type, exc_value, exc_trace)
diff --git a/cefpython/browser.pyx b/cefpython/browser.pyx
new file mode 100644
index 00000000..71631540
--- /dev/null
+++ b/cefpython/browser.pyx
@@ -0,0 +1,823 @@
+# Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.
+# License: New BSD License.
+# Website: http://code.google.com/p/cefpython/
+
+IF CEF_VERSION == 1:
+ # In CEF 1 there are both KT_KEYDOWN and KEYEVENT_KEYDOWN, and
+ # these are different constants, making a bit of confusion.
+ # In CEF 1 KT_ is for SendKeyEvent, KEYEVENT_ is for OnKeyEvent().
+ # In CEF 3 there are only KEYEVENT_* constants.
+ KEYTYPE_KEYDOWN = cef_types.KT_KEYDOWN
+ KEYTYPE_KEYUP = cef_types.KT_KEYUP
+ KEYTYPE_CHAR = cef_types.KT_CHAR
+
+# Both CEF 1 and CEF 3.
+# cef_mouse_button_type_t, SendMouseClickEvent().
+MOUSEBUTTON_LEFT = cef_types.MBT_LEFT
+MOUSEBUTTON_MIDDLE = cef_types.MBT_MIDDLE
+MOUSEBUTTON_RIGHT = cef_types.MBT_RIGHT
+
+# If you try to keep PyBrowser() objects inside cpp_vector you will
+# get segmentation faults, as they will be garbage collected.
+
+cdef dict g_pyBrowsers = {}
+
+IF CEF_VERSION == 3:
+ # Unused function warning in CEF 1.
+ cdef PyBrowser GetPyBrowserById(int browserId):
+ if browserId in g_pyBrowsers:
+ return g_pyBrowsers[browserId]
+ return None
+
+cdef PyBrowser GetPyBrowser(CefRefPtr[CefBrowser] cefBrowser):
+ global g_pyBrowsers
+ if cefBrowser == NULL or not cefBrowser.get():
+ Debug("GetPyBrowser(): returning None")
+ return None
+
+ cdef PyBrowser pyBrowser
+ cdef int browserId
+ cdef int id
+
+ browserId = cefBrowser.get().GetIdentifier()
+ if browserId in g_pyBrowsers:
+ return g_pyBrowsers[browserId]
+
+ for id, pyBrowser in g_pyBrowsers.items():
+ if not pyBrowser.cefBrowser.get():
+ Debug("GetPyBrowser(): removing an empty CefBrowser reference, "
+ "browserId=%s" % id)
+ del g_pyBrowsers[id]
+
+ Debug("GetPyBrowser(): creating new PyBrowser, browserId=%s" % browserId)
+ pyBrowser = PyBrowser()
+ pyBrowser.cefBrowser = cefBrowser
+ g_pyBrowsers[browserId] = pyBrowser
+
+ # Inherit client callbacks and javascript bindings
+ # from parent browser.
+
+ # Checking __outerWindowHandle as we should not inherit
+ # client callbacks and javascript bindings if the browser
+ # was created explicitily by calling CreateBrowserSync().
+
+ # Popups inherit client callbacks by default.
+
+ # Popups inherit javascript bindings only when "bindToPopups"
+ # constructor param was set to True.
+
+ cdef WindowHandle openerHandle
+ cdef dict clientCallbacks
+ cdef JavascriptBindings javascriptBindings
+ cdef PyBrowser tempPyBrowser
+
+ if pyBrowser.IsPopup() and \
+ not pyBrowser.GetUserData("__outerWindowHandle"):
+ openerHandle = pyBrowser.GetOpenerWindowHandle()
+ for id, tempPyBrowser in g_pyBrowsers.items():
+ if tempPyBrowser.GetWindowHandle() == openerHandle:
+ clientCallbacks = tempPyBrowser.GetClientCallbacksDict()
+ if clientCallbacks:
+ pyBrowser.SetClientCallbacksDict(clientCallbacks)
+ javascriptBindings = tempPyBrowser.GetJavascriptBindings()
+ if javascriptBindings:
+ if javascriptBindings.GetBindToPopups():
+ pyBrowser.SetJavascriptBindings(javascriptBindings)
+ return pyBrowser
+
+IF CEF_VERSION == 3:
+ # Unused function warning in CEF 1.
+ cdef void RemovePyBrowser(int browserId) except *:
+ # Called from LifespanHandler_OnBeforeClose().
+ # TODO: call this function also in CEF 1.
+ global g_pyBrowsers
+ if browserId in g_pyBrowsers:
+ if len(g_pyBrowsers) == 1:
+ # This is the last browser remaining.
+ if g_sharedRequestContext.get():
+ # A similar release is done in Shutdown and CloseBrowser.
+ Debug("RemovePyBrowser: releasing shared request context")
+ g_sharedRequestContext.Assign(NULL)
+ Debug("del g_pyBrowsers[%s]" % browserId)
+ del g_pyBrowsers[browserId]
+ else:
+ Debug("RemovePyBrowser() FAILED: browser not found, id = %s" \
+ % browserId)
+
+cpdef PyBrowser GetBrowserByWindowHandle(WindowHandle windowHandle):
+ cdef PyBrowser pyBrowser
+ for browserId in g_pyBrowsers:
+ pyBrowser = g_pyBrowsers[browserId]
+ if (pyBrowser.GetWindowHandle() == windowHandle or
+ pyBrowser.GetUserData("__outerWindowHandle") == long(windowHandle)):
+ return pyBrowser
+ return None
+
+cdef public void PyBrowser_ShowDevTools(CefRefPtr[CefBrowser] cefBrowser
+ ) except * with gil:
+ # Called from ClientHandler::OnContextMenuCommand
+ cdef PyBrowser pyBrowser
+ try:
+ pyBrowser = GetPyBrowser(cefBrowser)
+ pyBrowser.ShowDevTools()
+ except:
+ (exc_type, exc_value, exc_trace) = sys.exc_info()
+ sys.excepthook(exc_type, exc_value, exc_trace)
+
+# -----------------------------------------------------------------------------
+
+cdef class PyBrowser:
+ cdef CefRefPtr[CefBrowser] cefBrowser
+
+ cdef public dict clientCallbacks
+ cdef public list allowedClientCallbacks
+ cdef public JavascriptBindings javascriptBindings
+ cdef public dict userData
+
+ # Properties used by ToggleFullscreen().
+ cdef public int isFullscreen
+ cdef public int maximized
+ cdef public int gwlStyle
+ cdef public int gwlExStyle
+ cdef public tuple windowRect
+
+ # C-level attributes are initialized to 0 automatically.
+ cdef void* imageBuffer
+
+ cdef CefRefPtr[CefBrowser] GetCefBrowser(self) except *:
+ if self.cefBrowser != NULL and self.cefBrowser.get():
+ return self.cefBrowser
+ raise Exception("PyBrowser.GetCefBrowser() failed: CefBrowser "
+ "was destroyed")
+
+ IF CEF_VERSION == 3:
+
+ cdef CefRefPtr[CefBrowserHost] GetCefBrowserHost(self) except *:
+ cdef CefRefPtr[CefBrowserHost] cefBrowserHost = (
+ self.GetCefBrowser().get().GetHost())
+ if cefBrowserHost != NULL and cefBrowserHost.get():
+ return cefBrowserHost
+ raise Exception("PyBrowser.GetCefBrowserHost() failed: this "
+ "method can only be called in the browser "
+ "process.")
+
+ def __init__(self):
+ self.clientCallbacks = {}
+ self.allowedClientCallbacks = []
+ self.userData = {}
+
+ def __dealloc__(self):
+ if self.imageBuffer:
+ free(self.imageBuffer)
+
+ cpdef py_void SetClientCallback(self, py_string name, object callback):
+ IF CEF_VERSION == 1:
+ self.SetClientCallback_CEF1(name, callback)
+ ELIF CEF_VERSION == 3:
+ self.SetClientCallback_CEF3(name, callback)
+
+ # -------------------------------------------------------------------------
+ # CEF 1
+ # -------------------------------------------------------------------------
+ cpdef py_void SetClientCallback_CEF1(self,
+ py_string name, object callback):
+ if not self.allowedClientCallbacks:
+ # CefLoadHandler.
+ self.allowedClientCallbacks += ["OnLoadEnd", "OnLoadError",
+ "OnLoadStart"]
+ # CefKeyboardHandler.
+ self.allowedClientCallbacks += ["OnKeyEvent"]
+ # CefV8ContextHandler.
+ self.allowedClientCallbacks += ["OnContextCreated",
+ "OnContextReleased" ,"OnUncaughtException"]
+ # CefRequestHandler.
+ self.allowedClientCallbacks += ["OnBeforeBrowse",
+ "OnBeforeResourceLoad", "OnResourceRedirect",
+ "OnResourceResponse", "OnProtocolExecution",
+ "GetDownloadHandler", "GetAuthCredentials",
+ "GetCookieManager"]
+
+ # CefDisplayHandler.
+ self.allowedClientCallbacks += ["OnAddressChange",
+ "OnConsoleMessage", "OnContentsSizeChange",
+ "OnNavStateChange", "OnStatusMessage", "OnTitleChange",
+ "OnTooltip"]
+ # LifespanHandler.
+ self.allowedClientCallbacks += ["DoClose", "OnAfterCreated",
+ "OnBeforeClose", "RunModal"]
+ # RenderHandler
+ self.allowedClientCallbacks += ["GetViewRect", "GetScreenRect",
+ "GetScreenPoint", "OnPopupShow", "OnPopupSize",
+ "OnPaint", "OnCursorChange"]
+ # DragHandler
+ self.allowedClientCallbacks += ["OnDragStart", "OnDragEnter"]
+ if name not in self.allowedClientCallbacks:
+ raise Exception("Browser.SetClientCallback() failed: unknown "
+ "callback: %s" % name)
+ self.clientCallbacks[name] = callback
+
+ # -------------------------------------------------------------------------
+ # CEF 3
+ # -------------------------------------------------------------------------
+ cpdef py_void SetClientCallback_CEF3(self,
+ py_string name, object callback):
+ if not self.allowedClientCallbacks:
+ # DisplayHandler
+ self.allowedClientCallbacks += [
+ "OnAddressChange", "OnTitleChange", "OnTooltip",
+ "OnStatusMessage", "OnConsoleMessage"]
+ # KeyboardHandler
+ self.allowedClientCallbacks += ["OnPreKeyEvent", "OnKeyEvent"];
+ # RequestHandler
+ # NOTE: OnCertificateError and OnBeforePluginLoad are not
+ # included as they must be set using
+ # cefpython.SetGlobalClientCallback().
+ self.allowedClientCallbacks += ["OnBeforeResourceLoad",
+ "OnResourceRedirect", "GetAuthCredentials",
+ "OnQuotaRequest", "OnProtocolExecution",
+ "GetResourceHandler",
+ "OnBeforeBrowse", "OnRendererProcessTerminated",
+ "OnPluginCrashed"]
+ # RequestContextHandler
+ self.allowedClientCallbacks += ["GetCookieManager"]
+ # LoadHandler
+ self.allowedClientCallbacks += ["OnLoadingStateChange",
+ "OnLoadStart", "OnLoadEnd", "OnLoadError"]
+ # LifespanHandler
+ # NOTE: OnAfterCreated not included as it must be set using
+ # cefpython.SetGlobalClientCallback().
+ self.allowedClientCallbacks += ["OnBeforePopup",
+ "RunModal", "DoClose", "OnBeforeClose"]
+ # RenderHandler
+ self.allowedClientCallbacks += ["GetRootScreenRect",
+ "GetViewRect", "GetScreenPoint", "GetScreenInfo",
+ "OnPopupShow", "OnPopupSize", "OnPaint", "OnCursorChange",
+ "OnScrollOffsetChanged"]
+ # JavascriptDialogHandler
+ self.allowedClientCallbacks += ["OnJavascriptDialog",
+ "OnBeforeUnloadJavascriptDialog",
+ "OnResetJavascriptDialogState",
+ "OnJavascriptDialogClosed"]
+
+ if name not in self.allowedClientCallbacks:
+ raise Exception("Browser.SetClientCallback() failed: unknown "
+ "callback: %s" % name)
+ self.clientCallbacks[name] = callback
+
+ cpdef py_void SetClientHandler(self, object clientHandler):
+ if not hasattr(clientHandler, "__class__"):
+ raise Exception("Browser.SetClientHandler() failed: __class__ "
+ "attribute missing")
+ cdef dict methods = {}
+ cdef py_string key
+ cdef object method
+ cdef tuple value
+ for value in inspect.getmembers(clientHandler,
+ predicate=inspect.ismethod):
+ key = value[0]
+ method = value[1]
+ if key and key[0] != '_':
+ self.SetClientCallback(key, method)
+
+ cpdef object GetClientCallback(self, py_string name):
+ if name in self.clientCallbacks:
+ return self.clientCallbacks[name]
+
+ cpdef py_void SetClientCallbacksDict(self, dict clientCallbacks):
+ self.clientCallbacks = clientCallbacks
+
+ cpdef dict GetClientCallbacksDict(self):
+ return self.clientCallbacks
+
+ cpdef py_void SetJavascriptBindings(self, JavascriptBindings bindings):
+ self.javascriptBindings = bindings
+ IF CEF_VERSION == 1:
+ if self.GetUserData("__v8ContextCreated"):
+ Debug("Browser.SetJavascriptBindings(): v8 context already"
+ "created, calling Rebind()")
+ self.javascriptBindings.Rebind()
+ ELIF CEF_VERSION == 3:
+ self.javascriptBindings.Rebind()
+
+ cpdef JavascriptBindings GetJavascriptBindings(self):
+ return self.javascriptBindings
+
+ # --------------
+ # CEF API.
+ # --------------
+
+ cpdef py_bool CanGoBack(self):
+ return self.GetCefBrowser().get().CanGoBack()
+
+ cpdef py_bool CanGoForward(self):
+ return self.GetCefBrowser().get().CanGoForward()
+
+ IF CEF_VERSION == 1:
+
+ cpdef object ClearHistory(self):
+ self.GetCefBrowser().get().ClearHistory()
+
+ cpdef py_void ParentWindowWillClose(self):
+ IF CEF_VERSION == 1:
+ self.GetCefBrowser().get().ParentWindowWillClose()
+ ELIF CEF_VERSION == 3:
+ self.GetCefBrowserHost().get().ParentWindowWillClose()
+
+ cpdef py_void CloseBrowser(self, py_bool forceClose=False):
+ IF CEF_VERSION == 1:
+ Debug("CefBrowser::CloseBrowser(%s)" % forceClose)
+ self.GetCefBrowser().get().CloseBrowser(bool(forceClose))
+ ELIF CEF_VERSION == 3:
+ # ParentWindowWillClose() should be called by user when
+ # implementing LifespanHandler::DoClose().
+ # | Debug("CefBrowser::ParentWindowWillClose()")
+ # | self.GetCefBrowserHost().get().ParentWindowWillClose()
+ if len(g_pyBrowsers) == 1:
+ # This is the last browser remaining.
+ if g_sharedRequestContext.get():
+ # A similar release is done in Shutdown
+ # and RemovePyBrowser.
+ Debug("CloseBrowser: releasing shared request context")
+ g_sharedRequestContext.Assign(NULL)
+ Debug("CefBrowser::CloseBrowser(%s)" % forceClose)
+ self.GetCefBrowserHost().get().CloseBrowser(bool(forceClose))
+
+ IF CEF_VERSION == 1:
+
+ cpdef py_void CloseDevTools(self):
+ self.GetCefBrowser().get().CloseDevTools()
+
+ def ExecuteFunction(self, *args):
+ self.GetMainFrame().ExecuteFunction(*args)
+
+ cpdef py_void ExecuteJavascript(self, py_string jsCode,
+ py_string scriptUrl="", int startLine=0):
+ self.GetMainFrame().ExecuteJavascript(jsCode, scriptUrl, startLine)
+
+ cpdef py_void Find(self, int searchId, py_string searchText,
+ py_bool forward, py_bool matchCase,
+ py_bool findNext):
+ cdef CefString cefSearchText
+ PyToCefString(searchText, cefSearchText)
+ IF CEF_VERSION == 3:
+ self.GetCefBrowserHost().get().Find(searchId, cefSearchText,
+ bool(forward), bool(matchCase), bool(findNext))
+ ELIF CEF_VERSION == 1:
+ self.GetCefBrowser().get().Find(searchId, cefSearchText,
+ bool(forward), bool(matchCase), bool(findNext))
+
+ cpdef PyFrame GetFocusedFrame(self):
+ assert IsThread(TID_UI), (
+ "Browser.GetFocusedFrame() may only be called on UI thread")
+ return GetPyFrame(self.GetCefBrowser().get().GetFocusedFrame())
+
+ cpdef PyFrame GetFrame(self, py_string name):
+ assert IsThread(TID_UI), (
+ "Browser.GetFrame() may only be called on the UI thread")
+ cdef CefString cefName
+ PyToCefString(name, cefName)
+ return GetPyFrame(self.GetCefBrowser().get().GetFrame(cefName))
+
+ IF CEF_VERSION == 3:
+ cpdef object GetFrameByIdentifier(self, object identifier):
+ return GetPyFrame(self.GetCefBrowser().get().GetFrame(
+ long(identifier)))
+
+ cpdef list GetFrameNames(self):
+ assert IsThread(TID_UI), (
+ "Browser.GetFrameNames() may only be called on the UI thread")
+ cdef cpp_vector[CefString] cefNames
+ self.GetCefBrowser().get().GetFrameNames(cefNames)
+ cdef list names = []
+ cdef cpp_vector[CefString].iterator iterator = cefNames.begin()
+ cdef CefString cefString
+ while iterator != cefNames.end():
+ cefString = deref(iterator)
+ names.append(CefToPyString(cefString))
+ preinc(iterator)
+ return names
+
+ cpdef list GetFrames(self):
+ cdef list names = self.GetFrameNames()
+ cdef PyFrame frame
+ cdef list frames = []
+ for name in names:
+ frame = self.GetFrame(name)
+ frames.append(frame)
+ return frames
+
+ cpdef int GetIdentifier(self) except *:
+ return self.GetCefBrowser().get().GetIdentifier()
+
+ cpdef PyFrame GetMainFrame(self):
+ return GetPyFrame(self.GetCefBrowser().get().GetMainFrame())
+
+ cpdef WindowHandle GetOpenerWindowHandle(self) except *:
+ cdef WindowHandle hwnd
+ IF CEF_VERSION == 1:
+ hwnd = self.GetCefBrowser().get().GetOpenerWindowHandle()
+ ELIF CEF_VERSION == 3:
+ hwnd = self.GetCefBrowserHost().get().GetOpenerWindowHandle()
+ return hwnd
+
+ cpdef WindowHandle GetOuterWindowHandle(self) except *:
+ if self.GetUserData("__outerWindowHandle"):
+ return self.GetUserData("__outerWindowHandle")
+ else:
+ return self.GetWindowHandle()
+
+ cpdef py_string GetUrl(self):
+ return self.GetMainFrame().GetUrl()
+
+ cpdef object GetUserData(self, object key):
+ if key in self.userData:
+ return self.userData[key]
+ return None
+
+ cpdef WindowHandle GetWindowHandle(self) except *:
+ cdef WindowHandle hwnd
+ IF CEF_VERSION == 1:
+ hwnd = self.GetCefBrowser().get().GetWindowHandle()
+ ELIF CEF_VERSION == 3:
+ hwnd = self.GetCefBrowserHost().get().GetWindowHandle()
+ return hwnd
+
+ cpdef double GetZoomLevel(self) except *:
+ IF CEF_VERSION == 1:
+ assert IsThread(TID_UI), (
+ "Browser.GetZoomLevel() may only be called on UI thread")
+ cdef double zoomLevel
+ IF CEF_VERSION == 1:
+ zoomLevel = self.GetCefBrowser().get().GetZoomLevel()
+ ELIF CEF_VERSION == 3:
+ zoomLevel = self.GetCefBrowserHost().get().GetZoomLevel()
+ return zoomLevel
+
+ cpdef py_void GoBack(self):
+ self.GetCefBrowser().get().GoBack()
+
+ cpdef py_void GoForward(self):
+ self.GetCefBrowser().get().GoForward()
+
+ cpdef py_bool HasDocument(self):
+ return self.GetCefBrowser().get().HasDocument()
+
+ IF CEF_VERSION == 1:
+ cpdef py_void HidePopup(self):
+ self.GetCefBrowser().get().HidePopup()
+
+ cpdef py_bool IsFullscreen(self):
+ return bool(self.isFullscreen)
+
+ cpdef py_bool IsPopup(self):
+ return self.GetCefBrowser().get().IsPopup()
+
+ IF CEF_VERSION == 1:
+ cpdef py_bool IsPopupVisible(self):
+ assert IsThread(TID_UI), (
+ "Browser.IsPopupVisible() may only be called on UI thread")
+ return self.GetCefBrowser().get().IsPopupVisible()
+
+ cpdef py_bool IsWindowRenderingDisabled(self):
+ IF CEF_VERSION == 1:
+ return self.GetCefBrowser().get().IsWindowRenderingDisabled()
+ ELIF CEF_VERSION == 3:
+ return self.GetCefBrowserHost().get().IsWindowRenderingDisabled()
+
+ cpdef py_string LoadUrl(self, py_string url):
+ self.GetMainFrame().LoadUrl(url)
+
+ cpdef py_void Navigate(self, py_string url):
+ self.LoadUrl(url)
+
+ IF CEF_VERSION == 3:
+ cpdef py_void Print(self):
+ self.GetCefBrowserHost().get().Print()
+
+ cpdef py_void Reload(self):
+ self.GetCefBrowser().get().Reload()
+
+ cpdef py_void ReloadIgnoreCache(self):
+ self.GetCefBrowser().get().ReloadIgnoreCache()
+
+ cpdef py_void SetFocus(self, enable):
+ IF CEF_VERSION == 1:
+ self.GetCefBrowser().get().SetFocus(bool(enable))
+ ELIF CEF_VERSION == 3:
+ self.GetCefBrowserHost().get().SetFocus(bool(enable))
+
+ cpdef py_void SetUserData(self, object key, object value):
+ self.userData[key] = value
+
+ cpdef py_void SetZoomLevel(self, double zoomLevel):
+ IF CEF_VERSION == 1:
+ self.GetCefBrowser().get().SetZoomLevel(zoomLevel)
+ ELIF CEF_VERSION == 3:
+ self.GetCefBrowserHost().get().SetZoomLevel(zoomLevel)
+
+ cpdef py_void ShowDevTools(self):
+ cdef CefString cefUrl = self.GetCefBrowserHost().get().GetDevToolsURL(\
+ True)
+ cdef py_string url = CefToPyString(cefUrl)
+ # Example url returned:
+ # | http://localhost:54008/devtools/devtools.html?ws=localhost:54008
+ # | /devtools/page/1538ed984a2a4a90e5ed941c7d142a12
+ # Let's replace "localhost" with "127.0.0.1", using the ip address
+ # which is more reliable.
+ url = url.replace("localhost:", "127.0.0.1:")
+ jsCode = ("window.open('%s');" % url)
+ self.GetMainFrame().ExecuteJavascript(jsCode)
+
+ cpdef py_void StopLoad(self):
+ self.GetCefBrowser().get().StopLoad()
+
+ cpdef py_void StopFinding(self, py_bool clearSelection):
+ IF CEF_VERSION == 3:
+ self.GetCefBrowserHost().get().StopFinding(bool(clearSelection))
+ ELIF CEF_VERSION == 1:
+ self.GetCefBrowser().get().StopFinding(bool(clearSelection))
+
+ cpdef py_void ToggleFullscreen(self):
+ IF UNAME_SYSNAME == "Windows":
+ self.ToggleFullscreen_Windows()
+
+ IF UNAME_SYSNAME == "Windows":
+
+ cpdef py_void ToggleFullscreen_Windows(self):
+ cdef WindowHandle windowHandle
+ if self.GetUserData("__outerWindowHandle"):
+ windowHandle = self.GetUserData("__outerWindowHandle")
+ else:
+ windowHandle = self.GetWindowHandle()
+
+ # Offscreen browser will have an empty window handle.
+ assert windowHandle, (
+ "Browser.ToggleFullscreen() failed: no window handle "
+ "found")
+
+ cdef HWND hwnd = int(windowHandle)
+ cdef RECT rect
+ cdef HMONITOR monitor
+ cdef MONITORINFO monitorInfo
+ monitorInfo.cbSize = sizeof(monitorInfo)
+
+ # Logic copied from chromium > fullscreen_handler.cc >
+ # FullscreenHandler::SetFullscreenImpl:
+ # http://src.chromium.org/viewvc/chrome/trunk/src/ui/views/win/
+ # fullscreen_handler.cc
+
+ cdef py_bool for_metro = False
+
+ if not self.isFullscreen:
+ self.maximized = IsZoomed(hwnd)
+ if self.maximized:
+ SendMessage(hwnd, WM_SYSCOMMAND, SC_RESTORE, 0)
+ self.gwlStyle = GetWindowLong(hwnd, GWL_STYLE)
+ self.gwlExStyle = GetWindowLong(hwnd, GWL_EXSTYLE)
+ GetWindowRect(hwnd, &rect)
+ self.windowRect = (rect.left, rect.top,
+ rect.right, rect.bottom)
+
+ cdef int removeStyle, removeExStyle
+ cdef int left, top, right, bottom
+
+ if not self.isFullscreen:
+ removeStyle = WS_CAPTION | WS_THICKFRAME
+ removeExStyle = (WS_EX_DLGMODALFRAME | WS_EX_WINDOWEDGE
+ | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE)
+ SetWindowLong(hwnd, GWL_STYLE,
+ self.gwlStyle & ~(removeStyle))
+ SetWindowLong(hwnd, GWL_EXSTYLE,
+ self.gwlExStyle & ~(removeExStyle))
+
+ if not for_metro:
+ # MONITOR_DEFAULTTONULL, MONITOR_DEFAULTTOPRIMARY,
+ # MONITOR_DEFAULTTONEAREST
+ monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST)
+ GetMonitorInfo(monitor, &monitorInfo)
+ left = monitorInfo.rcMonitor.left
+ top = monitorInfo.rcMonitor.top
+ right = monitorInfo.rcMonitor.right
+ bottom = monitorInfo.rcMonitor.bottom
+ SetWindowPos(hwnd, NULL,
+ left, top, right-left, bottom-top,
+ SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED)
+ else:
+ SetWindowLong(hwnd, GWL_STYLE, int(self.gwlStyle))
+ SetWindowLong(hwnd, GWL_EXSTYLE, int(self.gwlExStyle))
+
+ if not for_metro:
+ (left, top, right, bottom) = self.windowRect
+ SetWindowPos(hwnd, NULL,
+ int(left), int(top),
+ int(right-left), int(bottom-top),
+ SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED)
+
+ if self.maximized:
+ SendMessage(hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0)
+
+ self.isFullscreen = int(not bool(self.isFullscreen))
+
+ # Off-screen rendering.
+
+ IF CEF_VERSION == 1:
+
+ cpdef tuple GetSize(self, PaintElementType paintElementType):
+ assert IsThread(TID_UI), (
+ "Browser.GetSize(): this method should only be called "
+ "on the UI thread")
+ cdef int width = 0
+ cdef int height = 0
+ cdef cpp_bool ret = self.GetCefBrowser().get().GetSize(
+ paintElementType, width, height)
+ if ret:
+ return (width, height)
+ else:
+ return (0, 0)
+
+ cpdef py_void SetSize(self, PaintElementType paintElementType,
+ int width, int height):
+ self.GetCefBrowser().get().SetSize(paintElementType, width, height)
+
+ cpdef py_void Invalidate(self, list dirtyRect):
+ assert len(dirtyRect) == 4, (
+ "Browser.Invalidate() failed, dirtyRect is invalid")
+ cdef CefRect cefRect = CefRect(
+ dirtyRect[0], dirtyRect[1], dirtyRect[2], dirtyRect[3])
+ self.GetCefBrowser().get().Invalidate(cefRect)
+
+ IF CEF_VERSION == 1 and UNAME_SYSNAME == "Windows":
+ cpdef PaintBuffer GetImage(self, PaintElementType paintElementType,
+ int width, int height):
+ assert IsThread(TID_UI), (
+ "Browser.GetImage(): this method should only be called "
+ "on the UI thread")
+
+ IF UNAME_SYSNAME == "Windows":
+ return self.GetImage_Windows(paintElementType, width, height)
+ ELSE:
+ return None
+
+ cdef PaintBuffer GetImage_Windows(self,
+ PaintElementType paintElementType, int width, int height):
+ if not self.imageBuffer:
+ self.imageBuffer = malloc(width*height*4)
+ cdef cpp_bool ret = self.GetCefBrowser().get().GetImage(
+ paintElementType, width, height, self.imageBuffer)
+ cdef PaintBuffer paintBuffer
+ if ret:
+ paintBuffer = CreatePaintBuffer(
+ self.imageBuffer, width, height)
+ return paintBuffer
+ else:
+ return None
+
+ # Sending mouse/key events.
+ IF CEF_VERSION == 1:
+ cpdef py_void SendKeyEvent(self, cef_types.cef_key_type_t keyType,
+ tuple keyInfo, int modifiers):
+ cdef CefKeyInfo cefKeyInfo
+ IF UNAME_SYSNAME == "Windows":
+ assert len(keyInfo) == 3, "Invalid keyInfo param"
+ cefKeyInfo.key = keyInfo[0]
+ cefKeyInfo.sysChar = keyInfo[1]
+ cefKeyInfo.imeChar = keyInfo[2]
+ ELIF UNAME_SYSNAME == "Darwin":
+ cefKeyInfo.keyCode = keyInfo[0]
+ cefKeyInfo.character = keyInfo[1]
+ cefKeyInfo.characterNoModifiers = keyInfo[2]
+ ELIF UNAME_SYSNAME == "Linux":
+ cefKeyInfo.key = keyInfo[0]
+ ELSE:
+ raise Exception("Invalid UNAME_SYSNAME")
+
+ self.GetCefBrowser().get().SendKeyEvent(keyType, cefKeyInfo,
+ modifiers)
+
+ cpdef py_void SendMouseClickEvent(self, int x, int y,
+ cef_types.cef_mouse_button_type_t mouseButtonType,
+ py_bool mouseUp, int clickCount, int modifiers=0):
+ self.GetCefBrowser().get().SendMouseClickEvent(x, y,
+ mouseButtonType, bool(mouseUp), clickCount)
+
+ cpdef py_void SendMouseMoveEvent(self, int x, int y,
+ py_bool mouseLeave, int modifiers=0):
+ self.GetCefBrowser().get().SendMouseMoveEvent(x, y,
+ bool(mouseLeave))
+
+ cpdef py_void SendMouseWheelEvent(self, int x, int y,
+ int deltaX, int deltaY, int modifiers=0):
+ self.GetCefBrowser().get().SendMouseWheelEvent(x, y,
+ deltaX, deltaY)
+
+ cpdef py_void SendFocusEvent(self, py_bool setFocus):
+ self.GetCefBrowser().get().SendFocusEvent(bool(setFocus))
+
+ cpdef py_void SendCaptureLostEvent(self):
+ self.GetCefBrowser().get().SendCaptureLostEvent()
+
+ ELIF CEF_VERSION == 3:
+ cpdef py_void SendKeyEvent(self, dict pyEvent):
+ cdef CefKeyEvent cefEvent
+ if "type" in pyEvent:
+ cefEvent.type = int(pyEvent["type"])
+ if "modifiers" in pyEvent:
+ cefEvent.modifiers = long(pyEvent["modifiers"])
+ if ("windows_key_code" in pyEvent) and UNAME_SYSNAME == "Windows":
+ cefEvent.windows_key_code = int(pyEvent["windows_key_code"])
+ if "native_key_code" in pyEvent:
+ cefEvent.native_key_code = int(pyEvent["native_key_code"])
+ if "is_system_key" in pyEvent:
+ cefEvent.is_system_key = bool(pyEvent["is_system_key"])
+ if "character" in pyEvent:
+ cefEvent.character = int(pyEvent["character"])
+ if "unmodified_character" in pyEvent:
+ cefEvent.unmodified_character = \
+ int(pyEvent["unmodified_character"])
+ if "focus_on_editable_field" in pyEvent:
+ cefEvent.focus_on_editable_field = \
+ bool(pyEvent["focus_on_editable_field"])
+ self.GetCefBrowserHost().get().SendKeyEvent(cefEvent)
+
+ cpdef py_void SendMouseClickEvent(self, int x, int y,
+ cef_types.cef_mouse_button_type_t mouseButtonType,
+ py_bool mouseUp, int clickCount, int modifiers=0):
+ cdef CefMouseEvent mouseEvent
+ mouseEvent.x = x
+ mouseEvent.y = y
+ mouseEvent.modifiers = modifiers
+ self.GetCefBrowserHost().get().SendMouseClickEvent(mouseEvent,
+ mouseButtonType, bool(mouseUp), clickCount)
+
+ cpdef py_void SendMouseMoveEvent(self, int x, int y,
+ py_bool mouseLeave, int modifiers=0):
+ cdef CefMouseEvent mouseEvent
+ mouseEvent.x = x
+ mouseEvent.y = y
+ mouseEvent.modifiers = modifiers
+ self.GetCefBrowserHost().get().SendMouseMoveEvent(mouseEvent,
+ bool(mouseLeave))
+
+ cpdef py_void SendMouseWheelEvent(self, int x, int y,
+ int deltaX, int deltaY, int modifiers=0):
+ cdef CefMouseEvent mouseEvent
+ mouseEvent.x = x
+ mouseEvent.y = y
+ mouseEvent.modifiers = modifiers
+ self.GetCefBrowserHost().get().SendMouseWheelEvent(mouseEvent,
+ deltaX, deltaY)
+
+ cpdef py_void SendFocusEvent(self, py_bool setFocus):
+ self.GetCefBrowserHost().get().SendFocusEvent(bool(setFocus))
+
+ cpdef py_void SendCaptureLostEvent(self):
+ self.GetCefBrowserHost().get().SendCaptureLostEvent()
+ # ENDIF CEF_VERSION == 3 / Sending mouse/key events.
+
+ IF CEF_VERSION == 3:
+ cpdef py_void StartDownload(self, py_string url):
+ self.GetCefBrowserHost().get().StartDownload(PyToCefStringValue(
+ url))
+
+ cpdef py_void SetMouseCursorChangeDisabled(self, py_bool disabled):
+ self.GetCefBrowserHost().get().SetMouseCursorChangeDisabled(
+ bool(disabled))
+
+ cpdef py_bool IsMouseCursorChangeDisabled(self):
+ return self.GetCefBrowserHost().get().IsMouseCursorChangeDisabled()
+
+ cpdef py_void WasResized(self):
+ self.GetCefBrowserHost().get().WasResized()
+
+ cpdef py_void WasHidden(self, py_bool hidden):
+ self.GetCefBrowserHost().get().WasHidden(bool(hidden))
+
+ cpdef py_void NotifyScreenInfoChanged(self):
+ self.GetCefBrowserHost().get().NotifyScreenInfoChanged()
+
+ # virtual CefTextInputContext GetNSTextInputContext() =0;
+ # virtual void HandleKeyEventBeforeTextInputClient(CefEventHandle keyEvent) =0;
+ # virtual void HandleKeyEventAfterTextInputClient(CefEventHandle keyEvent) =0;
+
+ cdef void SendProcessMessage(self, cef_process_id_t targetProcess,
+ object frameId, py_string messageName, list pyArguments
+ ) except *:
+ cdef CefRefPtr[CefProcessMessage] message = \
+ CefProcessMessage_Create(PyToCefStringValue(messageName))
+ # This does not work, no idea why, the CEF implementation
+ # seems not to allow it, both Assign() and swap() do not work:
+ # | message.get().GetArgumentList().Assign(arguments.get())
+ # | message.get().GetArgumentList().swap(arguments)
+ cdef CefRefPtr[CefListValue] messageArguments = \
+ message.get().GetArgumentList()
+ PyListToExistingCefListValue(self.GetIdentifier(), frameId,
+ pyArguments, messageArguments)
+ Debug("SendProcessMessage(): message=%s, arguments size=%d" % (
+ messageName,
+ message.get().GetArgumentList().get().GetSize()))
+ cdef cpp_bool success = \
+ self.GetCefBrowser().get().SendProcessMessage(
+ targetProcess, message)
+ if not success:
+ raise Exception("Browser.SendProcessMessage() failed: "\
+ "messageName=%s" % messageName)
diff --git a/cefpython/browser_process_handler_cef3.pyx b/cefpython/browser_process_handler_cef3.pyx
new file mode 100644
index 00000000..e3f38639
--- /dev/null
+++ b/cefpython/browser_process_handler_cef3.pyx
@@ -0,0 +1,24 @@
+# Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.
+# License: New BSD License.
+# Website: http://code.google.com/p/cefpython/
+
+cdef public void BrowserProcessHandler_OnRenderProcessThreadCreated(
+ CefRefPtr[CefListValue] extra_info
+ ) except * with gil:
+ try:
+ # Keys 0 and 1 are already set in C++ code - to pass debug options.
+ pass
+ except:
+ (exc_type, exc_value, exc_trace) = sys.exc_info()
+ sys.excepthook(exc_type, exc_value, exc_trace)
+
+cdef public void BrowserProcessHandler_OnBeforeChildProcessLaunch(
+ CefRefPtr[CefCommandLine] cefCommandLine
+ ) except * with gil:
+ global g_commandLineSwitches
+ try:
+ AppendSwitchesToCommandLine(cefCommandLine, g_commandLineSwitches)
+ Debug("BrowserProcessHandler_OnBeforeChildProcessLaunch()")
+ except:
+ (exc_type, exc_value, exc_trace) = sys.exc_info()
+ sys.excepthook(exc_type, exc_value, exc_trace)
diff --git a/cefpython/callback_cef3.pyx b/cefpython/callback_cef3.pyx
new file mode 100644
index 00000000..104cd732
--- /dev/null
+++ b/cefpython/callback_cef3.pyx
@@ -0,0 +1,18 @@
+# Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.
+# License: New BSD License.
+# Website: http://code.google.com/p/cefpython/
+
+cdef PyCallback CreatePyCallback(
+ CefRefPtr[CefCallback] cefCallback):
+ cdef PyCallback pyCallback = PyCallback()
+ pyCallback.cefCallback = cefCallback
+ return pyCallback
+
+cdef class PyCallback:
+ cdef CefRefPtr[CefCallback] cefCallback
+
+ cpdef py_void Continue(self):
+ self.cefCallback.get().Continue()
+
+ cpdef py_void Cancel(self):
+ self.cefCallback.get().Cancel()
diff --git a/cefpython/cef1/BUILD_COMPATIBILITY.txt b/cefpython/cef1/BUILD_COMPATIBILITY.txt
new file mode 100644
index 00000000..edc159a6
--- /dev/null
+++ b/cefpython/cef1/BUILD_COMPATIBILITY.txt
@@ -0,0 +1,16 @@
+Chromium/CEF branch:
+ 1453
+Chromium release url:
+ http://src.chromium.org/svn/releases/27.0.1453.110
+CEF revision:
+ 1273
+CEF repository url:
+ http://chromiumembedded.googlecode.com/svn/branches/1453/cef1@1273
+
+----
+
+To convert chromium revision back to version string use this url:
+http://src.chromium.org/viewvc/chrome/branches/xxxx/src/chrome/VERSION?revision=xxxx
+
+The latest chromium version in given branch:
+http://src.chromium.org/viewvc/chrome/branches/xxxx/src/chrome/VERSION
diff --git a/cefpython/cef1/cefpython_public_api.h b/cefpython/cef1/cefpython_public_api.h
new file mode 100644
index 00000000..f55df41f
--- /dev/null
+++ b/cefpython/cef1/cefpython_public_api.h
@@ -0,0 +1,30 @@
+// d:\cefpython\src\setup/cefpython.h(22) : warning C4190: 'RequestHandler_GetCookieManager'
+// has C-linkage specified, but returns UDT 'CefRefPtr' which is incompatible with C
+#if defined(OS_WIN)
+#pragma warning(disable:4190)
+#endif
+
+// All the imports that are required when including "cefpython.h".
+#include "include/cef_client.h"
+#include "include/cef_web_urlrequest.h"
+#include "include/cef_cookie.h"
+#include "util.h"
+
+// To be able to use 'public' declarations you need to include Python.h and cefpython.h.
+#include "Python.h"
+
+// Python 3.2 fix - DL_IMPORT is not defined in Python.h
+#ifndef DL_IMPORT /* declarations for DLL import/export */
+#define DL_IMPORT(RTYPE) RTYPE
+#endif
+#ifndef DL_EXPORT /* declarations for DLL import/export */
+#define DL_EXPORT(RTYPE) RTYPE
+#endif
+
+#if defined(OS_WIN)
+#include "windows/setup/cefpython.h"
+#endif
+
+#if defined(OS_LINUX)
+#include "linux/setup/cefpython.h"
+#endif
diff --git a/cefpython/cef1/client_handler/.gitignore b/cefpython/cef1/client_handler/.gitignore
new file mode 100644
index 00000000..151a620f
--- /dev/null
+++ b/cefpython/cef1/client_handler/.gitignore
@@ -0,0 +1,2 @@
+*.o
+*.a
\ No newline at end of file
diff --git a/cefpython/cef1/client_handler/Makefile b/cefpython/cef1/client_handler/Makefile
new file mode 100644
index 00000000..9baf4a88
--- /dev/null
+++ b/cefpython/cef1/client_handler/Makefile
@@ -0,0 +1,20 @@
+# -g - extra debug information
+# -O1 - more precise backtraces
+# -fPIC - required when using -shared option
+# -Wall - show important warnings
+# -Werror - treat warnings as errors
+
+CC = g++
+CCFLAGS = -g
+
+SRC = client_handler.cpp web_request_client.cpp content_filter_handler.cpp cookie_visitor.cpp download_handler.cpp
+OBJ = $(SRC:.cpp=.o)
+OUT = libclient_handler.a
+
+INC = -I./../ -I/usr/include/python2.7 -I/usr/include/gtk-2.0 -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/gtk-2.0/include -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/atk-1.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include
+
+.cpp.o:
+ $(CC) -fPIC $(INC) $(CCFLAGS) -c $< -o $@
+
+$(OUT): $(OBJ)
+ ar rcs $(OUT) $(OBJ)
diff --git a/cefpython/cef1/client_handler/client_handler.cpp b/cefpython/cef1/client_handler/client_handler.cpp
new file mode 100644
index 00000000..b2884fcc
--- /dev/null
+++ b/cefpython/cef1/client_handler/client_handler.cpp
@@ -0,0 +1,347 @@
+// Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.
+// License: New BSD License.
+// Website: http://code.google.com/p/cefpython/
+
+#include "client_handler.h"
+#include
+
+// The const_cast<> were required in Cython <= 0.17.4,
+// TODO: get rid of it.
+
+// -----------------------------------------------------------------------------
+// CefLoadHandler
+// -----------------------------------------------------------------------------
+
+void ClientHandler::OnLoadEnd(
+ CefRefPtr browser,
+ CefRefPtr frame,
+ int httpStatusCode) {
+ REQUIRE_UI_THREAD();
+ LoadHandler_OnLoadEnd(browser, frame, httpStatusCode);
+}
+
+void ClientHandler::OnLoadStart(
+ CefRefPtr browser,
+ CefRefPtr frame) {
+ REQUIRE_UI_THREAD();
+ LoadHandler_OnLoadStart(browser, frame);
+}
+
+bool ClientHandler::OnLoadError(
+ CefRefPtr browser,
+ CefRefPtr frame,
+ cef_handler_errorcode_t errorCode,
+ const CefString& failedUrl,
+ CefString& errorText
+ ) {
+ REQUIRE_UI_THREAD();
+ return LoadHandler_OnLoadError(
+ browser, frame, errorCode, const_cast(failedUrl), errorText);
+}
+
+// -----------------------------------------------------------------------------
+// CefKeyboardHandler
+// -----------------------------------------------------------------------------
+
+bool ClientHandler::OnKeyEvent(
+ CefRefPtr browser,
+ cef_handler_keyevent_type_t eventType,
+ int keyCode,
+ int modifiers,
+ bool isSystemKey,
+ bool isAfterJavascript) {
+ REQUIRE_UI_THREAD();
+ return KeyboardHandler_OnKeyEvent(
+ browser, eventType, keyCode, modifiers, isSystemKey, isAfterJavascript);
+}
+
+// -----------------------------------------------------------------------------
+// CefV8ContextHandler
+// -----------------------------------------------------------------------------
+
+void ClientHandler::OnContextCreated(
+ CefRefPtr cefBrowser,
+ CefRefPtr cefFrame,
+ CefRefPtr v8Context) {
+ REQUIRE_UI_THREAD();
+ V8ContextHandler_OnContextCreated(cefBrowser, cefFrame, v8Context);
+}
+
+void ClientHandler::OnContextReleased(
+ CefRefPtr cefBrowser,
+ CefRefPtr cefFrame,
+ CefRefPtr v8Context) {
+ REQUIRE_UI_THREAD();
+ V8ContextHandler_OnContextReleased(cefBrowser, cefFrame, v8Context);
+}
+
+void ClientHandler::OnUncaughtException(
+ CefRefPtr browser,
+ CefRefPtr frame,
+ CefRefPtr context,
+ CefRefPtr exception,
+ CefRefPtr stackTrace) {
+ REQUIRE_UI_THREAD();
+ V8ContextHandler_OnUncaughtException(
+ browser, frame, context, exception, stackTrace);
+}
+
+// -----------------------------------------------------------------------------
+// CefRequestHandler
+// -----------------------------------------------------------------------------
+
+bool ClientHandler::OnBeforeBrowse(
+ CefRefPtr browser,
+ CefRefPtr frame,
+ CefRefPtr request,
+ cef_handler_navtype_t navType,
+ bool isRedirect) {
+ REQUIRE_UI_THREAD();
+ return RequestHandler_OnBeforeBrowse(
+ browser, frame, request, navType, isRedirect);
+}
+
+bool ClientHandler::OnBeforeResourceLoad(
+ CefRefPtr browser,
+ CefRefPtr request,
+ CefString& redirectUrl,
+ CefRefPtr& resourceStream,
+ CefRefPtr response,
+ int loadFlags) {
+ REQUIRE_IO_THREAD();
+ return RequestHandler_OnBeforeResourceLoad(
+ browser, request, redirectUrl, resourceStream, response, loadFlags);
+}
+
+void ClientHandler::OnResourceRedirect(
+ CefRefPtr browser,
+ const CefString& old_url,
+ CefString& new_url) {
+ REQUIRE_IO_THREAD();
+ RequestHandler_OnResourceRedirect(
+ browser, const_cast(old_url), new_url);
+}
+
+void ClientHandler::OnResourceResponse(
+ CefRefPtr browser,
+ const CefString& url,
+ CefRefPtr response,
+ CefRefPtr& filter) {
+ REQUIRE_UI_THREAD();
+ RequestHandler_OnResourceResponse(
+ browser, const_cast(url), response, filter);
+}
+
+bool ClientHandler::OnProtocolExecution(
+ CefRefPtr browser,
+ const CefString& url,
+ bool& allowOSExecution) {
+ REQUIRE_IO_THREAD();
+ return RequestHandler_OnProtocolExecution(
+ browser, const_cast(url), allowOSExecution);
+}
+
+bool ClientHandler::GetDownloadHandler(
+ CefRefPtr browser,
+ const CefString& mimeType,
+ const CefString& fileName,
+ int64 contentLength,
+ CefRefPtr& handler) {
+ // Multiple downloads at the same time?
+ AutoLock lock_scope(this);
+ REQUIRE_UI_THREAD();
+ return RequestHandler_GetDownloadHandler(browser, mimeType, fileName,
+ contentLength, handler);
+}
+
+bool ClientHandler::GetAuthCredentials(
+ CefRefPtr browser,
+ bool isProxy,
+ const CefString& host,
+ int port,
+ const CefString& realm,
+ const CefString& scheme,
+ CefString& username,
+ CefString& password) {
+ REQUIRE_IO_THREAD();
+ return RequestHandler_GetAuthCredentials(
+ browser, isProxy, const_cast(host), port,
+ const_cast(realm), const_cast(scheme),
+ username, password);
+}
+
+CefRefPtr ClientHandler::GetCookieManager(
+ CefRefPtr browser,
+ const CefString& main_url) {
+ REQUIRE_IO_THREAD();
+ return RequestHandler_GetCookieManager(
+ browser, const_cast(main_url));
+}
+
+// -----------------------------------------------------------------------------
+// CefDisplayHandler
+// -----------------------------------------------------------------------------
+
+void ClientHandler::OnAddressChange(CefRefPtr browser,
+ CefRefPtr frame,
+ const CefString& url) {
+ REQUIRE_UI_THREAD();
+ DisplayHandler_OnAddressChange(browser, frame, const_cast(url));
+}
+
+bool ClientHandler::OnConsoleMessage(CefRefPtr browser,
+ const CefString& message,
+ const CefString& source,
+ int line) {
+ REQUIRE_UI_THREAD();
+ return DisplayHandler_OnConsoleMessage(
+ browser, const_cast(message),
+ const_cast(source), line);
+}
+
+void ClientHandler::OnContentsSizeChange(CefRefPtr browser,
+ CefRefPtr frame,
+ int width,
+ int height) {
+ REQUIRE_UI_THREAD();
+ DisplayHandler_OnContentsSizeChange(browser, frame, width, height);
+}
+
+void ClientHandler::OnNavStateChange(CefRefPtr browser,
+ bool canGoBack,
+ bool canGoForward) {
+ REQUIRE_UI_THREAD();
+ DisplayHandler_OnNavStateChange(browser, canGoBack, canGoForward);
+}
+
+void ClientHandler::OnStatusMessage(CefRefPtr browser,
+ const CefString& value,
+ StatusType type) {
+ REQUIRE_UI_THREAD();
+ DisplayHandler_OnStatusMessage(browser, const_cast(value), type);
+}
+
+
+void ClientHandler::OnTitleChange(CefRefPtr browser,
+ const CefString& title) {
+ REQUIRE_UI_THREAD();
+ DisplayHandler_OnTitleChange(browser, const_cast(title));
+}
+
+bool ClientHandler::OnTooltip(CefRefPtr browser,
+ CefString& text) {
+ REQUIRE_UI_THREAD();
+ return DisplayHandler_OnTooltip(browser, text);
+}
+
+// -----------------------------------------------------------------------------
+// CefLifeSpanHandler
+// -----------------------------------------------------------------------------
+
+bool ClientHandler::DoClose(CefRefPtr browser) {
+ REQUIRE_UI_THREAD();
+ return LifespanHandler_DoClose(browser);
+}
+
+void ClientHandler::OnAfterCreated(CefRefPtr browser) {
+ REQUIRE_UI_THREAD();
+ LifespanHandler_OnAfterCreated(browser);
+}
+
+void ClientHandler::OnBeforeClose(CefRefPtr browser) {
+ REQUIRE_UI_THREAD();
+ LifespanHandler_OnBeforeClose(browser);
+}
+
+bool ClientHandler::OnBeforePopup(CefRefPtr parentBrowser,
+ const CefPopupFeatures& popupFeatures,
+ CefWindowInfo& windowInfo,
+ const CefString& url,
+ CefRefPtr& client,
+ CefBrowserSettings& settings) {
+ REQUIRE_UI_THREAD();
+ // @TODO
+ return false;
+}
+
+bool ClientHandler::RunModal(CefRefPtr browser) {
+ REQUIRE_UI_THREAD();
+ return LifespanHandler_RunModal(browser);
+}
+
+// -----------------------------------------------------------------------------
+// CefRenderHandler
+// -----------------------------------------------------------------------------
+
+#if defined(OS_WIN)
+
+bool ClientHandler::GetViewRect(CefRefPtr browser,
+ CefRect& rect) {
+ REQUIRE_UI_THREAD();
+ return RenderHandler_GetViewRect(browser, rect);
+}
+
+bool ClientHandler::GetScreenRect(CefRefPtr browser,
+ CefRect& rect) {
+ REQUIRE_UI_THREAD();
+ return RenderHandler_GetScreenRect(browser, rect);
+}
+
+bool ClientHandler::GetScreenPoint(CefRefPtr browser,
+ int viewX,
+ int viewY,
+ int& screenX,
+ int& screenY) {
+ REQUIRE_UI_THREAD();
+ return RenderHandler_GetScreenPoint(
+ browser, viewX, viewY, screenX, screenY);
+}
+
+void ClientHandler::OnPopupShow(CefRefPtr browser,
+ bool show) {
+ REQUIRE_UI_THREAD();
+ RenderHandler_OnPopupShow(browser, show);
+}
+
+void ClientHandler::OnPopupSize(CefRefPtr browser,
+ const CefRect& rect) {
+ REQUIRE_UI_THREAD();
+ RenderHandler_OnPopupSize(browser, const_cast(rect));
+}
+
+void ClientHandler::OnPaint(CefRefPtr browser,
+ PaintElementType type,
+ const RectList& dirtyRects,
+ const void* buffer) {
+ REQUIRE_UI_THREAD();
+ RenderHandler_OnPaint(browser, type,
+ const_cast(dirtyRects),
+ const_cast(buffer));
+}
+
+void ClientHandler::OnCursorChange(CefRefPtr browser,
+ CefCursorHandle cursor) {
+ REQUIRE_UI_THREAD();
+ RenderHandler_OnCursorChange(browser, cursor);
+}
+
+// #if defined(OS_WIN) - CefRenderHandler
+#endif
+
+// -----------------------------------------------------------------------------
+// CefDragHandler
+// -----------------------------------------------------------------------------
+
+bool ClientHandler::OnDragStart(CefRefPtr browser,
+ CefRefPtr dragData,
+ DragOperationsMask mask) {
+ REQUIRE_UI_THREAD();
+ return DragHandler_OnDragStart(browser, dragData, mask);
+}
+
+bool ClientHandler::OnDragEnter(CefRefPtr browser,
+ CefRefPtr dragData,
+ DragOperationsMask mask) {
+ REQUIRE_UI_THREAD();
+ return DragHandler_OnDragEnter(browser, dragData, mask);
+}
diff --git a/cefpython/cef1/client_handler/client_handler.h b/cefpython/cef1/client_handler/client_handler.h
new file mode 100644
index 00000000..689a00ef
--- /dev/null
+++ b/cefpython/cef1/client_handler/client_handler.h
@@ -0,0 +1,304 @@
+// Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.
+// License: New BSD License.
+// Website: http://code.google.com/p/cefpython/
+
+#pragma once
+
+#if defined(_WIN32)
+#include "../windows/stdint.h"
+#endif
+
+#include "cefpython_public_api.h"
+
+class ClientHandler : public CefClient,
+ public CefLoadHandler,
+ public CefKeyboardHandler,
+ public CefV8ContextHandler,
+ public CefRequestHandler,
+ public CefDisplayHandler,
+ public CefLifeSpanHandler,
+ public CefRenderHandler,
+ public CefDragHandler
+/*
+ public CefFocusHandler,
+ public CefMenuHandler,
+ public CefPrintHandler,
+ public CefPermissionHandler,
+ public CefFindHandler,
+ public CefJSDialogHandler,
+*/
+{
+public:
+ ClientHandler(){}
+ virtual ~ClientHandler(){}
+
+ // ---------------------------------------------------------------------------
+ // Handlers that are already implemented
+ // ---------------------------------------------------------------------------
+
+ virtual CefRefPtr GetLoadHandler() OVERRIDE
+ { return this; }
+
+ virtual CefRefPtr GetRequestHandler() OVERRIDE
+ { return this; }
+
+ virtual CefRefPtr GetDisplayHandler() OVERRIDE
+ { return this; }
+
+ virtual CefRefPtr GetKeyboardHandler() OVERRIDE
+ { return this; }
+
+ virtual CefRefPtr GetV8ContextHandler() OVERRIDE
+ { return this; }
+
+ virtual CefRefPtr GetLifeSpanHandler() OVERRIDE
+ { return this; }
+
+ virtual CefRefPtr GetRenderHandler() OVERRIDE
+ { return this; }
+
+ virtual CefRefPtr GetDragHandler() OVERRIDE
+ { return this; }
+
+ // ---------------------------------------------------------------------------
+ // NOT yet implemented handlers
+ // ---------------------------------------------------------------------------
+
+ virtual CefRefPtr GetFocusHandler() OVERRIDE
+ { return NULL; }
+
+ virtual CefRefPtr GetMenuHandler() OVERRIDE
+ { return NULL; }
+
+ virtual CefRefPtr GetPermissionHandler() OVERRIDE
+ { return NULL; }
+
+ virtual CefRefPtr GetPrintHandler() OVERRIDE
+ { return NULL; }
+
+ virtual CefRefPtr GetFindHandler() OVERRIDE
+ { return NULL; }
+
+ virtual CefRefPtr GetJSDialogHandler() OVERRIDE
+ { return NULL; }
+
+ // ---------------------------------------------------------------------------
+ // CefLoadHandler methods.
+ // ---------------------------------------------------------------------------
+
+ virtual void OnLoadEnd(
+ CefRefPtr browser,
+ CefRefPtr frame,
+ int httpStatusCode
+ ) OVERRIDE;
+
+
+ virtual void OnLoadStart(
+ CefRefPtr browser,
+ CefRefPtr frame
+ ) OVERRIDE;
+
+ virtual bool OnLoadError(
+ CefRefPtr browser,
+ CefRefPtr frame,
+ cef_handler_errorcode_t errorCode,
+ const CefString& failedUrl,
+ CefString& errorText
+ ) OVERRIDE;
+
+ // ---------------------------------------------------------------------------
+ // CefKeyboardHandler methods.
+ // ---------------------------------------------------------------------------
+
+ virtual bool OnKeyEvent(
+ CefRefPtr browser,
+ cef_handler_keyevent_type_t eventType,
+ int keyCode,
+ int modifiers,
+ bool isSystemKey,
+ bool isAfterJavascript
+ ) OVERRIDE;
+
+ // ---------------------------------------------------------------------------
+ // CefV8ContextHandler methods.
+ // ---------------------------------------------------------------------------
+
+ virtual void OnContextCreated(
+ CefRefPtr cefBrowser,
+ CefRefPtr cefFrame,
+ CefRefPtr v8Context) OVERRIDE;
+
+ virtual void OnContextReleased(
+ CefRefPtr cefBrowser,
+ CefRefPtr cefFrame,
+ CefRefPtr v8Context) OVERRIDE;
+
+ virtual void OnUncaughtException(
+ CefRefPtr browser,
+ CefRefPtr frame,
+ CefRefPtr context,
+ CefRefPtr exception,
+ CefRefPtr stackTrace) OVERRIDE;
+
+ // ---------------------------------------------------------------------------
+ // CefRequestHandler methods.
+ // ---------------------------------------------------------------------------
+
+ virtual bool OnBeforeBrowse(
+ CefRefPtr browser,
+ CefRefPtr frame,
+ CefRefPtr request,
+ cef_handler_navtype_t navType,
+ bool isRedirect) OVERRIDE;
+
+ virtual bool OnBeforeResourceLoad(
+ CefRefPtr browser,
+ CefRefPtr request,
+ CefString& redirectUrl,
+ CefRefPtr& resourceStream,
+ CefRefPtr response,
+ int loadFlags) OVERRIDE;
+
+ virtual void OnResourceRedirect(
+ CefRefPtr browser,
+ const CefString& old_url,
+ CefString& new_url) OVERRIDE;
+
+ virtual void OnResourceResponse(
+ CefRefPtr browser,
+ const CefString& url,
+ CefRefPtr response,
+ CefRefPtr& filter) OVERRIDE;
+
+ virtual bool OnProtocolExecution(
+ CefRefPtr browser,
+ const CefString& url,
+ bool& allowOSExecution) OVERRIDE;
+
+ virtual bool GetDownloadHandler(
+ CefRefPtr browser,
+ const CefString& mimeType,
+ const CefString& fileName,
+ int64 contentLength,
+ CefRefPtr& handler) OVERRIDE;
+
+ virtual bool GetAuthCredentials(
+ CefRefPtr browser,
+ bool isProxy,
+ const CefString& host,
+ int port,
+ const CefString& realm,
+ const CefString& scheme,
+ CefString& username,
+ CefString& password) OVERRIDE;
+
+ virtual CefRefPtr GetCookieManager(
+ CefRefPtr browser,
+ const CefString& main_url) OVERRIDE;
+
+ // ---------------------------------------------------------------------------
+ // CefDisplayHandler
+ // ---------------------------------------------------------------------------
+
+ virtual void OnAddressChange(CefRefPtr browser,
+ CefRefPtr frame,
+ const CefString& url) OVERRIDE;
+
+ virtual bool OnConsoleMessage(CefRefPtr browser,
+ const CefString& message,
+ const CefString& source,
+ int line) OVERRIDE;
+
+ virtual void OnContentsSizeChange(CefRefPtr browser,
+ CefRefPtr frame,
+ int width,
+ int height) OVERRIDE;
+
+ virtual void OnNavStateChange(CefRefPtr browser,
+ bool canGoBack,
+ bool canGoForward) OVERRIDE;
+
+ virtual void OnStatusMessage(CefRefPtr browser,
+ const CefString& value,
+ StatusType type) OVERRIDE;
+
+ virtual void OnTitleChange(CefRefPtr browser,
+ const CefString& title) OVERRIDE;
+
+ virtual bool OnTooltip(CefRefPtr browser,
+ CefString& text) OVERRIDE;
+
+ // ---------------------------------------------------------------------------
+ // CefLifeSpanHandler
+ // ---------------------------------------------------------------------------
+
+ virtual bool DoClose(CefRefPtr browser) OVERRIDE;
+
+ virtual void OnAfterCreated(CefRefPtr browser) OVERRIDE;
+
+ virtual void OnBeforeClose(CefRefPtr browser) OVERRIDE;
+
+ virtual bool OnBeforePopup(CefRefPtr parentBrowser,
+ const CefPopupFeatures& popupFeatures,
+ CefWindowInfo& windowInfo,
+ const CefString& url,
+ CefRefPtr& client,
+ CefBrowserSettings& settings) OVERRIDE;
+
+ virtual bool RunModal(CefRefPtr browser) OVERRIDE;
+
+ // ---------------------------------------------------------------------------
+ // CefRenderHandler
+ // ---------------------------------------------------------------------------
+
+#if defined(OS_WIN)
+
+ virtual bool GetViewRect(CefRefPtr browser,
+ CefRect& rect) OVERRIDE;
+
+ virtual bool GetScreenRect(CefRefPtr browser,
+ CefRect& rect) OVERRIDE;
+
+ virtual bool GetScreenPoint(CefRefPtr browser,
+ int viewX,
+ int viewY,
+ int& screenX,
+ int& screenY) OVERRIDE;
+
+ virtual void OnPopupShow(CefRefPtr browser,
+ bool show) OVERRIDE;
+
+ virtual void OnPopupSize(CefRefPtr browser,
+ const CefRect& rect) OVERRIDE;
+
+ virtual void OnPaint(CefRefPtr browser,
+ PaintElementType type,
+ const RectList& dirtyRects,
+ const void* buffer) OVERRIDE;
+
+ virtual void OnCursorChange(CefRefPtr browser,
+ CefCursorHandle cursor) OVERRIDE;
+
+#endif
+
+ // ---------------------------------------------------------------------------
+ // CefDragHandler
+ // ---------------------------------------------------------------------------
+
+ virtual bool OnDragStart(CefRefPtr browser,
+ CefRefPtr dragData,
+ DragOperationsMask mask) OVERRIDE;
+
+ virtual bool OnDragEnter(CefRefPtr browser,
+ CefRefPtr dragData,
+ DragOperationsMask mask) OVERRIDE;
+
+protected:
+
+ // Include the default reference counting implementation.
+ IMPLEMENT_REFCOUNTING(ClientHandler);
+
+ // Include the default locking implementation.
+ IMPLEMENT_LOCKING(ClientHandler);
+
+};
diff --git a/cefpython/cef1/client_handler/client_handler.sln b/cefpython/cef1/client_handler/client_handler.sln
new file mode 100644
index 00000000..b3dd2d2a
--- /dev/null
+++ b/cefpython/cef1/client_handler/client_handler.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "client_handler_py27", "client_handler_py27.vcproj", "{15AD928F-FFD0-4FA5-B469-E42ABB0B4196}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC943}") = "client_handler_py32", "client_handler_py32.vcproj", "{37AA7CD9-67AD-40B1-ADC0-D62173764BCA}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {15AD928F-FFD0-4FA5-B469-E42ABB0B4196}.Debug|Win32.ActiveCfg = Debug|Win32
+ {15AD928F-FFD0-4FA5-B469-E42ABB0B4196}.Debug|Win32.Build.0 = Debug|Win32
+ {15AD928F-FFD0-4FA5-B469-E42ABB0B4196}.Release|Win32.ActiveCfg = Release|Win32
+ {15AD928F-FFD0-4FA5-B469-E42ABB0B4196}.Release|Win32.Build.0 = Release|Win32
+ {37AA7CD9-67AD-40B1-ADC0-D62173764BCA}.Debug|Win32.ActiveCfg = Debug|Win32
+ {37AA7CD9-67AD-40B1-ADC0-D62173764BCA}.Debug|Win32.Build.0 = Debug|Win32
+ {37AA7CD9-67AD-40B1-ADC0-D62173764BCA}.Release|Win32.ActiveCfg = Release|Win32
+ {37AA7CD9-67AD-40B1-ADC0-D62173764BCA}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/cefpython/cef1/client_handler/client_handler_py27.vcproj b/cefpython/cef1/client_handler/client_handler_py27.vcproj
new file mode 100644
index 00000000..3f45e736
--- /dev/null
+++ b/cefpython/cef1/client_handler/client_handler_py27.vcproj
@@ -0,0 +1,205 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cefpython/cef1/client_handler/client_handler_py32.vcproj b/cefpython/cef1/client_handler/client_handler_py32.vcproj
new file mode 100644
index 00000000..643a6751
--- /dev/null
+++ b/cefpython/cef1/client_handler/client_handler_py32.vcproj
@@ -0,0 +1,204 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cefpython/cef1/client_handler/content_filter_handler.cpp b/cefpython/cef1/client_handler/content_filter_handler.cpp
new file mode 100644
index 00000000..0578bf5d
--- /dev/null
+++ b/cefpython/cef1/client_handler/content_filter_handler.cpp
@@ -0,0 +1,17 @@
+// Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.
+// License: New BSD License.
+// Website: http://code.google.com/p/cefpython/
+
+#include "content_filter_handler.h"
+
+void ContentFilterHandler::ProcessData(const void* data, int data_size,
+ CefRefPtr& substitute_data) {
+ REQUIRE_UI_THREAD();
+ ContentFilterHandler_ProcessData(contentFilterId_, data, data_size,
+ substitute_data);
+}
+
+void ContentFilterHandler::Drain(CefRefPtr& remainder) {
+ REQUIRE_UI_THREAD();
+ ContentFilterHandler_Drain(contentFilterId_, remainder);
+}
\ No newline at end of file
diff --git a/cefpython/cef1/client_handler/content_filter_handler.h b/cefpython/cef1/client_handler/content_filter_handler.h
new file mode 100644
index 00000000..ee267ac4
--- /dev/null
+++ b/cefpython/cef1/client_handler/content_filter_handler.h
@@ -0,0 +1,31 @@
+// Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.
+// License: New BSD License.
+// Website: http://code.google.com/p/cefpython/
+
+#pragma once
+
+#if defined(_WIN32)
+#include "../windows/stdint.h"
+#endif
+
+#include "cefpython_public_api.h"
+
+class ContentFilterHandler : public CefContentFilter
+{
+public:
+ int contentFilterId_;
+public:
+ ContentFilterHandler(int contentFilterId) :
+ contentFilterId_(contentFilterId) {
+ }
+ virtual ~ContentFilterHandler(){}
+
+ virtual void ProcessData(const void* data, int data_size,
+ CefRefPtr& substitute_data) OVERRIDE;
+
+ virtual void Drain(CefRefPtr& remainder) OVERRIDE;
+
+protected:
+ // Include the default reference counting implementation.
+ IMPLEMENT_REFCOUNTING(ContentFilterHandler);
+};
diff --git a/cefpython/cef1/client_handler/cookie_visitor.cpp b/cefpython/cef1/client_handler/cookie_visitor.cpp
new file mode 100644
index 00000000..f1e362da
--- /dev/null
+++ b/cefpython/cef1/client_handler/cookie_visitor.cpp
@@ -0,0 +1,16 @@
+// Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.
+// License: New BSD License.
+// Website: http://code.google.com/p/cefpython/
+
+#include "cookie_visitor.h"
+#include
+
+bool CookieVisitor::Visit(
+ const CefCookie& cookie,
+ int count,
+ int total,
+ bool& deleteCookie
+ ) {
+ REQUIRE_IO_THREAD();
+ return CookieVisitor_Visit(cookieVisitorId_, cookie, count, total, deleteCookie);
+}
diff --git a/cefpython/cef1/client_handler/cookie_visitor.h b/cefpython/cef1/client_handler/cookie_visitor.h
new file mode 100644
index 00000000..b33a8f6e
--- /dev/null
+++ b/cefpython/cef1/client_handler/cookie_visitor.h
@@ -0,0 +1,32 @@
+// Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.
+// License: New BSD License.
+// Website: http://code.google.com/p/cefpython/
+
+#pragma once
+
+#if defined(_WIN32)
+#include "../windows/stdint.h"
+#endif
+
+#include "cefpython_public_api.h"
+
+class CookieVisitor : public CefCookieVisitor
+{
+public:
+ int cookieVisitorId_;
+public:
+ CookieVisitor(int cookieVisitorId)
+ : cookieVisitorId_(cookieVisitorId) {
+ }
+
+ virtual bool Visit(
+ const CefCookie& cookie,
+ int count,
+ int total,
+ bool& deleteCookie
+ ) OVERRIDE;
+
+protected:
+ // Include the default reference counting implementation.
+ IMPLEMENT_REFCOUNTING(CookieVisitor);
+};
diff --git a/cefpython/cef1/client_handler/download_handler.cpp b/cefpython/cef1/client_handler/download_handler.cpp
new file mode 100644
index 00000000..7f8b60aa
--- /dev/null
+++ b/cefpython/cef1/client_handler/download_handler.cpp
@@ -0,0 +1,25 @@
+// Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.
+// License: New BSD License.
+// Website: http://code.google.com/p/cefpython/
+
+#include "download_handler.h"
+#include
+
+bool DownloadHandler::ReceivedData(
+ void* data,
+ int data_size
+ ) {
+ // Multiple downloads at the same time?
+ AutoLock lock_scope(this);
+ REQUIRE_UI_THREAD();
+ if (data_size == 0)
+ return true;
+ return DownloadHandler_ReceivedData(downloadHandlerId_, data, data_size);
+}
+
+void DownloadHandler::Complete() {
+ // Multiple downloads at the same time?
+ AutoLock lock_scope(this);
+ REQUIRE_UI_THREAD();
+ DownloadHandler_Complete(downloadHandlerId_);
+}
diff --git a/cefpython/cef1/client_handler/download_handler.h b/cefpython/cef1/client_handler/download_handler.h
new file mode 100644
index 00000000..ad802965
--- /dev/null
+++ b/cefpython/cef1/client_handler/download_handler.h
@@ -0,0 +1,30 @@
+// Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.
+// License: New BSD License.
+// Website: http://code.google.com/p/cefpython/
+
+#pragma once
+
+#if defined(_WIN32)
+#include "../windows/stdint.h"
+#endif
+
+#include "cefpython_public_api.h"
+
+class DownloadHandler : public CefDownloadHandler
+{
+public:
+ int downloadHandlerId_;
+public:
+ DownloadHandler(int downloadHandlerId)
+ : downloadHandlerId_(downloadHandlerId) {
+ }
+
+ virtual bool ReceivedData(void* data, int data_size) OVERRIDE;
+ virtual void Complete() OVERRIDE;
+
+protected:
+ // Include the default reference counting implementation.
+ IMPLEMENT_REFCOUNTING(DownloadHandler);
+ // Include the default locking implementation.
+ IMPLEMENT_LOCKING(DownloadHandler);
+};
diff --git a/cefpython/cef1/client_handler/web_request_client.cpp b/cefpython/cef1/client_handler/web_request_client.cpp
new file mode 100644
index 00000000..2f5039f1
--- /dev/null
+++ b/cefpython/cef1/client_handler/web_request_client.cpp
@@ -0,0 +1,47 @@
+// Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.
+// License: New BSD License.
+// Website: http://code.google.com/p/cefpython/
+
+#include "web_request_client.h"
+
+// Cython doesn't know nothing about 'const' so we need to remove it,
+// otherwise you get compile error.
+
+void WebRequestClient::OnStateChange(CefRefPtr requester,
+ RequestState state) {
+ REQUIRE_UI_THREAD();
+ WebRequestClient_OnStateChange(webRequestId_, requester, state);
+}
+
+void WebRequestClient::OnRedirect(CefRefPtr requester,
+ CefRefPtr request,
+ CefRefPtr response) {
+ REQUIRE_UI_THREAD();
+ WebRequestClient_OnRedirect(webRequestId_, requester, request, response);
+}
+
+void WebRequestClient::OnHeadersReceived(CefRefPtr requester,
+ CefRefPtr response) {
+ REQUIRE_UI_THREAD();
+ WebRequestClient_OnHeadersReceived(webRequestId_, requester, response);
+}
+
+void WebRequestClient::OnProgress(CefRefPtr requester,
+ uint64 bytesSent, uint64 totalBytesToBeSent) {
+ REQUIRE_UI_THREAD();
+ WebRequestClient_OnProgress(webRequestId_, requester, bytesSent,
+ totalBytesToBeSent);
+}
+
+void WebRequestClient::OnData(CefRefPtr requester,
+ const void* data, int dataLength) {
+ REQUIRE_UI_THREAD();
+ WebRequestClient_OnData(webRequestId_, requester, const_cast(data),
+ dataLength);
+}
+
+void WebRequestClient::OnError(CefRefPtr requester,
+ ErrorCode errorCode) {
+ REQUIRE_UI_THREAD();
+ WebRequestClient_OnError(webRequestId_, requester, errorCode);
+}
diff --git a/cefpython/cef1/client_handler/web_request_client.h b/cefpython/cef1/client_handler/web_request_client.h
new file mode 100644
index 00000000..0a8eb996
--- /dev/null
+++ b/cefpython/cef1/client_handler/web_request_client.h
@@ -0,0 +1,44 @@
+// Copyright (c) 2012-2014 The CEF Python authors. All rights reserved.
+// License: New BSD License.
+// Website: http://code.google.com/p/cefpython/
+
+#pragma once
+
+#if defined(_WIN32)
+#include "../windows/stdint.h"
+#endif
+
+#include "cefpython_public_api.h"
+
+class WebRequestClient : public CefWebURLRequestClient
+{
+public:
+ int webRequestId_;
+public:
+ WebRequestClient(int webRequestId) :
+ webRequestId_(webRequestId) {
+ }
+ virtual ~WebRequestClient(){}
+
+ virtual void OnStateChange(CefRefPtr requester,
+ RequestState state) OVERRIDE;
+
+ virtual void OnRedirect(CefRefPtr requester,
+ CefRefPtr request,
+ CefRefPtr response) OVERRIDE;
+
+ virtual void OnHeadersReceived(CefRefPtr requester,
+ CefRefPtr response) OVERRIDE;
+
+ virtual void OnProgress(CefRefPtr requester,
+ uint64 bytesSent, uint64 totalBytesToBeSent) OVERRIDE;
+
+ virtual void OnData(CefRefPtr requester,
+ const void* data, int dataLength) OVERRIDE;
+
+ virtual void OnError(CefRefPtr requester,
+ ErrorCode errorCode) OVERRIDE;
+protected:
+ // Include the default reference counting implementation.
+ IMPLEMENT_REFCOUNTING(WebRequestClient);
+};
diff --git a/cefpython/cef1/http_authentication/AuthCredentials.cpp b/cefpython/cef1/http_authentication/AuthCredentials.cpp
new file mode 100644
index 00000000..054f0006
--- /dev/null
+++ b/cefpython/cef1/http_authentication/AuthCredentials.cpp
@@ -0,0 +1,3 @@
+#include "AuthCredentials.h"
+
+AuthCredentialsDataMap AuthCredentials::data;
diff --git a/cefpython/cef1/http_authentication/AuthCredentials.h b/cefpython/cef1/http_authentication/AuthCredentials.h
new file mode 100644
index 00000000..909c4b8b
--- /dev/null
+++ b/cefpython/cef1/http_authentication/AuthCredentials.h
@@ -0,0 +1,32 @@
+#pragma once
+
+#include
+#include
+#include