diff options
author | weitaosu <weitaosu@chromium.org> | 2015-07-31 12:34:32 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-31 19:35:39 +0000 |
commit | 9393e1eeeae43c41ef5c56c8e0105432267b40b7 (patch) | |
tree | c26a2268e8851feab27e6d243fd6f24c501442b0 /remoting/webapp/js_proto | |
parent | c8816192ffabb9a6c8e76ab96749ad9a12545ad1 (diff) | |
download | chromium_src-9393e1eeeae43c41ef5c56c8e0105432267b40b7.zip chromium_src-9393e1eeeae43c41ef5c56c8e0105432267b40b7.tar.gz chromium_src-9393e1eeeae43c41ef5c56c8e0105432267b40b7.tar.bz2 |
Using webview to show the cloud print dialog.
We host the cloud print dialog in a webview and only show it when a cloud print request is received.
1. CloudPrintDialogContainer is the proxy to the webview hosting the cloud print dialog.
2. We inject cloud_print_dialog_injected.js into the webview to be executed when loading the cloud print dialog.
3. We cache the access token in CloudPrintDialogContainer to use in the blocking onBeforeSendHeaders handler.
BUG=
Review URL: https://codereview.chromium.org/1220433003
Cr-Commit-Position: refs/heads/master@{#341390}
Diffstat (limited to 'remoting/webapp/js_proto')
-rw-r--r-- | remoting/webapp/js_proto/dom_proto.js | 80 |
1 files changed, 79 insertions, 1 deletions
diff --git a/remoting/webapp/js_proto/dom_proto.js b/remoting/webapp/js_proto/dom_proto.js index f8233bd..dcee0fa 100644 --- a/remoting/webapp/js_proto/dom_proto.js +++ b/remoting/webapp/js_proto/dom_proto.js @@ -60,7 +60,6 @@ Element.prototype.classList; /** @type {boolean} */ Element.prototype.checked; - /** @type {Window} */ HTMLIFrameElement.prototype.contentWindow; @@ -140,3 +139,82 @@ Number.isInteger = function(value) {}; // Chrome implements XMLHttpRequest.responseURL starting from Chrome 37. /** @type {string} */ XMLHttpRequest.prototype.responseURL = ""; + + +/******************************************************************************* + * Webview and related declarations + ******************************************************************************/ + +/** + * Like chrome.webRequest, but for webview tags. + * + * chrome.webRequest defined in chrome_extensions.js can't be + * used because it's not a type. + * + * @constructor + */ +function WebviewWebRequest() {} + +/** @type {WebRequestEvent} */ +WebviewWebRequest.prototype.onBeforeSendHeaders; + +/** @type {WebRequestEvent} */ +WebviewWebRequest.prototype.onCompleted; + +/** @type {WebRequestOnErrorOccurredEvent} */ +WebviewWebRequest.prototype.onErrorOccurred; + +/** + * Enable access to special APIs of webview DOM element. + * + * @constructor + * @extends {HTMLElement} + */ +function Webview() {} + +/** @type {!WebviewWebRequest} */ +Webview.prototype.request; + +/** @type {function(InjectDetails, function(Object))} */ +Webview.prototype.executeScript; + +/** @type {Window} */ +Webview.prototype.contentWindow; + +/** + * See https://developer.chrome.com/apps/tags/webview#type-InjectDetails + * + * @typedef {{ + * file: (string|undefined), + * code: (string|undefined) + * }} + */ +var InjectDetails; + +/******************************************************************************* + * ConsoleMessage event + ******************************************************************************/ + +/** + * The consolemessage BrowserEvent contains these fields: + * e.level: int32, log severity level (for exception/info etc) + * e.line: int32, line number + * e.message: string, the console message + * e.sourceId: string, source identifier (the ones seen in devtools) + * + * @constructor + * @extends {Event} + */ +chrome.ConsoleMessageBrowserEvent = function() {}; + +/** @type {number} */ +chrome.ConsoleMessageBrowserEvent.prototype.level; + +/** @type {number} */ +chrome.ConsoleMessageBrowserEvent.prototype.line; + +/** @type {string} */ +chrome.ConsoleMessageBrowserEvent.prototype.message; + +/** @type {string} */ +chrome.ConsoleMessageBrowserEvent.prototype.sourceId; |