1// Copyright 2013 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5[ 6 { 7 "namespace": "webviewTag", 8 "description": "Use the <code>webview</code> tag to actively load live content from the web over the network and embed it in your Chrome App. Your app can control the appearance of the <code>webview</code> and interact with the web content, initiate navigations in an embedded web page, react to error events that happen within it, and more (see <a href=\"#usage\">Usage</a>).", 9 "documentation_options": { 10 "title": "<webview> Tag", 11 "namespace": "<webview>", 12 "documented_in": "tags/webview" 13 }, 14 "types": [ 15 { 16 "id": "ClearDataOptions", 17 "type": "object", 18 "description": "Options that determine what data should be cleared by <code>clearData</code>.", 19 "properties": { 20 "since": { 21 "type": "number", 22 "optional": true, 23 "description": "Clear data accumulated on or after this date, represented in milliseconds since the epoch (accessible via the getTime method of the JavaScript <code>Date</code> object). If absent, defaults to <code>0</code> (which would remove all browsing data)." 24 } 25 } 26 }, 27 { 28 "id": "ClearDataTypeSet", 29 "type": "object", 30 "description": "A set of data types. Missing properties are interpreted as <code>false</code>.", 31 "properties": { 32 "appcache": { "type": "boolean", "optional": true, "description": "Websites' appcaches." }, 33 "cookies": { "type": "boolean", "optional": true, "description": "The partition's cookies." }, 34 "fileSystems": { "type": "boolean", "optional": true, "description": "Websites' filesystems." }, 35 "indexedDB": { "type": "boolean", "optional": true, "description": "Websites' IndexedDB data." }, 36 "localStorage": { "type": "boolean", "optional": true, "description": "Websites' local storage data." }, 37 "webSQL": { "type": "boolean", "optional": true, "description": "Websites' WebSQL data." } 38 } 39 }, 40 { 41 "id": "InjectDetails", 42 "type": "object", 43 "description": "Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.", 44 "properties": { 45 "code": { 46 "type": "string", 47 "optional": true, 48 "description": "JavaScript or CSS code to inject.<br><br><b>Warning:</b><br>Be careful using the <code>code</code> parameter. Incorrect use of it may open your app to <a href=\"https://en.wikipedia.org/wiki/Cross-site_scripting\">cross site scripting</a> attacks." 49 }, 50 "file": { 51 "type": "string", 52 "optional": true, 53 "description": "JavaScript or CSS file to inject." 54 } 55 } 56 }, 57 { 58 "id": "ContentWindow", 59 "type": "object", 60 "description": "Messaging handle to a guest window.", 61 "functions": [ 62 { 63 "name": "postMessage", 64 "description": "<p>Posts a message to the embedded web content as long as the embedded content is displaying a page from the target origin. This method is available once the page has completed loading. Listen for the <a href=\"#event-contentload\">contentload</a> event and then call the method.</p><p>The guest will be able to send replies to the embedder by posting message to <code>event.source</code> on the message event it receives.</p><p>This API is identical to the <a href=\"https://developer.mozilla.org/en-US/docs/DOM/window.postMessage\">HTML5 postMessage API</a> for communication between web pages. The embedder may listen for replies by adding a <code>message</code> event listener to its own frame.</p>", 65 "parameters": [ 66 { 67 "type": "any", 68 "name": "message", 69 "description": "Message object to send to the guest." 70 }, 71 { 72 "type": "string", 73 "name": "targetOrigin", 74 "description": "Specifies what the origin of the guest window must be for the event to be dispatched." 75 } 76 ] 77 } 78 ] 79 }, 80 { 81 "id": "DialogController", 82 "type": "object", 83 "description": "Interface attached to <code>dialog</code> DOM events.", 84 "functions": [ 85 { 86 "name": "ok", 87 "description": "Accept the dialog. Equivalent to clicking OK in an <code>alert</code>, <code>confirm</code>, or <code>prompt</code> dialog.", 88 "parameters": [ 89 { 90 "type": "string", 91 "optional": true, 92 "name": "response", 93 "description": "The response string to provide to the guest when accepting a <code>prompt</code> dialog." 94 } 95 ] 96 }, 97 { 98 "name": "cancel", 99 "description": "Reject the dialog. Equivalent to clicking Cancel in a <code>confirm</code> or <code>prompt</code> dialog." 100 } 101 ] 102 }, 103 { 104 "id": "FindCallbackResults", 105 "type": "object", 106 "description": "Contains all of the results of the find request.", 107 "properties": { 108 "numberOfMatches": { 109 "type": "integer", 110 "description": "The number of times <code>searchText</code> was matched on the page." 111 }, 112 "activeMatchOrdinal": { 113 "type": "integer", 114 "description": "The ordinal number of the current match." 115 }, 116 "selectionRect": { 117 "$ref": "SelectionRect", 118 "description": "Describes a rectangle around the active match in screen coordinates." 119 }, 120 "canceled": { 121 "type": "boolean", 122 "description": "Indicates whether this find request was canceled." 123 } 124 } 125 }, 126 { 127 "id": "FindOptions", 128 "type": "object", 129 "description": "Options for the find request.", 130 "properties": { 131 "backward": { 132 "type": "boolean", 133 "description": "Flag to find matches in reverse order. The default value is <code>false</code>.", 134 "optional": true 135 }, 136 "matchCase": { 137 "type": "boolean", 138 "description": "Flag to match with case-sensitivity. The default value is <code>false</code>.", 139 "optional": true 140 } 141 } 142 }, 143 { 144 "id": "NewWindow", 145 "type": "object", 146 "description": "Interface attached to <code>newwindow</code> DOM events.", 147 "functions": [ 148 { 149 "name": "attach", 150 "description": "Attach the requested target page to an existing <code>webview</code> element.", 151 "parameters": [ 152 { 153 "type": "object", 154 "name": "webview", 155 "description": "The <code>webview</code> element to which the target page should be attached.", 156 "properties": {} 157 } 158 ] 159 }, 160 { 161 "name": "discard", 162 "description": "Cancel the new window request." 163 } 164 ] 165 }, 166 { 167 "id": "MediaPermissionRequest", 168 "type": "object", 169 "description": "The type of <code>request</code> object which accompanies a <code>media</code> <a href=\"#event-permissionrequest\">permissionrequest</a></code> DOM event.", 170 "properties": { 171 "url": { 172 "description": "The URL of the frame requesting access to user media.", 173 "type": "string" 174 } 175 }, 176 "functions": [ 177 { "name": "allow", "description": "Allow the permission request." }, 178 { "name": "deny", "description": "Deny the permission request. This is the default behavior if <code>allow</code> is not called." } 179 ] 180 }, 181 { 182 "id": "GeolocationPermissionRequest", 183 "type": "object", 184 "description": "The type of <code>request</code> object which accompanies a <code>geolocation</code> <a href=\"#event-permissionrequest\">permissionrequest</a></code> DOM event.", 185 "properties": { 186 "url": { 187 "description": "The URL of the frame requesting access to geolocation data.", 188 "type": "string" 189 } 190 }, 191 "functions": [ 192 { "name": "allow", "description": "Allow the permission request." }, 193 { "name": "deny", "description": "Deny the permission request. This is the default behavior if <code>allow</code> is not called." } 194 ] 195 }, 196 { 197 "id": "PointerLockPermissionRequest", 198 "type": "object", 199 "description": "The type of <code>request</code> object which accompanies a <code>pointerLock</code> <a href=\"#event-permissionrequest\">permissionrequest</a></code> DOM event.", 200 "properties": { 201 "userGesture": { 202 "description": "Whether or not pointer lock was requested as a result of a user input gesture.", 203 "type": "boolean" 204 }, 205 "lastUnlockedBySelf": { 206 "description": "Whether or not the requesting frame was the most recent client to hold pointer lock.", 207 "type": "boolean" 208 }, 209 "url": { 210 "description": "The URL of the frame requesting pointer lock.", 211 "type": "string" 212 } 213 }, 214 "functions": [ 215 { "name": "allow", "description": "Allow the permission request." }, 216 { "name": "deny", "description": "Deny the permission request. This is the default behavior if <code>allow</code> is not called." } 217 ] 218 }, 219 { 220 "id": "DownloadPermissionRequest", 221 "type": "object", 222 "description": "The type of <code>request</code> object which accompanies a <code>download</code> <a href=\"#event-permissionrequest\">permissionrequest</a></code> DOM event.", 223 "properties": { 224 "requestMethod": { 225 "description": "The HTTP request type (e.g. <code>GET</code>) associated with the download request.", 226 "type": "string" 227 }, 228 "url": { 229 "description": "The requested download URL.", 230 "type": "string" 231 } 232 }, 233 "functions": [ 234 { "name": "allow", "description": "Allow the permission request." }, 235 { "name": "deny", "description": "Deny the permission request. This is the default behavior if <code>allow</code> is not called." } 236 ] 237 }, 238 { 239 "id": "FileSystemPermissionRequest", 240 "type": "object", 241 "description": "The type of <code>request</code> object which accompanies a <code>filesystem</code> <a href=\"#event-permissionrequest\">permissionrequest</a></code> DOM event.", 242 "properties": { 243 "url": { 244 "description": "The URL of the frame requesting access to local file system.", 245 "type": "string" 246 } 247 }, 248 "functions": [ 249 { "name": "allow", "description": "Allow the permission request." }, 250 { "name": "deny", "description": "Deny the permission request." } 251 ] 252 }, 253 { 254 "id": "LoadPluginPermissionRequest", 255 "type": "object", 256 "description": "The type of <code>request</code> object which accompanies a <code>loadplugin</code> <a href=\"#event-permissionrequest\">permissionrequest</a> DOM event.<p>", 257 "properties": { 258 "identifier": { 259 "description": "The plugin's identifier string.", 260 "type": "string" 261 }, 262 "name": { 263 "description": "The plugin's display name.", 264 "type": "string" 265 } 266 }, 267 "functions": [ 268 { "name": "allow", "description": "Allow the permission request. This is the default behavior if <code>deny</code> is not called.." }, 269 { "name": "deny", "description": "Deny the permission request." } 270 ] 271 }, 272 { 273 "id": "SelectionRect", 274 "type": "object", 275 "description": "<p>Describes a rectangle in screen coordinates.</p><p>The containment semantics are array-like; that is, the coordinate <code>(left, top)</code> is considered to be contained by the rectangle, but the coordinate <code>(left + width, top)</code> is not.</p>", 276 "properties": { 277 "left": { 278 "type": "integer", 279 "description": "Distance from the left edge of the screen to the left edge of the rectangle." 280 }, 281 "top": { 282 "type": "integer", 283 "description": "Distance from the top edge of the screen to the top edge of the rectangle." 284 }, 285 "width": { 286 "type": "integer", 287 "description": "Width of the rectangle." 288 }, 289 "height": { 290 "type": "integer", 291 "description": "Height of the rectangle." 292 } 293 } 294 }, 295 { 296 "id": "WebRequestEventInteface", 297 "type": "object", 298 "description": "Interface which provides access to webRequest events on the guest page. See the <a href=\"http://developer.chrome.com/extensions/webRequest\">chrome.webRequest</a> extensions API for details on webRequest life cycle and related concepts.<p>To illustrate how usage differs from the extensions webRequest API, consider the following example code which blocks any guest requests for URLs which match <code>*://www.evil.com/*</code>:</p><pre>webview.request.onBeforeRequest.addListener(\r function(details) { return {cancel: true}; },\r {urls: [\"*://www.evil.com/*\"]},\r [\"blocking\"]);</pre><p>Additionally, this interface supports declarative webRequest rules through <code>onRequest</code> and <code>onMessage</code> events. See <a href=\"http://developer.chrome.com/extensions/declarativeWebRequest.html\">declarativeWebRequest</a> for API details.</p>Note that conditions and actions for declarative webview webRequests should be instantiated from their <code>chrome.webViewRequest.*</code> counterparts. The following example code declaratively blocks all requests to <code>\"example.com\"</code> on the webview <code>myWebview</code>:</p><pre>var rule = {\r conditions: [\r new chrome.webViewRequest.RequestMatcher({ url: { hostSuffix: 'example.com' } })\r ],\r actions: [ new chrome.webViewRequest.CancelRequest() ]\r};\rmyWebview.request.onRequest.addRules([rule]);</pre>", 299 "properties": {} 300 } 301 ], 302 "functions": [ 303 { 304 "name": "back", 305 "type": "function", 306 "description": "Navigates backward one history entry if possible. Equivalent to <code>go(-1)</code>." 307 }, 308 { 309 "name": "canGoBack", 310 "type": "function", 311 "returns": { "type": "boolean" }, 312 "description": "Indicates whether or not it is possible to navigate backward through history." 313 }, 314 { 315 "name": "canGoForward", 316 "type": "function", 317 "returns": { "type": "boolean" }, 318 "description": "Indicates whether or not it is possible to navigate forward through history." 319 }, 320 { 321 "name": "clearData", 322 "type": "function", 323 "description": "<p>Clears browsing data for the <code>webview</code> partition.</p>", 324 "parameters": [ 325 { 326 "name": "options", 327 "$ref": "ClearDataOptions", 328 "description": "Options determining exactly what data to clear." 329 }, 330 { 331 "name": "types", 332 "$ref": "ClearDataTypeSet", 333 "description": "The types of data to be cleared." 334 }, 335 { 336 "type": "function", 337 "name": "callback", 338 "optional": true, 339 "description": "Called after the data has been successfully cleared.", 340 "parameters": [] 341 } 342 ] 343 }, 344 { 345 "name": "executeScript", 346 "type": "function", 347 "description": "<p>Injects JavaScript code into the guest page.</p><p>The following sample code uses script injection to set the guest page's background color to red:</p><pre>webview.executeScript({ code: \"document.body.style.backgroundColor = 'red'\" });</pre>", 348 "parameters": [ 349 { 350 "$ref": "InjectDetails", 351 "name": "details", 352 "description": "Details of the script to run." 353 }, 354 { 355 "type": "function", 356 "name": "callback", 357 "optional": true, 358 "description": "Called after all the JavaScript has been executed.", 359 "parameters": [ 360 { 361 "name": "result", 362 "optional": true, 363 "type": "array", 364 "items": {"type": "any", "minimum": 0}, 365 "description": "The result of the script in every injected frame." 366 } 367 ] 368 } 369 ] 370 }, 371 { 372 "name": "find", 373 "type": "function", 374 "description": "Initiates a find-in-page request.", 375 "parameters": [ 376 { 377 "type": "string", 378 "name": "searchText", 379 "description": "The string to find in the page." 380 }, 381 { 382 "$ref": "FindOptions", 383 "name": "options", 384 "optional": true, 385 "description": "Options for the find request." 386 }, 387 { 388 "type": "function", 389 "name": "callback", 390 "description": "Called after all find results have been returned for this find request.", 391 "optional": true, 392 "parameters": [ 393 { 394 "$ref": "FindCallbackResults", 395 "name": "results", 396 "description": "Contains all of the results of the find request. <code>results</code> can be omitted if it is not utilized in the callback function body; for example, if the callback is only used to discern when the find request has completed.", 397 "optional": true 398 } 399 ] 400 } 401 ] 402 }, 403 { 404 "name": "forward", 405 "type": "function", 406 "description": "Navigates forward one history entry if possible. Equivalent to <code>go(1)</code>.", 407 "parameters": [] 408 }, 409 { 410 "name": "getProcessId", 411 "type": "function", 412 "returns": { "type": "integer" }, 413 "description": "Returns Chrome's internal process ID for the guest web page's current process, allowing embedders to know how many guests would be affected by terminating the process. Two guests will share a process only if they belong to the same app and have the same <a href=\"#partition\">storage partition ID</a>. The call is synchronous and returns the embedder's cached notion of the current process ID. The process ID isn't the same as the operating system's process ID.", 414 "parameters": [] 415 }, 416 { 417 "name": "getUserAgent", 418 "type": "function", 419 "returns": { "type": "string" }, 420 "description": "Returns the user agent string used by the webview for guest page requests.", 421 "parameters": [] 422 }, 423 { 424 "name": "getZoom", 425 "type": "function", 426 "description": "Gets the current zoom factor.", 427 "parameters": [ 428 { 429 "type": "function", 430 "name": "callback", 431 "description": "Called after the current zoom factor is retreived.", 432 "parameters": [ 433 { 434 "type": "number", 435 "name": "zoomFactor", 436 "description": "The current zoom factor." 437 } 438 ] 439 } 440 ] 441 }, 442 { 443 "name": "go", 444 "type": "function", 445 "description": "Navigates to a history entry using a history index relative to the current navigation. If the requested navigation is impossible, this method has no effect.", 446 "parameters": [ 447 { 448 "type": "integer", 449 "name": "relativeIndex", 450 "description": "Relative history index to which the webview should be navigated. For example, a value of <code>2</code> will navigate forward 2 history entries if possible; a value of <code>-3</code> will navigate backward 3 entries." 451 } 452 ] 453 }, 454 { 455 "name": "insertCSS", 456 "type": "function", 457 "description": "Injects CSS into the guest page.", 458 "parameters": [ 459 { 460 "$ref": "InjectDetails", 461 "name": "details", 462 "description": "Details of the CSS to insert." 463 }, 464 { 465 "type": "function", 466 "name": "callback", 467 "optional": true, 468 "description": "Called after the CSS has been inserted.", 469 "parameters": [] 470 } 471 ] 472 }, 473 { 474 "name": "isUserAgentOverridden", 475 "type": "function", 476 "description": "Indicates whether or not the webview's user agent string has been overridden by $(ref:webviewTag.setUserAgentOverride)" 477 }, 478 { 479 "name": "reload", 480 "type": "function", 481 "description": "Reloads the current top-level page.", 482 "parameters": [] 483 }, 484 { 485 "name": "setUserAgentOverride", 486 "type": "function", 487 "description": "Override the user agent string used by the webview for guest page requests.", 488 "parameters": [ 489 { 490 "name": "userAgent", 491 "type": "string", 492 "description": "The user agent string to use." 493 } 494 ] 495 }, 496 { 497 "name": "setZoom", 498 "type": "function", 499 "description": "Changes the zoom factor of the page. This zoom will persist for the page's origin, even after navigation.", 500 "parameters": [ 501 { 502 "type": "number", 503 "name": "zoomFactor", 504 "description" : "The new zoom factor." 505 }, 506 { 507 "type": "function", 508 "name": "callback", 509 "description": "Called after the page has been zoomed.", 510 "optional": true, 511 "parameters": [] 512 } 513 ] 514 }, 515 { 516 "name": "stop", 517 "type": "function", 518 "description": "Stops loading the current <webview> navigation if in progress.", 519 "parameters": [] 520 }, 521 { 522 "name": "stopFinding", 523 "type": "function", 524 "description": "Ends the current find session (clearing all highlighting) and cancels all find requests in progress.", 525 "parameters": [ 526 { 527 "type": "string", 528 "name": "action", 529 "description": "Determines what to do with the active match after the find session has ended. <code>clear</code> will clear the highlighting over the active match; <code>keep</code> will keep the active match highlighted; <code>activate</code> will keep the active match highlighted and simulate a user click on that match. The default action is <code>keep</code>.", 530 "optional": true, 531 "enum": ["clear", "keep", "activate"] 532 } 533 ] 534 }, 535 { 536 "name": "terminate", 537 "type": "function", 538 "description": "Forcibly kills the guest web page's renderer process. This may affect multiple <code>webview</code> tags in the current app if they share the same process, but it will not affect <code>webview</code> tags in other apps.", 539 "parameters": [] 540 } 541 ], 542 "events": [ 543 { 544 "name": "close", 545 "options": { "supportsDom": true }, 546 "description": "Fired when the guest window attempts to close itself.<p>The following example code navigates the webview to <code>about:blank</code> when the guest attempts to close itself.</p><pre>webview.addEventListener('close', function() {\r webview.src = 'about:blank';\r});</pre>", 547 "parameters": [] 548 }, 549 { 550 "name": "consolemessage", 551 "options": { "supportsDom": true }, 552 "description": "Fired when the guest window logs a console message.<p>The following example code forwards all log messages to the embedder's console without regard for log level or other properties.</p><pre>webview.addEventListener('consolemessage', function(e) {\r console.log('Guest page logged a message: ', e.message);\r});</pre>", 553 "parameters": [ 554 { 555 "name": "level", 556 "description": "The severity level of the log message. Ranges from 0 to 4.", 557 "type": "integer" 558 }, 559 { 560 "name": "message", 561 "description": "The logged message contents.", 562 "type": "string" 563 }, 564 { 565 "name": "line", 566 "description": "The line number of the message source.", 567 "type": "integer" 568 }, 569 { 570 "name": "sourceId", 571 "description": "A string identifying the resource which logged the message.", 572 "type": "string" 573 } 574 ] 575 }, 576 { 577 "name": "contentload", 578 "options": { "supportsDom": true }, 579 "description": "Fired when the guest window fires a <code>load</code> event, i.e., when a new document is loaded. This does <em>not</em> include page navigation within the current document or asynchronous resource loads. <p>The following example code modifies the default font size of the guest's <code>body</code> element after the page loads:</p><pre>webview.addEventListener('contentload', function() {\r webview.executeScript({ code: 'document.body.style.fontSize = \"42px\"' });\r});</pre>", 580 "parameters": [] 581 }, 582 { 583 "name": "dialog", 584 "options": { "supportsDom": true }, 585 "description": "Fired when the guest window attempts to open a modal dialog via <code>window.alert</code>, <code>window.confirm</code>, or <code>window.prompt</code>.<p>Handling this event will block the guest process until each event listener returns or the <code>dialog</code> object becomes unreachable (if <code>preventDefault()</code> was called.)</p><p>The default behavior is to cancel the dialog.</p>", 586 "parameters": [ 587 { 588 "name": "messageType", 589 "type": "string", 590 "enum": ["alert", "confirm", "prompt"], 591 "description": "The type of modal dialog requested by the guest." 592 }, 593 { 594 "name": "messageText", 595 "type": "string", 596 "description": "The text the guest attempted to display in the modal dialog." 597 }, 598 { 599 "name": "dialog", 600 "$ref": "DialogController", 601 "description": "An interface that can be used to respond to the guest's modal request." 602 } 603 ] 604 }, 605 { 606 "name": "exit", 607 "options": { "supportsDom": true }, 608 "description": "Fired when the process rendering the guest web content has exited.<p>The following example code will show a farewell message whenever the guest page crashes:</p><pre>webview.addEventListener('exit', function(e) {\r if (e.reason === 'crash') {\r webview.src = 'data:text/plain,Goodbye, world!';\r }\r});</pre>", 609 "parameters": [ 610 { 611 "name": "processID", 612 "description": "Chrome's interal ID of the process that exited.", 613 "type": "integer" 614 }, 615 { 616 "name": "reason", 617 "description": "String indicating the reason for the exit.", 618 "type": "string", 619 "enum": ["normal", "abnormal", "crash", "kill"] 620 } 621 ] 622 }, 623 { 624 "name": "findupdate", 625 "options": { "supportsDom": true }, 626 "description": "Fired when new find results are available for an active find request. This might happen multiple times for a single find request as matches are found.", 627 "parameters": [ 628 { 629 "name": "searchText", 630 "type": "string", 631 "description": "The string that is being searched for in the page." 632 }, 633 { 634 "name": "numberOfMatches", 635 "type": "integer", 636 "description": "The number of matches found for <code>searchText</code> on the page so far." 637 }, 638 { 639 "name": "activeMatchOrdinal", 640 "type": "integer", 641 "description": "The ordinal number of the current active match, if it has been found. This will be <code>0</code> until then." 642 }, 643 { 644 "name": "selectionRect", 645 "$ref": "SelectionRect", 646 "description": "Describes a rectangle around the active match, if it has been found, in screen coordinates." 647 }, 648 { 649 "name": "canceled", 650 "type": "boolean", 651 "description": "Indicates whether the find request was canceled." 652 }, 653 { 654 "name": "finalUpdate", 655 "type": "string", 656 "description": "Indicates that all find requests have completed and that no more <code>findupdate</code> events will be fired until more find requests are made." 657 } 658 ] 659 }, 660 { 661 "name": "loadabort", 662 "options": { "supportsDom": true }, 663 "description": "Fired when a top-level load has aborted without committing. <p class=\"note\"><strong>Note:</strong> When a resource load is aborted, a <code>loadabort</code> event will eventually be followed by a <code>loadstop</code> event, even if all committed loads since the last <code>loadstop</code> event (if any) were aborted.</p>", 664 "parameters": [ 665 { 666 "name": "url", 667 "description": "Requested URL.", 668 "type": "string" 669 }, 670 { 671 "name": "isTopLevel", 672 "description": "Whether the load was top-level or in a subframe.", 673 "type": "boolean" 674 }, 675 { 676 "name": "reason", 677 "description": "String indicating what type of abort occurred.", 678 "type": "string", 679 "enum": ["networkError", "download", "canceled", "sslError", "safeBrowsingError"] 680 } 681 ] 682 }, 683 { 684 "name": "loadcommit", 685 "options": { "supportsDom": true }, 686 "description": "Fired when a load has committed. This includes navigation within the current document as well as subframe document-level loads, but does <em>not</em> include asynchronous resource loads.", 687 "parameters": [ 688 { 689 "name": "url", 690 "description": "The URL that committed.", 691 "type": "string" 692 }, 693 { 694 "name": "isTopLevel", 695 "description": "Whether the load is top-level or in a subframe.", 696 "type": "boolean" 697 } 698 ] 699 }, 700 { 701 "name": "loadredirect", 702 "options": { "supportsDom": true }, 703 "description": "Fired when a top-level load request has redirected to a different URL.", 704 "parameters": [ 705 { 706 "name": "oldUrl", 707 "description": "The requested URL before the redirect.", 708 "type": "string" 709 }, 710 { 711 "name": "newUrl", 712 "description": "The new URL after the redirect.", 713 "type": "string" 714 }, 715 { 716 "name": "isTopLevel", 717 "description": "Whether or not the redirect happened at top-level or in a subframe.", 718 "type": "boolean" 719 } 720 ] 721 }, 722 { 723 "name": "loadstart", 724 "options": { "supportsDom": true }, 725 "description": "Fired when a load has begun.", 726 "parameters": [ 727 { 728 "name": "url", 729 "description": "Requested URL.", 730 "type": "string" 731 }, 732 { 733 "name": "isTopLevel", 734 "description": "Whether the load is top-level or in a subframe.", 735 "type": "boolean" 736 } 737 ] 738 }, 739 { 740 "name": "loadstop", 741 "options": { "supportsDom": true }, 742 "description": "Fired when all frame-level loads in a guest page (including all its subframes) have completed. This includes navigation within the current document as well as subframe document-level loads, but does <em>not</em> include asynchronous resource loads. This event fires every time the number of document-level loads transitions from one (or more) to zero. For example, if a page that has already finished loading (i.e., <code>loadstop</code> already fired once) creates a new iframe which loads a page, then a second <code>loadstop</code> will fire when the iframe page load completes. This pattern is commonly observed on pages that load ads. <p class=\"note\"><strong>Note:</strong> When a committed load is aborted, a <code>loadstop</code> event will eventually follow a <code>loadabort</code> event, even if all committed loads since the last <code>loadstop</code> event (if any) were aborted.</p>", 743 "parameters": [] 744 }, 745 { 746 "name": "newwindow", 747 "options": { "supportsDom": true }, 748 "description": "Fired when the guest page attempts to open a new browser window.<p>The following example code will create and navigate a new <code>webview</code> in the embedder for each requested new window:</p><pre>webview.addEventListener('newwindow', function(e) {\r var newWebview = document.createElement('webview');\r document.body.appendChild(newWebview);\r e.window.attach(newWebview);\r});</pre>", 749 "parameters": [ 750 { 751 "name": "window", 752 "description": "An interface that can be used to either attach the requested target page to an existing <code>webview</code> element or explicitly discard the request.", 753 "$ref": "NewWindow" 754 }, 755 { 756 "name": "targetUrl", 757 "description": "The target URL requested for the new window.", 758 "type": "string" 759 }, 760 { 761 "name": "initialWidth", 762 "description": "The initial width requested for the new window.", 763 "type": "number" 764 }, 765 { 766 "name": "initialHeight", 767 "description": "The initial height requested for the new window.", 768 "type": "number" 769 }, 770 { 771 "name": "name", 772 "description": "The requested name of the new window.", 773 "type": "string" 774 }, 775 { 776 "name": "windowOpenDisposition", 777 "description": "The requested disposition of the new window.", 778 "type": "string", 779 "enum": ["ignore", "save_to_disk", "current_tab", "new_background_tab", "new_foreground_tab", "new_window", "new_popup"] 780 } 781 ] 782 }, 783 { 784 "name": "permissionrequest", 785 "options": { "supportsDom": true }, 786 "description": "Fired when the guest page needs to request special permission from the embedder.<p>The following example code will grant the guest page access to the <code>webkitGetUserMedia</code> API. Note that an app using this example code must itself specify <code>audioCapture</code> and/or <code>videoCapture</code> manifest permissions:</p><pre>webview.addEventListener('permissionrequest', function(e) {\r if (e.permission === 'media') {\r e.request.allow();\r }\r});</pre>", 787 "parameters": [ 788 { 789 "name": "permission", 790 "description": "The type of permission being requested.", 791 "type": "string", 792 "enum": ["media", "geolocation", "pointerLock", "download", "loadplugin", "filesystem"] 793 }, 794 { 795 "name": "requestId", 796 "description": "A number which uniquely identifies this request from the guest.", 797 "type": "integer" 798 }, 799 { 800 "name": "request", 801 "type": "object", 802 "properties": {}, 803 "description": "An object which holds details of the requested permission. Depending on the type of permission requested, this may be a $(ref:webviewTag.MediaPermissionRequest), $(ref:webviewTag.GeolocationPermissionRequest), $(ref:webviewTag.PointerLockPermissionRequest), $(ref:webviewTag.DownloadPermissionRequest), or $(ref:webviewTag.LoadPluginPermissionRequest)." 804 } 805 ] 806 }, 807 { 808 "name": "responsive", 809 "options": { "supportsDom": true }, 810 "description": "Fired when the process rendering the guest web content has become responsive again after being unresponsive.<p>The following example code will fade the <code>webview</code> element in or out as it becomes responsive or unresponsive:</p><pre>webview.style.webkitTransition = 'opacity 250ms';\rwebview.addEventListener('unresponsive', function() {\r webview.style.opacity = '0.5';\r});\rwebview.addEventListener('responsive', function() {\r webview.style.opacity = '1';\r});</pre>", 811 "parameters": [ 812 { 813 "name": "processID", 814 "description": "Chrome's internal ID of the process that became responsive.", 815 "type": "integer" 816 } 817 ] 818 }, 819 { 820 "name": "sizechanged", 821 "options": { "supportsDom": true }, 822 "description": "Fired when the embedded web content has been resized. Only fires if <code>autosize</code> is enabled.", 823 "parameters": [ 824 { 825 "name": "oldWidth", 826 "description": "Old width of embedded web content.", 827 "type": "number" 828 }, 829 { 830 "name": "oldHeight", 831 "description": "Old height of embedded web content.", 832 "type": "number" 833 }, 834 { 835 "name": "newWidth", 836 "description": "New width of embedded web content.", 837 "type": "number" 838 }, 839 { 840 "name": "newHeight", 841 "description": "New height of embedded web content.", 842 "type": "number" 843 } 844 ] 845 }, 846 { 847 "name": "unresponsive", 848 "options": { "supportsDom": true }, 849 "description": "Fired when the process rendering the guest web content has become unresponsive. This event will be generated once with a matching responsive event if the guest begins to respond again.", 850 "parameters": [ 851 { 852 "name": "processID", 853 "description": "Chrome's internal ID of the process that has become unresponsive.", 854 "type": "integer" 855 } 856 ] 857 }, 858 { 859 "name": "zoomchange", 860 "options": { "supportsDom": true }, 861 "description": "Fired when the page's zoom changes.", 862 "parameters": [ 863 { 864 "name": "oldZoomFactor", 865 "type": "number", 866 "description": "The page's previous zoom factor." 867 }, 868 { 869 "name": "newZoomFactor", 870 "type": "number", 871 "description": "The new zoom factor that the page was zoomed to." 872 } 873 ] 874 } 875 ], 876 "properties": { 877 "contentWindow": { 878 "$ref": "ContentWindow", 879 "description": "Object reference which can be used to post messages into the guest page." 880 }, 881 "request": { 882 "$ref": "WebRequestEventInteface", 883 "description": "Interface which provides access to webRequest events on the guest page." 884 } 885 } 886 } 887] 888