From 700558a844607c40a42a64868979e9908d69b0cc Mon Sep 17 00:00:00 2001 From: Stanislas Polu Date: Mon, 10 Nov 2014 12:38:42 -0800 Subject: [PATCH 01/64] Documentation README --- docs/README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 docs/README.md diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..225c698 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,31 @@ + +A typical Thrust app is composed of two main components. The platform code +which is language specific and calls into one of Thrust's language binding, +and the HTML5 client code which is executed by Thrusts windows. + +The platform code is generally in charge of serving the client code locally and +provide an API for it to interact with. As the platform code is language +specific, the API reference only describe objects and available methods in a +pseudocode format, as exposed by Thrust standard I/O API for language bindings +to work with. Please refer to your specific language bindings for a more specific +documentation and syntax. + +### API Reference + +Platform code objects: + +- [window][api/window.md] +- [session][api/session.md] +- [menu][api/menu.md] + +Client code modules: + +- remote (coming soon) + +Client custom DOM elements: + +- [`` tag](api/webview.md) + +### Language Bidings Documenatation + +- [go-thrust](https://github.com/miketheprogrammer/go-thrust/tree/master/doc) From 814c07a1610b523f81da4ed9eea1fa199e293e53 Mon Sep 17 00:00:00 2001 From: Stanislas Polu Date: Mon, 10 Nov 2014 12:50:47 -0800 Subject: [PATCH 02/64] Window API --- docs/README.md | 17 ++++++++------- docs/api/window.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 docs/api/window.md diff --git a/docs/README.md b/docs/README.md index 225c698..e0e908c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -5,18 +5,18 @@ and the HTML5 client code which is executed by Thrusts windows. The platform code is generally in charge of serving the client code locally and provide an API for it to interact with. As the platform code is language -specific, the API reference only describe objects and available methods in a -pseudocode format, as exposed by Thrust standard I/O API for language bindings -to work with. Please refer to your specific language bindings for a more specific -documentation and syntax. +specific, the API reference only describe objects and available methods, using +a pseudocode format, as exposed by Thrust standard I/O API for language bindings +to interact with. Please refer to your specific language bindings for a more +specific documentation and syntax. ### API Reference Platform code objects: -- [window][api/window.md] -- [session][api/session.md] -- [menu][api/menu.md] +- [window](api/window.md) +- [session](api/session.md) +- [menu](api/menu.md) Client code modules: @@ -26,6 +26,7 @@ Client custom DOM elements: - [`` tag](api/webview.md) -### Language Bidings Documenatation +### Language Bindings Documenatation +- node-thrust - [go-thrust](https://github.com/miketheprogrammer/go-thrust/tree/master/doc) diff --git a/docs/api/window.md b/docs/api/window.md new file mode 100644 index 0000000..8be10bc --- /dev/null +++ b/docs/api/window.md @@ -0,0 +1,54 @@ +window +====== + +The `window` object provides an API to show and interact with native windows +in charge of executing client side code. + +#### Constructor + +- `root_url` the url to load as top-level document for the window +- `size` + - `width` the initial window width + - `height` the initial window height +- `title` the window title +- `icon_path` absolute path to a `PNG` or `JPG` icon file for the window +- `has_frame` creates a frameless window if `true` +- `session_id` the id of the session to use for this window + +#### Event: `closed` + +Emitted when the window is closed + +#### Event: `blur` + +Emitted when the window loses focus + +#### Event: `focus` + +Emitted when the window gains focus + +#### Event: `unresponsive` + +Emitted when the window renderer become unresponsive + +#### Event: `responsive` + +Emitted when the window renderer regains responsiveness + +#### Event: `worker_crashed` + +Emitted when the window renderer crashed + +#### show + +Makes the window visible + +#### focus + +- `focus` wether to focus or blur the window + +Focuses or blur the window depending on the value of `focus` + +#### maximize + +Maximizes the window From 6d9080e589b3e85c9b9133e76717f31e7a420a0c Mon Sep 17 00:00:00 2001 From: Stanislas Polu Date: Mon, 10 Nov 2014 12:58:38 -0800 Subject: [PATCH 03/64] Finish window documentation --- docs/api/window.md | 88 +++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 84 insertions(+), 4 deletions(-) diff --git a/docs/api/window.md b/docs/api/window.md index 8be10bc..cb33491 100644 --- a/docs/api/window.md +++ b/docs/api/window.md @@ -39,16 +39,96 @@ Emitted when the window renderer regains responsiveness Emitted when the window renderer crashed -#### show +#### Method: `show` Makes the window visible -#### focus +#### Method: `focus` -- `focus` wether to focus or blur the window +- `focus` whether to focus or blur the window Focuses or blur the window depending on the value of `focus` -#### maximize +#### Method: `maximize` Maximizes the window + +#### Method: `minimize` + +Minimizes the window + +#### Method: `restore` + +Restores a minimized window + +#### Method: `set_title` + +- `title` the title to set + +Sets the title of a window + +#### Method: `set_fullscreen` + +- `fullscreen` whether to set the window fullscreen or not + +Makes the window enter or leave fullscreen + +#### Method: `set_kiosk` + +- `kiosk` whether to set the window in kiosk mode + +Makes the window enter or leave kiosk mode + +#### Method: `open_devtools` + +Opens the DevTools for this window's main document + +#### Method: `close_devtools` + +Closes the DevTools for this window's main document + +#### Method: `move` + +- `x` the new x position +- `y` the new y position + +Moves the window to the specified position + +#### Method: `resize` + +- `width` the new window width +- `height` the new window height + +Resizes the window to the specified size + +#### Accessor: `is_closed` + +Returns wether the window has been closed or not (can't be reopened) + +#### Accessor: `size` + +Returns the size of the window + +#### Accessor: `position` + +Returns the position of the window + +#### Accessor: `is_maximized` + +Returns whether the window is maximized or not + +#### Accessor: `is_minimized` + +Returns whether the window is minimized or not + +#### Accessor: `is_fullscreen` + +Returns whether the window is in fullscreen mode or not + +#### Accessor: `is_kiosed` + +Returns whether the window is in kiosk mode or not + +#### Accessor: `is_devtools_opened` + +Returns whether the window's main document has its DevTools opened or not From d03e47a1272e38fd46c240f4893b5c2428a40244 Mon Sep 17 00:00:00 2001 From: Stanislas Polu Date: Mon, 10 Nov 2014 13:10:30 -0800 Subject: [PATCH 04/64] session API Documentation --- docs/api/session.md | 96 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 docs/api/session.md diff --git a/docs/api/session.md b/docs/api/session.md new file mode 100644 index 0000000..1c068ef --- /dev/null +++ b/docs/api/session.md @@ -0,0 +1,96 @@ +session +======= + +The `session` object provides an API to manage sessions for a window (cookies, +storage). + +#### Constructor + +- `off_the_record` if true windows using this session won't write to disk +- `path` path under which session information should be stored (cache, storage) +- `cookie_store` whether or not to use a custom cookie store + +#### Method: `visitedlink_add` + +- `url` a link url + +Adds the specified url to the list of visited links for this session + +#### Method: `visitedlink_clear` + +Clears the visited links storage for this session + +#### Accessor: `off_the_record` + +Returns whether the session is off the record or not + +#### Remote Method: `cookies_load` + +Retrieves all the cookies from the custom cookie store + +#### Remote Method: `cookies_load_for_key` + +- `key` domain key to retrieve cookie for + +Retrieves the cookies for the specified domain key. + +#### Remote Method: `cookies_flush` + +Flush all cookies to permanent storage + +#### Remote Method: `cookies_add` + +- `cookie` + - `source` the source url + - `name` the cookie name + - `value` the cookie value + - `domain` the cookie domain + - `path` the cookie path + - `creation` the creation date + - `expiry` the expiration date + - `last_access` the last time the cookie was accessed + - `secure` is the cookie secure + - `http_only` is the cookie only valid for HTTP + - `priority` internal priority information + +Add the specified cookie to the custom cookie store. + +#### Remote Method: `cookies_update_access_time` + +- `cookie` + - `source` the source url + - `name` the cookie name + - `value` the cookie value + - `domain` the cookie domain + - `path` the cookie path + - `creation` the creation date + - `expiry` the expiration date + - `last_access` the last time the cookie was accessed + - `secure` is the cookie secure + - `http_only` is the cookie only valid for HTTP + - `priority` internal priority information + +Updates the `last_access` time for the cookie specified + +#### Remote Method: `cookies_delete` + +- `cookie` + - `source` the source url + - `name` the cookie name + - `value` the cookie value + - `domain` the cookie domain + - `path` the cookie path + - `creation` the creation date + - `expiry` the expiration date + - `last_access` the last time the cookie was accessed + - `secure` is the cookie secure + - `http_only` is the cookie only valid for HTTP + - `priority` internal priority information + +Removes the specified cookie from the custom cookie store. + + +#### Remote Method: `cookies_force_keep_session_state` + +Informs the cookie store that it should keep session cookie across restart. + From 6d9b9377e5016d4b75af835ebf355f08a5fa6418 Mon Sep 17 00:00:00 2001 From: Stanislas Polu Date: Mon, 10 Nov 2014 13:55:53 -0800 Subject: [PATCH 05/64] Menu APi --- docs/api/menu.md | 94 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 docs/api/menu.md diff --git a/docs/api/menu.md b/docs/api/menu.md new file mode 100644 index 0000000..267336b --- /dev/null +++ b/docs/api/menu.md @@ -0,0 +1,94 @@ +menu +==== + +The `menu` object provides an API to create native global application menu +(MacOSX and X11/Unity only) and native context menus. + +Window specific menus on other platform are meant to be handled using client +side code. + +#### Constructor + +#### Method: `add_item` + +- `command_id` the label command id (see `execute`) +- `label` the item label + +Adds a standard item to the menu + +#### Method: `add_check_item` + +- `command_id` the label command id (see `execute`) +- `label` the item label + +Adds a check item to the menu + +#### Method: `add_radio_item` + +- `command_id` the label command id (see `execute`) +- `label` the item label +- `group_id` radio group + +Adds a radio item to the menu + +#### Method: `add_separator` + +Adds a separator to the menu + +#### Method: `set_checked` + +- `command_id` the command of the item to alter +- `value` true or false + +Sets an item checked or unchecked + +#### Method: `set_enabled` + +- `command_id` the command of the item to alter +- `value` true or false + +Sets an item enabled or disabled + +#### Method: `set_visible` + +- `command_id` the command of the item to alter +- `value` true or false + +#### Method: `set_accelerator` + +- `command_id` the command id of the item to alter +- `accelerator` accelerator string + +Sets the accelerator string for the menu item + +Sets an item visible or invisible + +#### Method: `add_submenu` + +- `menu_id` the menu id to add as submenu +- `label` label for the submenu +- `command_id` command id for the submenu item + +Adds an other menu as submenu of this menu + +#### Method: `clear` + +Clears the menu of all its items + +#### Method: `popup` + +- `window_id` the window id on which to popup the menu + +Popup the menu as a context menu under the current mouse position for the window +specified by its id. + +#### Method: `set_application_menu` + +Sets this menu as the global application menu on MacOSX and X11/Unity + +#### Remote Method: `execute` + +- `command_id` the command id of the item that was clicked +- `event_flags` event flag integer + +Called when a menu item is clicked From 5a0207f5d6bd4aa9d54282d1b030b9df2e9fa440 Mon Sep 17 00:00:00 2001 From: Stanislas Polu Date: Mon, 10 Nov 2014 14:34:33 -0800 Subject: [PATCH 06/64] Webview API reference --- docs/api/webview.md | 241 ++++++++++++++++++ src/browser/web_view/web_view_guest.cc | 6 - src/renderer/extensions/resources/web_view.js | 3 +- 3 files changed, 242 insertions(+), 8 deletions(-) create mode 100644 docs/api/webview.md diff --git a/docs/api/webview.md b/docs/api/webview.md new file mode 100644 index 0000000..b35d989 --- /dev/null +++ b/docs/api/webview.md @@ -0,0 +1,241 @@ +`` +=========== + +The `` tag is available in the top-level document of any Thrust windows +and lets client code embed untrusted content securely and efficiently. The +`` runs in its own separate process and has stricter permissions than +an `