diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,165 @@
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+  This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+  0. Additional Definitions. 
+
+  As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+  "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+  An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+  A "Combined Work" is a work produced by combining or linking an
+Application with the Library.  The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+  The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+  The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+  1. Exception to Section 3 of the GNU GPL.
+
+  You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+  2. Conveying Modified Versions.
+
+  If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+   a) under this License, provided that you make a good faith effort to
+   ensure that, in the event an Application does not supply the
+   function or data, the facility still operates, and performs
+   whatever part of its purpose remains meaningful, or
+
+   b) under the GNU GPL, with none of the additional permissions of
+   this License applicable to that copy.
+
+  3. Object Code Incorporating Material from Library Header Files.
+
+  The object code form of an Application may incorporate material from
+a header file that is part of the Library.  You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+   a) Give prominent notice with each copy of the object code that the
+   Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the object code with a copy of the GNU GPL and this license
+   document.
+
+  4. Combined Works.
+
+  You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+   a) Give prominent notice with each copy of the Combined Work that
+   the Library is used in it and that the Library and its use are
+   covered by this License.
+
+   b) Accompany the Combined Work with a copy of the GNU GPL and this license
+   document.
+
+   c) For a Combined Work that displays copyright notices during
+   execution, include the copyright notice for the Library among
+   these notices, as well as a reference directing the user to the
+   copies of the GNU GPL and this license document.
+
+   d) Do one of the following:
+
+       0) Convey the Minimal Corresponding Source under the terms of this
+       License, and the Corresponding Application Code in a form
+       suitable for, and under terms that permit, the user to
+       recombine or relink the Application with a modified version of
+       the Linked Version to produce a modified Combined Work, in the
+       manner specified by section 6 of the GNU GPL for conveying
+       Corresponding Source.
+
+       1) Use a suitable shared library mechanism for linking with the
+       Library.  A suitable mechanism is one that (a) uses at run time
+       a copy of the Library already present on the user's computer
+       system, and (b) will operate properly with a modified version
+       of the Library that is interface-compatible with the Linked
+       Version. 
+
+   e) Provide Installation Information, but only if you would otherwise
+   be required to provide such information under section 6 of the
+   GNU GPL, and only to the extent that such information is
+   necessary to install and execute a modified version of the
+   Combined Work produced by recombining or relinking the
+   Application with a modified version of the Linked Version. (If
+   you use option 4d0, the Installation Information must accompany
+   the Minimal Corresponding Source and Corresponding Application
+   Code. If you use option 4d1, you must provide the Installation
+   Information in the manner specified by section 6 of the GNU GPL
+   for conveying Corresponding Source.)
+
+  5. Combined Libraries.
+
+  You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+   a) Accompany the combined library with a copy of the same work based
+   on the Library, uncombined with any other library facilities,
+   conveyed under the terms of this License.
+
+   b) Give prominent notice with the combined library that part of it
+   is a work based on the Library, and explaining where to find the
+   accompanying uncombined form of the same work.
+
+  6. Revised Versions of the GNU Lesser General Public License.
+
+  The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+  Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+  If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
diff --git a/Setup.hs b/Setup.hs
new file mode 100644
--- /dev/null
+++ b/Setup.hs
@@ -0,0 +1,2 @@
+import Distribution.Simple
+main = defaultMain
diff --git a/awesomium.cabal b/awesomium.cabal
new file mode 100644
--- /dev/null
+++ b/awesomium.cabal
@@ -0,0 +1,52 @@
+
+Name:                awesomium
+Version:             0.1.0.0
+Synopsis:            High-level Awesomium bindings.
+License:             LGPL-3
+License-File:        LICENSE
+Author:              Maksymilian Owsianny
+Maintainer:          Maksymilian.Owsianny+Awesomium@gmail.com
+Bug-Reports:         https://github.com/MaxOw/awesomium/issues
+Copyright:           (c) 2012 Maksymilian Owsianny
+Category:            Graphics, Web
+Build-Type:          Simple
+Stability:           Experimental
+Cabal-Version:       >= 1.8
+
+Description:         Awesomium (<http://awesomium.com>) is a windowless
+                     port of Chromium/Webkit.
+                     .
+                     You can integrate it with your program, and write
+                     all of your UI with HTML\/CSS\/JS.
+                     .
+                     If you plan to integrate Awesomium with GLUT you
+                     can also check out this package
+                     (<http://hackage.haskell.org/package/awesomium-glut>).
+
+Source-Repository head
+  Type:     git
+  Location: https://github.com/MaxOw/awesomium.git
+
+Library
+  Exposed-Modules: Graphics.UI.Awesomium
+                 , Graphics.UI.Awesomium.WebCore
+                 , Graphics.UI.Awesomium.WebView
+                 , Graphics.UI.Awesomium.WebView.Callbacks
+                 , Graphics.UI.Awesomium.RenderBuffer
+                 , Graphics.UI.Awesomium.Resource
+                 , Graphics.UI.Awesomium.UploadElement
+                 , Graphics.UI.Awesomium.History
+                 , Graphics.UI.Awesomium.Javascript
+                 , Graphics.UI.Awesomium.Javascript.JSValue
+                 , Graphics.UI.Awesomium.Javascript.JSObject
+                 , Graphics.UI.Awesomium.Javascript.JSArray
+
+  Build-Depends  : awesomium-raw
+                 , base             >= 3 && < 5
+                 , vector           >= 0.7.1
+                 , text             >= 0.11.1
+                 , containers
+                 , aeson
+                 , attoparsec       >= 0.8.6.1
+
+  Hs-Source-Dirs : src
diff --git a/src/Graphics/UI/Awesomium.hs b/src/Graphics/UI/Awesomium.hs
new file mode 100644
--- /dev/null
+++ b/src/Graphics/UI/Awesomium.hs
@@ -0,0 +1,28 @@
+----------------------------------------------------------------------
+-- |
+-- Module      :  Graphics.UI.Awesomium
+-- Copyright   :  (c) 2012 Maksymilian Owsianny
+-- License     :  LGPL-3 (see the file LICENSE)
+-- 
+-- Maintainer  :  Maksymilian.Owsianny+Awesomium@gmail.com
+-- Stability   :  Experimental
+-- Portability :  Portable? (needs FFI)
+--
+----------------------------------------------------------------------
+
+module Graphics.UI.Awesomium 
+    ( module Graphics.UI.Awesomium.WebCore
+    , module Graphics.UI.Awesomium.WebView
+    , module Graphics.UI.Awesomium.RenderBuffer
+    , module Graphics.UI.Awesomium.Resource
+    , module Graphics.UI.Awesomium.UploadElement
+    , module Graphics.UI.Awesomium.History
+) where
+
+import Graphics.UI.Awesomium.WebCore
+import Graphics.UI.Awesomium.WebView
+import Graphics.UI.Awesomium.RenderBuffer
+import Graphics.UI.Awesomium.Resource
+import Graphics.UI.Awesomium.UploadElement
+import Graphics.UI.Awesomium.History
+
diff --git a/src/Graphics/UI/Awesomium/History.hs b/src/Graphics/UI/Awesomium/History.hs
new file mode 100644
--- /dev/null
+++ b/src/Graphics/UI/Awesomium/History.hs
@@ -0,0 +1,68 @@
+----------------------------------------------------------------------
+-- |
+-- Module      :  Graphics.UI.Awesomium.History
+-- Copyright   :  (c) 2012 Maksymilian Owsianny
+-- License     :  LGPL-3 (see the file LICENSE)
+-- 
+-- Maintainer  :  Maksymilian.Owsianny+Awesomium@gmail.com
+-- Stability   :  Experimental
+-- Portability :  Portable? (needs FFI)
+--
+----------------------------------------------------------------------
+
+module Graphics.UI.Awesomium.History
+    ( HistoryQueryResult, HistoryEntry
+    , queryResultDestroy
+    , queryResultGetSize
+    , queryResultGetEntryAtIndex
+    , entryDestroy
+    , entryGetUrl
+    , entryGetTitle
+    , entryGetVisitTime
+    , entryGetVisitCount
+) where
+
+import Graphics.UI.Awesomium.Raw
+
+import Foreign.Ptr
+
+-- | Destroy the instance (you must call this once you're done using
+-- the instance)
+queryResultDestroy :: HistoryQueryResult -> IO ()
+queryResultDestroy = awe_history_query_result_destroy
+
+-- | Get the total number of entries
+queryResultGetSize :: HistoryQueryResult -> IO Int
+queryResultGetSize = awe_history_query_result_get_size
+
+-- | Get a certain entry (you must destroy any returned entry using
+-- 'entryDestroy'). May return Nothing if the index is out of
+-- bounds.
+queryResultGetEntryAtIndex :: HistoryQueryResult -> Int
+                           -> IO (Maybe HistoryEntry)
+queryResultGetEntryAtIndex i r =
+    awe_history_query_result_get_entry_at_index i r >>= \res ->
+    if (res == nullPtr)
+        then return Nothing
+        else return $ Just res
+
+-- | Destroy the instance
+entryDestroy :: HistoryEntry -> IO ()
+entryDestroy = awe_history_entry_destroy
+
+-- | Get the URL of the page
+entryGetUrl :: HistoryEntry -> IO String
+entryGetUrl = awe_history_entry_get_url
+
+-- | Get the title of the page
+entryGetTitle :: HistoryEntry -> IO String
+entryGetTitle = awe_history_entry_get_title
+
+-- | Get the last time this page was visited (in seconds since epoch)
+entryGetVisitTime :: HistoryEntry -> IO Double
+entryGetVisitTime = awe_history_entry_get_visit_time
+
+-- | Get the number of times this page was visited.
+entryGetVisitCount :: HistoryEntry -> IO Int
+entryGetVisitCount = awe_history_entry_get_visit_count
+
diff --git a/src/Graphics/UI/Awesomium/Javascript.hs b/src/Graphics/UI/Awesomium/Javascript.hs
new file mode 100644
--- /dev/null
+++ b/src/Graphics/UI/Awesomium/Javascript.hs
@@ -0,0 +1,108 @@
+----------------------------------------------------------------------
+-- |
+-- Module      :  Graphics.UI.Awesomium.Javascript
+-- Copyright   :  (c) 2012 Maksymilian Owsianny
+-- License     :  LGPL-3 (see the file LICENSE)
+-- 
+-- Maintainer  :  Maksymilian.Owsianny+Awesomium@gmail.com
+-- Stability   :  Experimental
+-- Portability :  Portable? (needs FFI)
+--
+-- You shouldn't ever have to use functions from this module or its
+-- sub-modules, as all functions that use Javascript already convert
+-- everything to more friendly JSON 'Data.Aeson.Value' from
+-- "Data.Aeson" module.
+----------------------------------------------------------------------
+
+module Graphics.UI.Awesomium.Javascript
+    ( JSValue, JSValueType(..), JSArray, JSObject
+    , jsvalueToJSON
+    , jsarrayToJSON, jsarrayToJSONValues
+    , jsobjectToJSON
+    , withJS, withJSArray
+) where
+
+import Graphics.UI.Awesomium.Raw
+
+import qualified Graphics.UI.Awesomium.Javascript.JSValue as JSValue
+import qualified Graphics.UI.Awesomium.Javascript.JSArray as JSArray
+import qualified Graphics.UI.Awesomium.Javascript.JSObject as JSObject
+
+import Foreign.Marshal (withArray, withMany)
+import Control.Monad (mapM, (<=<))
+import Control.Exception (bracket)
+import Data.Maybe (catMaybes)
+import qualified Data.Text as T
+import qualified Data.Vector as V
+import qualified Data.Map as M
+import Data.Aeson.Types
+import Data.Attoparsec.Number
+
+jsvalueToJSON :: JSValue -> IO Value
+jsvalueToJSON v = JSValue.getType v >>= \t -> case t of
+    JSValueTypeNull    -> return Null
+    JSValueTypeBoolean -> JSValue.toBoolean v >>= return . toJSON
+    JSValueTypeInteger -> JSValue.toInteger v >>= return . toJSON
+    JSValueTypeDouble  -> JSValue.toDouble  v >>= return . toJSON
+    JSValueTypeString  -> JSValue.toString  v >>= return . toJSON
+    JSValueTypeObject  -> JSValue.getObject v >>= jsobjectToJSON
+    JSValueTypeArray   -> JSValue.getArray  v >>= jsarrayToJSON
+
+jsarrayToJSON :: JSArray -> IO Value
+jsarrayToJSON = return . Array . V.fromList <=< jsarrayToJSONValues
+
+jsarrayToJSONValues :: JSArray -> IO [Value]
+jsarrayToJSONValues a = JSArray.getSize a >>= \s ->
+    mapM (jsvalueToJSON <=< JSArray.getElement a) [0..s-1]
+
+jsobjectToJSON :: JSObject -> IO Value
+jsobjectToJSON o = do
+    ks <- getStrKeys =<< JSObject.getKeys o
+    vs <- mapM (jsvalueToJSON <=< JSObject.getProperty o) ks
+    return . object $ zipWith (.=) (map T.pack ks) vs
+    where
+        getStrKeys :: JSArray -> IO [String]
+        getStrKeys a = JSArray.getSize a >>= \s ->
+            mapM (takeStr <=< JSArray.getElement a) [0..s-1]
+            >>= return . catMaybes
+        
+        takeStr :: JSValue -> IO (Maybe String)
+        takeStr v = JSValue.getType v >>= \t ->
+            if (t == JSValueTypeString)
+                then JSValue.toString v >>= return . Just
+                else return Nothing
+
+withJS :: Value -> (JSValue -> IO ()) -> IO ()
+withJS v f = case v of
+    Null           -> brt JSValue.createNullValue
+    (Bool _)       -> fv $ brt . JSValue.createBoolValue
+    (Number (I _)) -> fv $ brt . JSValue.createIntegerValue
+    (Number (D _)) -> fv $ brt . JSValue.createDoubleValue
+    (String _)     -> fv $ brt . JSValue.createStringValue
+    (Object _)     -> fv $ \ps ->
+        JSObject.with $ \ob ->
+            let (ns, vs) = (unzip . M.toList) ps in
+            withMany withJS vs $ \vs' ->
+                mapM_ (uncurry $ JSObject.setProperty ob) 
+                      (zip (map T.unpack ns) vs')
+                >> (brt $ JSValue.createObjectValue ob)
+    (Array _)      -> fv $ \vs ->
+        withMany withJS vs $ \vs' ->
+            JSArray.with vs' $ \ar ->
+                brt $ JSValue.createArrayValue ar
+    where brt c = JSValue.with c f
+          fv r = either putStrLn r $ parseEither parseJSON v
+
+withJSArray :: [Value] -> (JSArray -> IO ()) -> IO ()
+withJSArray vs f = withMany withJS vs $ flip JSArray.with f
+
+{-
+instance ToJSON JSValue where
+    toJSON x = unsafePreformIO $ jsvalueToJSON x
+
+instance ToJSON JSArray where
+    toJSON x = unsafePreformIO $ jsarrayToJSON x
+
+instance ToJSON JSObject where
+    toJSON x = unsafePreformIO $ jsobjectToJSON x
+-}
diff --git a/src/Graphics/UI/Awesomium/Javascript/JSArray.hs b/src/Graphics/UI/Awesomium/Javascript/JSArray.hs
new file mode 100644
--- /dev/null
+++ b/src/Graphics/UI/Awesomium/Javascript/JSArray.hs
@@ -0,0 +1,43 @@
+----------------------------------------------------------------------
+-- |
+-- Module      :  Graphics.UI.Awesomium.Javascript.JSArray
+-- Copyright   :  (c) 2012 Maksymilian Owsianny
+-- License     :  LGPL-3 (see the file LICENSE)
+-- 
+-- Maintainer  :  Maksymilian.Owsianny+Awesomium@gmail.com
+-- Stability   :  Experimental
+-- Portability :  Portable? (needs FFI)
+--
+----------------------------------------------------------------------
+
+module Graphics.UI.Awesomium.Javascript.JSArray
+    ( JSArray
+    , create
+    , destroy
+    , with
+    , getSize
+    , getElement
+) where
+
+import Graphics.UI.Awesomium.Raw
+
+import Control.Exception (bracket)
+import Foreign (withArray)
+import Foreign.Ptr (Ptr)
+
+create :: Ptr JSValue -> Int -> IO JSArray
+create = awe_jsarray_create
+
+destroy :: JSArray -> IO ()
+destroy = awe_jsarray_destroy
+
+with :: [JSValue] -> (JSArray -> IO b) -> IO b
+with vs f = withArray vs $ \ptr ->
+            bracket (create ptr (length vs)) destroy f
+
+getSize :: JSArray -> IO Int
+getSize = awe_jsarray_get_size
+
+getElement :: JSArray -> Int -> IO JSValue
+getElement = awe_jsarray_get_element
+
diff --git a/src/Graphics/UI/Awesomium/Javascript/JSObject.hs b/src/Graphics/UI/Awesomium/Javascript/JSObject.hs
new file mode 100644
--- /dev/null
+++ b/src/Graphics/UI/Awesomium/Javascript/JSObject.hs
@@ -0,0 +1,52 @@
+----------------------------------------------------------------------
+-- |
+-- Module      :  Graphics.UI.Awesomium.Javascript.JSObject
+-- Copyright   :  (c) 2012 Maksymilian Owsianny
+-- License     :  LGPL-3 (see the file LICENSE)
+-- 
+-- Maintainer  :  Maksymilian.Owsianny+Awesomium@gmail.com
+-- Stability   :  Experimental
+-- Portability :  Portable? (needs FFI)
+--
+----------------------------------------------------------------------
+
+module Graphics.UI.Awesomium.Javascript.JSObject
+    ( JSObject
+    , create
+    , destroy
+    , with
+    , hasProperty
+    , getProperty
+    , setProperty
+    , getSize
+    , getKeys
+) where
+
+import Graphics.UI.Awesomium.Raw
+
+import Control.Exception (bracket)
+
+create :: IO JSObject
+create = awe_jsobject_create
+
+destroy :: JSObject -> IO ()
+destroy = awe_jsobject_destroy
+
+with :: (JSObject -> IO b) -> IO b
+with = bracket create destroy
+
+hasProperty :: JSObject -> String -> IO Bool
+hasProperty = awe_jsobject_has_property
+
+getProperty :: JSObject -> String -> IO JSValue
+getProperty = awe_jsobject_get_property
+
+setProperty :: JSObject -> String -> JSValue -> IO ()
+setProperty = awe_jsobject_set_property
+
+getSize :: JSObject -> IO Int
+getSize = awe_jsobject_get_size
+
+getKeys :: JSObject -> IO JSArray
+getKeys = awe_jsobject_get_keys
+
diff --git a/src/Graphics/UI/Awesomium/Javascript/JSValue.hs b/src/Graphics/UI/Awesomium/Javascript/JSValue.hs
new file mode 100644
--- /dev/null
+++ b/src/Graphics/UI/Awesomium/Javascript/JSValue.hs
@@ -0,0 +1,85 @@
+----------------------------------------------------------------------
+-- |
+-- Module      :  Graphics.UI.Awesomium.Javascript.JSValue
+-- Copyright   :  (c) 2012 Maksymilian Owsianny
+-- License     :  LGPL-3 (see the file LICENSE)
+-- 
+-- Maintainer  :  Maksymilian.Owsianny+Awesomium@gmail.com
+-- Stability   :  Experimental
+-- Portability :  Portable? (needs FFI)
+--
+----------------------------------------------------------------------
+
+module Graphics.UI.Awesomium.Javascript.JSValue
+    ( JSValue, JSValueType(..)
+    , createNullValue
+    , createBoolValue
+    , createIntegerValue
+    , createDoubleValue
+    , createStringValue
+    , createObjectValue
+    , createArrayValue
+    , destroy
+    , with
+    , getType
+    , toString
+    , toInteger
+    , toDouble
+    , toBoolean
+    , getArray
+    , getObject
+) where
+
+import Graphics.UI.Awesomium.Raw
+
+import Prelude (IO, Int, Double, Bool, String)
+import Control.Exception (bracket)
+
+createNullValue :: IO JSValue
+createNullValue = awe_jsvalue_create_null_value
+
+createBoolValue :: Bool -> IO JSValue
+createBoolValue = awe_jsvalue_create_bool_value
+
+createIntegerValue :: Int -> IO JSValue
+createIntegerValue = awe_jsvalue_create_integer_value
+
+createDoubleValue :: Double -> IO JSValue
+createDoubleValue = awe_jsvalue_create_double_value
+
+createStringValue :: String -> IO JSValue
+createStringValue = awe_jsvalue_create_string_value
+
+createObjectValue :: JSObject -> IO JSValue
+createObjectValue = awe_jsvalue_create_object_value
+
+createArrayValue :: JSArray -> IO JSValue
+createArrayValue = awe_jsvalue_create_array_value
+
+destroy :: JSValue -> IO ()
+destroy = awe_jsvalue_destroy
+
+with :: IO JSValue -> (JSValue -> IO b) -> IO b
+with c = bracket c destroy
+
+getType :: JSValue -> IO JSValueType
+getType = awe_jsvalue_get_type
+
+toString :: JSValue -> IO String
+toString = awe_jsvalue_to_string
+
+toInteger :: JSValue -> IO Int
+toInteger = awe_jsvalue_to_integer
+
+toDouble :: JSValue -> IO Double
+toDouble = awe_jsvalue_to_double
+
+toBoolean :: JSValue -> IO Bool
+toBoolean = awe_jsvalue_to_boolean
+
+getArray :: JSValue -> IO JSArray
+getArray = awe_jsvalue_get_array
+
+getObject :: JSValue -> IO JSObject
+getObject = awe_jsvalue_get_object
+
diff --git a/src/Graphics/UI/Awesomium/RenderBuffer.hs b/src/Graphics/UI/Awesomium/RenderBuffer.hs
new file mode 100644
--- /dev/null
+++ b/src/Graphics/UI/Awesomium/RenderBuffer.hs
@@ -0,0 +1,79 @@
+----------------------------------------------------------------------
+-- |
+-- Module      :  Graphics.UI.Awesomium.RenderBuffer
+-- Copyright   :  (c) 2012 Maksymilian Owsianny
+-- License     :  LGPL-3 (see the file LICENSE)
+-- 
+-- Maintainer  :  Maksymilian.Owsianny+Awesomium@gmail.com
+-- Stability   :  Experimental
+-- Portability :  Portable? (needs FFI)
+--
+----------------------------------------------------------------------
+
+module Graphics.UI.Awesomium.RenderBuffer
+    ( RenderBuffer
+    
+    , getWidth
+    , getHeight
+    , getRowspan
+    , getBuffer
+ -- , copyTo
+ -- , copyToFloat
+    , saveToPng
+    , saveToJpeg
+    , getAlphaAtPoint
+    , flushAlpha
+) where
+
+import Foreign.Ptr (Ptr)
+import Foreign.C.Types (CUChar)
+import Graphics.UI.Awesomium.Raw
+
+-- | Get the width (in pixels) of a 'RenderBuffer'.
+getWidth :: RenderBuffer -> IO Int
+getWidth = awe_renderbuffer_get_width
+
+-- | Get the height (in pixels) of a 'RenderBuffer'.
+getHeight :: RenderBuffer -> IO Int
+getHeight = awe_renderbuffer_get_height
+
+-- | Get the rowspan (number of bytes per row) of a 'RenderBuffer'.
+getRowspan :: RenderBuffer -> IO Int
+getRowspan = awe_renderbuffer_get_rowspan
+
+-- | Get a pointer to the actual pixel buffer within a 'RenderBuffer'.
+getBuffer :: RenderBuffer -> IO (Ptr CUChar)
+getBuffer = awe_renderbuffer_get_buffer
+
+-- Copy a 'RenderBuffer' to a specific destination with the same
+-- dimensions.
+-- copyTo :: RenderBuffer -> (unsigned char* dest_buffer) -> Int -> Int -> Bool -> Bool -> IO ()
+-- copyTo = awe_renderbuffer_copy_to
+
+-- Copy a 'RenderBuffer' to a pixel buffer with a floating-point pixel
+-- format for use with game engines like Unity3D.
+-- copyToFloat :: RenderBuffer -> (float* dest_buffer) -> IO ()
+-- copyToFloat = awe_renderbuffer_copy_to_float
+
+-- | Save a copy of this 'RenderBuffer' to a PNG image file.
+saveToPng :: RenderBuffer -> String -> Bool -> IO Bool
+saveToPng = awe_renderbuffer_save_to_png
+
+-- | Save a copy of this 'RenderBuffer' to a JPEG image file with
+-- quality 1 to 100.
+saveToJpeg :: RenderBuffer -> String -> Int -> IO Bool
+saveToJpeg = awe_renderbuffer_save_to_jpeg
+
+-- | Get the alpha value at a certain point (origin is top-left). This
+-- is useful for alpha-picking.
+getAlphaAtPoint
+    :: RenderBuffer
+    -> Int -- ^ The x-value of the point.
+    -> Int -- ^ The y-value of the point.
+    -> IO Int -- ^ Returns the alpha value at a certain point (255 is
+    -- comppletely opaque, 0 is completely transparent).
+getAlphaAtPoint = awe_renderbuffer_get_alpha_at_point
+
+-- | Sets the alpha channel to completely opaque values.
+flushAlpha :: RenderBuffer -> IO ()
+flushAlpha = awe_renderbuffer_flush_alpha
diff --git a/src/Graphics/UI/Awesomium/Resource.hs b/src/Graphics/UI/Awesomium/Resource.hs
new file mode 100644
--- /dev/null
+++ b/src/Graphics/UI/Awesomium/Resource.hs
@@ -0,0 +1,115 @@
+----------------------------------------------------------------------
+-- |
+-- Module      :  Graphics.UI.Awesomium.Resource
+-- Copyright   :  (c) 2012 Maksymilian Owsianny
+-- License     :  LGPL-3 (see the file LICENSE)
+-- 
+-- Maintainer  :  Maksymilian.Owsianny+Awesomium@gmail.com
+-- Stability   :  Experimental
+-- Portability :  Portable? (needs FFI)
+--
+----------------------------------------------------------------------
+
+module Graphics.UI.Awesomium.Resource
+    ( ResourceResponse, ResourceRequest
+ -- , responseCreate
+    , responseCreateFromFile
+    , requestCancel
+    , requestGetUrl
+    , requestGetMethod
+    , requestSetMethod
+    , requestGetReferrer
+    , requestSetReferrer
+    , requestGetExtraHeaders
+    , requestSetExtraHeaders
+    , requestAppendExtraHeader
+    , requestGetNumUploadElements
+    , requestGetUploadElement
+    , requestClearUploadElements
+    , requestAppendUploadFilePath
+    , requestAppendUploadBytes
+) where
+
+import Graphics.UI.Awesomium.Raw
+
+-- {#fun awe_webview_set_callback_resource_request :: WebView', resource_response* (*callback } -> IO ()
+-- {#fun awe_webview_set_callback_resource_response :: WebView', void (*callback } -> IO ()
+
+-- responseCreate :: size_t num_bytes, unsigned char* buffer, `String -> IO ResourceResponse
+-- responseCreate = awe_resource_response_create
+
+-- | Create a ResourceResponse from a file on disk.
+responseCreateFromFile :: String -> IO ResourceResponse
+responseCreateFromFile = awe_resource_response_create_from_file
+
+-- | Cancel the request (this is useful for blocking a resource load).
+requestCancel :: ResourceRequest -> IO ()
+requestCancel = awe_resource_request_cancel
+
+-- | Get the URL associated with this request.
+requestGetUrl :: ResourceRequest -> IO String
+requestGetUrl = awe_resource_request_get_url
+
+-- | Get the HTTP method (usually @GET@ or @POST@).
+requestGetMethod :: ResourceRequest -> IO String
+requestGetMethod = awe_resource_request_get_method
+
+-- | Set the HTTP method
+requestSetMethod :: ResourceRequest -> String -> IO ()
+requestSetMethod = awe_resource_request_set_method
+
+-- | Get the referrer.
+requestGetReferrer :: ResourceRequest -> IO String
+requestGetReferrer = awe_resource_request_get_referrer
+
+-- | Set the referrer.
+requestSetReferrer :: ResourceRequest -> String -> IO ()
+requestSetReferrer = awe_resource_request_set_referrer
+
+-- | Get extra headers for the request.
+requestGetExtraHeaders :: ResourceRequest -> IO String
+requestGetExtraHeaders = awe_resource_request_get_extra_headers
+
+-- | Override extra headers for the request, delimited by \/r\/n (CRLF).
+--
+-- Format should be:
+--   Name: Value\/r\/nName: Value\/r\/nName: Value
+--
+-- Headers should NOT end in \/r\/n (CRLF)
+requestSetExtraHeaders :: ResourceRequest -> String -> IO ()
+requestSetExtraHeaders = awe_resource_request_set_extra_headers
+
+-- | Append an extra header to the request.
+requestAppendExtraHeader
+    :: ResourceRequest
+    -> String -- ^ Name of the header
+    -> String -- ^ Value of the header
+    -> IO ()
+requestAppendExtraHeader = awe_resource_request_append_extra_header
+
+-- | Get the number of upload elements (essentially, batches of POST
+-- data).
+requestGetNumUploadElements :: ResourceRequest -> IO Int
+requestGetNumUploadElements =
+    awe_resource_request_get_num_upload_elements
+
+-- | Get a certain upload element (returned instance is owned by this
+-- class)
+requestGetUploadElement :: ResourceRequest -> Int -> IO UploadElement
+requestGetUploadElement = awe_resource_request_get_upload_element
+
+-- | Clear all upload elements
+requestClearUploadElements :: ResourceRequest -> IO ()
+requestClearUploadElements =
+    awe_resource_request_clear_upload_elements
+
+-- | Append a file for POST data (adds a new 'UploadElement')
+requestAppendUploadFilePath :: ResourceRequest -> String -> IO ()
+requestAppendUploadFilePath =
+    awe_resource_request_append_upload_file_path
+
+-- | Append a string of bytes for POST data (adds a new
+-- 'UploadElement')
+requestAppendUploadBytes :: ResourceRequest -> String -> IO ()
+requestAppendUploadBytes = awe_resource_request_append_upload_bytes
+
diff --git a/src/Graphics/UI/Awesomium/UploadElement.hs b/src/Graphics/UI/Awesomium/UploadElement.hs
new file mode 100644
--- /dev/null
+++ b/src/Graphics/UI/Awesomium/UploadElement.hs
@@ -0,0 +1,38 @@
+----------------------------------------------------------------------
+-- |
+-- Module      :  Graphics.UI.Awesomium.UploadElement
+-- Copyright   :  (c) 2012 Maksymilian Owsianny
+-- License     :  LGPL-3 (see the file LICENSE)
+-- 
+-- Maintainer  :  Maksymilian.Owsianny+Awesomium@gmail.com
+-- Stability   :  Experimental
+-- Portability :  Portable? (needs FFI)
+--
+----------------------------------------------------------------------
+
+module Graphics.UI.Awesomium.UploadElement
+    ( UploadElement
+    , isFilePath
+    , isBytes
+    , getBytes
+    , getFilePath
+) where
+
+import Graphics.UI.Awesomium.Raw
+
+-- | Whether or not this 'UploadElement' is a file.
+isFilePath :: UploadElement -> IO Bool
+isFilePath = awe_upload_element_is_file_path
+
+-- | Whether or not this 'UploadElement' is a string of bytes.
+isBytes :: UploadElement -> IO Bool
+isBytes = awe_upload_element_is_bytes
+
+-- | Get the string of bytes associated with this 'UploadElement'.
+getBytes :: UploadElement -> IO String
+getBytes = awe_upload_element_get_bytes
+
+-- | Get the file path associated with this 'UploadElement'.
+getFilePath :: UploadElement -> IO String
+getFilePath = awe_upload_element_get_file_path
+
diff --git a/src/Graphics/UI/Awesomium/WebCore.hs b/src/Graphics/UI/Awesomium/WebCore.hs
new file mode 100644
--- /dev/null
+++ b/src/Graphics/UI/Awesomium/WebCore.hs
@@ -0,0 +1,221 @@
+----------------------------------------------------------------------
+-- |
+-- Module      :  Graphics.UI.Awesomium.WebCore
+-- Copyright   :  (c) 2012 Maksymilian Owsianny
+-- License     :  LGPL-3 (see the file LICENSE)
+-- 
+-- Maintainer  :  Maksymilian.Owsianny+Awesomium@gmail.com
+-- Stability   :  Experimental
+-- Portability :  Portable? (needs FFI)
+--
+----------------------------------------------------------------------
+
+module Graphics.UI.Awesomium.WebCore
+    ( Config (..)
+    , LogLevel (..)
+    , defaultConfig
+    , initialize
+    , shutdown
+    , setBaseDirectory
+    , createWebview
+    , setCustomResponsePage
+    , update
+    , getBaseDirectory
+    , arePluginsEnabled
+    , clearCache
+    , clearCookies
+    , setCookie
+    , getCookies
+    , deleteCookie
+    , setSuppressPrinterDialog
+    , queryHistory
+) where
+
+import Graphics.UI.Awesomium.Raw
+
+data Config = Config
+    { enablePlugins            :: Bool
+    , enableJavascript         :: Bool
+    , enableDatabases          :: Bool
+    , packagePath              :: String
+    , localePath               :: String
+    , userDataPath             :: String
+    , pluginPath               :: String
+    , logPath                  :: String
+    , logLevel                 :: LogLevel
+    , forceSingleProcess       :: Bool
+    , childProcessPath         :: String
+    , enableAutoDetectEncoding :: Bool
+    , acceptLanguageOverride   :: String
+    , defaultCharsetOverride   :: String
+    , userAgentOverride        :: String
+    , proxyServer              :: String
+    , proxyConfigScript        :: String
+    , authServerWhitelist      :: String
+    , saveCacheAndCookies      :: Bool
+    , maxCacheSize             :: Int
+    , disableSameOriginPolicy  :: Bool
+    , disableWinMessagePump    :: Bool
+    , customCss                :: String
+} deriving (Show, Read, Eq)
+
+-- | Helper function for easier initialization e.g.:
+--
+-- @
+--     initialize (defaultConfig { logLevel = Verbose
+--                               , customCss = myCss })
+-- @
+--
+defaultConfig :: Config
+defaultConfig = Config
+    { enablePlugins            = False
+    , enableJavascript         = True
+    , enableDatabases          = False
+    , packagePath              = ""
+    , localePath               = ""
+    , userDataPath             = ""
+    , pluginPath               = ""
+    , logPath                  = ""
+    , logLevel                 = Normal
+    , forceSingleProcess       = False
+    , childProcessPath         = ""
+    , enableAutoDetectEncoding = True
+    , acceptLanguageOverride   = ""
+    , defaultCharsetOverride   = ""
+    , userAgentOverride        = ""
+    , proxyServer              = ""
+    , proxyConfigScript        = ""
+    , authServerWhitelist      = ""
+    , saveCacheAndCookies      = True
+    , maxCacheSize             = 0
+    , disableSameOriginPolicy  = False
+    , disableWinMessagePump    = False
+    , customCss                = "" }
+
+-- | Instantiates the WebCore singleton with a set of configuration
+-- parameters.
+initialize :: Config -> IO ()
+initialize c@(Config a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12
+                     a13 a14 a15 a16 a17 a18 a19 a20 a21 a22 a23)
+    | c == defaultConfig = awe_webcore_initialize_default
+    | otherwise = awe_webcore_initialize a1 a2 a3 a4 a5 a6 a7 a8 a9
+        a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a20 a21 a22 a23
+
+-- | Destroys the WebCore singleton and destroys any remaining
+-- WebViews.
+shutdown :: IO ()
+shutdown = awe_webcore_shutdown
+
+-- | Sets the base directory.
+setBaseDirectory
+    :: String -- ^ The absolute path to your base directory.  The base
+              -- directory is a location that holds all of your local
+              -- assets. It will be used for
+              -- 'Graphics.UI.Awesomium.WebView.loadFile' and
+              -- 'Graphics.UI.Awesomium.WebView.loadHTML'
+              -- (to resolve relative URLs).
+    -> IO ()
+setBaseDirectory = awe_webcore_set_base_directory
+
+-- | Creates a new WebView.
+createWebview
+    :: Int        -- ^ The width of the WebView in pixels.
+    -> Int        -- ^ The height of the WebView in pixels.
+    -> Bool       -- ^ Enable this to view the HTML source of any 
+    -- loaded into this WebView. Default is false.
+    -> IO WebView -- ^ Returns a pointer to the created WebView
+    -- instance. To call method on the WebView, see
+    -- 'Graphics.UI.Awesomium.WebView.loadURL' and related functions.
+createWebview = awe_webcore_create_webview
+
+-- | Sets a custom response page to use when a WebView encounters
+-- a certain HTML status code from the server (like '404 - File not
+-- found').
+setCustomResponsePage
+    :: Int    -- ^ The status code this response page should be
+    -- associated with. See
+    -- <http://en.wikipedia.org/wiki/List_of_HTTP_status_codes>
+    -> String -- ^ The local page to load as a response, a path
+    -- relative to the base directory.
+    -> IO ()
+setCustomResponsePage = awe_webcore_set_custom_response_page
+
+-- | Updates the WebCore and allows it to conduct various operations
+-- such as updating the render buffer of each WebView, destroying any
+-- WebViews that are queued for destruction, and invoking any queued
+-- callback events.
+update :: IO ()
+update = awe_webcore_update
+
+-- | Retrieves the base directory.
+getBaseDirectory
+    :: IO String -- ^ Returns a string instance representing the
+    -- current base directory.
+getBaseDirectory = awe_webcore_get_base_directory
+
+-- | Returns whether or not plugins are enabled.
+arePluginsEnabled :: IO Bool
+arePluginsEnabled = awe_webcore_are_plugins_enabled
+
+-- | Clear the disk cache and media cache.
+clearCache :: IO ()
+clearCache = awe_webcore_clear_cache
+
+-- | Clear all cookies.
+clearCookies :: IO ()
+clearCookies = awe_webcore_clear_cookies
+
+-- | Sets a cookie for a certain URL.
+setCookie
+    :: String -- ^ The URL to set the cookie on.
+    -> String -- ^ The cookie string, for example: 
+    -- @\"key1=value1; key2=value2\"@
+    -> Bool   -- ^ Whether or not this cookie is HTTP-only.
+    -> Bool   -- ^ Whether or not to force this as a session cookie.
+    -> IO ()
+setCookie = awe_webcore_set_cookie
+
+-- | Gets all cookies for a certain URL.
+getCookies
+    :: String    -- ^ The URL whose cookies will be retrieved.
+    -> Bool      -- ^ Whether or not to exclude HTTP-only cookies from
+    -- the result.
+    -> IO String -- ^ Returns the cookie string.
+getCookies = awe_webcore_get_cookies
+
+-- | Deletes a certain cookie on a certain URL.
+deleteCookie
+    :: String -- ^ The URL that we will be deleting cookies on.
+    -> String -- ^ The name of the cookie that will be deleted.
+    -> IO ()
+deleteCookie = awe_webcore_delete_cookie
+
+-- | Set whether or not the printer dialog should be suppressed or
+-- not.  Set this to @True@ to hide printer dialogs and print
+-- immediately using the OS's default printer when
+-- 'Graphics.UI.Awesomium.WebView.print' is
+-- called.  Default is @False@ if you never call this.
+setSuppressPrinterDialog
+    :: Bool -- ^ Whether or not the printer dialog should be
+    -- suppressed.
+    -> IO ()
+setSuppressPrinterDialog = awe_webcore_set_suppress_printer_dialog
+
+-- | Query the on-disk history database.
+--
+--      [@note@] You must enable @saveCacheAndCookies@ (see 'Config')
+--  for this method to work (otherwise no results will be returned).
+queryHistory
+    :: String -- ^ All results returned should match the
+    -- specified text (either in the page title or
+    -- in the actual text of the page itself).
+    -- Specify an empty string to match anything.
+    -> Int -- ^ Limit results to a specified number of days ago.
+    -> Int  -- ^ Limit results to a maximum count. Specify 0 to use no
+    -- limit.
+    -> IO HistoryQueryResult -- ^ Returns an instance of
+    -- historyQueryResult containing the results of the query. You
+    -- must call 'History.queryResultDestroy' once you are
+    -- finished using the instance.
+queryHistory = awe_webcore_query_history
+
diff --git a/src/Graphics/UI/Awesomium/WebView.hs b/src/Graphics/UI/Awesomium/WebView.hs
new file mode 100644
--- /dev/null
+++ b/src/Graphics/UI/Awesomium/WebView.hs
@@ -0,0 +1,590 @@
+----------------------------------------------------------------------
+-- |
+-- Module      :  Graphics.UI.Awesomium.WebView
+-- Copyright   :  (c) 2012 Maksymilian Owsianny
+-- License     :  LGPL-3 (see the file LICENSE)
+-- 
+-- Maintainer  :  Maksymilian.Owsianny+Awesomium@gmail.com
+-- Stability   :  Experimental
+-- Portability :  Portable? (needs FFI)
+--
+----------------------------------------------------------------------
+
+module Graphics.UI.Awesomium.WebView
+    ( WebView, Rect (..), WebkeyboardEvent (..), destroy, loadUrl
+    , loadHtml, loadFile, getUrl, goToHistoryOffset
+    , getHistoryBackCount , getHistoryForwardCount, stop, reload
+    , executeJavascript , executeJavascriptWithResult
+    , callJavascriptFunction , createObject, destroyObject
+    , setObjectProperty , setObjectCallback, isLoadingPage, isDirty
+    , getDirtyBounds , render, pauseRendering, resumeRendering
+    , MouseButton (..) , injectMouseMove, injectMouseDown
+    , injectMouseUp , injectMouseWheel, injectKeyboardEvent, cut, copy
+    , paste , selectAll, copyImageAt, setZoom, resetZoom, getZoom
+    , getZoomForHost, resize, isResizing, unfocus, focus
+    , setTransparent, isTransparent, UrlFilteringMode (..)
+    , setUrlFilteringMode, addUrlFilter, clearAllUrlFilters
+    , setHeaderDefinition, addHeaderRewriteRule
+    , removeHeaderRewriteRule
+    , removeHeaderRewriteRulesByDefinitionName, chooseFile, print
+    , requestScrollData, find, stopFind, translatePage, activateIme
+    , setImeComposition, confirmImeComposition, cancelImeComposition
+    , login, cancelLogin, closeJavascriptDialog
+
+    , module Graphics.UI.Awesomium.WebView.Callbacks
+) where
+
+import Graphics.UI.Awesomium.Raw
+import Graphics.UI.Awesomium.Javascript
+import Graphics.UI.Awesomium.WebView.Callbacks
+
+import Prelude hiding (print)
+import Foreign.Ptr (FunPtr)
+import Data.Aeson
+
+-- | Queue a WebView for destruction by the WebCore.
+destroy
+    :: WebView -- ^ The WebView instance.
+    -> IO ()
+destroy = awe_webview_destroy
+
+-- | Loads a URL into the WebView asynchronously.
+loadUrl
+    :: WebView -- ^ The WebView instance.
+    -> String -- ^ The URL to load.
+    -> String -- ^ The name of the frame to load the URL
+    -- in; leave this blank to load in the main frame.
+    -> String -- ^ If the URL requires authentication, the username
+    -- to authorize as, otherwise just pass an empty string.
+    -> String -- ^ If the URL requires authentication, the password
+    -- to use, otherwise just pass an empty string.
+    -> IO ()
+loadUrl = awe_webview_load_url
+
+-- | Loads a string of HTML into the WebView asynchronously.
+loadHtml
+    :: WebView -- ^ The WebView instance.
+    -> String -- ^ The HTML string (ASCII) to load.
+    -> String -- ^ The name of the frame to load the HTML
+    -- in; leave this blank to load in the main frame.
+    -> IO ()
+loadHtml = awe_webview_load_html
+
+-- | Loads a local file into the WebView asynchronously.
+--
+-- The file should exist within the base directory.
+loadFile
+    :: WebView -- ^ The WebView instance.
+    -> String -- ^ The file to load.
+    -> String -- ^ The name of the frame to load the file
+    -- in; leave this blank to load in the main frame.
+    -> IO ()
+loadFile = awe_webview_load_file
+
+getUrl
+    :: WebView -- ^ The WebView instance.
+    -> IO String -- ^ URL
+getUrl = awe_webview_get_url
+
+-- | Navigates back/forward in history via a relative offset.
+goToHistoryOffset
+    :: WebView -- ^ The WebView instance.
+    -> Int -- ^ The relative offset in history to navigate to.
+    -> IO ()
+goToHistoryOffset = awe_webview_go_to_history_offset
+
+-- | Get the number of steps back in history we can go.
+getHistoryBackCount
+    :: WebView
+    -> IO Int
+getHistoryBackCount = awe_webview_get_history_back_count
+
+-- | Get the number of steps forward in history we can go.
+getHistoryForwardCount
+    :: WebView
+    -> IO Int
+getHistoryForwardCount = awe_webview_get_history_forward_count
+
+-- | Stops the current navigation.
+stop
+    :: WebView
+    -> IO ()
+stop = awe_webview_stop
+
+-- | Reloads the current page.
+reload
+    :: WebView
+    -> IO ()
+reload = awe_webview_reload
+
+-- | Executes a string of Javascript in the context of the current
+-- page asynchronously.
+executeJavascript
+    :: WebView
+    -> String -- ^ The string of Javascript to execute.
+    -> String -- ^ The name of the frame to execute in;
+    -- pass an empty string to execute in the main frame.
+    -> IO ()
+executeJavascript = awe_webview_execute_javascript
+
+-- | Executes a string of Javascript in the context of the current
+-- page asynchronously with a result.
+executeJavascriptWithResult
+    :: WebView
+    -> String -- ^ The string of Javascript to execute.
+    -> String -- ^ The name of the frame to execute in;
+    -- pass an empty string to execute in the main frame.
+    -> Int -- ^ The maximum amount of time (in milliseconds) to wait
+    -- for a result. Pass 0 to use no timeout. (If no result
+    -- is obtained, or the timeout is reached, this function
+    -- will return a 'Data.Aeson.Value' with Null)
+    -> IO Value -- ^ Returns an 'Data.Aeson.Value' (see "Data.Aeson").
+executeJavascriptWithResult wv o fn to = jsvalueToJSON =<<
+    awe_webview_execute_javascript_with_result wv o fn to
+
+-- | Call a certain function defined in Javascript directly.
+callJavascriptFunction
+    :: WebView
+    -> String -- ^ The name of the object that contains the function,
+    -- pass an empty string if the function is defined in
+    -- the global scope.
+    -> String -- ^ The name of the function.
+    -> [Value] -- ^ The arguments to pass to the function (see
+    -- "Data.Aeson").
+    -> String -- ^ The name of the frame to execute in;
+    -- leave this blank to execute in the main frame.
+    -> IO ()
+callJavascriptFunction wv o fn arg fr =
+    withJSArray arg $ \arg' ->
+    awe_webview_call_javascript_function wv o fn arg' fr
+
+-- | Creates a new global Javascript object that will persist
+-- throughout the lifetime of this WebView. This object is managed
+-- directly by Awesomium and so you can modify its properties and bind
+-- callback functions via 'setObjectProperty' and 'setObjectCallback',
+-- respectively.
+createObject
+    :: WebView
+    -> String -- ^ The name of the object.
+    -> IO ()
+createObject = awe_webview_create_object
+
+-- | Destroys a Javascript object previously created by
+-- 'createObject'
+destroyObject
+    :: WebView
+    -> String -- ^ The name of the object to destroy.
+    -> IO ()
+destroyObject = awe_webview_destroy_object
+
+-- | Sets a property of a Javascript object previously created by
+-- 'createObject'.
+setObjectProperty
+    :: WebView
+    -> String -- ^ The name of the Javascript object.
+    -> String -- ^ The name of the property.
+    -> Value -- ^ The javascript value of the property.
+    -> IO ()
+setObjectProperty wv o fn v = 
+    withJS v $ \v' ->
+    awe_webview_set_object_property wv o fn v'
+
+-- | Sets a callback function of a Javascript object previously
+-- created by 'createObject'. This is very useful for passing events
+-- from Javascript to Haskell. To receive notification of the
+-- callback, please see 'setCallbackJS'.
+setObjectCallback
+    :: WebView
+    -> String -- ^ The name of the Javascript object.
+    -> String -- ^ The name of the callback function.
+    -> IO ()
+setObjectCallback = awe_webview_set_object_callback
+
+-- | Returns whether or not a page is currently loading in the
+-- WebView.
+isLoadingPage
+    :: WebView
+    -> IO Bool -- ^ If a page is loading, returns True, otherwise
+    -- returns False.
+isLoadingPage = awe_webview_is_loading_page
+
+-- | Returns whether or not the WebView is dirty and needs to be
+-- re-rendered via 'render'.
+isDirty
+    :: WebView
+    -> IO Bool -- ^ the WebView is dirty, returns True, otherwise
+    -- returns False.
+isDirty = awe_webview_is_dirty
+
+-- | Returns the bounds of the area that has changed since the last
+-- call to 'render'.
+getDirtyBounds
+    :: WebView
+    -> IO Rect -- ^ bounds of the dirty area.
+getDirtyBounds = awe_webview_get_dirty_bounds
+
+-- | Renders this WebView into an offscreen render buffer and clears
+-- the dirty state.
+render
+    :: WebView
+    -> IO RenderBuffer -- ^ A pointer to the internal render buffer
+    -- instance that was used to render this WebView. This value may
+    -- change between renders and may return 'nullPtr' if the WebView
+    -- has crashed.
+render = awe_webview_render
+
+-- | All rendering is actually done asynchronously in a separate
+-- process and so the page is usually continuously rendering even if
+-- you never call 'render'. Call this to temporarily pause rendering.
+pauseRendering :: WebView -> IO ()
+pauseRendering = awe_webview_pause_rendering
+
+-- | Resume rendering after all call to 'pauseRendering'.
+resumeRendering :: WebView -> IO ()
+resumeRendering = awe_webview_resume_rendering
+
+-- | Injects a mouse-move event in local coordinates.
+injectMouseMove
+    :: WebView
+    -> Int -- ^ The absolute x-coordinate of the mouse (localized to
+    -- the WebView).
+    -> Int -- ^ The absolute y-coordinate of the mouse (localized to
+    -- the WebView).
+    -> IO ()
+injectMouseMove = awe_webview_inject_mouse_move
+
+-- | Injects a mouse-down event.
+injectMouseDown
+    :: WebView
+    -> MouseButton -- ^ The button that was pressed.
+    -> IO ()
+injectMouseDown = awe_webview_inject_mouse_down
+
+-- | Injects a mouse-up event.
+injectMouseUp
+    :: WebView
+    -> MouseButton -- ^ The button that was released.
+    -> IO ()
+injectMouseUp = awe_webview_inject_mouse_up
+
+-- | Injects a mouse-wheel event.
+injectMouseWheel
+    :: WebView
+    -> Int -- ^ The relative amount of pixels to scroll vertically.
+    -> Int -- ^ The relative amount of pixels to scroll horizontally.
+    -> IO ()
+injectMouseWheel = awe_webview_inject_mouse_wheel
+
+-- | Injects a keyboard event. You'll need to initialize the members
+-- of 'WebkeyboardEvent' yourself.
+injectKeyboardEvent
+    :: WebView
+    -> WebkeyboardEvent -- ^ The keyboard event to inject.
+    -> IO ()
+injectKeyboardEvent = awe_webview_inject_keyboard_event
+
+--)| Injects a native Windows keyboard event.
+--)^ The msg parameter.
+--)^ The wparam parameter.
+--)^ The lparam parameter.
+-- #ifdef _WIN32
+-- inject_keyboard_event_win = awe_webview_inject_keyboard_event_win
+--  :: WebView', UINT msg, WPARAM wparam, LPARAM lparam }
+--  -> IO ()
+-- #endif
+
+-- | Invokes a 'cut' action using the system clipboard.
+cut :: WebView -> IO ()
+cut = awe_webview_cut
+
+-- | Invokes a 'copy' action using the system clipboard.
+copy :: WebView -> IO ()
+copy = awe_webview_copy
+
+-- | Invokes a 'paste' action using the system clipboard.
+paste :: WebView -> IO ()
+paste = awe_webview_paste
+
+-- | Selects all items on the current page.
+selectAll :: WebView -> IO ()
+selectAll = awe_webview_select_all
+
+-- | Copies an image on the page to the system clipboard.
+copyImageAt
+    :: WebView
+    -> Int -- ^ x
+    -> Int -- ^ y
+    -> IO ()
+copyImageAt = awe_webview_copy_image_at
+
+-- | Zooms the page a specified percent.
+setZoom
+    :: WebView
+    -> Int -- ^ The percent of the page to zoom to. Valid range
+    -- is from 10% to 500%.
+    -> IO ()
+setZoom = awe_webview_set_zoom
+
+-- | Resets the zoom level.
+resetZoom
+    :: WebView
+    -> IO ()
+resetZoom = awe_webview_reset_zoom
+
+-- | Gets the current zoom level.
+getZoom :: WebView -> IO Int
+getZoom = awe_webview_get_zoom
+
+-- | Gets the zoom level for a specific hostname.
+getZoomForHost :: WebView -> String -> IO Int
+getZoomForHost = awe_webview_get_zoom_for_host
+
+-- | Resizes this WebView to certain dimensions.
+resize
+    :: WebView
+    -> Int -- ^ The width in pixels to resize to.
+    -> Int -- ^ The height in pixels to resize to.
+    -> Bool -- ^ Whether or not to wait for the WebView
+    -- to finish repainting.
+    -> Int -- ^ The maximum amount of time to wait
+    -- for a repaint, in milliseconds.
+    -> IO Bool -- ^ true if the resize was successful. This operation
+    -- can fail if there is another resize already pending (see
+    -- 'isResizing') or if the repaint timeout was exceeded.
+resize = awe_webview_resize
+
+-- | Checks whether or not there is a resize operation pending.
+isResizing
+    :: WebView
+    -> IO Bool -- ^ true if we are waiting for the WebView process to
+    -- return acknowledgement of a pending resize operation.
+isResizing = awe_webview_is_resizing
+
+-- | Notifies the current page that it has lost focus.
+unfocus :: WebView -> IO ()
+unfocus = awe_webview_unfocus
+
+-- | Notifies the current page that is has gained focus. You will need
+-- to call this to gain textbox focus, among other things. (If you
+-- fail to ever see a blinking caret when typing text, this is why).
+focus :: WebView -> IO ()
+focus = awe_webview_focus
+
+-- | Sets whether or not pages should be rendered with transparency
+-- preserved. (ex, for pages with
+-- style=@\"background-color:transparent\"@)
+setTransparent
+    :: WebView
+    -> Bool -- ^ Whether or not this WebView is transparent.
+    -> IO ()
+setTransparent = awe_webview_set_transparent
+
+isTransparent :: WebView -> IO Bool
+isTransparent = awe_webview_is_transparent
+
+-- | Sets the current URL Filtering Mode (default is @UfmNone@).
+-- See 'UrlFilteringMode' for more information on the modes.
+setUrlFilteringMode
+    :: WebView
+    -> UrlFilteringMode -- ^ The URL filtering mode to use.
+    -> IO ()
+setUrlFilteringMode = awe_webview_set_url_filtering_mode
+
+-- | Adds a new URL Filter rule.
+--
+-- [@note@] For example, to match all URLs from the domain
+-- @\"google.com\"@, your filter string might be:
+-- @http:\/\/google.com\/*@
+--
+-- [@note2@] You may also use the @\"local:\/\/\"@ scheme prefix to
+-- describe the URL to the base directory (set via
+-- 'Graphics.UI.Awesomium.WebCore.setBaseDirectory').
+--
+addUrlFilter
+    :: WebView
+    -> String -- ^ A string with optional wildcards that describes
+    -- a certain URL.
+    -> IO ()
+addUrlFilter = awe_webview_add_url_filter
+
+-- | Clears all URL Filter rules.
+clearAllUrlFilters :: WebView -> IO ()
+clearAllUrlFilters = awe_webview_clear_all_url_filters
+
+-- | Defines a new Header Definition or updates it if it already
+-- exists.
+setHeaderDefinition
+    :: WebView
+    -> String -- ^ The unique name of the Header Definition; this is
+    -- used to refer to it later in 'addHeaderRewriteRule' and related
+    -- methods.
+    -> [(String, String)] -- ^ An array of string pairs
+    -- (field name, field value)
+    -> IO ()
+setHeaderDefinition = awe_webview_set_header_definition
+
+-- | Adds a new a header re-write rule. All requests whose URL matches
+-- the specified rule will have its  HTTP headers re-written with the
+-- specified header definition before sending it to the server.
+--
+-- [@note@] The case where a URL is matched by multiple rules is
+-- unsupported, only the first match will be used.
+addHeaderRewriteRule
+    :: WebView
+    -> String -- ^ A string with optional wildcards (*, ?) that
+    -- matches the URL(s) that will have its headers
+    -- re-written with the specified header definition.
+    -> String -- ^ The name of the header definition (specified in
+    -- 'setHeaderDefinition').
+    -> IO ()
+addHeaderRewriteRule = awe_webview_add_header_rewrite_rule
+
+-- | Removes a header re-write rule from this WebView.
+
+removeHeaderRewriteRule
+    :: WebView
+    -> String -- ^ The rule to remove (should match the string
+    -- specified in 'addHeaderRewriteRule' exactly).
+    -> IO ()
+removeHeaderRewriteRule = awe_webview_remove_header_rewrite_rule
+
+-- | Removes all header re-write rules that are using a certain header
+-- definition.
+removeHeaderRewriteRulesByDefinitionName
+    :: WebView
+    -> String -- ^ The name of the header definition (specified in
+    -- 'setHeaderDefinition'). If you specify an
+    -- empty string, this will remove ALL header re-write rules.
+    -> IO ()
+removeHeaderRewriteRulesByDefinitionName =
+    awe_webview_remove_header_rewrite_rules_by_definition_name
+
+-- | This should be called as a response to the request file chooser
+-- callback.
+chooseFile
+    :: WebView
+    -> String -- ^ The full path to the file that was chosen.
+    -> IO ()
+chooseFile = awe_webview_choose_file
+
+-- | Print the current page. To suppress the printer selection dialog
+-- and print immediately using the operating system's defaults, see
+-- 'Graphics.UI.Awesomium.WebCore.setSuppressPrinterDialog'.
+print
+    :: WebView
+    -> IO ()
+print = awe_webview_print
+
+-- | Request the page dimensions and scroll position of the page. You
+-- can retrieve the response via the get scroll data callback.
+requestScrollData
+    :: WebView
+    -> String -- ^ The frame's scroll data to retrieve. Leave blank
+    -- to get the main frame's scroll data.
+    -> IO ()
+requestScrollData = awe_webview_request_scroll_data
+
+-- | Start finding a certain string on the current web-page. All
+-- matches of the string will be highlighted on the page and you can
+-- jump to different instances of the string by using the @Find Next@
+-- parameter. To get actual stats about a certain query, please see
+-- 'setCallbackGetFindResults'.
+find
+    :: WebView
+    -> Int -- ^ A unique numeric ID for each search. You will
+    -- need to generate one yourself for each unique
+    -- search. Please note that you should use the
+    -- same request id if you wish to iterate through
+    -- all the search results using the @Find Next@
+    -- parameter.
+    -> String -- ^ The string to search for.
+    -> Bool -- ^ Whether or not we should search forward, down
+    -- the page.
+    -> Bool -- ^ Whether or not this search is case-sensitive.
+    -> Bool -- ^ @Find Next@ - Whether or not we should jump to the
+    -- next instance of a search string (you should use the same
+    -- request id as a previously-successful search).
+    -> IO ()
+find = awe_webview_find
+
+-- | Stop finding. This will un-highlight all matches of a previous
+-- call to 'find'.
+stopFind
+    :: WebView
+    -> Bool -- ^ Whether or not we should also deselect
+    -- the currently-selected string instance.
+    -> IO ()
+stopFind = awe_webview_stop_find
+
+-- | Attempt automatic translation of the current page via Google
+-- Translate. All language codes are ISO 639-2.
+translatePage
+    :: WebView
+    -> String -- ^ The language to translate from
+    -- (for ex. \"en\" for English)
+    -> String -- ^ The language to translate to
+    -- (for ex. \"fr\" for French)
+    -> IO ()
+translatePage = awe_webview_translate_page
+
+-- | Call this method to let the WebView know you will be passing
+-- text input via IME and will need to be notified of any
+-- IME-related events (caret position, user unfocusing textbox, etc.)
+-- Please see 'setCallbackUpdateIme'.
+activateIme
+    :: WebView
+    -> Bool
+    -> IO ()
+activateIme = awe_webview_activate_ime
+
+-- | Update the current IME text composition.
+setImeComposition
+    :: WebView
+    -> String -- ^ The string generated by your IME.
+    -> Int -- ^ The current cursor position in your IME composition.
+    -> Int -- ^ The position of the beginning of the selection.
+    -> Int -- ^ The position of the end of the selection.
+    -> IO ()
+setImeComposition = awe_webview_set_ime_composition
+
+-- | Confirm a current IME text composition.
+confirmImeComposition
+    :: WebView
+    -> String -- ^ The string generated by your IME.
+    -> IO ()
+confirmImeComposition = awe_webview_confirm_ime_composition
+
+-- | Cancel a current IME text composition.
+cancelImeComposition
+    :: WebView
+    -> IO ()
+cancelImeComposition = awe_webview_cancel_ime_composition
+
+-- | Respond to the @\"request login\"@ callback with some
+-- user-supplied credentials.
+login
+    :: WebView
+    -> Int -- ^ The unique ID of the request.
+    -> String -- ^ The username supplied by the user.
+    -> String -- ^ The password supplied by the user.
+    -> IO ()
+login = awe_webview_login
+
+-- | Respond to the @\"request login\"@ callback by telling the
+-- server that the user cancelled the authentication request.
+cancelLogin
+    :: WebView
+    -> Int -- ^ The unique ID of the request.
+    -> IO ()
+cancelLogin = awe_webview_cancel_login
+
+-- | Respond to the @\"show javascript dialog\"@ callback.
+closeJavascriptDialog
+    :: WebView
+    -> Int -- ^ The unique ID of the dialog request.
+    -> Bool -- ^ Whether or not the dialog was cancelled/ignored.
+    -> String -- ^ If the dialog had a prompt, you should pass
+    -- whatever text the user entered into the textbox via this
+    -- parameter.
+    -> IO ()
+closeJavascriptDialog = awe_webview_close_javascript_dialog
diff --git a/src/Graphics/UI/Awesomium/WebView/Callbacks.hs b/src/Graphics/UI/Awesomium/WebView/Callbacks.hs
new file mode 100644
--- /dev/null
+++ b/src/Graphics/UI/Awesomium/WebView/Callbacks.hs
@@ -0,0 +1,462 @@
+----------------------------------------------------------------------
+-- |
+-- Module      :  Graphics.UI.Awesomium.WebView.Callbacks
+-- Copyright   :  (c) 2012 Maksymilian Owsianny
+-- License     :  LGPL-3 (see the file LICENSE)
+-- 
+-- Maintainer  :  Maksymilian.Owsianny+Awesomium@gmail.com
+-- Stability   :  Experimental
+-- Portability :  Portable? (needs FFI)
+--
+----------------------------------------------------------------------
+
+module Graphics.UI.Awesomium.WebView.Callbacks
+    ( BeginNavigationCallbackHandler      , setCallbackBeginNavigation
+    , BeginLoadingCallbackHandler         , setCallbackBeginLoading
+    , FinishLoadingCallbackHandler        , setCallbackFinishLoading
+    , JSCallbackHandler                   , setCallbackJS
+    , ReceiveTitleCallbackHandler         , setCallbackReceiveTitle
+    , ChangeTooltipCallbackHandler        , setCallbackChangeTooltip
+    , CursorType (..)
+    , ChangeCursorCallbackHandler         , setCallbackChangeCursor
+    , ChangeKeyboardFocusCallbackHandler  , setCallbackChangeKeyboardFocus
+    , ChangeTargetUrlCallbackHandler      , setCallbackChangeTargetUrl
+    , OpenExternalLinkCallbackHandler     , setCallbackOpenExternalLink
+    , RequestDownloadCallbackHandler      , setCallbackRequestDownload
+    , WebViewCrashedCallbackHandler       , setCallbackWebViewCrashed
+    , PluginCrashedCallbackHandler        , setCallbackPluginCrashed
+    , RequestMoveCallbackHandler          , setCallbackRequestMove
+    , GetPageContentsCallbackHandler      , setCallbackGetPageContents
+    , DomReadyCallbackHandler             , setCallbackDomReady
+    , RequestFileChooserCallbackHandler   , setCallbackRequestFileChooser
+    , GetScrollDataCallbackHandler        , setCallbackGetScrollData
+    , JsConsoleMessageCallbackHandler     , setCallbackJsConsoleMessage
+    , GetFindResultsCallbackHandler       , setCallbackGetFindResults
+    , ImeState (..)
+    , UpdateImeCallbackHandler            , setCallbackUpdateIme
+    , MediaType (..)
+    , ShowContextMenuCallbackHandler      , setCallbackShowContextMenu
+    , RequestLoginCallbackHandler         , setCallbackRequestLogin
+    , ChangeHistoryCallbackHandler        , setCallbackChangeHistory
+    , FinishResizeCallbackHandler         , setCallbackFinishResize
+    , ShowJavascriptDialogCallbackHandler , setCallbackShowJavascriptDialog
+) where
+
+import Graphics.UI.Awesomium.Raw
+import Graphics.UI.Awesomium.Javascript
+
+import Foreign (peek)
+import Foreign.Ptr (FunPtr)
+import Foreign.Marshal.Utils (toBool)
+import Data.Aeson
+
+(>>=>) :: Monad m => m a -> (a -> m b) -> m a
+(>>=>) a f = a >>= \r -> f r >> return r
+
+type BeginNavigationCallbackHandler = WebView -> String -> String -> IO()
+defBeginNavigationCallback :: BeginNavigationCallbackHandler -> BeginNavigationCallback
+defBeginNavigationCallback convcb wv a1 a0 = do
+    ar1 <- fromAweString a1
+    ar0 <- fromAweString a0
+    convcb wv ar1 ar0
+
+-- | Assign a callback function to be notified when a WebView begins
+-- navigation to a certain URL.
+setCallbackBeginNavigation :: WebView -> BeginNavigationCallbackHandler -> IO (FunPtr BeginNavigationCallback)
+setCallbackBeginNavigation wv ah = 
+    mkBeginNavigationCallback (defBeginNavigationCallback ah) >>=>
+    awe_webview_set_callback_begin_navigation wv
+
+type BeginLoadingCallbackHandler = WebView -> String -> String -> Int -> String -> IO()
+defBeginLoadingCallback :: BeginLoadingCallbackHandler -> BeginLoadingCallback
+defBeginLoadingCallback convcb wv a1 a2 a3 a0 = do
+    ar1 <- fromAweString a1
+    ar2 <- fromAweString a2
+    let ar3 = fromIntegral a3
+    ar0 <- fromAweString a0
+    convcb wv ar1 ar2 ar3 ar0
+
+-- | Assign a callback function to be notified when a WebView begins
+-- to actually receive data from a server.
+setCallbackBeginLoading :: WebView -> BeginLoadingCallbackHandler -> IO (FunPtr BeginLoadingCallback)
+setCallbackBeginLoading wv ah = 
+    mkBeginLoadingCallback (defBeginLoadingCallback ah) >>=>
+    awe_webview_set_callback_begin_loading wv
+
+type FinishLoadingCallbackHandler = WebView -> IO()
+defFinishLoadingCallback :: FinishLoadingCallbackHandler -> FinishLoadingCallback
+defFinishLoadingCallback convcb wv = do
+    convcb wv
+
+-- | Assign a callback function to be notified when a WebView has
+-- finished all loads.
+setCallbackFinishLoading :: WebView -> FinishLoadingCallbackHandler -> IO (FunPtr FinishLoadingCallback)
+setCallbackFinishLoading wv ah = 
+    mkFinishLoadingCallback (defFinishLoadingCallback ah) >>=>
+    awe_webview_set_callback_finish_loading wv
+
+type JSCallbackHandler = WebView -> String -> String -> [Value] -> IO()
+defJSCallback :: JSCallbackHandler -> JSCallback
+defJSCallback convcb wv a1 a2 a0 = do
+    ar1 <- fromAweString a1
+    ar2 <- fromAweString a2
+    ar0 <- jsarrayToJSONValues a0
+    convcb wv ar1 ar2 ar0
+
+-- | Assign a callback function to be notified when a Javascript
+-- object callback has been invoked on a page.
+setCallbackJS :: WebView -> JSCallbackHandler -> IO (FunPtr JSCallback)
+setCallbackJS wv ah = 
+    mkJSCallback (defJSCallback ah) >>=>
+    awe_webview_set_callback_js_callback wv
+
+type ReceiveTitleCallbackHandler = WebView -> String -> String -> IO()
+defReceiveTitleCallback :: ReceiveTitleCallbackHandler -> ReceiveTitleCallback
+defReceiveTitleCallback convcb wv a1 a0 = do
+    ar1 <- fromAweString a1
+    ar0 <- fromAweString a0
+    convcb wv ar1 ar0
+
+-- | Assign a callback function to be notified when a page title is
+-- received.
+setCallbackReceiveTitle :: WebView -> ReceiveTitleCallbackHandler -> IO (FunPtr ReceiveTitleCallback)
+setCallbackReceiveTitle wv ah = 
+    mkReceiveTitleCallback (defReceiveTitleCallback ah) >>=>
+    awe_webview_set_callback_receive_title wv
+
+type ChangeTooltipCallbackHandler = WebView -> String -> IO()
+defChangeTooltipCallback :: ChangeTooltipCallbackHandler -> ChangeTooltipCallback
+defChangeTooltipCallback convcb wv a0 = do
+    ar0 <- fromAweString a0
+    convcb wv ar0
+
+-- | Assign a callback function to be notified when a tooltip has
+-- changed state.
+setCallbackChangeTooltip :: WebView -> ChangeTooltipCallbackHandler -> IO (FunPtr ChangeTooltipCallback)
+setCallbackChangeTooltip wv ah = 
+    mkChangeTooltipCallback (defChangeTooltipCallback ah) >>=>
+    awe_webview_set_callback_change_tooltip wv
+
+type ChangeCursorCallbackHandler = WebView -> CursorType -> IO()
+defChangeCursorCallback :: ChangeCursorCallbackHandler -> ChangeCursorCallback
+defChangeCursorCallback convcb wv a0 = do
+    let ar0 = toEnum . fromIntegral $ a0
+    convcb wv ar0
+
+-- | Assign a callback function to be notified when a cursor has
+-- changed state.
+setCallbackChangeCursor :: WebView -> ChangeCursorCallbackHandler -> IO (FunPtr ChangeCursorCallback)
+setCallbackChangeCursor wv ah = 
+    mkChangeCursorCallback (defChangeCursorCallback ah) >>=>
+    awe_webview_set_callback_change_cursor wv
+
+type ChangeKeyboardFocusCallbackHandler = WebView -> Bool -> IO()
+defChangeKeyboardFocusCallback :: ChangeKeyboardFocusCallbackHandler -> ChangeKeyboardFocusCallback
+defChangeKeyboardFocusCallback convcb wv a0 = do
+    let ar0 = toBool a0
+    convcb wv ar0
+
+-- | Assign a callback function to be notified when keyboard focus has
+-- changed.
+setCallbackChangeKeyboardFocus :: WebView -> ChangeKeyboardFocusCallbackHandler -> IO (FunPtr ChangeKeyboardFocusCallback)
+setCallbackChangeKeyboardFocus wv ah = 
+    mkChangeKeyboardFocusCallback (defChangeKeyboardFocusCallback ah) >>=>
+    awe_webview_set_callback_change_keyboard_focus wv
+
+type ChangeTargetUrlCallbackHandler = WebView -> String -> IO()
+defChangeTargetUrlCallback :: ChangeTargetUrlCallbackHandler -> ChangeTargetUrlCallback
+defChangeTargetUrlCallback convcb wv a0 = do
+    ar0 <- fromAweString a0
+    convcb wv ar0
+
+-- | Assign a callback function to be notified when the target URL has
+-- changed.  This is usually the result of hovering over a link on the
+-- page.
+setCallbackChangeTargetUrl :: WebView -> ChangeTargetUrlCallbackHandler -> IO (FunPtr ChangeTargetUrlCallback)
+setCallbackChangeTargetUrl wv ah = 
+    mkChangeTargetUrlCallback (defChangeTargetUrlCallback ah) >>=>
+    awe_webview_set_callback_change_target_url wv
+
+type OpenExternalLinkCallbackHandler = WebView -> String -> String -> IO()
+defOpenExternalLinkCallback :: OpenExternalLinkCallbackHandler -> OpenExternalLinkCallback
+defOpenExternalLinkCallback convcb wv a1 a0 = do
+    ar1 <- fromAweString a1
+    ar0 <- fromAweString a0
+    convcb wv ar1 ar0
+
+-- | Assign a callback function to be notified when an external link
+-- is attempted to be opened. An external link is any link that
+-- normally opens in a new window in a standard browser (for example,
+-- links with @target=\"_blank\"@, calls to @window.open(url)@, and
+-- URL open events from Flash plugins).
+setCallbackOpenExternalLink :: WebView -> OpenExternalLinkCallbackHandler -> IO (FunPtr OpenExternalLinkCallback)
+setCallbackOpenExternalLink wv ah = 
+    mkOpenExternalLinkCallback (defOpenExternalLinkCallback ah) >>=>
+    awe_webview_set_callback_open_external_link wv
+
+type RequestDownloadCallbackHandler = WebView -> String -> IO()
+defRequestDownloadCallback :: RequestDownloadCallbackHandler -> RequestDownloadCallback
+defRequestDownloadCallback convcb wv a0 = do
+    ar0 <- fromAweString a0
+    convcb wv ar0
+
+-- | Assign a callback function to be notified when a page requests
+-- for a certain URL to be downloaded by the user.
+setCallbackRequestDownload :: WebView -> RequestDownloadCallbackHandler -> IO (FunPtr RequestDownloadCallback)
+setCallbackRequestDownload wv ah = 
+    mkRequestDownloadCallback (defRequestDownloadCallback ah) >>=>
+    awe_webview_set_callback_request_download wv
+
+type WebViewCrashedCallbackHandler = WebView -> IO()
+defWebViewCrashedCallback :: WebViewCrashedCallbackHandler -> WebViewCrashedCallback
+defWebViewCrashedCallback convcb wv = do
+    convcb wv
+
+-- | Assign a callback function to be notified when the renderer for
+-- a certain WebView (which is isolated in a separate process) crashes
+-- unexpectedly.
+setCallbackWebViewCrashed :: WebView -> WebViewCrashedCallbackHandler -> IO (FunPtr WebViewCrashedCallback)
+setCallbackWebViewCrashed wv ah = 
+    mkWebViewCrashedCallback (defWebViewCrashedCallback ah) >>=>
+    awe_webview_set_callback_web_view_crashed wv
+
+type PluginCrashedCallbackHandler = WebView -> String -> IO()
+defPluginCrashedCallback :: PluginCrashedCallbackHandler -> PluginCrashedCallback
+defPluginCrashedCallback convcb wv a0 = do
+    ar0 <- fromAweString a0
+    convcb wv ar0
+
+-- | Assign a callback function to be notified when when the renderer
+-- for a certain plugin (usually Flash, which is isolated in
+-- a separate process) crashes unexpectedly.
+setCallbackPluginCrashed :: WebView -> PluginCrashedCallbackHandler -> IO (FunPtr PluginCrashedCallback)
+setCallbackPluginCrashed wv ah = 
+    mkPluginCrashedCallback (defPluginCrashedCallback ah) >>=>
+    awe_webview_set_callback_plugin_crashed wv
+
+type RequestMoveCallbackHandler = WebView -> Int -> Int -> IO()
+defRequestMoveCallback :: RequestMoveCallbackHandler -> RequestMoveCallback
+defRequestMoveCallback convcb wv a1 a0 = do
+    let ar1 = fromIntegral a1
+    let ar0 = fromIntegral a0
+    convcb wv ar1 ar0
+
+-- | Assign a callback function to be notified when the page requests
+-- for the containing window to be moved to a certain location on the
+-- screen.
+setCallbackRequestMove :: WebView -> RequestMoveCallbackHandler -> IO (FunPtr RequestMoveCallback)
+setCallbackRequestMove wv ah = 
+    mkRequestMoveCallback (defRequestMoveCallback ah) >>=>
+    awe_webview_set_callback_request_move wv
+
+type GetPageContentsCallbackHandler = WebView -> String -> String -> IO()
+defGetPageContentsCallback :: GetPageContentsCallbackHandler -> GetPageContentsCallback
+defGetPageContentsCallback convcb wv a1 a0 = do
+    ar1 <- fromAweString a1
+    ar0 <- fromAweString a0
+    convcb wv ar1 ar0
+
+-- | Assign a callback function to be notified when the contents of
+-- the page has finished loading. This occurs at the end of most page
+-- loads.
+setCallbackGetPageContents :: WebView -> GetPageContentsCallbackHandler -> IO (FunPtr GetPageContentsCallback)
+setCallbackGetPageContents wv ah = 
+    mkGetPageContentsCallback (defGetPageContentsCallback ah) >>=>
+    awe_webview_set_callback_get_page_contents wv
+
+type DomReadyCallbackHandler = WebView -> IO()
+defDomReadyCallback :: DomReadyCallbackHandler -> DomReadyCallback
+defDomReadyCallback convcb wv = do
+    convcb wv
+
+-- | Assign a callback function to be notified once the DOM (Document
+-- Object Model) for a page is ready. This is very useful for
+-- executing Javascript on a page before its content has finished
+-- loading.
+setCallbackDomReady :: WebView -> DomReadyCallbackHandler -> IO (FunPtr DomReadyCallback)
+setCallbackDomReady wv ah = 
+    mkDomReadyCallback (defDomReadyCallback ah) >>=>
+    awe_webview_set_callback_dom_ready wv
+
+type RequestFileChooserCallbackHandler = WebView -> Bool -> String -> String -> IO()
+defRequestFileChooserCallback :: RequestFileChooserCallbackHandler -> RequestFileChooserCallback
+defRequestFileChooserCallback convcb wv a1 a2 a0 = do
+    let ar1 = toBool a1
+    ar2 <- fromAweString a2
+    ar0 <- fromAweString a0
+    convcb wv ar1 ar2 ar0
+
+-- | Assign a callback function to be notified whenever a page
+-- requests a file chooser dialog to be displayed (usually the result
+-- of an @input@ element with type @file@ being clicked by a user).
+-- You will need to display your own dialog (it does not have to be
+-- modal, this request does not block).  Once a file has been chosen
+-- by the user, 'Graphics.UI.Awesomium.WebView.chooseFile'
+-- should be called.
+setCallbackRequestFileChooser :: WebView -> RequestFileChooserCallbackHandler -> IO (FunPtr RequestFileChooserCallback)
+setCallbackRequestFileChooser wv ah = 
+    mkRequestFileChooserCallback (defRequestFileChooserCallback ah) >>=>
+    awe_webview_set_callback_request_file_chooser wv
+
+type GetScrollDataCallbackHandler = WebView -> Int -> Int -> Int -> Int -> Int -> IO()
+defGetScrollDataCallback :: GetScrollDataCallbackHandler -> GetScrollDataCallback
+defGetScrollDataCallback convcb wv a1 a2 a3 a4 a0 = do
+    let ar1 = fromIntegral a1
+    let ar2 = fromIntegral a2
+    let ar3 = fromIntegral a3
+    let ar4 = fromIntegral a4
+    let ar0 = fromIntegral a0
+    convcb wv ar1 ar2 ar3 ar4 ar0
+
+-- | Assign a callback function to be notified of a response to
+-- 'Graphics.UI.Awesomium.WebView.requestScrollData'.
+setCallbackGetScrollData :: WebView -> GetScrollDataCallbackHandler -> IO (FunPtr GetScrollDataCallback)
+setCallbackGetScrollData wv ah = 
+    mkGetScrollDataCallback (defGetScrollDataCallback ah) >>=>
+    awe_webview_set_callback_get_scroll_data wv
+
+type JsConsoleMessageCallbackHandler = WebView -> String -> Int -> String -> IO()
+defJsConsoleMessageCallback :: JsConsoleMessageCallbackHandler -> JsConsoleMessageCallback
+defJsConsoleMessageCallback convcb wv a1 a2 a0 = do
+    ar1 <- fromAweString a1
+    let ar2 = fromIntegral a2
+    ar0 <- fromAweString a0
+    convcb wv ar1 ar2 ar0
+
+-- | Assign a callback function to be notified of any Javascript
+-- console messages. (Usually Javascript errors encountered in
+-- scripts)
+setCallbackJsConsoleMessage :: WebView -> JsConsoleMessageCallbackHandler -> IO (FunPtr JsConsoleMessageCallback)
+setCallbackJsConsoleMessage wv ah = 
+    mkJsConsoleMessageCallback (defJsConsoleMessageCallback ah) >>=>
+    awe_webview_set_callback_js_console_message wv
+
+type GetFindResultsCallbackHandler = WebView -> Int -> Int -> Rect -> Int -> Bool -> IO()
+defGetFindResultsCallback :: GetFindResultsCallbackHandler -> GetFindResultsCallback
+defGetFindResultsCallback convcb wv a1 a2 a3 a4 a0 = do
+    let ar1 = fromIntegral a1
+    let ar2 = fromIntegral a2
+    ar3 <- peek a3
+    let ar4 = fromIntegral a4
+    let ar0 = toBool a0
+    convcb wv ar1 ar2 ar3 ar4 ar0
+
+-- | Assign a callback function to be notified whenever we receive
+-- results back from an in-page find operation
+-- ('Graphics.UI.Awesomium.WebView.find').
+setCallbackGetFindResults :: WebView -> GetFindResultsCallbackHandler -> IO (FunPtr GetFindResultsCallback)
+setCallbackGetFindResults wv ah = 
+    mkGetFindResultsCallback (defGetFindResultsCallback ah) >>=>
+    awe_webview_set_callback_get_find_results wv
+
+type UpdateImeCallbackHandler = WebView -> ImeState -> Rect -> IO()
+defUpdateImeCallback :: UpdateImeCallbackHandler -> UpdateImeCallback
+defUpdateImeCallback convcb wv a1 a0 = do
+    let ar1 = toEnum . fromIntegral $ a1
+    ar0 <- peek a0
+    convcb wv ar1 ar0
+
+-- | Assign a callback function to be notified whenever the user does
+-- something that may change the position or visiblity of the IME
+-- Widget.  This callback is only active when IME is activated (please
+-- see 'Graphics.UI.Awesomium.WebView.activateIme').
+setCallbackUpdateIme :: WebView -> UpdateImeCallbackHandler -> IO (FunPtr UpdateImeCallback)
+setCallbackUpdateIme wv ah = 
+    mkUpdateImeCallback (defUpdateImeCallback ah) >>=>
+    awe_webview_set_callback_update_ime wv
+
+type ShowContextMenuCallbackHandler = WebView -> Int -> Int -> MediaType -> Int {-MediaState-} -> String -> String -> String -> String -> String -> Bool -> Int {-CanEditFlags-} -> IO()
+defShowContextMenuCallback :: ShowContextMenuCallbackHandler -> ShowContextMenuCallback
+defShowContextMenuCallback convcb wv a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a0 = do
+    let ar1 = fromIntegral a1
+    let ar2 = fromIntegral a2
+    let ar3 = toEnum . fromIntegral $ a3
+    let ar4 = fromIntegral a4
+    ar5 <- fromAweString a5
+    ar6 <- fromAweString a6
+    ar7 <- fromAweString a7
+    ar8 <- fromAweString a8
+    ar9 <- fromAweString a9
+    let ar10 = toBool a10
+    let ar0 = fromIntegral a0
+    convcb wv ar1 ar2 ar3 ar4 ar5 ar6 ar7 ar8 ar9 ar10 ar0
+
+-- | Assign a callback function to be notified whenever the page
+-- requests a context menu to be shown (usually the result of a user
+-- right-clicking somewhere on the page). It is your responsiblity to
+-- display a menu for the user to select an appropriate action.
+setCallbackShowContextMenu :: WebView -> ShowContextMenuCallbackHandler -> IO (FunPtr ShowContextMenuCallback)
+setCallbackShowContextMenu wv ah = 
+    mkShowContextMenuCallback (defShowContextMenuCallback ah) >>=>
+    awe_webview_set_callback_show_context_menu wv
+
+type RequestLoginCallbackHandler = WebView -> Int -> String -> Bool -> String -> String -> String -> IO()
+defRequestLoginCallback :: RequestLoginCallbackHandler -> RequestLoginCallback
+defRequestLoginCallback convcb wv a1 a2 a3 a4 a5 a0 = do
+    let ar1 = fromIntegral a1
+    ar2 <- fromAweString a2
+    let ar3 = toBool a3
+    ar4 <- fromAweString a4
+    ar5 <- fromAweString a5
+    ar0 <- fromAweString a0
+    convcb wv ar1 ar2 ar3 ar4 ar5 ar0
+
+-- | Assign a callback function to be notified whenever a page
+-- requests authentication from the user (ex, Basic HTTP Auth, NTLM
+-- Auth, etc.).  See 'Graphics.UI.Awesomium.WebView.login' and
+-- 'Graphics.UI.Awesomium.WebView.cancelLogin'.
+setCallbackRequestLogin :: WebView -> RequestLoginCallbackHandler -> IO (FunPtr RequestLoginCallback)
+setCallbackRequestLogin wv ah = 
+    mkRequestLoginCallback (defRequestLoginCallback ah) >>=>
+    awe_webview_set_callback_request_login wv
+
+type ChangeHistoryCallbackHandler = WebView -> Int -> Int -> IO()
+defChangeHistoryCallback :: ChangeHistoryCallbackHandler -> ChangeHistoryCallback
+defChangeHistoryCallback convcb wv a1 a0 = do
+    let ar1 = fromIntegral a1
+    let ar0 = fromIntegral a0
+    convcb wv ar1 ar0
+
+-- | Assign a callback function to be notified whenever the history
+-- state has changed. (eg, the state of thie back/forward buttons
+-- should be updated)
+setCallbackChangeHistory :: WebView -> ChangeHistoryCallbackHandler -> IO (FunPtr ChangeHistoryCallback)
+setCallbackChangeHistory wv ah = 
+    mkChangeHistoryCallback (defChangeHistoryCallback ah) >>=>
+    awe_webview_set_callback_change_history wv
+
+type FinishResizeCallbackHandler = WebView -> Int -> Int -> IO()
+defFinishResizeCallback :: FinishResizeCallbackHandler -> FinishResizeCallback
+defFinishResizeCallback convcb wv a1 a0 = do
+    let ar1 = fromIntegral a1
+    let ar0 = fromIntegral a0
+    convcb wv ar1 ar0
+
+-- | Assign a callback function to be notified whenever a WebView has
+-- finished resizing to a certain size (and has finished repainting
+-- the RenderBuffer).
+setCallbackFinishResize :: WebView -> FinishResizeCallbackHandler -> IO (FunPtr FinishResizeCallback)
+setCallbackFinishResize wv ah = 
+    mkFinishResizeCallback (defFinishResizeCallback ah) >>=>
+    awe_webview_set_callback_finish_resize wv
+
+type ShowJavascriptDialogCallbackHandler = WebView -> Int -> Int {-DialogFlags-} -> String -> String -> String -> IO()
+defShowJavascriptDialogCallback :: ShowJavascriptDialogCallbackHandler -> ShowJavascriptDialogCallback
+defShowJavascriptDialogCallback convcb wv a1 a2 a3 a4 a0 = do
+    let ar1 = fromIntegral a1
+    let ar2 = fromIntegral a2
+    ar3 <- fromAweString a3
+    ar4 <- fromAweString a4
+    ar0 <- fromAweString a0
+    convcb wv ar1 ar2 ar3 ar4 ar0
+
+-- | Assign a callback function to be notified whenever a WebView
+-- requests that a certain Javascript dialog be shown (eg, alert,
+-- confirm, prompt). See
+-- 'Graphics.UI.Awesomium.WebView.closeJavascriptDialog' for more
+-- information.
+setCallbackShowJavascriptDialog :: WebView -> ShowJavascriptDialogCallbackHandler -> IO (FunPtr ShowJavascriptDialogCallback)
+setCallbackShowJavascriptDialog wv ah = 
+    mkShowJavascriptDialogCallback (defShowJavascriptDialogCallback ah) >>=>
+    awe_webview_set_callback_show_javascript_dialog wv
+
