1 /* 2 * Copyright 2009 The Closure Compiler Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /** 18 * @fileoverview Definitions for the Chromium extensions API. 19 * 20 * This is the externs file for the Chrome Extensions API. 21 * See http://developer.chrome.com/extensions/ 22 * 23 * There are several problematic issues regarding Chrome extension APIs and 24 * this externs files, including: 25 * A. When to add packages to this file 26 * B. Optional parameters 27 * C. Pseudo-types 28 * D. Events 29 * E. Nullability 30 * F. Private APIs 31 * 32 * The best practices for each are described in more detail below. It 33 * should be noted that, due to historical reasons, and the evolutionary 34 * nature of this file, much this file currently violates the best practices 35 * described below. As changed are made, the changes should adhere to the 36 * best practices. 37 * 38 * A. When to Add Packages to this File? 39 * Packages in chrome.experimental.* should *not* be added to this file. The 40 * experimental APIs change very quickly, so rather than add them here, make a 41 * separate externs file for your project, then move the API here when it moves 42 * out of experimental. 43 * 44 * Some non-experimental APIs are still evolving or are not full documented. It 45 * is still advantageous to include these in this file as doing so avoids a 46 * proliferation of project-private externs files containing duplicated info. In 47 * these cases, use comments to describe the situation. 48 * 49 * B. Optional Parameters 50 * The Chrome extension APIs make extensive use of optional parameters that 51 * are not at the end of the parameter list, "interior optional parameters", 52 * while the JS Compiler's type system requires optional parameters to be 53 * at the end. This creates a bit of tension: 54 * 55 * 1. If a method has N required params, then the parameter declarations 56 * should have N required params. 57 * 2. If, due to interior optional params, a parameter can be of more than 58 * one type, its at-param should: 59 * a. be named to indicate both possibilities, eg, extensionIdOrRequest, 60 * or getInfoOrCallback. 61 * b. the type should include both types, in the same order as the parts 62 * of the name, even when one type subsumes the other, eg, {string|*} 63 * or {Object|function(string)}. 64 * See chrome.runtime.sendMessage for a complex example as sendMessage 65 * takes three params with the first and third being optional. 66 * 67 * C. Pseudo-types 68 * The Chrome APIs define many types are that actually pseudo-types, that 69 * is, they can't be instantiated by name. The extension APIs also pass 70 * untyped objects (a bag of properties) to callbacks. 71 * 72 * The Chrome extension APIs include at least three different situations: 73 * 74 * 1. an object that must be created by an extension developer and passed 75 * into a Chrome extension API and for which there is no constructor. 76 * 2. an instance of a type that is created inside the extension libraries 77 * and passed out to a callback/listener or returned by an extension API 78 * (the constructor implicity lives within the library). 79 * 3. like #2, but a bag-of-properties object that is passed out to a 80 * callback/listener or returned by an extension API so there is no 81 * defined type. 82 * 83 * For #1, use a typedef so object literals and objects created via goog.object 84 * are acceptable, for example, the Permissions type defined at 85 * http://developer.chrome.com/extensions/permissions.html#type-Permissions 86 * should be: 87 * 88 * / ** 89 * * at-typedef {?{ 90 * * permissions: (!Array.<string>|undefined), 91 * * origins: (!Array.<string>|undefined) 92 * * }} 93 * * / 94 * chrome.permissions.Permissions; 95 * 96 * Using typedefs provides type-safety for the fields that are defined in 97 * the object literal and also defined in the typedef. Note that typedefs define 98 * a minimal interface and will not complain about extraneous (often 99 * misspelled) fields. 100 * 101 * Also, typedefs of record types are non-nullable by default. The "{?{" 102 * creates a nullable record-type typedef so ! has the same meaning in usages 103 * as it does for real types. 104 * 105 * For #2, use a standard constructor, even though no constructor is provided 106 * and extension writers will never instantiate an instance, as using a first 107 * class type provides the strongest type checking. For example, see the Port 108 * type defined at http://developer.chrome.com/apps/runtime.html#type-Port. 109 * Always qualify the type name to reduce top-level pollution in this file: 110 * 111 * Do: 112 * chrome.extension.Port = function() {} 113 * Don't: 114 * function Port() {} 115 * 116 * Note that, unfortunately, the actual Port class definition in this file 117 * does not follow this recommendation. 118 * 119 * For #3, use {!Object}, that is, a bag of properites. This is a sad reality 120 * given that the Chrome extensions do not document a real type. It is tempting 121 * to define a real-type within this file and treat this situation as identical 122 * to #2, but that means a new type is being defined in this file and developers 123 * do not expect to find required new types in extension files. 124 * 125 * If a real type is declared here, then developers will need to incorporate 126 * that type into the signature of their callback method and there will be 127 * no indication from the docs that they need to do so. 128 * 129 * D. Events 130 * Most packages define a set of events with the standard set of methods: 131 * addListener, removeListener, hasListener and hasListeners. ChromeEvent 132 * is the appropriate type when an event's listeners do not take any 133 * parameters, however, many events take parameters specific to that event: 134 * 135 * 1. Create a pseudo-type for the event, for example, 136 * chrome.runtime.PortEvent and define the four methods on it. 137 * 2. Fully describe the listener/callback's signature, for example, 138 * 139 * * at-param {function(!chrome.runtime.Port): void} callback Callback. 140 * chrome.runtime.PortEvent.prototype.addListener = 141 * function(callback) {}; 142 * or 143 * 144 * * at-param {function(*, !chrome.runtime.MessageSender, 145 * * function(*): void): (boolean|undefined)} callback Callback. 146 * chrome.runtime.MessageSenderEvent.prototype.addListener = 147 * function(callback) {}; 148 * 149 * E. Nullability 150 * We treat the Chrome Extension API pages as "the truth". Not-null types 151 * should be used in the following situations: 152 * 153 * 1. Parameters and return values that are not explicitly declared to handle 154 * null. 155 * 2. Static event instances, for example, chrome.runtime.onConnect's type 156 * should be: !chrome.runtime.PortEvent. 157 * 3. Optional params as there is little value to passing null when the 158 * parameter can be omitted, of course, if null is explicitly declared 159 * to be meaningful, then a nullable type should be used. 160 * 161 * F. Private APIs 162 * Private Chrome APIs (such as those that end in "Private") should go at the 163 * bottom of this file. 164 * 165 * @externs 166 * 167 */ 168 169 170 /** 171 * TODO(tbreisacher): Move all chrome.app.* externs into their own file. 172 * @const 173 */ 174 chrome.app = {}; 175 176 177 /** 178 * @const 179 * @see http://developer.chrome.com/apps/app.runtime.html 180 */ 181 chrome.app.runtime = {}; 182 183 184 /** 185 * @constructor 186 * @see http://developer.chrome.com/apps/app_runtime.html 187 */ 188 chrome.app.runtime.LaunchItem = function() {}; 189 190 191 /** @type {!FileEntry} */ 192 chrome.app.runtime.LaunchItem.prototype.entry; 193 194 195 /** @type {string} */ 196 chrome.app.runtime.LaunchItem.prototype.type; 197 198 199 /** 200 * @constructor 201 * @see http://developer.chrome.com/apps/app_runtime.html 202 */ 203 chrome.app.runtime.LaunchData = function() {}; 204 205 206 /** @type {string|undefined} */ 207 chrome.app.runtime.LaunchData.prototype.id; 208 209 210 /** @type {!Array.<!chrome.app.runtime.LaunchItem>|undefined} */ 211 chrome.app.runtime.LaunchData.prototype.items; 212 213 214 /** @type {string|undefined} */ 215 chrome.app.runtime.LaunchData.prototype.url; 216 217 218 /** @type {string|undefined} */ 219 chrome.app.runtime.LaunchData.prototype.referrerUrl; 220 221 222 /** @type {boolean|undefined} */ 223 chrome.app.runtime.LaunchData.prototype.isKioskSession; 224 225 226 /** 227 * The type of chrome.app.runtime.onLaunched. 228 * @constructor 229 */ 230 chrome.app.runtime.LaunchEvent = function() {}; 231 232 233 /** 234 * @param {function(!chrome.app.runtime.LaunchData)} callback 235 * @see http://developer.chrome.com/apps/app.runtime.html#event-onLaunched 236 */ 237 chrome.app.runtime.LaunchEvent.prototype.addListener = function(callback) {}; 238 239 240 /** 241 * @param {function(!chrome.app.runtime.LaunchData)} callback 242 */ 243 chrome.app.runtime.LaunchEvent.prototype.removeListener = function(callback) {}; 244 245 246 /** 247 * @param {function(!chrome.app.runtime.LaunchData)} callback 248 * @return {boolean} 249 */ 250 chrome.app.runtime.LaunchEvent.prototype.hasListener = function(callback) {}; 251 252 253 /** 254 * @return {boolean} 255 */ 256 chrome.app.runtime.LaunchEvent.prototype.hasListeners = function() {}; 257 258 259 /** @type {!chrome.app.runtime.LaunchEvent} */ 260 chrome.app.runtime.onLaunched; 261 262 263 /** 264 * @type {!ChromeEvent} 265 * @see http://developer.chrome.com/apps/app.runtime.html#event-onRestarted 266 */ 267 chrome.app.runtime.onRestarted; 268 269 270 /** 271 * @const 272 * @see http://developer.chrome.com/apps/app.window.html 273 */ 274 chrome.app.window = {}; 275 276 277 /** 278 * @see https://developer.chrome.com/apps/app_window#method-getAll 279 * @return {!Array.<!chrome.app.window.AppWindow>} 280 */ 281 chrome.app.window.getAll = function() {}; 282 283 284 /** 285 * @see https://developer.chrome.com/apps/app_window#method-get 286 * @param {string} id 287 * @return {chrome.app.window.AppWindow} 288 */ 289 chrome.app.window.get = function(id) {}; 290 291 292 /** 293 * @constructor 294 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 295 */ 296 chrome.app.window.AppWindow = function() {}; 297 298 299 /** 300 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 301 */ 302 chrome.app.window.AppWindow.prototype.focus = function() {}; 303 304 305 /** 306 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 307 */ 308 chrome.app.window.AppWindow.prototype.fullscreen = function() {}; 309 310 311 /** 312 * @return {boolean} 313 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 314 */ 315 chrome.app.window.AppWindow.prototype.isFullscreen = function() {}; 316 317 318 /** 319 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 320 */ 321 chrome.app.window.AppWindow.prototype.minimize = function() {}; 322 323 324 /** 325 * @return {boolean} 326 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 327 */ 328 chrome.app.window.AppWindow.prototype.isMinimized = function() {}; 329 330 331 /** 332 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 333 */ 334 chrome.app.window.AppWindow.prototype.maximize = function() {}; 335 336 337 /** 338 * @return {boolean} 339 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 340 */ 341 chrome.app.window.AppWindow.prototype.isMaximized = function() {}; 342 343 344 /** 345 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 346 */ 347 chrome.app.window.AppWindow.prototype.restore = function() {}; 348 349 350 /** 351 * @param {number} left The new left position, in pixels. 352 * @param {number} top The new top position, in pixels. 353 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 354 */ 355 chrome.app.window.AppWindow.prototype.moveTo = function(left, top) {}; 356 357 358 /** 359 * @param {number} width The new width, in pixels. 360 * @param {number} height The new height, in pixels. 361 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 362 */ 363 chrome.app.window.AppWindow.prototype.resizeTo = function(width, height) {}; 364 365 366 /** 367 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 368 */ 369 chrome.app.window.AppWindow.prototype.drawAttention = function() {}; 370 371 372 /** 373 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 374 */ 375 chrome.app.window.AppWindow.prototype.clearAttention = function() {}; 376 377 378 /** 379 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 380 */ 381 chrome.app.window.AppWindow.prototype.close = function() {}; 382 383 384 /** 385 * @param {boolean=} opt_focus Should the window be focused? Defaults to true. 386 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 387 */ 388 chrome.app.window.AppWindow.prototype.show = function(opt_focus) {}; 389 390 391 /** 392 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 393 */ 394 chrome.app.window.AppWindow.prototype.hide = function() {}; 395 396 397 /** 398 * @return {!chrome.app.window.Bounds} The current window bounds. 399 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 400 */ 401 chrome.app.window.AppWindow.prototype.getBounds = function() {}; 402 403 404 /** 405 * @param {!chrome.app.window.Bounds} bounds The new window bounds. 406 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 407 */ 408 chrome.app.window.AppWindow.prototype.setBounds = function(bounds) {}; 409 410 411 /** 412 * @return {boolean} 413 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 414 */ 415 chrome.app.window.AppWindow.prototype.isAlwaysOnTop = function() {}; 416 417 418 /** 419 * @param {boolean} alwaysOnTop Set whether the window should stay above most 420 * other windows. 421 * @see http://developer.chrome.com/apps/app.window.html#type-AppWindow 422 */ 423 chrome.app.window.AppWindow.prototype.setAlwaysOnTop = function(alwaysOnTop) {}; 424 425 426 /** @type {!ChromeEvent} */ 427 chrome.app.window.AppWindow.prototype.onBoundsChanged; 428 429 430 /** @type {!ChromeEvent} */ 431 chrome.app.window.AppWindow.prototype.onClosed; 432 433 434 /** @type {!ChromeEvent} */ 435 chrome.app.window.AppWindow.prototype.onFullscreened; 436 437 438 /** @type {!ChromeEvent} */ 439 chrome.app.window.AppWindow.prototype.onMinimized; 440 441 442 /** @type {!ChromeEvent} */ 443 chrome.app.window.AppWindow.prototype.onMaximized; 444 445 446 /** @type {!ChromeEvent} */ 447 chrome.app.window.AppWindow.prototype.onRestored; 448 449 450 /** @type {!Window} */ 451 chrome.app.window.AppWindow.prototype.contentWindow; 452 453 454 /** 455 * @typedef {{ 456 * left: (number|undefined), 457 * top: (number|undefined), 458 * width: (number|undefined), 459 * height: (number|undefined) 460 * }} 461 * @see http://developer.chrome.com/apps/app.window.html#type-Bounds 462 */ 463 chrome.app.window.Bounds; 464 465 466 /** 467 * @typedef {{ 468 * id: (string|undefined), 469 * minWidth: (number|undefined), 470 * minHeight: (number|undefined), 471 * maxWidth: (number|undefined), 472 * maxHeight: (number|undefined), 473 * frame: (string|undefined), 474 * bounds: (!chrome.app.window.Bounds|undefined), 475 * transparentBackground: (boolean|undefined), 476 * state: (string|undefined), 477 * hidden: (boolean|undefined), 478 * resizable: (boolean|undefined), 479 * alwaysOnTop: (boolean|undefined), 480 * focused: (boolean|undefined) 481 * }} 482 * @see http://developer.chrome.com/apps/app.window.html#method-create 483 */ 484 chrome.app.window.CreateWindowOptions; 485 486 487 /** 488 * @param {string} url URL to create. 489 * @param {!chrome.app.window.CreateWindowOptions=} opt_options The options for 490 * the new window. 491 * @param {function(!chrome.app.window.AppWindow)=} opt_createWindowCallback 492 * Callback to be run. 493 * @see http://developer.chrome.com/apps/app.window.html#method-create 494 */ 495 chrome.app.window.create = function( 496 url, opt_options, opt_createWindowCallback) {}; 497 498 499 /** 500 * Returns an AppWindow object for the current script context (ie JavaScript 501 * 'window' object). 502 * @return {!chrome.app.window.AppWindow} 503 * @see http://developer.chrome.com/apps/app.window.html#method-current 504 */ 505 chrome.app.window.current = function() {}; 506 507 508 /** 509 * @type {!ChromeEvent} 510 * @see http://developer.chrome.com/apps/app.window.html#event-onBoundsChanged 511 */ 512 chrome.app.window.onBoundsChanged; 513 514 515 /** 516 * @type {!ChromeEvent} 517 * @see http://developer.chrome.com/apps/app.window.html#event-onClosed 518 */ 519 chrome.app.window.onClosed; 520 521 522 /** 523 * @type {!ChromeEvent} 524 * @see http://developer.chrome.com/apps/app.window.html#event-onFullscreened 525 */ 526 chrome.app.window.onFullscreened; 527 528 529 /** 530 * @type {!ChromeEvent} 531 * @see http://developer.chrome.com/apps/app.window.html#event-onMaximized 532 */ 533 chrome.app.window.onMaximized; 534 535 536 /** 537 * @type {!ChromeEvent} 538 * @see http://developer.chrome.com/apps/app.window.html#event-onMinimized 539 */ 540 chrome.app.window.onMinimized; 541 542 543 /** 544 * @type {!ChromeEvent} 545 * @see http://developer.chrome.com/apps/app.window.html#event-onRestored 546 */ 547 chrome.app.window.onRestored; 548 549 550 /** 551 * @const 552 * @see https://developer.chrome.com/apps/bluetooth 553 */ 554 chrome.bluetooth = function() {}; 555 556 557 /** 558 * @constructor 559 * @see https://developer.chrome.com/apps/bluetooth#type-AdapterState 560 */ 561 chrome.bluetooth.AdapterState = function() {}; 562 563 564 /** @type {string} */ 565 chrome.bluetooth.AdapterState.prototype.address; 566 567 568 /** @type {string} */ 569 chrome.bluetooth.AdapterState.prototype.name; 570 571 572 /** @type {boolean} */ 573 chrome.bluetooth.AdapterState.prototype.powered; 574 575 576 /** @type {boolean} */ 577 chrome.bluetooth.AdapterState.prototype.available; 578 579 580 /** @type {boolean} */ 581 chrome.bluetooth.AdapterState.prototype.discovering; 582 583 584 /** 585 * @constructor 586 * @see https://developer.chrome.com/apps/bluetooth#type-Device 587 */ 588 chrome.bluetooth.Device = function() {}; 589 590 591 /** @type {string} */ 592 chrome.bluetooth.Device.prototype.address; 593 594 595 /** @type {string|undefined} */ 596 chrome.bluetooth.Device.prototype.name; 597 598 599 /** @type {number|undefined} */ 600 chrome.bluetooth.Device.prototype.deviceClass; 601 602 603 /** @type {string|undefined} */ 604 chrome.bluetooth.Device.prototype.vendorIdSource; 605 606 607 /** @type {string|undefined} */ 608 chrome.bluetooth.Device.prototype.vendorId; 609 610 611 /** @type {number|undefined} */ 612 chrome.bluetooth.Device.prototype.productId; 613 614 615 /** @type {number|undefined} */ 616 chrome.bluetooth.Device.prototype.deviceId; 617 618 619 /** @type {string|undefined} */ 620 chrome.bluetooth.Device.prototype.type; 621 622 623 /** @type {boolean|undefined} */ 624 chrome.bluetooth.Device.prototype.paired; 625 626 627 /** @type {boolean|undefined} */ 628 chrome.bluetooth.Device.prototype.connected; 629 630 631 /** @type {!Array.<string>|undefined} */ 632 chrome.bluetooth.Device.prototype.uuids; 633 634 635 /** 636 * @param {function(!chrome.bluetooth.AdapterState)} callback 637 * @see https://developer.chrome.com/apps/bluetooth#method-getAdapterState 638 */ 639 chrome.bluetooth.getAdapterState = function(callback) {}; 640 641 642 /** 643 * @param {string} deviceAddress 644 * @param {function(!chrome.bluetooth.Device)} callback 645 * @see https://developer.chrome.com/apps/bluetooth#method-getDevice 646 */ 647 chrome.bluetooth.getDevice = function(deviceAddress, callback) {}; 648 649 650 /** 651 * @param {function(!Array.<!chrome.bluetooth.Device>)} callback 652 * @see https://developer.chrome.com/apps/bluetooth#method-getDevices 653 */ 654 chrome.bluetooth.getDevices = function(callback) {}; 655 656 657 /** 658 * @param {function()=} opt_callback 659 * @see https://developer.chrome.com/apps/bluetooth#method-startDiscovery 660 */ 661 chrome.bluetooth.startDiscovery = function(opt_callback) {}; 662 663 664 /** 665 * @param {function()=} opt_callback 666 * @see https://developer.chrome.com/apps/bluetooth#method-stopDiscovery 667 */ 668 chrome.bluetooth.stopDiscovery = function(opt_callback) {}; 669 670 671 /** 672 * Event whose listeners take an AdapaterState parameter. 673 * @constructor 674 */ 675 chrome.bluetooth.AdapterStateEvent = function() {}; 676 677 678 /** @param {function(!chrome.bluetooth.AdapterState): void} callback */ 679 chrome.bluetooth.AdapterStateEvent.prototype.addListener = 680 function(callback) {}; 681 682 683 /** @param {function(!chrome.bluetooth.AdapterState): void} callback */ 684 chrome.bluetooth.AdapterStateEvent.prototype.removeListener = 685 function(callback) {}; 686 687 688 /** 689 * @param {function(!chrome.bluetooth.AdapterState): void} callback 690 * @return {boolean} 691 */ 692 chrome.bluetooth.AdapterStateEvent.prototype.hasListener = 693 function(callback) {}; 694 695 696 /** @return {boolean} */ 697 chrome.bluetooth.AdapterStateEvent.prototype.hasListeners = function() {}; 698 699 700 /** 701 * @type {!chrome.bluetooth.AdapterStateEvent} 702 * @see https://developer.chrome.com/apps/bluetooth#event-onAdapterStateChanged 703 */ 704 chrome.bluetooth.onAdapterStateChanged; 705 706 707 /** 708 * Event whose listeners take an Device parameter. 709 * @constructor 710 */ 711 chrome.bluetooth.DeviceEvent = function() {}; 712 713 714 /** @param {function(!chrome.bluetooth.Device): void} callback */ 715 chrome.bluetooth.DeviceEvent.prototype.addListener = function(callback) {}; 716 717 718 /** @param {function(!chrome.bluetooth.Device): void} callback */ 719 chrome.bluetooth.DeviceEvent.prototype.removeListener = function(callback) {}; 720 721 722 /** 723 * @param {function(!chrome.bluetooth.Device): void} callback 724 * @return {boolean} 725 */ 726 chrome.bluetooth.DeviceEvent.prototype.hasListener = function(callback) {}; 727 728 729 /** @return {boolean} */ 730 chrome.bluetooth.DeviceEvent.prototype.hasListeners = function() {}; 731 732 733 /** 734 * @type {!chrome.bluetooth.DeviceEvent} 735 * @see https://developer.chrome.com/apps/bluetooth#event-onDeviceAdded 736 */ 737 chrome.bluetooth.onDeviceAdded; 738 739 740 /** 741 * @type {!chrome.bluetooth.DeviceEvent} 742 * @see https://developer.chrome.com/apps/bluetooth#event-onDeviceChanged 743 */ 744 chrome.bluetooth.onDeviceChanged; 745 746 747 /** 748 * @type {!chrome.bluetooth.DeviceEvent} 749 * @see https://developer.chrome.com/apps/bluetooth#event-onDeviceRemoved 750 */ 751 chrome.bluetooth.onDeviceRemoved; 752 753 754 /** 755 * @const 756 * @see https://developer.chrome.com/apps/bluetoothSocket 757 */ 758 chrome.bluetoothSocket = {}; 759 760 761 /** 762 * @typedef {{ 763 * persistent: (boolean|undefined), 764 * name: (string|undefined), 765 * bufferSize: (number|undefined) 766 * }} 767 * @see https://developer.chrome.com/apps/bluetoothSocket#type-SocketProperties 768 */ 769 chrome.bluetoothSocket.SocketProperties; 770 771 772 /** 773 * @typedef {{ 774 * channel: (number|undefined), 775 * psm: (number|undefined), 776 * backlog: (number|undefined) 777 * }} 778 * @see https://developer.chrome.com/apps/bluetoothSocket#type-ListenOptions 779 */ 780 chrome.bluetoothSocket.ListenOptions; 781 782 783 /** 784 * @constructor 785 * @see https://developer.chrome.com/apps/bluetoothSocket#type-SocketInfo 786 */ 787 chrome.bluetoothSocket.SocketInfo = function() {}; 788 789 790 /** @type {number} */ 791 chrome.bluetoothSocket.SocketInfo.prototype.socketId; 792 793 794 /** @type {boolean} */ 795 chrome.bluetoothSocket.SocketInfo.prototype.persistent; 796 797 798 /** @type {string|undefined} */ 799 chrome.bluetoothSocket.SocketInfo.prototype.name; 800 801 802 /** @type {number|undefined} */ 803 chrome.bluetoothSocket.SocketInfo.prototype.bufferSize; 804 805 806 /** @type {boolean} */ 807 chrome.bluetoothSocket.SocketInfo.prototype.paused; 808 809 810 /** @type {boolean} */ 811 chrome.bluetoothSocket.SocketInfo.prototype.connected; 812 813 814 /** @type {string|undefined} */ 815 chrome.bluetoothSocket.SocketInfo.prototype.address; 816 817 818 /** @type {string|undefined} */ 819 chrome.bluetoothSocket.SocketInfo.prototype.uuid; 820 821 822 /** 823 * @param {!chrome.bluetoothSocket.SocketProperties| 824 * function(!{socketId: number})} propertiesOrCallback 825 * @param {function(!{socketId: number})=} opt_callback 826 * @see https://developer.chrome.com/apps/bluetoothSocket#method-create 827 */ 828 chrome.bluetoothSocket.create = function(propertiesOrCallback, opt_callback) {}; 829 830 831 /** 832 * @param {number} socketId 833 * @param {!chrome.bluetoothSocket.SocketProperties} properties 834 * @param {function()=} opt_callback 835 * @see https://developer.chrome.com/apps/bluetoothSocket#method-update 836 */ 837 chrome.bluetoothSocket.update = function(socketId, properties, opt_callback) {}; 838 839 840 /** 841 * @param {number} socketId 842 * @param {boolean} paused 843 * @param {function()=} opt_callback 844 * @see https://developer.chrome.com/apps/bluetoothSocket#method-setPaused 845 */ 846 chrome.bluetoothSocket.setPaused = function(socketId, paused, opt_callback) {}; 847 848 849 /** 850 * @param {number} socketId 851 * @param {string} uuid 852 * @param {!chrome.bluetoothSocket.ListenOptions|function()} optionsOrCallback 853 * @param {function()=} opt_callback 854 * @see https://developer.chrome.com/apps/bluetoothSocket#method-listenUsingRfcomm 855 */ 856 chrome.bluetoothSocket.listenUsingRfcomm = 857 function(socketId, uuid, optionsOrCallback, opt_callback) {}; 858 859 860 /** 861 * @param {number} socketId 862 * @param {string} uuid 863 * @param {!chrome.bluetoothSocket.ListenOptions|function()} optionsOrCallback 864 * @param {function()=} opt_callback 865 * @see https://developer.chrome.com/apps/bluetoothSocket#method-listenUsingL2cap 866 */ 867 chrome.bluetoothSocket.listenUsingL2cap = 868 function(socketId, uuid, optionsOrCallback, opt_callback) {}; 869 870 871 /** 872 * @param {number} socketId 873 * @param {string} address 874 * @param {string} uuid 875 * @param {function()} callback 876 * @see https://developer.chrome.com/apps/bluetoothSocket#method-connect 877 */ 878 chrome.bluetoothSocket.connect = function(socketId, address, uuid, callback) {}; 879 880 881 /** 882 * @param {number} socketId 883 * @param {function()=} opt_callback 884 * @see https://developer.chrome.com/apps/bluetoothSocket#method-disconnect 885 */ 886 chrome.bluetoothSocket.disconnect = function(socketId, opt_callback) {}; 887 888 889 /** 890 * @param {number} socketId 891 * @param {function()=} opt_callback 892 * @see https://developer.chrome.com/apps/bluetoothSocket#method-close 893 */ 894 chrome.bluetoothSocket.close = function(socketId, opt_callback) {}; 895 896 897 /** 898 * @param {number} socketId 899 * @param {!ArrayBuffer} data 900 * @param {function(number)=} opt_callback 901 * @see https://developer.chrome.com/apps/bluetoothSocket#method-send 902 */ 903 chrome.bluetoothSocket.send = function(socketId, data, opt_callback) {}; 904 905 906 /** 907 * @param {number} socketId 908 * @param {function(!chrome.bluetoothSocket.SocketInfo)} callback 909 * @see https://developer.chrome.com/apps/bluetoothSocket#method-getInfo 910 */ 911 chrome.bluetoothSocket.getInfo = function(socketId, callback) {}; 912 913 914 /** 915 * @param {function(!Array.<!chrome.bluetoothSocket.SocketInfo>)} callback 916 * @see https://developer.chrome.com/apps/bluetoothSocket#method-getSockets 917 */ 918 chrome.bluetoothSocket.getSockets = function(callback) {}; 919 920 921 /** 922 * @constructor 923 * @see https://developer.chrome.com/apps/bluetoothSocket#event-onAccept 924 */ 925 chrome.bluetoothSocket.AcceptEventData = function() {}; 926 927 928 /** @type {number} */ 929 chrome.bluetoothSocket.AcceptEventData.prototype.socketId; 930 931 932 /** @type {number} */ 933 chrome.bluetoothSocket.AcceptEventData.prototype.clientSocketId; 934 935 936 /** 937 * Event whose listeners take a AcceptEventData parameter. 938 * @constructor 939 */ 940 chrome.bluetoothSocket.AcceptEvent = function() {}; 941 942 943 /** 944 * @param {function(!chrome.bluetoothSocket.AcceptEventData): void} callback 945 */ 946 chrome.bluetoothSocket.AcceptEvent.prototype.addListener = 947 function(callback) {}; 948 949 950 /** 951 * @param {function(!chrome.bluetoothSocket.AcceptEventData): void} callback 952 */ 953 chrome.bluetoothSocket.AcceptEvent.prototype.removeListener = 954 function(callback) {}; 955 956 957 /** 958 * @param {function(!chrome.bluetoothSocket.AcceptEventData): void} callback 959 * @return {boolean} 960 */ 961 chrome.bluetoothSocket.AcceptEvent.prototype.hasListener = 962 function(callback) {}; 963 964 965 /** @return {boolean} */ 966 chrome.bluetoothSocket.AcceptEvent.prototype.hasListeners = function() {}; 967 968 969 /** @type {!chrome.bluetoothSocket.AcceptEvent} */ 970 chrome.bluetoothSocket.onAccept; 971 972 973 /** 974 * @constructor 975 * @see https://developer.chrome.com/apps/bluetoothSocket#event-onAcceptError 976 */ 977 chrome.bluetoothSocket.AcceptErrorEventData = function() {}; 978 979 980 /** @type {number} */ 981 chrome.bluetoothSocket.AcceptErrorEventData.prototype.socketId; 982 983 984 /** @type {string} */ 985 chrome.bluetoothSocket.AcceptErrorEventData.prototype.errorMessage; 986 987 988 /** @type {string} */ 989 chrome.bluetoothSocket.AcceptErrorEventData.prototype.error; 990 991 992 /** 993 * Event whose listeners take a AcceptErrorEventData parameter. 994 * @constructor 995 */ 996 chrome.bluetoothSocket.AcceptErrorEvent = function() {}; 997 998 999 /** 1000 * @param {function( 1001 * !chrome.bluetoothSocket.AcceptErrorEventData): void} callback 1002 */ 1003 chrome.bluetoothSocket.AcceptErrorEvent.prototype.addListener = 1004 function(callback) {}; 1005 1006 1007 /** 1008 * @param {function( 1009 * !chrome.bluetoothSocket.AcceptErrorEventData): void} callback 1010 */ 1011 chrome.bluetoothSocket.AcceptErrorEvent.prototype.removeListener = 1012 function(callback) {}; 1013 1014 1015 /** 1016 * @param {function( 1017 * !chrome.bluetoothSocket.AcceptErrorEventData): void} callback 1018 * @return {boolean} 1019 */ 1020 chrome.bluetoothSocket.AcceptErrorEvent.prototype.hasListener = 1021 function(callback) {}; 1022 1023 1024 /** @return {boolean} */ 1025 chrome.bluetoothSocket.AcceptErrorEvent.prototype.hasListeners = 1026 function() {}; 1027 1028 1029 /** @type {!chrome.bluetoothSocket.AcceptErrorEvent} */ 1030 chrome.bluetoothSocket.onAcceptError; 1031 1032 1033 /** 1034 * @constructor 1035 * @see https://developer.chrome.com/apps/bluetoothSocket#event-onReceive 1036 */ 1037 chrome.bluetoothSocket.ReceiveEventData = function() {}; 1038 1039 1040 /** @type {number} */ 1041 chrome.bluetoothSocket.ReceiveEventData.prototype.socketId; 1042 1043 1044 /** @type {!ArrayBuffer} */ 1045 chrome.bluetoothSocket.ReceiveEventData.prototype.data; 1046 1047 1048 /** 1049 * Event whose listeners take a ReceiveEventData parameter. 1050 * @constructor 1051 */ 1052 chrome.bluetoothSocket.ReceiveEvent = function() {}; 1053 1054 1055 /** 1056 * @param {function(!chrome.bluetoothSocket.ReceiveEventData): void} callback 1057 */ 1058 chrome.bluetoothSocket.ReceiveEvent.prototype.addListener = 1059 function(callback) {}; 1060 1061 1062 /** 1063 * @param {function(!chrome.bluetoothSocket.ReceiveEventData): void} callback 1064 */ 1065 chrome.bluetoothSocket.ReceiveEvent.prototype.removeListener = 1066 function(callback) {}; 1067 1068 1069 /** 1070 * @param {function(!chrome.bluetoothSocket.ReceiveEventData): void} callback 1071 * @return {boolean} 1072 */ 1073 chrome.bluetoothSocket.ReceiveEvent.prototype.hasListener = 1074 function(callback) {}; 1075 1076 1077 /** @return {boolean} */ 1078 chrome.bluetoothSocket.ReceiveEvent.prototype.hasListeners = function() {}; 1079 1080 1081 /** @type {!chrome.bluetoothSocket.ReceiveEvent} */ 1082 chrome.bluetoothSocket.onReceive; 1083 1084 1085 /** 1086 * @constructor 1087 * @see https://developer.chrome.com/apps/bluetoothSocket#event-onReceiveError 1088 */ 1089 chrome.bluetoothSocket.ReceiveErrorEventData = function() {}; 1090 1091 1092 /** @type {number} */ 1093 chrome.bluetoothSocket.ReceiveErrorEventData.prototype.socketId; 1094 1095 1096 /** @type {string} */ 1097 chrome.bluetoothSocket.ReceiveErrorEventData.prototype.errorMessage; 1098 1099 1100 /** @type {string} */ 1101 chrome.bluetoothSocket.ReceiveErrorEventData.prototype.error; 1102 1103 1104 /** 1105 * Event whose listeners take a ReceiveErrorEventData parameter. 1106 * @constructor 1107 */ 1108 chrome.bluetoothSocket.ReceiveErrorEvent = function() {}; 1109 1110 1111 /** 1112 * @param {function( 1113 * !chrome.bluetoothSocket.ReceiveErrorEventData): void} callback 1114 */ 1115 chrome.bluetoothSocket.ReceiveErrorEvent.prototype.addListener = 1116 function(callback) {}; 1117 1118 1119 /** 1120 * @param {function( 1121 * !chrome.bluetoothSocket.ReceiveErrorEventData): void} callback 1122 */ 1123 chrome.bluetoothSocket.ReceiveErrorEvent.prototype.removeListener = 1124 function(callback) {}; 1125 1126 1127 /** 1128 * @param {function( 1129 * !chrome.bluetoothSocket.ReceiveErrorEventData): void} callback 1130 * @return {boolean} 1131 */ 1132 chrome.bluetoothSocket.ReceiveErrorEvent.prototype.hasListener = 1133 function(callback) {}; 1134 1135 1136 /** @return {boolean} */ 1137 chrome.bluetoothSocket.ReceiveErrorEvent.prototype.hasListeners = 1138 function() {}; 1139 1140 1141 /** @type {!chrome.bluetoothSocket.ReceiveErrorEvent} */ 1142 chrome.bluetoothSocket.onReceiveError; 1143 1144 1145 /** 1146 * @see http://developer.chrome.com/extensions/commands.html 1147 * @const 1148 */ 1149 chrome.commands = {}; 1150 1151 1152 /** 1153 * @param {function(Array.<string>): void} callback Callback function. 1154 */ 1155 chrome.commands.getAll = function(callback) {}; 1156 1157 1158 /** @type {!ChromeEvent} */ 1159 chrome.commands.onCommand; 1160 1161 1162 /** 1163 * @see https://developer.chrome.com/extensions/extension.html 1164 * @const 1165 */ 1166 chrome.extension = {}; 1167 1168 1169 /** @type {!Object|undefined} */ 1170 chrome.extension.lastError = {}; 1171 1172 1173 /** 1174 * @type {string|undefined} 1175 */ 1176 chrome.extension.lastError.message; 1177 1178 1179 /** @type {boolean|undefined} */ 1180 chrome.extension.inIncognitoContext; 1181 1182 1183 // TODO: change Object to !Object when it's clear nobody is passing in null 1184 // TODO: change Port to !Port since it should never be null 1185 /** 1186 * @param {string|Object.<string>=} opt_extensionIdOrConnectInfo Either the 1187 * extensionId to connect to, in which case connectInfo params can be 1188 * passed in the next optional argument, or the connectInfo params. 1189 * @param {Object.<string>=} opt_connectInfo The connectInfo object, 1190 * if arg1 was the extensionId to connect to. 1191 * @return {Port} New port. 1192 */ 1193 chrome.extension.connect = function( 1194 opt_extensionIdOrConnectInfo, opt_connectInfo) {}; 1195 1196 1197 /** 1198 * @return {Window} The global JS object for the background page. 1199 */ 1200 chrome.extension.getBackgroundPage = function() {}; 1201 1202 1203 /** 1204 * @param {string} path A path to a resource within an extension expressed 1205 * relative to it's install directory. 1206 * @return {string} The fully-qualified URL to the resource. 1207 */ 1208 chrome.extension.getURL = function(path) {}; 1209 1210 1211 /** 1212 * @param {Object=} opt_fetchProperties An object with optional 'type' and 1213 * optional 'windowId' keys. 1214 * @return {Array.<Window>} The global JS objects for each content view. 1215 */ 1216 chrome.extension.getViews = function(opt_fetchProperties) {}; 1217 1218 1219 /** 1220 * @param {function(boolean): void} callback Callback function. 1221 */ 1222 chrome.extension.isAllowedFileSchemeAccess = function(callback) {}; 1223 1224 1225 /** 1226 * @param {function(boolean): void} callback Callback function. 1227 */ 1228 chrome.extension.isAllowedIncognitoAccess = function(callback) {}; 1229 1230 1231 /** 1232 * @param {string|*} extensionIdOrRequest Either the extensionId to send the 1233 * request to, in which case the request is passed as the next arg, or the 1234 * request. 1235 * @param {*=} opt_request The request value, if arg1 was the extensionId. 1236 * @param {function(*): void=} opt_callback The callback function which 1237 * takes a JSON response object sent by the handler of the request. 1238 */ 1239 chrome.extension.sendMessage = function( 1240 extensionIdOrRequest, opt_request, opt_callback) {}; 1241 1242 1243 /** 1244 * @param {number|*=} opt_arg1 Either the extensionId to send the request to, 1245 * in which case the request is passed as the next arg, or the request. 1246 * @param {*=} opt_request The request value, if arg1 was the extensionId. 1247 * @param {function(*): void=} opt_callback The callback function which 1248 * takes a JSON response object sent by the handler of the request. 1249 */ 1250 chrome.extension.sendRequest = function(opt_arg1, opt_request, opt_callback) {}; 1251 1252 1253 /** 1254 * @param {string} data 1255 */ 1256 chrome.extension.setUpdateUrlData = function(data) {}; 1257 1258 1259 /** @type {!ChromeEvent} */ 1260 chrome.extension.onConnect; 1261 1262 1263 /** @type {!ChromeEvent} */ 1264 chrome.extension.onConnectExternal; 1265 1266 1267 /** @type {!ChromeEvent} */ 1268 chrome.extension.onMessage; 1269 1270 1271 /** @type {!ChromeEvent} */ 1272 chrome.extension.onRequest; 1273 1274 1275 /** @type {!ChromeEvent} */ 1276 chrome.extension.onRequestExternal; 1277 1278 1279 /** 1280 * @see https://developer.chrome.com/extensions/runtime.html 1281 * @const 1282 */ 1283 chrome.runtime = {}; 1284 1285 1286 /** @type {!Object|undefined} */ 1287 chrome.runtime.lastError = {}; 1288 1289 1290 /** 1291 * @type {string|undefined} 1292 */ 1293 chrome.runtime.lastError.message; 1294 1295 1296 /** @type {string} */ 1297 chrome.runtime.id; 1298 1299 1300 /** 1301 * @param {function(!Window=): void} callback Callback function. 1302 */ 1303 chrome.runtime.getBackgroundPage = function(callback) {}; 1304 1305 1306 1307 /** 1308 * Manifest information returned from chrome.runtime.getManifest. See 1309 * http://developer.chrome.com/extensions/manifest.html. Note that there are 1310 * several other fields not included here. They should be added to these externs 1311 * as needed. 1312 * @constructor 1313 */ 1314 chrome.runtime.Manifest = function() {}; 1315 1316 1317 /** @type {string} */ 1318 chrome.runtime.Manifest.prototype.name; 1319 1320 1321 /** @type {string} */ 1322 chrome.runtime.Manifest.prototype.version; 1323 1324 1325 /** @type {number|undefined} */ 1326 chrome.runtime.Manifest.prototype.manifest_version; 1327 1328 1329 /** @type {string|undefined} */ 1330 chrome.runtime.Manifest.prototype.description; 1331 1332 1333 /** @type {!chrome.runtime.Manifest.Oauth2|undefined} */ 1334 chrome.runtime.Manifest.prototype.oauth2; 1335 1336 1337 /** @type {!Array.<(string|!Object)>} */ 1338 chrome.runtime.Manifest.prototype.permissions; 1339 1340 1341 1342 /** 1343 * Oauth2 info in the manifest. 1344 * See http://developer.chrome.com/apps/app_identity.html#update_manifest. 1345 * @constructor 1346 */ 1347 chrome.runtime.Manifest.Oauth2 = function() {}; 1348 1349 1350 /** @type {string} */ 1351 chrome.runtime.Manifest.Oauth2.prototype.client_id; 1352 1353 /**@type {!Array.<string>} */ 1354 chrome.runtime.Manifest.Oauth2.prototype.scopes; 1355 1356 1357 /** 1358 * http://developer.chrome.com/extensions/runtime.html#method-getManifest 1359 * @return {!chrome.runtime.Manifest} The full manifest file of the app or 1360 * extension. 1361 */ 1362 chrome.runtime.getManifest = function() {}; 1363 1364 1365 /** 1366 * @param {string} path A path to a resource within an extension expressed 1367 * relative to it's install directory. 1368 * @return {string} The fully-qualified URL to the resource. 1369 */ 1370 chrome.runtime.getURL = function(path) {}; 1371 1372 /** 1373 * @param {string} url This may be used to clean up server-side data, do 1374 * analytics, and implement surveys. Maximum 255 characters. 1375 */ 1376 chrome.runtime.setUninstallUrl = function(url) {}; 1377 1378 /** 1379 * Reloads the app or extension. 1380 */ 1381 chrome.runtime.reload = function() {}; 1382 1383 1384 /** 1385 * @param {function(string, !Object=): void} callback Called with "throttled", 1386 * "no_update", or "update_available". If an update is available, the object 1387 * contains more information about the available update. 1388 */ 1389 chrome.runtime.requestUpdateCheck = function(callback) {}; 1390 1391 /** 1392 * Restart the ChromeOS device when the app runs in kiosk mode. Otherwise, it's 1393 * no-op. 1394 */ 1395 chrome.runtime.restart = function() {}; 1396 1397 1398 /** 1399 * @param {string|!Object.<string>=} opt_extensionIdOrConnectInfo Either the 1400 * extensionId to connect to, in which case connectInfo params can be 1401 * passed in the next optional argument, or the connectInfo params. 1402 * @param {!Object.<string>=} opt_connectInfo The connectInfo object, 1403 * if arg1 was the extensionId to connect to. 1404 * @return {!Port} New port. 1405 */ 1406 chrome.runtime.connect = function( 1407 opt_extensionIdOrConnectInfo, opt_connectInfo) {}; 1408 1409 1410 /** 1411 * @see http://developer.chrome.com/extensions/runtime.html#method-connectNative 1412 * @param {string} application Name of the registered native messaging host to 1413 * connect to, like 'com.google.your_product'. 1414 * @return {!Port} New port. 1415 */ 1416 chrome.runtime.connectNative = function(application) {}; 1417 1418 1419 /** 1420 * @param {string|*} extensionIdOrMessage Either the extensionId to send the 1421 * message to, in which case the message is passed as the next arg, or the 1422 * message itself. 1423 * @param {(*|Object|function(*): void)=} opt_messageOrOptsOrCallback 1424 * One of: 1425 * The message, if arg1 was the extensionId. 1426 * The options for message sending, if arg1 was the message and this 1427 * argument is not a function. 1428 * The callback, if arg1 was the message and this argument is a function. 1429 * @param {(Object|function(*): void)=} opt_optsOrCallback 1430 * Either the options for message sending, if arg2 was the message, 1431 * or the callback. 1432 * @param {function(*): void=} opt_callback The callback function which 1433 * takes a JSON response object sent by the handler of the request. 1434 */ 1435 chrome.runtime.sendMessage = function( 1436 extensionIdOrMessage, opt_messageOrOptsOrCallback, opt_optsOrCallback, 1437 opt_callback) {}; 1438 1439 1440 /** 1441 * @see http://developer.chrome.com/extensions/runtime.html#method-sendNativeMessage 1442 * @param {string} application Name of the registered native messaging host to 1443 * connect to, like 'com.google.your_product'. 1444 * @param {Object} message The message that will be passed to the native 1445 * messaging host. 1446 * @param {function(*)=} opt_callback Called with the response message sent by 1447 * the native messaging host. If an error occurs while connecting to the 1448 * native messaging host, the callback will be called with no arguments and 1449 * chrome.runtime.lastError will be set to the error message. 1450 */ 1451 chrome.runtime.sendNativeMessage = function( 1452 application, message, opt_callback) {}; 1453 1454 /** 1455 * 1456 * @param {function(!Object)} callback 1457 */ 1458 chrome.runtime.getPlatformInfo = function(callback) {}; 1459 1460 1461 /** 1462 * @param {function(!DirectoryEntry)} callback 1463 */ 1464 chrome.runtime.getPackageDirectoryEntry = function(callback) {}; 1465 1466 1467 /** @type {!chrome.runtime.PortEvent} */ 1468 chrome.runtime.onConnect; 1469 1470 1471 /** @type {!chrome.runtime.PortEvent} */ 1472 chrome.runtime.onConnectExternal; 1473 1474 1475 /** @type {!ChromeObjectEvent} */ 1476 chrome.runtime.onInstalled; 1477 1478 1479 /** @type {!chrome.runtime.MessageSenderEvent} */ 1480 chrome.runtime.onMessage; 1481 1482 1483 /** @type {!chrome.runtime.MessageSenderEvent} */ 1484 chrome.runtime.onMessageExternal; 1485 1486 1487 /** @type {!ChromeEvent} */ 1488 chrome.runtime.onStartup; 1489 1490 1491 /** @type {!ChromeEvent} */ 1492 chrome.runtime.onSuspend; 1493 1494 1495 /** @type {!ChromeEvent} */ 1496 chrome.runtime.onSuspendCanceled; 1497 1498 1499 /** @type {!ChromeObjectEvent} */ 1500 chrome.runtime.onUpdateAvailable; 1501 1502 1503 /** @type {!ChromeStringEvent} */ 1504 chrome.runtime.onRestartRequired; 1505 1506 1507 /** 1508 * Event whose listeners take a Port parameter. 1509 * @constructor 1510 */ 1511 chrome.runtime.PortEvent = function() {}; 1512 1513 1514 /** 1515 * @param {function(!Port): void} callback Callback. 1516 */ 1517 chrome.runtime.PortEvent.prototype.addListener = function(callback) {}; 1518 1519 1520 /** 1521 * @param {function(!Port): void} callback Callback. 1522 */ 1523 chrome.runtime.PortEvent.prototype.removeListener = function(callback) {}; 1524 1525 1526 /** 1527 * @param {function(!Port): void} callback Callback. 1528 * @return {boolean} 1529 */ 1530 chrome.runtime.PortEvent.prototype.hasListener = function(callback) {}; 1531 1532 1533 /** 1534 * @return {boolean} 1535 */ 1536 chrome.runtime.PortEvent.prototype.hasListeners = function() {}; 1537 1538 1539 1540 /** 1541 * Event whose listeners take a MessageSender and additional parameters. 1542 * @see http://developer.chrome.com/dev/apps/runtime.html#event-onMessage 1543 * @constructor 1544 */ 1545 chrome.runtime.MessageSenderEvent = function() {}; 1546 1547 1548 /** 1549 * @param {function(*, !MessageSender, function(*): void): (boolean|undefined)} 1550 * callback Callback. 1551 */ 1552 chrome.runtime.MessageSenderEvent.prototype.addListener = function(callback) {}; 1553 1554 1555 /** 1556 * @param {function(*, !MessageSender, function(*): void): (boolean|undefined)} 1557 * callback Callback. 1558 */ 1559 chrome.runtime.MessageSenderEvent.prototype.removeListener = function(callback) 1560 {}; 1561 1562 1563 /** 1564 * @param {function(*, !MessageSender, function(*): void): (boolean|undefined)} 1565 * callback Callback. 1566 * @return {boolean} 1567 */ 1568 chrome.runtime.MessageSenderEvent.prototype.hasListener = function(callback) {}; 1569 1570 1571 /** 1572 * @return {boolean} 1573 */ 1574 chrome.runtime.MessageSenderEvent.prototype.hasListeners = function() {}; 1575 1576 1577 /** 1578 * @const 1579 * @see https://developer.chrome.com/extensions/tabs.html 1580 */ 1581 chrome.tabs = {}; 1582 1583 1584 /** 1585 * @typedef {?{ 1586 * code: (string|undefined), 1587 * file: (string|undefined), 1588 * allFrames: (boolean|undefined), 1589 * matchAboutBlank: (boolean|undefined), 1590 * runAt: (string|undefined) 1591 * }} 1592 */ 1593 chrome.tabs.InjectDetails; 1594 1595 1596 /** 1597 * @see https://developer.chrome.com/extensions/tabs#method-captureVisibleTab 1598 * @param {number|!chrome.types.ImageDetails|function(string):void} 1599 * windowIdOrOptionsOrCallback One of: 1600 * The target window. 1601 * An object defining details about the format and quality of an image, in 1602 * which case the window defaults to the current window. 1603 * A callback function which accepts the data URL string of a JPEG encoding 1604 * of the visible area of the captured tab. 1605 * @param {(!chrome.types.ImageDetails|function(string):void)=} 1606 * opt_optionsOrCallback Either an object defining details about the 1607 * format and quality of an image, or a callback function which accepts the 1608 * data URL string of a JPEG encoding of the visible area of the captured 1609 * tab. 1610 * @param {function(string):void=} opt_callback A callback function which 1611 * accepts the data URL string of a JPEG encoding of the visible area of the 1612 * captured tab. 1613 */ 1614 chrome.tabs.captureVisibleTab = function(windowIdOrOptionsOrCallback, 1615 opt_optionsOrCallback, opt_callback) {}; 1616 1617 1618 /** 1619 * @param {number} tabId Tab Id. 1620 * @param {{name: (string|undefined)}=} connectInfo Info Object. 1621 */ 1622 chrome.tabs.connect = function(tabId, connectInfo) {}; 1623 1624 1625 /** 1626 * @typedef {?{ 1627 * windowId: (number|undefined), 1628 * index: (number|undefined), 1629 * url: (string|undefined), 1630 * active: (boolean|undefined), 1631 * pinned: (boolean|undefined), 1632 * openerTabId: (number|undefined) 1633 * }} 1634 */ 1635 chrome.tabs.CreateProperties; 1636 1637 1638 /** 1639 * @param {!chrome.tabs.CreateProperties} createProperties Info object. 1640 * @param {function(!Tab): void=} opt_callback The callback function. 1641 */ 1642 chrome.tabs.create = function(createProperties, opt_callback) {}; 1643 1644 1645 /** 1646 * @see https://developer.chrome.com/extensions/tabs#method-detectLanguage 1647 * @param {number|function(string): void} tabIdOrCallback The tab id, or a 1648 * callback function that will be invoked with the language of the active 1649 * tab in the current window. 1650 * @param {function(string): void=} opt_callback An optional callback function 1651 * that will be invoked with the language of the tab specified as first 1652 * argument. 1653 */ 1654 chrome.tabs.detectLanguage = function(tabIdOrCallback, opt_callback) {}; 1655 1656 1657 /** 1658 * @see https://developer.chrome.com/extensions/tabs#method-executeScript 1659 * @param {number|!chrome.tabs.InjectDetails} tabIdOrDetails 1660 * Either the id of the tab in which to run the script, or an object 1661 * containing the details of the script to run, in which case the script 1662 * will be executed in the active tab of the current window. 1663 * @param {(!chrome.tabs.InjectDetails|function(!Array.<*>):void)=} 1664 * opt_detailsOrCallback Either an object containing the details of the 1665 * script to run, if the tab id was speficied as first argument, or a 1666 * callback that will be invoked with the result of the execution of the 1667 * script in every injected frame. 1668 * @param {function(!Array.<*>):void=} opt_callback A callback that will be 1669 * invoked with the result of the execution of the script in every 1670 * injected frame. 1671 */ 1672 chrome.tabs.executeScript = function(tabIdOrDetails, opt_detailsOrCallback, 1673 opt_callback) {}; 1674 1675 1676 /** 1677 * @param {number} tabId Tab id. 1678 * @param {function(!Tab): void} callback Callback. 1679 */ 1680 chrome.tabs.get = function(tabId, callback) {}; 1681 1682 1683 /** 1684 * Note (2014-05-21): Because this function is deprecated, the types of it's 1685 * parameters were not upgraded to make the first parameter optional and to mark 1686 * the Array and Tab in the callback as non-null. 1687 * 1688 * @param {number?} windowId Window id. 1689 * @param {function(Array.<Tab>): void} callback Callback. 1690 * @deprecated Please use tabs.query {windowId: windowId}. 1691 */ 1692 chrome.tabs.getAllInWindow = function(windowId, callback) {}; 1693 1694 1695 /** 1696 * @param {function(!Tab=): void} callback Callback. 1697 */ 1698 chrome.tabs.getCurrent = function(callback) {}; 1699 1700 1701 /** 1702 * Note (2014-05-21): Because this function is deprecated, the types of it's 1703 * parameters were not upgraded to make the first parameter optional and to mark 1704 * the Array and Tab in the callback as non-null. 1705 * 1706 * @param {number?} windowId Window id. 1707 * @param {function(Tab): void} callback Callback. 1708 * @deprecated Please use tabs.query({active: true}). 1709 */ 1710 chrome.tabs.getSelected = function(windowId, callback) {}; 1711 1712 1713 /** 1714 * @typedef {?{ 1715 * windowId: (number|undefined), 1716 * tabs: (number|!Array.<number>) 1717 * }} 1718 */ 1719 chrome.tabs.HighlightInfo; 1720 1721 1722 /** 1723 * @param {!chrome.tabs.HighlightInfo} highlightInfo 1724 * @param {function(!Window): void} callback Callback function invoked 1725 * with each appropriate Window. 1726 */ 1727 chrome.tabs.highlight = function(highlightInfo, callback) {}; 1728 1729 1730 /** 1731 * @link https://developer.chrome.com/extensions/tabs#method-insertCSS 1732 * @param {number|!chrome.tabs.InjectDetails} tabIdOrDetails 1733 * Either the id of the tab in which to run the script, or an object 1734 * containing the details of the CSS to insert, in which case the script 1735 * will be executed in the active tab of the current window. 1736 * @param {(!chrome.tabs.InjectDetails|function():void)=} 1737 * opt_detailsOrCallback Either an object containing the details of the 1738 * CSS to insert, if the tab id was speficied as first argument, or a 1739 * callback that will be invoked after the CSS has been injected. 1740 * @param {function():void=} opt_callback A callback that will be invoked after 1741 * the CSS has been injected. 1742 */ 1743 chrome.tabs.insertCSS = function(tabIdOrDetails, opt_detailsOrCallback, 1744 opt_callback) {}; 1745 1746 1747 /** 1748 * @typedef {?{ 1749 * windowId: (number|undefined), 1750 * index: number 1751 * }} 1752 */ 1753 chrome.tabs.MoveProperties; 1754 1755 1756 /** 1757 * @param {number|!Array.<number>} tabId Tab id or array of tab ids. 1758 * @param {!chrome.tabs.MoveProperties} moveProperties 1759 * @param {function((!Tab|!Array.<!Tab>)): void=} opt_callback Callback. 1760 */ 1761 chrome.tabs.move = function(tabId, moveProperties, opt_callback) {}; 1762 1763 1764 /** 1765 * @typedef {?{ 1766 * active: (boolean|undefined), 1767 * pinned: (boolean|undefined), 1768 * highlighted: (boolean|undefined), 1769 * currentWindow: (boolean|undefined), 1770 * lastFocusedWindow: (boolean|undefined), 1771 * status: (string|undefined), 1772 * title: (string|undefined), 1773 * url: (string|undefined), 1774 * windowId: (number|undefined), 1775 * windowType: (string|undefined), 1776 * index: (number|undefined) 1777 * }} 1778 */ 1779 chrome.tabs.QueryInfo; 1780 1781 1782 /** 1783 * @param {!chrome.tabs.QueryInfo} queryInfo 1784 * @param {function(!Array.<!Tab>): void} callback Callback. 1785 */ 1786 chrome.tabs.query = function(queryInfo, callback) {}; 1787 1788 1789 /** 1790 * @see https://developer.chrome.com/extensions/tabs#method-query 1791 * @param {number} tabId The ID of the tab which is to be duplicated. 1792 * @param {(function(!Tab=):void)=} opt_callback A callback to be invoked with 1793 * details about the duplicated tab. 1794 */ 1795 chrome.tabs.duplicate = function(tabId, opt_callback) {}; 1796 1797 1798 /** 1799 * @typedef {?{ 1800 * bypassCache: (boolean|undefined) 1801 * }} 1802 */ 1803 chrome.tabs.ReloadProperties; 1804 1805 1806 /** 1807 * @see https://developer.chrome.com/extensions/tabs#method-reload 1808 * @param {(number|!chrome.tabs.ReloadProperties|function():void)=} 1809 * opt_tabIdOrReloadPropertiesOrCallback One of: 1810 * The ID of the tab to reload; defaults to the selected tab of the current 1811 * window. 1812 * An object specifying boolean flags to customize the reload operation. 1813 * A callback to be invoked when the reload is complete. 1814 * @param {(!chrome.tabs.ReloadProperties|function():void)=} 1815 * opt_reloadPropertiesOrCallback Either an object specifying boolean flags 1816 * to customize the reload operation, or a callback to be invoked when the 1817 * reload is complete, if no object needs to be specified. 1818 * @param {function():void=} opt_callback A callback to be invoked when the 1819 * reload is complete. 1820 */ 1821 chrome.tabs.reload = function(opt_tabIdOrReloadPropertiesOrCallback, 1822 opt_reloadPropertiesOrCallback, opt_callback) {}; 1823 1824 1825 /** 1826 * @param {number|!Array.<number>} tabIds A tab ID or an array of tab IDs. 1827 * @param {function(): void=} opt_callback Callback. 1828 */ 1829 chrome.tabs.remove = function(tabIds, opt_callback) {}; 1830 1831 1832 /** 1833 * @param {number} tabId Tab id. 1834 * @param {*} request The request value of any type. 1835 * @param {function(*): void=} opt_callback The callback function which 1836 * takes a JSON response object sent by the handler of the request. 1837 */ 1838 chrome.tabs.sendMessage = function(tabId, request, opt_callback) {}; 1839 1840 1841 /** 1842 * @param {number} tabId Tab id. 1843 * @param {*} request The request value of any type. 1844 * @param {function(*): void=} opt_callback The callback function which 1845 * takes a JSON response object sent by the handler of the request. 1846 * @deprecated Please use runtime.sendMessage. 1847 */ 1848 chrome.tabs.sendRequest = function(tabId, request, opt_callback) {}; 1849 1850 1851 /** 1852 * @typedef {?{ 1853 * url: (string|undefined), 1854 * active: (boolean|undefined), 1855 * highlighted: (boolean|undefined), 1856 * pinned: (boolean|undefined), 1857 * openerTabId: (number|undefined) 1858 * }} 1859 */ 1860 chrome.tabs.UpdateProperties; 1861 1862 1863 /** 1864 * @see https://developer.chrome.com/extensions/tabs#method-update 1865 * @param {number|!chrome.tabs.UpdateProperties} tabIdOrUpdateProperties 1866 * Either the id of the tab to update, or an object with new property 1867 * values, in which case the selected tab of the current window will be 1868 * updated. 1869 * @param {(!chrome.tabs.UpdateProperties|function(Tab):void)=} 1870 * opt_updatePropertiesOrCallback Either an object with new property values, 1871 * if the tabId was specified as first parameter, or an optional callback 1872 * that will be invoked with information about the tab being updated. 1873 * @param {function(!Tab=): void=} opt_callback An optional callback that will 1874 * be invoked with information about the tab being updated. 1875 */ 1876 chrome.tabs.update = function(tabIdOrUpdateProperties, 1877 opt_updatePropertiesOrCallback, opt_callback) {}; 1878 1879 1880 /** 1881 * @type {!ChromeEvent} 1882 * @deprecated Please use tabs.onActivated. 1883 */ 1884 chrome.tabs.onActiveChanged; 1885 1886 1887 /** @type {!ChromeEvent} */ 1888 chrome.tabs.onActivated; 1889 1890 1891 /** @type {!ChromeEvent} */ 1892 chrome.tabs.onAttached; 1893 1894 1895 /** @type {!ChromeEvent} */ 1896 chrome.tabs.onCreated; 1897 1898 1899 /** @type {!ChromeEvent} */ 1900 chrome.tabs.onDetached; 1901 1902 1903 /** 1904 * @type {!ChromeEvent} 1905 * @deprecated Please use tabs.onHighlighted. 1906 */ 1907 chrome.tabs.onHighlightChanged; 1908 1909 1910 /** 1911 * @type {!ChromeEvent} 1912 */ 1913 chrome.tabs.onHighlighted; 1914 1915 1916 /** @type {!ChromeEvent} */ 1917 chrome.tabs.onMoved; 1918 1919 1920 /** @type {!ChromeEvent} */ 1921 chrome.tabs.onRemoved; 1922 1923 1924 /** @type {!ChromeEvent} */ 1925 chrome.tabs.onUpdated; 1926 1927 1928 /** @type {!ChromeEvent} */ 1929 chrome.tabs.onReplaced; 1930 1931 // DEPRECATED: 1932 // TODO(user): Remove once all usage has been confirmed to have ended. 1933 1934 1935 /** 1936 * @type {!ChromeEvent} 1937 * @deprecated Please use tabs.onActivated. 1938 */ 1939 chrome.tabs.onSelectionChanged; 1940 1941 1942 /** 1943 * @const 1944 * @see https://developer.chrome.com/extensions/windows.html 1945 */ 1946 chrome.windows = {}; 1947 1948 1949 /** 1950 * @param {Object=} opt_createData May have many keys to specify parameters. 1951 * Or the callback. 1952 * @param {function(ChromeWindow): void=} opt_callback Callback. 1953 */ 1954 chrome.windows.create = function(opt_createData, opt_callback) {}; 1955 1956 1957 /** 1958 * @param {number} id Window id. 1959 * @param {Object=} opt_getInfo May have 'populate' key. Or the callback. 1960 * @param {function(!ChromeWindow): void=} opt_callback Callback when 1961 * opt_getInfo is an object. 1962 */ 1963 chrome.windows.get = function(id, opt_getInfo, opt_callback) {}; 1964 1965 1966 /** 1967 * @param {Object=} opt_getInfo May have 'populate' key. Or the callback. 1968 * @param {function(!Array.<!ChromeWindow>): void=} opt_callback Callback. 1969 */ 1970 chrome.windows.getAll = function(opt_getInfo, opt_callback) {}; 1971 1972 1973 /** 1974 * @param {Object=} opt_getInfo May have 'populate' key. Or the callback. 1975 * @param {function(ChromeWindow): void=} opt_callback Callback. 1976 */ 1977 chrome.windows.getCurrent = function(opt_getInfo, opt_callback) { }; 1978 1979 1980 /** 1981 * @param {Object=} opt_getInfo May have 'populate' key. Or the callback. 1982 * @param {function(ChromeWindow): void=} opt_callback Callback. 1983 */ 1984 chrome.windows.getLastFocused = function(opt_getInfo, opt_callback) { }; 1985 1986 1987 /** 1988 * @param {number} tabId Tab Id. 1989 * @param {function(): void=} opt_callback Callback. 1990 */ 1991 chrome.windows.remove = function(tabId, opt_callback) {}; 1992 1993 1994 /** 1995 * @param {number} tabId Tab Id. 1996 * @param {Object} updateProperties An object which may have many keys for 1997 * various options. 1998 * @param {function(): void=} opt_callback Callback. 1999 */ 2000 chrome.windows.update = function(tabId, updateProperties, opt_callback) {}; 2001 2002 2003 /** @type {!ChromeEvent} */ 2004 chrome.windows.onCreated; 2005 2006 2007 /** @type {!ChromeEvent} */ 2008 chrome.windows.onFocusChanged; 2009 2010 2011 /** @type {!ChromeEvent} */ 2012 chrome.windows.onRemoved; 2013 2014 2015 /** 2016 * @see https://developer.chrome.com/extensions/windows.html#property-WINDOW_ID_NONE 2017 * @type {number} 2018 */ 2019 chrome.windows.WINDOW_ID_NONE; 2020 2021 2022 /** 2023 * @see https://developer.chrome.com/extensions/windows.html#property-WINDOW_ID_CURRENT 2024 * @type {number} 2025 */ 2026 chrome.windows.WINDOW_ID_CURRENT; 2027 2028 2029 /** 2030 * @const 2031 * @see https://developer.chrome.com/extensions/i18n.html 2032 */ 2033 chrome.i18n = {}; 2034 2035 2036 /** 2037 * @param {function(Array.<string>): void} callback The callback function which 2038 * accepts an array of the accept languages of the browser, such as 2039 * 'en-US','en','zh-CN'. 2040 */ 2041 chrome.i18n.getAcceptLanguages = function(callback) {}; 2042 2043 2044 /** 2045 * @param {string} messageName 2046 * @param {(string|Array.<string>)=} opt_args 2047 * @return {string} 2048 */ 2049 chrome.i18n.getMessage = function(messageName, opt_args) {}; 2050 2051 /** 2052 * @return {string} 2053 */ 2054 chrome.i18n.getUILanguage = function() {}; 2055 2056 2057 /** 2058 * @const 2059 * @see https://developer.chrome.com/extensions/pageAction.html 2060 */ 2061 chrome.pageAction = {}; 2062 2063 2064 /** 2065 * @param {number} tabId Tab Id. 2066 */ 2067 chrome.pageAction.hide = function(tabId) {}; 2068 2069 2070 /** 2071 * @param {Object} details An object which has 'tabId' and either 2072 * 'imageData' or 'path'. 2073 */ 2074 chrome.pageAction.setIcon = function(details) {}; 2075 2076 2077 /** 2078 * @param {Object} details An object which may have 'popup' or 'tabId' as keys. 2079 */ 2080 chrome.pageAction.setPopup = function(details) {}; 2081 2082 2083 /** 2084 * @param {Object} details An object which has 'tabId' and 'title'. 2085 */ 2086 chrome.pageAction.setTitle = function(details) {}; 2087 2088 2089 /** 2090 * @param {number} tabId Tab Id. 2091 */ 2092 chrome.pageAction.show = function(tabId) {}; 2093 2094 2095 /** @type {!ChromeEvent} */ 2096 chrome.pageAction.onClicked; 2097 2098 /** 2099 * @const 2100 */ 2101 chrome.browser = {}; 2102 2103 2104 /** 2105 * @param {{url: string}} details An object with a single 'url' key. 2106 * @param {function(): void} callback The callback function. If an error occurs 2107 * opening the URL, chrome.runtime.lastError will be set to the error message. 2108 */ 2109 chrome.browser.openTab = function(details, callback) {}; 2110 2111 2112 /** 2113 * @const 2114 * @see https://developer.chrome.com/extensions/browserAction.html 2115 */ 2116 chrome.browserAction = {}; 2117 2118 2119 /** 2120 * @param {Object} details An object whose keys are 'color' and 2121 * optionally 'tabId'. 2122 */ 2123 chrome.browserAction.setBadgeBackgroundColor = function(details) {}; 2124 2125 2126 /** 2127 * @param {Object} details An object whose keys are 'text' and 2128 * optionally 'tabId'. 2129 */ 2130 chrome.browserAction.setBadgeText = function(details) {}; 2131 2132 2133 /** 2134 * @param {Object} details An object which may have 'imageData', 2135 * 'path', or 'tabId' as keys. 2136 */ 2137 chrome.browserAction.setIcon = function(details) {}; 2138 2139 2140 /** 2141 * @param {Object} details An object which may have 'popup' or 'tabId' as keys. 2142 */ 2143 chrome.browserAction.setPopup = function(details) {}; 2144 2145 2146 /** 2147 * @param {Object} details An object which has 'title' and optionally 2148 * 'tabId'. 2149 */ 2150 chrome.browserAction.setTitle = function(details) {}; 2151 2152 2153 /** @type {!ChromeEvent} */ 2154 chrome.browserAction.onClicked; 2155 2156 2157 /** 2158 * @param {number} tabId the ID of the tab on which to disable this action. 2159 */ 2160 chrome.browserAction.disable = function(tabId) {}; 2161 2162 2163 /** 2164 * @param {number} tabId the ID of the tab on which to enable this action. 2165 */ 2166 chrome.browserAction.enable = function(tabId) {}; 2167 2168 2169 /** 2170 * @const 2171 * @see https://developer.chrome.com/extensions/bookmarks.html 2172 */ 2173 chrome.bookmarks = {}; 2174 2175 2176 /** 2177 * @typedef {?{ 2178 * pareintId: (string|undefined), 2179 * index: (number|undefined), 2180 * url: (string|undefined), 2181 * title: (string|undefined) 2182 * }} 2183 * @see https://developer.chrome.com/extensions/bookmarks#method-create 2184 */ 2185 chrome.bookmarks.CreateDetails; 2186 2187 2188 /** 2189 * @param {(string|Array.<string>)} idOrIdList 2190 * @param {function(Array.<BookmarkTreeNode>): void} callback The 2191 * callback function which accepts an array of BookmarkTreeNode. 2192 * @return {Array.<BookmarkTreeNode>} 2193 */ 2194 chrome.bookmarks.get = function(idOrIdList, callback) {}; 2195 2196 2197 /** 2198 * @param {string} id 2199 * @param {function(Array.<BookmarkTreeNode>): void} callback The 2200 * callback function which accepts an array of BookmarkTreeNode. 2201 * @return {Array.<BookmarkTreeNode>} 2202 */ 2203 chrome.bookmarks.getChildren = function(id, callback) {}; 2204 2205 2206 /** 2207 * @param {number} numberOfItems The number of items to return. 2208 * @param {function(Array.<BookmarkTreeNode>): void} callback The 2209 * callback function which accepts an array of BookmarkTreeNode. 2210 * @return {Array.<BookmarkTreeNode>} 2211 */ 2212 chrome.bookmarks.getRecent = function(numberOfItems, callback) {}; 2213 2214 2215 /** 2216 * @param {function(Array.<BookmarkTreeNode>): void} callback The 2217 * callback function which accepts an array of BookmarkTreeNode. 2218 * @return {Array.<BookmarkTreeNode>} 2219 */ 2220 chrome.bookmarks.getTree = function(callback) {}; 2221 2222 2223 /** 2224 * @param {string} id The ID of the root of the subtree to retrieve. 2225 * @param {function(Array.<BookmarkTreeNode>): void} callback The 2226 * callback function which accepts an array of BookmarkTreeNode. 2227 * @return {Array.<BookmarkTreeNode>} 2228 */ 2229 chrome.bookmarks.getSubTree = function(id, callback) {}; 2230 2231 2232 /** 2233 * @param {string} query 2234 * @param {function(Array.<BookmarkTreeNode>): void} callback 2235 * @return {Array.<BookmarkTreeNode>} 2236 */ 2237 chrome.bookmarks.search = function(query, callback) {}; 2238 2239 2240 /** 2241 * @param {chrome.bookmarks.CreateDetails} bookmark 2242 * @param {function(BookmarkTreeNode): void=} opt_callback The 2243 * callback function which accepts a BookmarkTreeNode object. 2244 */ 2245 chrome.bookmarks.create = function(bookmark, opt_callback) {}; 2246 2247 2248 /** 2249 * @param {string} id 2250 * @param {Object} destination An object which has optional 'parentId' and 2251 * optional 'index'. 2252 * @param {function(BookmarkTreeNode): void=} opt_callback 2253 * The callback function which accepts a BookmarkTreeNode object. 2254 */ 2255 chrome.bookmarks.move = function(id, destination, opt_callback) {}; 2256 2257 2258 /** 2259 * @param {string} id 2260 * @param {Object} changes An object which may have 'title' as a key. 2261 * @param {function(BookmarkTreeNode): void=} opt_callback The 2262 * callback function which accepts a BookmarkTreeNode object. 2263 */ 2264 chrome.bookmarks.update = function(id, changes, opt_callback) {}; 2265 2266 2267 /** 2268 * @param {string} id 2269 * @param {function(): void=} opt_callback 2270 */ 2271 chrome.bookmarks.remove = function(id, opt_callback) {}; 2272 2273 2274 /** 2275 * @param {string} id 2276 * @param {function(): void=} opt_callback 2277 */ 2278 chrome.bookmarks.removeTree = function(id, opt_callback) {}; 2279 2280 2281 /** 2282 * @param {function(): void=} opt_callback 2283 */ 2284 chrome.bookmarks.import = function(opt_callback) {}; 2285 2286 2287 /** 2288 * @param {function(): void=} opt_callback 2289 */ 2290 chrome.bookmarks.export = function(opt_callback) {}; 2291 2292 2293 /** @type {!ChromeEvent} */ 2294 chrome.bookmarks.onChanged; 2295 2296 2297 /** @type {!ChromeEvent} */ 2298 chrome.bookmarks.onChildrenReordered; 2299 2300 2301 /** @type {!ChromeEvent} */ 2302 chrome.bookmarks.onCreated; 2303 2304 2305 /** @type {!ChromeEvent} */ 2306 chrome.bookmarks.onImportBegan; 2307 2308 2309 /** @type {!ChromeEvent} */ 2310 chrome.bookmarks.onImportEnded; 2311 2312 2313 /** @type {!ChromeEvent} */ 2314 chrome.bookmarks.onMoved; 2315 2316 2317 /** @type {!ChromeEvent} */ 2318 chrome.bookmarks.onRemoved; 2319 2320 2321 /** 2322 * @typedef {?{ 2323 * content: string, 2324 * description: string 2325 * }} 2326 */ 2327 var SuggestResult; 2328 2329 2330 /** 2331 * @const 2332 * @see https://developer.chrome.com/extensions/omnibox.html 2333 */ 2334 chrome.omnibox = {}; 2335 2336 2337 /** @constructor */ 2338 chrome.omnibox.InputChangedEvent = function() {}; 2339 2340 2341 /** 2342 * @param {function(string, function(!Array.<!SuggestResult>)): void} callback 2343 */ 2344 chrome.omnibox.InputChangedEvent.prototype.addListener = function(callback) {}; 2345 2346 2347 /** 2348 * @param {function(string, function(!Array.<!SuggestResult>)): void} callback 2349 */ 2350 chrome.omnibox.InputChangedEvent.prototype.removeListener = 2351 function(callback) {}; 2352 2353 2354 /** 2355 * @param {function(string, function(!Array.<!SuggestResult>)): void} callback 2356 * @return {boolean} 2357 */ 2358 chrome.omnibox.InputChangedEvent.prototype.hasListener = function(callback) {}; 2359 2360 2361 /** @return {boolean} */ 2362 chrome.omnibox.InputChangedEvent.prototype.hasListeners = function() {}; 2363 2364 2365 /** @constructor */ 2366 chrome.omnibox.InputEnteredEvent = function() {}; 2367 2368 2369 /** @param {function(string, string): void} callback */ 2370 chrome.omnibox.InputEnteredEvent.prototype.addListener = function(callback) {}; 2371 2372 2373 /** @param {function(string, string): void} callback */ 2374 chrome.omnibox.InputEnteredEvent.prototype.removeListener = 2375 function(callback) {}; 2376 2377 2378 /** 2379 * @param {function(string, string): void} callback 2380 * @return {boolean} 2381 */ 2382 chrome.omnibox.InputEnteredEvent.prototype.hasListener = function(callback) {}; 2383 2384 2385 /** @return {boolean} */ 2386 chrome.omnibox.InputEnteredEvent.prototype.hasListeners = function() {}; 2387 2388 2389 /** 2390 * @param {{description: string}} suggestion A partial SuggestResult object. 2391 */ 2392 chrome.omnibox.setDefaultSuggestion = function(suggestion) {}; 2393 2394 2395 /** @type {!ChromeEvent} */ 2396 chrome.omnibox.onInputCancelled; 2397 2398 2399 /** @type {!chrome.omnibox.InputChangedEvent} */ 2400 chrome.omnibox.onInputChanged; 2401 2402 2403 /** @type {!chrome.omnibox.InputEnteredEvent} */ 2404 chrome.omnibox.onInputEntered; 2405 2406 2407 /** @type {!ChromeEvent} */ 2408 chrome.omnibox.onInputStarted; 2409 2410 2411 /** 2412 * @const 2413 * @see https://developer.chrome.com/extensions/dev/contextMenus.html 2414 */ 2415 chrome.contextMenus = {}; 2416 2417 2418 /** 2419 * @param {!Object} createProperties 2420 * @param {function()=} opt_callback 2421 * @return {number} The id of the newly created window. 2422 */ 2423 chrome.contextMenus.create = function(createProperties, opt_callback) {}; 2424 2425 2426 /** 2427 * @param {number} menuItemId 2428 * @param {function()=} opt_callback 2429 */ 2430 chrome.contextMenus.remove = function(menuItemId, opt_callback) {}; 2431 2432 2433 /** 2434 * @param {function()=} opt_callback 2435 */ 2436 chrome.contextMenus.removeAll = function(opt_callback) {}; 2437 2438 2439 /** 2440 * @param {number} id 2441 * @param {!Object} updateProperties 2442 * @param {function()=} opt_callback 2443 */ 2444 chrome.contextMenus.update = function(id, updateProperties, opt_callback) {}; 2445 2446 2447 /** 2448 * @const 2449 * @see https://developer.chrome.com/extensions/dev/cookies.html 2450 */ 2451 chrome.cookies = {}; 2452 2453 2454 /** 2455 * This typedef is used for the parameters to chrome.cookies.get, 2456 * chrome.cookies.remove, and for the parameter to remove's callback. These uses 2457 * all identify a single cookie uniquely without specifying its content, and the 2458 * objects are identical except for the the storeId being optional vs required. 2459 * If greater divergence occurs, then going to two typedefs is recommended. 2460 * 2461 * @typedef {?{ 2462 * url: string, 2463 * name: string, 2464 * storeId: (string|undefined) 2465 * }} 2466 */ 2467 chrome.cookies.CookieIdentifier; 2468 2469 2470 /** 2471 * @param {!chrome.cookies.CookieIdentifier} details 2472 * @param {function(Cookie=): void} callback 2473 */ 2474 chrome.cookies.get = function(details, callback) {}; 2475 2476 2477 /** 2478 * @param {Object} details 2479 * @param {function(Array.<Cookie>): void} callback 2480 */ 2481 chrome.cookies.getAll = function(details, callback) {}; 2482 2483 2484 /** 2485 * @param {function(Array.<CookieStore>): void} callback 2486 */ 2487 chrome.cookies.getAllCookieStores = function(callback) {}; 2488 2489 2490 /** 2491 * @param {!chrome.cookies.CookieIdentifier} details 2492 * @param {function(chrome.cookies.CookieIdentifier): void=} opt_callback If 2493 * removal failed for any reason, the parameter will be "null", and 2494 * "chrome.runtime.lastError" will be set. 2495 */ 2496 chrome.cookies.remove = function(details, opt_callback) {}; 2497 2498 2499 /** 2500 * @typedef {?{ 2501 * url: string, 2502 * name: (string|undefined), 2503 * value: (string|undefined), 2504 * domain: (string|undefined), 2505 * path: (string|undefined), 2506 * secure: (boolean|undefined), 2507 * httpOnly: (boolean|undefined), 2508 * expirationDate: (number|undefined), 2509 * storeId: (string|undefined) 2510 * }} 2511 */ 2512 chrome.cookies.CookieSetDetails; 2513 2514 2515 /** 2516 * @param {!chrome.cookies.CookieSetDetails} details 2517 * @param {function(Cookie): void=} opt_callback If setting failed for any 2518 * reason, the parameter will be "null", and "chrome.runtime.lastError" will 2519 * be set. 2520 */ 2521 chrome.cookies.set = function(details, opt_callback) {}; 2522 2523 2524 /** 2525 * @see https://developer.chrome.com/extensions/cookies.html#event-onChanged 2526 * @type {!ChromeEvent} 2527 */ 2528 chrome.cookies.onChanged; 2529 2530 2531 2532 /** @constructor */ 2533 function CookieChangeInfo() {} 2534 2535 2536 /** @type {boolean} */ 2537 CookieChangeInfo.prototype.removed; 2538 2539 2540 /** @type {Cookie} */ 2541 CookieChangeInfo.prototype.cookie; 2542 2543 2544 /** @type {string} */ 2545 CookieChangeInfo.prototype.cause; 2546 2547 2548 /** @const */ 2549 chrome.management = {}; 2550 2551 2552 /** 2553 * @typedef {?{ 2554 * showConfirmDialog: (boolean|undefined) 2555 * }} 2556 */ 2557 chrome.management.InstallOptions; 2558 2559 2560 /** 2561 * @param {string} id 2562 * @param {function(!ExtensionInfo): void=} opt_callback Optional callback 2563 * function. 2564 */ 2565 chrome.management.get = function(id, opt_callback) {}; 2566 2567 2568 /** 2569 * @param {function(!Array.<!ExtensionInfo>): void=} opt_callback Optional 2570 * callback function. 2571 * @return {!Array.<!ExtensionInfo>} 2572 */ 2573 chrome.management.getAll = function(opt_callback) {}; 2574 2575 2576 /** 2577 * @param {string} id The id of an already installed extension. 2578 * @param {function(!Array.<string>)=} opt_callback Optional callback function. 2579 */ 2580 chrome.management.getPermissionWarningsById = function(id, opt_callback) {}; 2581 2582 2583 /** 2584 * @param {string} manifestStr Extension's manifest JSON string. 2585 * @param {function(!Array.<string>)=} opt_callback Optional callback function. 2586 */ 2587 chrome.management.getPermissionWarningsByManifest = 2588 function(manifestStr, opt_callback) {}; 2589 2590 2591 /** 2592 * @param {string} id The id of an already installed extension. 2593 * @param {function(): void=} opt_callback Optional callback function. 2594 */ 2595 chrome.management.launchApp = function(id, opt_callback) {}; 2596 2597 2598 /** 2599 * @param {string} id The id of an already installed extension. 2600 * @param {boolean} enabled Whether this item should be enabled. 2601 * @param {function(): void=} opt_callback Optional callback function. 2602 */ 2603 chrome.management.setEnabled = function(id, enabled, opt_callback) {}; 2604 2605 2606 /** 2607 * @param {string} id The id of an already installed extension. 2608 * @param {(!chrome.management.InstallOptions|function(): void)=} 2609 * opt_optionsOrCallback An optional uninstall options object or an optional 2610 * callback function. 2611 * @param {function(): void=} opt_callback Optional callback function. 2612 */ 2613 chrome.management.uninstall = 2614 function(id, opt_optionsOrCallback, opt_callback) {}; 2615 2616 2617 /** 2618 * @param {(!chrome.management.InstallOptions|function(): void)=} 2619 * opt_optionsOrCallback An optional uninstall options object or an optional 2620 * callback function. 2621 * @param {function(): void=} opt_callback An optional callback function. 2622 */ 2623 chrome.management.uninstallSelf = 2624 function(opt_optionsOrCallback, opt_callback) {}; 2625 2626 2627 /** 2628 * @param {string} id The id of an already installed extension. 2629 * @param {function(): void=} opt_callback Optional callback function. 2630 */ 2631 chrome.management.createAppShortcut = function(id, opt_callback) {}; 2632 2633 2634 /** 2635 * @param {string} id The id of an already installed extension. 2636 * @param {string} launchType The LaunchType enum value to set. Make sure this 2637 * value is in ExtensionInfo.availableLaunchTypes because the available 2638 * launch types vary on different platforms and configurations. 2639 * @param {function(): void=} opt_callback Optional callback function. 2640 */ 2641 chrome.management.setLaunchType = function(id, launchType, opt_callback) {}; 2642 2643 2644 /** 2645 * @param {string} url The URL of a web page. The scheme of the URL can only be 2646 * "http" or "https". 2647 * @param {string} title The title of the generated app. 2648 * @param {function(!ExtensionInfo): void=} opt_callback Optional callback 2649 * function. 2650 */ 2651 chrome.management.generateAppForLink = function(url, title, opt_callback) {}; 2652 2653 2654 /** @type {!ChromeExtensionInfoEvent} */ 2655 chrome.management.onDisabled; 2656 2657 2658 /** @type {!ChromeExtensionInfoEvent} */ 2659 chrome.management.onEnabled; 2660 2661 2662 /** @type {!ChromeExtensionInfoEvent} */ 2663 chrome.management.onInstalled; 2664 2665 2666 /** @type {!ChromeStringEvent} */ 2667 chrome.management.onUninstalled; 2668 2669 2670 /** 2671 * @const 2672 * @see https://developer.chrome.com/extensions/idle.html 2673 */ 2674 chrome.idle = {}; 2675 2676 2677 /** 2678 * @param {number} thresholdSeconds Threshold in seconds, used to determine 2679 * when a machine is in the idle state. 2680 * @param {function(string): void} callback Callback to handle the state. 2681 */ 2682 chrome.idle.queryState = function(thresholdSeconds, callback) {}; 2683 2684 2685 /** 2686 * @param {number} intervalInSeconds Threshold, in seconds, used to determine 2687 * when the system is in an idle state. 2688 */ 2689 chrome.idle.setDetectionInterval = function(intervalInSeconds) {}; 2690 2691 2692 /** @type {!ChromeEvent} */ 2693 chrome.idle.onStateChanged; 2694 2695 2696 /** 2697 * Chrome Text-to-Speech API. 2698 * @const 2699 * @see https://developer.chrome.com/extensions/tts.html 2700 */ 2701 chrome.tts = {}; 2702 2703 2704 2705 /** 2706 * An event from the TTS engine to communicate the status of an utterance. 2707 * @constructor 2708 */ 2709 function TtsEvent() {} 2710 2711 2712 /** @type {string} */ 2713 TtsEvent.prototype.type; 2714 2715 2716 /** @type {number} */ 2717 TtsEvent.prototype.charIndex; 2718 2719 2720 /** @type {string} */ 2721 TtsEvent.prototype.errorMessage; 2722 2723 2724 2725 /** 2726 * A description of a voice available for speech synthesis. 2727 * @constructor 2728 */ 2729 function TtsVoice() {} 2730 2731 2732 /** @type {string} */ 2733 TtsVoice.prototype.voiceName; 2734 2735 2736 /** @type {string} */ 2737 TtsVoice.prototype.lang; 2738 2739 2740 /** @type {string} */ 2741 TtsVoice.prototype.gender; 2742 2743 2744 /** @type {string} */ 2745 TtsVoice.prototype.extensionId; 2746 2747 2748 /** @type {Array.<string>} */ 2749 TtsVoice.prototype.eventTypes; 2750 2751 2752 /** 2753 * Gets an array of all available voices. 2754 * @param {function(Array.<TtsVoice>)=} opt_callback An optional callback 2755 * function. 2756 */ 2757 chrome.tts.getVoices = function(opt_callback) {}; 2758 2759 2760 /** 2761 * Checks if the engine is currently speaking. 2762 * @param {function(boolean)=} opt_callback The callback function. 2763 */ 2764 chrome.tts.isSpeaking = function(opt_callback) {}; 2765 2766 2767 /** 2768 * Speaks text using a text-to-speech engine. 2769 * @param {string} utterance The text to speak, either plain text or a complete, 2770 * well-formed SSML document. Speech engines that do not support SSML will 2771 * strip away the tags and speak the text. The maximum length of the text is 2772 * 32,768 characters. 2773 * @param {Object=} opt_options The speech options. 2774 * @param {function()=} opt_callback Called right away, before speech finishes. 2775 */ 2776 chrome.tts.speak = function(utterance, opt_options, opt_callback) {}; 2777 2778 2779 /** 2780 * Stops any current speech. 2781 */ 2782 chrome.tts.stop = function() {}; 2783 2784 2785 /** 2786 * @const 2787 * @see https://developer.chrome.com/extensions/ttsEngine.html 2788 */ 2789 chrome.ttsEngine = {}; 2790 2791 2792 /** @type {!ChromeEvent} */ 2793 chrome.ttsEngine.onSpeak; 2794 2795 2796 /** @type {!ChromeEvent} */ 2797 chrome.ttsEngine.onStop; 2798 2799 2800 /** 2801 * @const 2802 * @see https://developer.chrome.com/extensions/contentSettings.html 2803 */ 2804 chrome.contentSettings = {}; 2805 2806 2807 /** @type {!ContentSetting} */ 2808 chrome.contentSettings.cookies; 2809 2810 2811 /** @type {!ContentSetting} */ 2812 chrome.contentSettings.images; 2813 2814 2815 /** @type {!ContentSetting} */ 2816 chrome.contentSettings.javascript; 2817 2818 2819 /** @type {!ContentSetting} */ 2820 chrome.contentSettings.plugins; 2821 2822 2823 /** @type {!ContentSetting} */ 2824 chrome.contentSettings.popups; 2825 2826 2827 /** @type {!ContentSetting} */ 2828 chrome.contentSettings.notifications; 2829 2830 2831 /** 2832 * @const 2833 * @see https://developer.chrome.com/extensions/fileBrowserHandle.html 2834 */ 2835 chrome.fileBrowserHandle = {}; 2836 2837 2838 /** @type {!ChromeEvent} */ 2839 chrome.fileBrowserHandle.onExecute; 2840 2841 2842 /** 2843 * @const 2844 * @see https://developer.chrome.com/extensions/gcm 2845 */ 2846 chrome.gcm = {}; 2847 2848 2849 /** 2850 * @see https://developer.chrome.com/extensions/gcm#property-MAX_MESSAGE_SIZE 2851 * @type {number} 2852 */ 2853 chrome.gcm.MAX_MESSAGE_SIZE; 2854 2855 2856 /** 2857 * Registers the application with GCM. The registration ID will be returned by 2858 * the callback. If register is called again with the same list of senderIds, 2859 * the same registration ID will be returned. 2860 * @see https://developer.chrome.com/extensions/gcm#method-register 2861 * @param {!Array.<string>} senderIds A list of server IDs that are allowed to 2862 * send messages to the application. 2863 * @param {function(string): void} callback Function called when 2864 * registration completes with registration ID as argument. 2865 */ 2866 chrome.gcm.register = function(senderIds, callback) {}; 2867 2868 2869 /** 2870 * Unregisters the application from GCM. 2871 * @see https://developer.chrome.com/extensions/gcm#method-unregister 2872 * @param {function(): void} callback Called when unregistration is done. 2873 */ 2874 chrome.gcm.unregister = function(callback) {}; 2875 2876 2877 /** 2878 * Sends an upstream message using GCM. 2879 * @see https://developer.chrome.com/extensions/gcm#method-send 2880 * @param {!chrome.gcm.Message} message Message to be sent. 2881 * @param {function(string): void} callback Called with message ID. 2882 */ 2883 chrome.gcm.send = function(message, callback) {}; 2884 2885 2886 /** 2887 * Outgoing message. 2888 * @typedef {?{ 2889 * destinationId: string, 2890 * messageId: string, 2891 * timeToLive: (number|undefined), 2892 * data: !Object.<string, string> 2893 * }} 2894 */ 2895 chrome.gcm.Message; 2896 2897 2898 /** 2899 * An event, fired when a message is received through GCM. 2900 * @see https://developer.chrome.com/extensions/gcm#event-onMessage 2901 * @type {!chrome.gcm.OnMessageEvent} 2902 */ 2903 chrome.gcm.onMessage; 2904 2905 2906 /** 2907 * An event, fired when GCM server had to delete messages to the application 2908 * from its queue in order to manage its size. 2909 * @see https://developer.chrome.com/extensions/gcm#event-onMessagesDeleted 2910 * @type {!ChromeEvent} 2911 */ 2912 chrome.gcm.onMessagesDeleted; 2913 2914 2915 /** 2916 * An event indicating problems with sending messages. 2917 * @see https://developer.chrome.com/extensions/gcm#event-onSendError 2918 * @type {!chrome.gcm.OnSendErrorEvent} 2919 */ 2920 chrome.gcm.onSendError; 2921 2922 2923 /** 2924 * @constructor 2925 */ 2926 chrome.gcm.OnMessageEvent = function() {}; 2927 2928 2929 /** 2930 * @param {function(!Object): void} callback Callback. 2931 */ 2932 chrome.gcm.OnMessageEvent.prototype.addListener = function(callback) {}; 2933 2934 2935 /** 2936 * @param {function(!Object): void} callback Callback. 2937 */ 2938 chrome.gcm.OnMessageEvent.prototype.removeListener = function(callback) {}; 2939 2940 2941 /** 2942 * @param {function(!Object): void} callback Callback. 2943 * @return {boolean} 2944 */ 2945 chrome.gcm.OnMessageEvent.prototype.hasListener = function(callback) {}; 2946 2947 2948 /** 2949 * @return {boolean} 2950 */ 2951 chrome.gcm.OnMessageEvent.prototype.hasListeners = function() {}; 2952 2953 2954 /** 2955 * @constructor 2956 */ 2957 chrome.gcm.OnSendErrorEvent = function() {}; 2958 2959 2960 /** 2961 * @param {function(!Object): void} callback Callback. 2962 */ 2963 chrome.gcm.OnSendErrorEvent.prototype.addListener = function(callback) {}; 2964 2965 2966 /** 2967 * @param {function(!Object): void} callback Callback. 2968 */ 2969 chrome.gcm.OnSendErrorEvent.prototype.removeListener = function(callback) {}; 2970 2971 /** 2972 * @param {function(!Object): void} callback Callback. 2973 * @return {boolean} 2974 */ 2975 chrome.gcm.OnSendErrorEvent.prototype.hasListener = function(callback) {}; 2976 2977 2978 /** 2979 * @return {boolean} 2980 */ 2981 chrome.gcm.OnSendErrorEvent.prototype.hasListeners = function() {}; 2982 2983 2984 /** 2985 * @const 2986 * @see https://developer.chrome.com/extensions/history.html 2987 */ 2988 chrome.history = {}; 2989 2990 2991 /** 2992 * @param {Object.<string, string>} details Object with a 'url' key. 2993 */ 2994 chrome.history.addUrl = function(details) {}; 2995 2996 2997 /** 2998 * @param {function(): void} callback Callback function. 2999 */ 3000 chrome.history.deleteAll = function(callback) {}; 3001 3002 3003 /** 3004 * @param {Object.<string, string>} range Object with 'startTime' 3005 * and 'endTime' keys. 3006 * @param {function(): void} callback Callback function. 3007 */ 3008 chrome.history.deleteRange = function(range, callback) {}; 3009 3010 3011 /** 3012 * @param {Object.<string, string>} details Object with a 'url' key. 3013 */ 3014 chrome.history.deleteUrl = function(details) {}; 3015 3016 3017 /** 3018 * @param {Object.<string, string>} details Object with a 'url' key. 3019 * @param {function(!Array.<!VisitItem>): void} callback Callback function. 3020 * @return {!Array.<!VisitItem>} 3021 */ 3022 chrome.history.getVisits = function(details, callback) {}; 3023 3024 3025 /** 3026 * @param {Object.<string, string>} query Object with a 'text' (string) 3027 * key and optional 'startTime' (number), 'endTime' (number) and 3028 * 'maxResults' keys. 3029 * @param {function(!Array.<!HistoryItem>): void} callback Callback function. 3030 * @return {!Array.<!HistoryItem>} 3031 */ 3032 chrome.history.search = function(query, callback) {}; 3033 3034 3035 /** @type {!ChromeEvent} */ 3036 chrome.history.onVisitRemoved; 3037 3038 3039 /** @type {!ChromeEvent} */ 3040 chrome.history.onVisited; 3041 3042 3043 /** 3044 * @const 3045 * @see http://developer.chrome.com/apps/identity.html 3046 */ 3047 chrome.identity = {}; 3048 3049 3050 /** 3051 * @param {(chrome.identity.TokenDetails|function(string=): void)} 3052 * detailsOrCallback Token options or a callback function if no options are 3053 * specified. 3054 * @param {function(string=): void=} opt_callback A callback function if options 3055 * are specified. 3056 */ 3057 chrome.identity.getAuthToken = function(detailsOrCallback, opt_callback) {}; 3058 3059 3060 /** @typedef {{interactive: (boolean|undefined)}} */ 3061 chrome.identity.TokenDetails; 3062 3063 3064 /** 3065 * @param {chrome.identity.InvalidTokenDetails} details 3066 * @param {function(): void} callback 3067 */ 3068 chrome.identity.removeCachedAuthToken = function(details, callback) {}; 3069 3070 3071 /** @typedef {{token: string}} */ 3072 chrome.identity.InvalidTokenDetails; 3073 3074 3075 /** 3076 * @param {chrome.identity.WebAuthFlowDetails} details 3077 * @param {function(string=): void} callback 3078 */ 3079 chrome.identity.launchWebAuthFlow = function(details, callback) {}; 3080 3081 3082 /** @typedef {{url: string, interactive: (boolean|undefined)}} */ 3083 chrome.identity.WebAuthFlowDetails; 3084 3085 3086 /** @type {!ChromeEvent} */ 3087 chrome.identity.onSignInChanged; 3088 3089 3090 /** 3091 * @const 3092 * @see https://developer.chrome.com/extensions/input.ime.html 3093 */ 3094 chrome.input = {}; 3095 3096 3097 /** @const */ 3098 chrome.input.ime = {}; 3099 3100 3101 3102 /** 3103 * The OnKeyEvent event takes an extra argument. 3104 * @constructor 3105 */ 3106 function ChromeInputImeOnKeyEventEvent() {} 3107 3108 3109 /** 3110 * @param {function(string, !ChromeKeyboardEvent): (boolean|undefined)} callback 3111 * callback. 3112 * @param {Array.<string>=} opt_extraInfoSpec Array of extra information. 3113 */ 3114 ChromeInputImeOnKeyEventEvent.prototype.addListener = 3115 function(callback, opt_extraInfoSpec) {}; 3116 3117 3118 /** 3119 * @param {function(string, !ChromeKeyboardEvent): (boolean|undefined)} callback 3120 * callback. 3121 */ 3122 ChromeInputImeOnKeyEventEvent.prototype.removeListener = function(callback) {}; 3123 3124 3125 /** 3126 * @param {function(string, !ChromeKeyboardEvent): (boolean|undefined)} callback 3127 * callback. 3128 */ 3129 ChromeInputImeOnKeyEventEvent.prototype.hasListener = function(callback) {}; 3130 3131 3132 /** 3133 * @param {function(string, !ChromeKeyboardEvent): (boolean|undefined)} callback 3134 * callback. 3135 */ 3136 ChromeInputImeOnKeyEventEvent.prototype.hasListeners = function(callback) {}; 3137 3138 3139 /** 3140 * @param {!Object.<string,number>} parameters An object with a 3141 * 'contextID' (number) key. 3142 * @param {function(boolean): void} callback Callback function. 3143 */ 3144 chrome.input.ime.clearComposition = function(parameters, callback) {}; 3145 3146 3147 /** 3148 * @param {!Object.<string,(string|number)>} parameters An object with 3149 * 'contextID' (number) and 'text' (string) keys. 3150 * @param {function(boolean): void=} opt_callback Callback function. 3151 */ 3152 chrome.input.ime.commitText = function(parameters, opt_callback) {}; 3153 3154 3155 /** 3156 * @param {!Object.<string,(string|number)>} parameters An object with 3157 * 'contextID' (number) and 'text' (string) keys. 3158 * @param {function(boolean): void=} opt_callback Callback function. 3159 */ 3160 chrome.input.ime.deleteSurroundingText = function(parameters, opt_callback) {}; 3161 3162 3163 /** 3164 * @param {!Object.<string,(number|Object.<string,(string|number|boolean)>)>} 3165 * parameters An object with 'engineID' (string) and 'properties' 3166 * (Object) keys. 3167 * @param {function(boolean): void=} opt_callback Callback function. 3168 */ 3169 chrome.input.ime.setCandidateWindowProperties = 3170 function(parameters, opt_callback) {}; 3171 3172 3173 /** 3174 * @param {!Object.<string,(number|Object.<string,(string|number)>)>} 3175 * parameters An object with 'contextID' (number) and 'candidates' 3176 * (array of object) keys. 3177 * @param {function(boolean): void=} opt_callback Callback function. 3178 */ 3179 chrome.input.ime.setCandidates = function(parameters, opt_callback) {}; 3180 3181 3182 /** 3183 * @param {!Object.<string,(string|number|Object.<string,(string|number)>)>} 3184 * parameters An object with 'contextID' (number), 'text' (string), 3185 * 'selectionStart (number), 'selectionEnd' (number), 'cursor' (number), 3186 * and 'segments' (array of object) keys. 3187 * @param {function(boolean): void=} opt_callback Callback function. 3188 */ 3189 chrome.input.ime.setComposition = function(parameters, opt_callback) {}; 3190 3191 3192 /** 3193 * @param {!Object.<string,number>} parameters An object with 3194 * 'contextID' (number) and 'candidateID' (number) keys. 3195 * @param {function(boolean): void=} opt_callback Callback function. 3196 */ 3197 chrome.input.ime.setCursorPosition = function(parameters, opt_callback) {}; 3198 3199 3200 /** 3201 * @param {!Object.<string,(string|Array.<Object.<string,(string|boolean)>>)>} 3202 * parameters An object with 'engineID' (string) and 'items' 3203 * (array of object) keys. 3204 * @param {function(): void=} opt_callback Callback function. 3205 */ 3206 chrome.input.ime.setMenuItems = function(parameters, opt_callback) {}; 3207 3208 3209 /** 3210 * @param {!Object.<string,(string|Array.<Object.<string,(string|boolean)>>)>} 3211 * parameters An object with 'engineID' (string) and 'items' 3212 * (array of object) keys. 3213 * @param {function(): void=} opt_callback Callback function. 3214 */ 3215 chrome.input.ime.updateMenuItems = function(parameters, opt_callback) {}; 3216 3217 3218 /** 3219 * @param {string} requestId Request id of the event that was handled. This 3220 * should come from keyEvent.requestId. 3221 * @param {boolean} response True if the keystroke was handled, false if not. 3222 */ 3223 chrome.input.ime.keyEventHandled = function(requestId, response) {}; 3224 3225 3226 /** @type {!ChromeEvent} */ 3227 chrome.input.ime.onActivate; 3228 3229 3230 /** @type {!ChromeEvent} */ 3231 chrome.input.ime.onBlur; 3232 3233 3234 /** @type {!ChromeEvent} */ 3235 chrome.input.ime.onCandidateClicked; 3236 3237 3238 /** @type {!ChromeEvent} */ 3239 chrome.input.ime.onDeactivated; 3240 3241 3242 /** @type {!ChromeEvent} */ 3243 chrome.input.ime.onFocus; 3244 3245 3246 /** @type {!ChromeEvent} */ 3247 chrome.input.ime.onInputContextUpdate; 3248 3249 3250 /** @type {!ChromeInputImeOnKeyEventEvent} */ 3251 chrome.input.ime.onKeyEvent; 3252 3253 3254 /** @type {!ChromeEvent} */ 3255 chrome.input.ime.onMenuItemActivated; 3256 3257 3258 /** @type {!ChromeEvent} */ 3259 chrome.input.ime.onReset; 3260 3261 3262 /** @type {!ChromeEvent} */ 3263 chrome.input.ime.onSurroundingTextChanged; 3264 3265 3266 /** 3267 * namespace 3268 * @see http://developer.chrome.com/apps/mediaGalleries 3269 * @const 3270 */ 3271 chrome.mediaGalleries = {}; 3272 3273 3274 /** 3275 * @param {{interactive: (string|undefined)}|function(!Array.<!FileSystem>)} 3276 * detailsOrCallback A details object for whether the request should be 3277 * interactive if permissions haven't been granted yet or the callback. 3278 * @param {function(!Array.<!FileSystem>)=} opt_callback A success callback if 3279 * no details were supplied as arg1. 3280 */ 3281 chrome.mediaGalleries.getMediaFileSystems = function( 3282 detailsOrCallback, opt_callback) {}; 3283 3284 3285 /** 3286 * @param {function(!Array.<!FileSystem>, string)} callback Callback function. 3287 */ 3288 chrome.mediaGalleries.addUserSelectedFolder = function(callback) {}; 3289 3290 chrome.mediaGalleries.startMediaScan = function() {}; 3291 3292 chrome.mediaGalleries.cancelMediaScan = function() {}; 3293 3294 3295 /** 3296 * @param {function(!Array.<!FileSystem>)} callback Callback function. 3297 */ 3298 chrome.mediaGalleries.addScanResults = function(callback) {}; 3299 3300 3301 /** 3302 * @typedef {{ 3303 * name: string, 3304 * galleryId: string, 3305 * deviceId: (string|undefined), 3306 * isRemovable: boolean, 3307 * isMediaDevice: boolean, 3308 * isAvailable: boolean 3309 * }} 3310 */ 3311 chrome.mediaGalleries.MediaFileSystemMetadata; 3312 3313 3314 /** 3315 * @param {!FileSystem} mediaFileSystem The file system to get metadata for. 3316 * @return {!chrome.mediaGalleries.MediaFileSystemMetadata} 3317 */ 3318 chrome.mediaGalleries.getMediaFileSystemMetadata = function(mediaFileSystem) {}; 3319 3320 3321 /** 3322 * @param {function(!Array.<!chrome.mediaGalleries.MediaFileSystemMetadata>)} 3323 * callback Callback function. 3324 */ 3325 chrome.mediaGalleries.getAllMediaFileSystemMetadata = function(callback) {}; 3326 3327 3328 /** 3329 * @typedef {{ 3330 * mimeType: string, 3331 * height: (number|undefined), 3332 * width: (number|undefined), 3333 * duration: (number|undefined), 3334 * rotation: (number|undefined), 3335 * album: (string|undefined), 3336 * artist: (string|undefined), 3337 * comment: (string|undefined), 3338 * copyright: (string|undefined), 3339 * disc: (number|undefined), 3340 * genre: (string|undefined), 3341 * language: (string|undefined), 3342 * title: (string|undefined), 3343 * track: (number|undefined) 3344 * }} 3345 */ 3346 chrome.mediaGalleries.MetaData; 3347 3348 3349 /** 3350 * @param {!Blob} mediaFile The media file for which to get metadata. 3351 * @param {{metadataType: (string|undefined)}| 3352 * function(!chrome.mediaGalleries.MetaData)} optionsOrCallback The options 3353 * for the metadata to retrieve or the callback to invoke with the metadata. 3354 * The metadataType should either be 'all' or 'mimeTypeOnly'. Defaults to 3355 * 'all' if the metadataType is omitted. 3356 * @param {function(!chrome.mediaGalleries.MetaData)=} opt_callback If options 3357 * were passed as arg2, the callback to invoke with the metadata. 3358 */ 3359 chrome.mediaGalleries.getMetadata = function( 3360 mediaFile, optionsOrCallback, opt_callback) {}; 3361 3362 3363 /** 3364 * @typedef {{ 3365 * type: string, 3366 * galleryCount: (number|undefined), 3367 * audioCount: (number|undefined), 3368 * imageCount: (number|undefined), 3369 * videoCount: (number|undefined) 3370 * }} 3371 */ 3372 chrome.mediaGalleries.OnScanProgressDetails; 3373 3374 3375 3376 /** 3377 * Event whose listeners take a chrome.mediaGalleries.OnScanProgressDetails 3378 * parameter. 3379 * @constructor 3380 */ 3381 chrome.mediaGalleries.ScanProgressEvent = function() {}; 3382 3383 3384 /** @param {function(!chrome.mediaGalleries.OnScanProgressDetails)} callback */ 3385 chrome.mediaGalleries.ScanProgressEvent.prototype.addListener = 3386 function(callback) {}; 3387 3388 3389 /** @param {function(!chrome.mediaGalleries.OnScanProgressDetails)} callback */ 3390 chrome.mediaGalleries.ScanProgressEvent.prototype.removeListener = 3391 function(callback) {}; 3392 3393 3394 /** 3395 * @param {function(!chrome.mediaGalleries.OnScanProgressDetails)} callback 3396 * @return {boolean} 3397 */ 3398 chrome.mediaGalleries.ScanProgressEvent.prototype.hasListener = 3399 function(callback) {}; 3400 3401 3402 /** @return {boolean} */ 3403 chrome.mediaGalleries.ScanProgressEvent.prototype.hasListeners = function() {}; 3404 3405 3406 /** @type {!chrome.mediaGalleries.ScanProgressEvent} */ 3407 chrome.mediaGalleries.onScanProgress; 3408 3409 3410 /** 3411 * @const 3412 * @see https://developer.chrome.com/extensions/pageCapture.html 3413 */ 3414 chrome.pageCapture = {}; 3415 3416 3417 /** 3418 * @param {Object.<string, number>} details Object with a 'tabId' (number) key. 3419 * @param {function(Blob=): void} callback Callback function. 3420 */ 3421 chrome.pageCapture.saveAsMHTML = function(details, callback) {}; 3422 3423 3424 /** 3425 * @const 3426 * @see https://developer.chrome.com/extensions/permissions.html 3427 */ 3428 chrome.permissions = {}; 3429 3430 3431 /** 3432 * @typedef {{ 3433 * permissions: (Array.<string>|undefined), 3434 * origins: (Array.<string>|undefined) 3435 * }} 3436 * @see http://developer.chrome.com/extensions/permissions.html#type-Permissions 3437 */ 3438 chrome.permissions.Permissions; 3439 3440 3441 /** 3442 * @param {!chrome.permissions.Permissions} permissions 3443 * @param {function(boolean): void} callback Callback function. 3444 */ 3445 chrome.permissions.contains = function(permissions, callback) {}; 3446 3447 3448 /** 3449 * @param {function(!chrome.permissions.Permissions): void} callback 3450 * Callback function. 3451 */ 3452 chrome.permissions.getAll = function(callback) {}; 3453 3454 3455 /** 3456 * @param {!chrome.permissions.Permissions} permissions 3457 * @param {function(boolean): void=} opt_callback Callback function. 3458 */ 3459 chrome.permissions.remove = function(permissions, opt_callback) {}; 3460 3461 3462 /** 3463 * @param {!chrome.permissions.Permissions} permissions 3464 * @param {function(boolean): void=} opt_callback Callback function. 3465 */ 3466 chrome.permissions.request = function(permissions, opt_callback) {}; 3467 3468 3469 /** @type {!ChromeEvent} */ 3470 chrome.permissions.onAdded; 3471 3472 3473 /** @type {!ChromeEvent} */ 3474 chrome.permissions.onRemoved; 3475 3476 3477 /** 3478 * @see http://developer.chrome.com/dev/extensions/power.html 3479 */ 3480 chrome.power = {}; 3481 3482 3483 /** 3484 * @param {string} level A string describing the degree to which power 3485 * management should be disabled, should be either "system" or "display". 3486 */ 3487 chrome.power.requestKeepAwake = function(level) {}; 3488 3489 3490 /** 3491 * Releases a request previously made via requestKeepAwake(). 3492 */ 3493 chrome.power.releaseKeepAwake = function() {}; 3494 3495 3496 /** 3497 * @const 3498 * @see https://developer.chrome.com/extensions/privacy.html 3499 */ 3500 chrome.privacy = {}; 3501 3502 3503 /** @type {!Object.<string,!ChromeSetting>} */ 3504 chrome.privacy.network; 3505 3506 3507 /** @type {!Object.<string,!ChromeSetting>} */ 3508 chrome.privacy.services; 3509 3510 3511 /** @type {!Object.<string,!ChromeSetting>} */ 3512 chrome.privacy.websites; 3513 3514 3515 /** 3516 * @const 3517 * @see https://developer.chrome.com/extensions/proxy.html 3518 */ 3519 chrome.proxy = {}; 3520 3521 3522 /** @type {!Object.<string,!ChromeSetting>} */ 3523 chrome.proxy.settings; 3524 3525 3526 /** @type {!ChromeEvent} */ 3527 chrome.proxy.onProxyError; 3528 3529 3530 /** 3531 * @const 3532 * @see http://developer.chrome.com/apps/socket.html 3533 */ 3534 chrome.socket = {}; 3535 3536 3537 3538 /** 3539 * @constructor 3540 */ 3541 chrome.socket.CreateInfo = function() {}; 3542 3543 3544 /** @type {number} */ 3545 chrome.socket.CreateInfo.prototype.socketId; 3546 3547 3548 3549 /** 3550 * @constructor 3551 */ 3552 chrome.socket.ReadInfo = function() {}; 3553 3554 3555 /** @type {number} */ 3556 chrome.socket.ReadInfo.prototype.resultCode; 3557 3558 3559 /** @type {!ArrayBuffer} */ 3560 chrome.socket.ReadInfo.prototype.data; 3561 3562 3563 3564 /** 3565 * @constructor 3566 */ 3567 chrome.socket.WriteInfo = function() {}; 3568 3569 3570 /** @type {number} */ 3571 chrome.socket.WriteInfo.prototype.bytesWritten; 3572 3573 3574 3575 /** 3576 * @constructor 3577 */ 3578 chrome.socket.RecvFromInfo = function() {}; 3579 3580 3581 /** @type {number} */ 3582 chrome.socket.RecvFromInfo.prototype.resultCode; 3583 3584 3585 /** @type {!ArrayBuffer} */ 3586 chrome.socket.RecvFromInfo.prototype.data; 3587 3588 3589 /** @type {string} */ 3590 chrome.socket.RecvFromInfo.prototype.address; 3591 3592 3593 /** @type {number} */ 3594 chrome.socket.RecvFromInfo.prototype.port; 3595 3596 3597 3598 /** 3599 * @constructor 3600 */ 3601 chrome.socket.AcceptInfo = function() {}; 3602 3603 3604 /** @type {number} */ 3605 chrome.socket.AcceptInfo.prototype.resultCode; 3606 3607 3608 /** @type {(number|undefined)} */ 3609 chrome.socket.AcceptInfo.prototype.socketId; 3610 3611 3612 3613 /** 3614 * @constructor 3615 */ 3616 chrome.socket.SocketInfo = function() {}; 3617 3618 3619 /** @type {string} */ 3620 chrome.socket.SocketInfo.prototype.socketType; 3621 3622 3623 /** @type {boolean} */ 3624 chrome.socket.SocketInfo.prototype.connected; 3625 3626 3627 /** @type {(string|undefined)} */ 3628 chrome.socket.SocketInfo.prototype.peerAddress; 3629 3630 3631 /** @type {(number|undefined)} */ 3632 chrome.socket.SocketInfo.prototype.peerPort; 3633 3634 3635 /** @type {(string|undefined)} */ 3636 chrome.socket.SocketInfo.prototype.localAddress; 3637 3638 3639 /** @type {(number|undefined)} */ 3640 chrome.socket.SocketInfo.prototype.localPort; 3641 3642 3643 3644 /** 3645 * @constructor 3646 */ 3647 chrome.socket.NetworkAdapterInfo = function() {}; 3648 3649 3650 /** @type {string} */ 3651 chrome.socket.NetworkAdapterInfo.prototype.name; 3652 3653 3654 /** @type {string} */ 3655 chrome.socket.NetworkAdapterInfo.prototype.address; 3656 3657 3658 /** 3659 * @param {string} type The type of socket to create. Must be 'tcp' or 'udp'. 3660 * @param {(Object|function(!chrome.socket.CreateInfo))} optionsOrCallback The 3661 * socket options or callback. 3662 * @param {function(!chrome.socket.CreateInfo)=} opt_callback Called when the 3663 * socket has been created. 3664 */ 3665 chrome.socket.create = function(type, optionsOrCallback, opt_callback) {}; 3666 3667 3668 /** 3669 * @param {number} socketId The id of the socket to destroy. 3670 */ 3671 chrome.socket.destroy = function(socketId) {}; 3672 3673 3674 /** 3675 * @param {number} socketId The id of the socket. 3676 * @param {string} hostname The hostname or IP address of the remote machine. 3677 * @param {number} port The port of the remote machine. 3678 * @param {function(number)} callback Called when the connection attempt is 3679 * complete. 3680 */ 3681 chrome.socket.connect = function(socketId, hostname, port, callback) {}; 3682 3683 3684 /** 3685 * @param {number} socketId The id of the socket. 3686 * @param {string} address The address of the local machine. 3687 * @param {number} port The port of the local machine. 3688 * @param {function(number)} callback Called when the bind attempt is complete. 3689 */ 3690 chrome.socket.bind = function(socketId, address, port, callback) {}; 3691 3692 3693 /** 3694 * @param {number} socketId The id of the socket to disconnect. 3695 */ 3696 chrome.socket.disconnect = function(socketId) {}; 3697 3698 3699 /** 3700 * @param {number} socketId The id of the socket to read from. 3701 * @param {(number|function(!chrome.socket.ReadInfo))} bufferSizeOrCallback The 3702 * read buffer size or the callback. 3703 * @param {function(!chrome.socket.ReadInfo)=} opt_callback Called with data 3704 * that was available to be read without blocking. 3705 */ 3706 chrome.socket.read = function(socketId, bufferSizeOrCallback, opt_callback) {}; 3707 3708 3709 /** 3710 * @param {number} socketId The id of the socket to write to. 3711 * @param {!ArrayBuffer} data The data to write. 3712 * @param {function(!chrome.socket.WriteInfo)} callback Called when the write 3713 * operation completes without blocking or an error occurs. 3714 */ 3715 chrome.socket.write = function(socketId, data, callback) {}; 3716 3717 3718 /** 3719 * @param {number} socketId The id of the socket to read from. 3720 * @param {(number|function(!chrome.socket.RecvFromInfo))} bufferSizeOrCallback 3721 * The read buffer size or the callback. 3722 * @param {function(!chrome.socket.RecvFromInfo)=} opt_callback Called with data 3723 * that was available to be read without blocking. 3724 */ 3725 chrome.socket.recvFrom = function(socketId, bufferSizeOrCallback, 3726 opt_callback) {}; 3727 3728 3729 /** 3730 * @param {number} socketId The id of the socket to write to. 3731 * @param {!ArrayBuffer} data The data to write. 3732 * @param {string} address The address of the remote machine. 3733 * @param {number} port The port of the remote machine. 3734 * @param {function(!chrome.socket.WriteInfo)} callback Called when the write 3735 * operation completes without blocking or an error occurs. 3736 */ 3737 chrome.socket.sendTo = function(socketId, data, address, port, callback) {}; 3738 3739 3740 /** 3741 * @param {number} socketId The id of the socket to listen on. 3742 * @param {string} address The address of the local machine to listen on. Use 3743 * '0' to listen on all addresses. 3744 * @param {number} port The port of the local machine. 3745 * @param {(number|function(number))} backlogOrCallback The length of the 3746 * socket's listen queue or the callback. 3747 * @param {function(number)=} opt_callback Called when the listen operation 3748 * completes. 3749 */ 3750 chrome.socket.listen = 3751 function(socketId, address, port, backlogOrCallback, opt_callback) {}; 3752 3753 3754 /** 3755 * @param {number} socketId The id of the socket to accept a connection on. 3756 * @param {function(!chrome.socket.AcceptInfo)} callback Called when a new 3757 * socket is accepted. 3758 */ 3759 chrome.socket.accept = function(socketId, callback) {}; 3760 3761 3762 /** 3763 * @param {number} socketId The id of the socket to listen on. 3764 * @param {boolean} enable If true, enable keep-alive functionality. 3765 * @param {(number|function(boolean))} delayOrCallback The delay in seconds 3766 * between the last packet received and the first keepalive probe (default 3767 * is 0) or the callback 3768 * @param {function(boolean)=} opt_callback Called when the setKeepAlive attempt 3769 * is complete. 3770 */ 3771 chrome.socket.setKeepAlive = function(socketId, enable, delayOrCallback, 3772 opt_callback) {}; 3773 3774 3775 /** 3776 * @param {number} socketId The id of the socket to listen on. 3777 * @param {boolean} noDelay If true, disables Nagle's algorithm. 3778 * @param {function(boolean)} callback Called when the setNoDelay attempt is 3779 * complete. 3780 */ 3781 chrome.socket.setNoDelay = function(socketId, noDelay, callback) {}; 3782 3783 3784 /** 3785 * @param {number} socketId The id of the socket. 3786 * @param {function(!chrome.socket.SocketInfo)} callback Called when the state 3787 * is available. 3788 */ 3789 chrome.socket.getInfo = function(socketId, callback) {}; 3790 3791 3792 /** 3793 * @param {function(!Array.<!chrome.socket.NetworkAdapterInfo>)} callback Called 3794 * when local adapter information is available. 3795 */ 3796 chrome.socket.getNetworkList = function(callback) {}; 3797 3798 3799 /** 3800 * @param {number} socketId The id of the socket. 3801 * @param {string} address The group address to join. Domain names are not 3802 * supported. 3803 * @param {function(number)} callback Called when the join operation is done. 3804 */ 3805 chrome.socket.joinGroup = function(socketId, address, callback) {}; 3806 3807 3808 /** 3809 * @param {number} socketId The id of the socket. 3810 * @param {string} address The group address to leave. Domain names are not 3811 * supported. 3812 * @param {function(number)} callback Called when the leave operation is done. 3813 */ 3814 chrome.socket.leaveGroup = function(socketId, address, callback) {}; 3815 3816 3817 /** 3818 * @param {number} socketId The id of the socket. 3819 * @param {number} ttl The time-to-live value. 3820 * @param {function(number)} callback Called when the configuration operation is 3821 * done. 3822 */ 3823 chrome.socket.setMulticastTimeToLive = function(socketId, ttl, callback) {}; 3824 3825 3826 /** 3827 * @param {number} socketId The id of the socket. 3828 * @param {boolean} enabled True to enable loopback mode. 3829 * @param {function(number)} callback Called when the configuration operation is 3830 * done. 3831 */ 3832 chrome.socket.setMulticastLoopbackMode = function(socketId, enabled, 3833 callback) {}; 3834 3835 3836 /** 3837 * @param {number} socketId The id of the socket. 3838 * @param {function(!Array.<string>)} callback Called with an array of string 3839 * groups. 3840 */ 3841 chrome.socket.getJoinedGroups = function(socketId, callback) {}; 3842 3843 3844 /** 3845 * @const 3846 * @see https://developer.chrome.com/extensions/storage.html 3847 */ 3848 chrome.storage = {}; 3849 3850 3851 /** @type {!StorageArea} */ 3852 chrome.storage.sync; 3853 3854 3855 /** @type {!StorageArea} */ 3856 chrome.storage.local; 3857 3858 3859 /** @type {!StorageChangeEvent} */ 3860 chrome.storage.onChanged; 3861 3862 3863 /** @const */ 3864 chrome.system = {}; 3865 3866 3867 /** 3868 * @const 3869 * @see http://developer.chrome.com/apps/system_display.html 3870 */ 3871 chrome.system.display = {}; 3872 3873 3874 /** @type {!ChromeEvent} */ 3875 chrome.system.display.onDisplayChanged; 3876 3877 3878 /** 3879 * @constructor 3880 */ 3881 chrome.system.display.Bounds = function() {}; 3882 3883 3884 /** @type {number} */ 3885 chrome.system.display.Bounds.prototype.left; 3886 3887 3888 /** @type {number} */ 3889 chrome.system.display.Bounds.prototype.top; 3890 3891 3892 /** @type {number} */ 3893 chrome.system.display.Bounds.prototype.width; 3894 3895 3896 /** @type {number} */ 3897 chrome.system.display.Bounds.prototype.height; 3898 3899 3900 /** 3901 * @typedef {{ 3902 * left: (number|undefined), 3903 * top: (number|undefined), 3904 * right: (number|undefined), 3905 * bottom: (number|undefined) 3906 * }} 3907 */ 3908 chrome.system.display.Insets; 3909 3910 3911 /** 3912 * @constructor 3913 */ 3914 chrome.system.display.DisplayInfo = function() {}; 3915 3916 3917 /** @type {string} */ 3918 chrome.system.display.DisplayInfo.prototype.id; 3919 3920 3921 /** @type {string} */ 3922 chrome.system.display.DisplayInfo.prototype.name; 3923 3924 3925 /** @type {string} */ 3926 chrome.system.display.DisplayInfo.prototype.mirroringSourceId; 3927 3928 3929 /** @type {boolean} */ 3930 chrome.system.display.DisplayInfo.prototype.isPrimary; 3931 3932 3933 /** @type {boolean} */ 3934 chrome.system.display.DisplayInfo.prototype.isInternal; 3935 3936 3937 /** @type {boolean} */ 3938 chrome.system.display.DisplayInfo.prototype.isEnabled; 3939 3940 3941 /** @type {number} */ 3942 chrome.system.display.DisplayInfo.prototype.dpiX; 3943 3944 3945 /** @type {number} */ 3946 chrome.system.display.DisplayInfo.prototype.dpiY; 3947 3948 3949 /** @type {number} */ 3950 chrome.system.display.DisplayInfo.prototype.rotation; 3951 3952 3953 /** @type {!chrome.system.display.Bounds} */ 3954 chrome.system.display.DisplayInfo.prototype.bounds; 3955 3956 3957 /** @type {!chrome.system.display.Insets} */ 3958 chrome.system.display.DisplayInfo.prototype.overscan; 3959 3960 3961 /** @type {!chrome.system.display.Bounds} */ 3962 chrome.system.display.DisplayInfo.prototype.workArea; 3963 3964 3965 /** 3966 * @typedef {{ 3967 * mirroringSourceId: (string|undefined), 3968 * isPrimary: (boolean|undefined), 3969 * overscan: (!chrome.system.display.Insets|undefined), 3970 * rotation: (number|undefined), 3971 * boundsOriginX: (number|undefined), 3972 * boundsOriginY: (number|undefined) 3973 * }} 3974 */ 3975 chrome.system.display.SettableDisplayInfo; 3976 3977 3978 chrome.types = {}; 3979 3980 3981 /** 3982 * @typedef {?{ 3983 * format: (string|undefined), 3984 * quality: (number|undefined) 3985 * }} 3986 */ 3987 chrome.types.ImageDetails; 3988 3989 3990 /** 3991 * @param {function(!Array.<!chrome.system.display.DisplayInfo>)} 3992 * callback Called with an array of objects representing display info. 3993 */ 3994 chrome.system.display.getInfo = function(callback) {}; 3995 3996 3997 /** 3998 * @param {string} id The display's unique identifier. 3999 * @param {!chrome.system.display.SettableDisplayInfo} info The information 4000 * about display properties that should be changed. 4001 * @param {function()=} opt_callback The callback to execute when the display 4002 * info has been changed. 4003 */ 4004 chrome.system.display.setDisplayProperties = 4005 function(id, info, opt_callback) {}; 4006 4007 4008 /** 4009 * @const 4010 * @see https://developer.chrome.com/extensions/types.html 4011 */ 4012 chrome.chromeSetting = {}; 4013 4014 4015 /** @type {!ChromeEvent} */ 4016 chrome.chromeSetting.onChange; 4017 4018 4019 /** 4020 * @const 4021 * @see https://developer.chrome.com/extensions/webNavigation.html 4022 */ 4023 chrome.webNavigation = {}; 4024 4025 4026 /** 4027 * @param {Object} details Object with a 'tabId' (number) key. 4028 * @param {function(!Array.<Object.<string, (boolean|number|string)>>)} callback 4029 * Callback function. 4030 */ 4031 chrome.webNavigation.getAllFrames = function(details, callback) {}; 4032 4033 4034 /** 4035 * @param {Object} details Object with 'tabId' (number) and 'frameId' (number) 4036 * keys. 4037 * @param {function(Object.<string, (boolean|string)>)} callback 4038 * Callback function. 4039 */ 4040 chrome.webNavigation.getFrame = function(details, callback) {}; 4041 4042 4043 /** @type {!ChromeEvent} */ 4044 chrome.webNavigation.onBeforeNavigate; 4045 4046 4047 /** @type {!ChromeEvent} */ 4048 chrome.webNavigation.onCommitted; 4049 4050 4051 /** @type {!ChromeEvent} */ 4052 chrome.webNavigation.onDOMContentLoaded; 4053 4054 4055 /** @type {!ChromeEvent} */ 4056 chrome.webNavigation.onCompleted; 4057 4058 4059 /** @type {!ChromeEvent} */ 4060 chrome.webNavigation.onErrorOccurred; 4061 4062 4063 /** @type {!ChromeEvent} */ 4064 chrome.webNavigation.onCreatedNavigationTarget; 4065 4066 4067 /** @type {!ChromeEvent} */ 4068 chrome.webNavigation.onReferenceFragmentUpdated; 4069 4070 4071 /** @type {!ChromeEvent} */ 4072 chrome.webNavigation.onTabReplaced; 4073 4074 4075 /** @type {!ChromeEvent} */ 4076 chrome.webNavigation.onHistoryStateUpdated; 4077 4078 4079 4080 /** 4081 * Most event listeners for WebRequest take extra arguments. 4082 * @see https://developer.chrome.com/extensions/webRequest.html. 4083 * @constructor 4084 */ 4085 function WebRequestEvent() {} 4086 4087 4088 /** 4089 * @param {function(!Object): (void|!BlockingResponse)} listener Listener 4090 * function. 4091 * @param {!RequestFilter} filter A set of filters that restrict 4092 * the events that will be sent to this listener. 4093 * @param {Array.<string>=} opt_extraInfoSpec Array of extra information 4094 * that should be passed to the listener function. 4095 */ 4096 WebRequestEvent.prototype.addListener = 4097 function(listener, filter, opt_extraInfoSpec) {}; 4098 4099 4100 /** 4101 * @param {function(!Object): (void|!BlockingResponse)} listener Listener 4102 * function. 4103 */ 4104 WebRequestEvent.prototype.removeListener = function(listener) {}; 4105 4106 4107 /** 4108 * @param {function(!Object): (void|!BlockingResponse)} listener Listener 4109 * function. 4110 */ 4111 WebRequestEvent.prototype.hasListener = function(listener) {}; 4112 4113 4114 /** 4115 * @param {function(!Object): (void|!BlockingResponse)} listener Listener 4116 * function. 4117 */ 4118 WebRequestEvent.prototype.hasListeners = function(listener) {}; 4119 4120 4121 4122 /** 4123 * The onErrorOccurred event takes one less parameter than the others. 4124 * @see https://developer.chrome.com/extensions/webRequest.html. 4125 * @constructor 4126 */ 4127 function WebRequestOnErrorOccurredEvent() {} 4128 4129 4130 /** 4131 * @param {function(!Object): void} listener Listener function. 4132 * @param {!RequestFilter} filter A set of filters that restrict 4133 * the events that will be sent to this listener. 4134 */ 4135 WebRequestOnErrorOccurredEvent.prototype.addListener = 4136 function(listener, filter) {}; 4137 4138 4139 /** 4140 * @param {function(!Object): void} listener Listener function. 4141 */ 4142 WebRequestOnErrorOccurredEvent.prototype.removeListener = function(listener) {}; 4143 4144 4145 /** 4146 * @param {function(!Object): void} listener Listener function. 4147 */ 4148 WebRequestOnErrorOccurredEvent.prototype.hasListener = function(listener) {}; 4149 4150 4151 /** 4152 * @param {function(!Object): void} listener Listener function. 4153 */ 4154 WebRequestOnErrorOccurredEvent.prototype.hasListeners = function(listener) {}; 4155 4156 4157 /** 4158 * @const 4159 * @see https://developer.chrome.com/extensions/webRequest.html 4160 */ 4161 chrome.webRequest = {}; 4162 4163 4164 /** 4165 * @param {function(): void=} opt_callback Callback function. 4166 */ 4167 chrome.webRequest.handlerBehaviorChanged = function(opt_callback) {}; 4168 4169 4170 /** @type {!WebRequestEvent} */ 4171 chrome.webRequest.onAuthRequired; 4172 4173 4174 /** @type {!WebRequestEvent} */ 4175 chrome.webRequest.onBeforeRedirect; 4176 4177 4178 /** @type {!WebRequestEvent} */ 4179 chrome.webRequest.onBeforeRequest; 4180 4181 4182 /** @type {!WebRequestEvent} */ 4183 chrome.webRequest.onBeforeSendHeaders; 4184 4185 4186 /** @type {!WebRequestEvent} */ 4187 chrome.webRequest.onCompleted; 4188 4189 4190 /** @type {!WebRequestOnErrorOccurredEvent} */ 4191 chrome.webRequest.onErrorOccurred; 4192 4193 4194 /** @type {!WebRequestEvent} */ 4195 chrome.webRequest.onHeadersReceived; 4196 4197 4198 /** @type {!WebRequestEvent} */ 4199 chrome.webRequest.onResponseStarted; 4200 4201 4202 /** @type {!WebRequestEvent} */ 4203 chrome.webRequest.onSendHeaders; 4204 4205 4206 // Classes 4207 4208 4209 4210 /**onKeyEvent 4211 * @see https://developer.chrome.com/extensions/management.html 4212 * @constructor 4213 */ 4214 function ExtensionInfo() {} 4215 4216 4217 /** @type {string} */ 4218 ExtensionInfo.prototype.id; 4219 4220 4221 /** @type {string} */ 4222 ExtensionInfo.prototype.name; 4223 4224 4225 /** @type {string} */ 4226 ExtensionInfo.prototype.description; 4227 4228 4229 /** @type {string} */ 4230 ExtensionInfo.prototype.version; 4231 4232 4233 /** @type {boolean} */ 4234 ExtensionInfo.prototype.mayDisable; 4235 4236 4237 /** @type {boolean} */ 4238 ExtensionInfo.prototype.enabled; 4239 4240 4241 /** @type {string|undefined} */ 4242 ExtensionInfo.prototype.disabledReason; 4243 4244 4245 /** @type {boolean} */ 4246 ExtensionInfo.prototype.isApp; 4247 4248 4249 /** @type {string|undefined} */ 4250 ExtensionInfo.prototype.appLaunchUrl; 4251 4252 4253 /** @type {string|undefined} */ 4254 ExtensionInfo.prototype.homepageUrl; 4255 4256 4257 /** @type {string|undefined} */ 4258 ExtensionInfo.prototype.updateUrl; 4259 4260 4261 /** @type {boolean} */ 4262 ExtensionInfo.prototype.offlineEnabled; 4263 4264 4265 /** @type {string} */ 4266 ExtensionInfo.prototype.optionsUrl; 4267 4268 4269 /** @type {!Array.<!IconInfo>|undefined} */ 4270 ExtensionInfo.prototype.icons; 4271 4272 4273 /** @type {!Array.<string>} */ 4274 ExtensionInfo.prototype.permissions; 4275 4276 4277 /** @type {!Array.<string>} */ 4278 ExtensionInfo.prototype.hostPermissions; 4279 4280 4281 /** @type {string} */ 4282 ExtensionInfo.prototype.installType; 4283 4284 4285 /** @type {string|undefined} */ 4286 ExtensionInfo.prototype.launchType; 4287 4288 4289 /** @type {!Array.<string>|undefined} */ 4290 ExtensionInfo.prototype.availableLaunchTypes; 4291 4292 4293 4294 /** 4295 * @see https://developer.chrome.com/extensions/management.html 4296 * @constructor 4297 */ 4298 function IconInfo() {} 4299 4300 4301 /** @type {number} */ 4302 IconInfo.prototype.size; 4303 4304 4305 /** @type {string} */ 4306 IconInfo.prototype.url; 4307 4308 4309 4310 /** 4311 * @see https://developer.chrome.com/extensions/tabs 4312 * @constructor 4313 */ 4314 function Tab() {} 4315 4316 // TODO: Make this field optional once dependent projects have been updated. 4317 /** 4318 * @type {number} 4319 */ 4320 Tab.prototype.id; 4321 4322 4323 /** @type {number} */ 4324 Tab.prototype.index; 4325 4326 4327 /** @type {number} */ 4328 Tab.prototype.windowId; 4329 4330 4331 // TODO: Make this field optional once dependent projects have been updated. 4332 /** 4333 * @type {number} 4334 */ 4335 Tab.prototype.openerTabId; 4336 4337 4338 /** @type {boolean} */ 4339 Tab.prototype.highlighted; 4340 4341 4342 /** @type {boolean} */ 4343 Tab.prototype.active; 4344 4345 4346 /** @type {boolean} */ 4347 Tab.prototype.pinned; 4348 4349 4350 // TODO: Make this field optional once dependent projects have been updated. 4351 /** 4352 * @type {string} 4353 */ 4354 Tab.prototype.url; 4355 4356 4357 // TODO: Make this field optional once dependent projects have been updated. 4358 /** 4359 * @type {string} 4360 */ 4361 Tab.prototype.title; 4362 4363 4364 // TODO: Make this field optional once dependent projects have been updated. 4365 /** 4366 * @type {string} 4367 */ 4368 Tab.prototype.favIconUrl; 4369 4370 4371 // TODO: Make this field optional once dependent projects have been updated. 4372 /** 4373 * @type {string} 4374 */ 4375 Tab.prototype.status; 4376 4377 4378 /** @type {boolean} */ 4379 Tab.prototype.incognito; 4380 4381 4382 /** @type {number|undefined} */ 4383 Tab.prototype.width; 4384 4385 4386 /** @type {number|undefined} */ 4387 Tab.prototype.height; 4388 4389 4390 /** @type {number|undefined} */ 4391 Tab.prototype.sessionId; 4392 4393 4394 /** 4395 * @see https://developer.chrome.com/extensions/windows.html 4396 * @constructor 4397 */ 4398 function ChromeWindow() {} 4399 4400 4401 /** @type {number} */ 4402 ChromeWindow.prototype.id; 4403 4404 4405 /** @type {boolean} */ 4406 ChromeWindow.prototype.focused; 4407 4408 4409 /** @type {number} */ 4410 ChromeWindow.prototype.top; 4411 4412 4413 /** @type {number} */ 4414 ChromeWindow.prototype.left; 4415 4416 4417 /** @type {number} */ 4418 ChromeWindow.prototype.width; 4419 4420 4421 /** @type {number} */ 4422 ChromeWindow.prototype.height; 4423 4424 4425 /** @type {Array.<Tab>} */ 4426 ChromeWindow.prototype.tabs; 4427 4428 4429 /** @type {boolean} */ 4430 ChromeWindow.prototype.incognito; 4431 4432 4433 /** @type {string} */ 4434 ChromeWindow.prototype.type; 4435 4436 4437 /** @type {string} */ 4438 ChromeWindow.prototype.state; 4439 4440 4441 /** @type {boolean} */ 4442 ChromeWindow.prototype.alwaysOnTop; 4443 4444 4445 4446 /** 4447 * @see https://developer.chrome.com/extensions/events.html 4448 * @constructor 4449 */ 4450 function ChromeEvent() {} 4451 4452 4453 /** @param {!Function} callback */ 4454 ChromeEvent.prototype.addListener = function(callback) {}; 4455 4456 4457 /** @param {!Function} callback */ 4458 ChromeEvent.prototype.removeListener = function(callback) {}; 4459 4460 4461 /** 4462 * @param {!Function} callback 4463 * @return {boolean} 4464 */ 4465 ChromeEvent.prototype.hasListener = function(callback) {}; 4466 4467 4468 /** @return {boolean} */ 4469 ChromeEvent.prototype.hasListeners = function() {}; 4470 4471 4472 /** 4473 * Event whose listeners take a string parameter. 4474 * @constructor 4475 */ 4476 function ChromeStringEvent() {} 4477 4478 4479 /** @param {function(string): void} callback */ 4480 ChromeStringEvent.prototype.addListener = function(callback) {}; 4481 4482 4483 /** @param {function(string): void} callback */ 4484 ChromeStringEvent.prototype.removeListener = function(callback) {}; 4485 4486 4487 /** 4488 * @param {function(string): void} callback 4489 * @return {boolean} 4490 */ 4491 ChromeStringEvent.prototype.hasListener = function(callback) {}; 4492 4493 4494 /** @return {boolean} */ 4495 ChromeStringEvent.prototype.hasListeners = function() {}; 4496 4497 4498 4499 /** 4500 * Event whose listeners take a boolean parameter. 4501 * @constructor 4502 */ 4503 4504 function ChromeBooleanEvent() {} 4505 4506 4507 /** 4508 * @param {function(boolean): void} callback 4509 */ 4510 ChromeBooleanEvent.prototype.addListener = function(callback) {}; 4511 4512 4513 /** 4514 * @param {function(boolean): void} callback 4515 */ 4516 ChromeBooleanEvent.prototype.removeListener = function(callback) {}; 4517 4518 4519 /** 4520 * @param {function(boolean): void} callback 4521 * @return {boolean} 4522 */ 4523 ChromeBooleanEvent.prototype.hasListener = function(callback) {}; 4524 4525 4526 /** 4527 * @return {boolean} 4528 */ 4529 ChromeBooleanEvent.prototype.hasListeners = function() {}; 4530 4531 4532 4533 /** 4534 * Event whose listeners take a number parameter. 4535 * @constructor 4536 */ 4537 4538 function ChromeNumberEvent() {} 4539 4540 4541 /** 4542 * @param {function(number): void} callback 4543 */ 4544 ChromeNumberEvent.prototype.addListener = function(callback) {}; 4545 4546 4547 /** 4548 * @param {function(number): void} callback 4549 */ 4550 ChromeNumberEvent.prototype.removeListener = function(callback) {}; 4551 4552 4553 /** 4554 * @param {function(number): void} callback 4555 * @return {boolean} 4556 */ 4557 ChromeNumberEvent.prototype.hasListener = function(callback) {}; 4558 4559 4560 /** 4561 * @return {boolean} 4562 */ 4563 ChromeNumberEvent.prototype.hasListeners = function() {}; 4564 4565 4566 4567 /** 4568 * Event whose listeners take an Object parameter. 4569 * @constructor 4570 */ 4571 function ChromeObjectEvent() {} 4572 4573 4574 /** 4575 * @param {function(!Object): void} callback Callback. 4576 */ 4577 ChromeObjectEvent.prototype.addListener = function(callback) {}; 4578 4579 4580 /** 4581 * @param {function(!Object): void} callback Callback. 4582 */ 4583 ChromeObjectEvent.prototype.removeListener = function(callback) {}; 4584 4585 4586 /** 4587 * @param {function(!Object): void} callback Callback. 4588 * @return {boolean} 4589 */ 4590 ChromeObjectEvent.prototype.hasListener = function(callback) {}; 4591 4592 4593 /** 4594 * @return {boolean} 4595 */ 4596 ChromeObjectEvent.prototype.hasListeners = function() {}; 4597 4598 4599 4600 /** 4601 * Event whose listeners take an ExtensionInfo parameter. 4602 * @constructor 4603 */ 4604 function ChromeExtensionInfoEvent() {} 4605 4606 4607 /** @param {function(!ExtensionInfo): void} callback */ 4608 ChromeExtensionInfoEvent.prototype.addListener = function(callback) {}; 4609 4610 4611 /** @param {function(!ExtensionInfo): void} callback */ 4612 ChromeExtensionInfoEvent.prototype.removeListener = function(callback) {}; 4613 4614 4615 /** 4616 * @param {function(!ExtensionInfo): void} callback 4617 * @return {boolean} 4618 */ 4619 ChromeExtensionInfoEvent.prototype.hasListener = function(callback) {}; 4620 4621 4622 /** @return {boolean} */ 4623 ChromeExtensionInfoEvent.prototype.hasListeners = function() {}; 4624 4625 4626 /** 4627 * Event whose listeners take a string array parameter. 4628 * @constructor 4629 */ 4630 function ChromeStringArrayEvent() {} 4631 4632 4633 /** @param {function(!Array.<string>): void} callback */ 4634 ChromeStringArrayEvent.prototype.addListener = function(callback) {}; 4635 4636 4637 /** @param {function(!Array.<string>): void} callback */ 4638 ChromeStringArrayEvent.prototype.removeListener = function(callback) {}; 4639 4640 4641 /** 4642 * @param {function(!Array.<string>): void} callback 4643 * @return {boolean} 4644 */ 4645 ChromeStringArrayEvent.prototype.hasListener = function(callback) {}; 4646 4647 4648 /** @return {boolean} */ 4649 ChromeStringArrayEvent.prototype.hasListeners = function() {}; 4650 4651 4652 4653 /** 4654 * Event whose listeners take two strings as parameters. 4655 * @constructor 4656 */ 4657 function ChromeStringStringEvent() {} 4658 4659 4660 /** @param {function(string, string): void} callback */ 4661 ChromeStringStringEvent.prototype.addListener = function(callback) {}; 4662 4663 4664 /** @param {function(string, string): void} callback */ 4665 ChromeStringStringEvent.prototype.removeListener = function(callback) {}; 4666 4667 4668 /** 4669 * @param {function(string, string): void} callback 4670 * @return {boolean} 4671 */ 4672 ChromeStringStringEvent.prototype.hasListener = function(callback) {}; 4673 4674 4675 /** @return {boolean} */ 4676 ChromeStringStringEvent.prototype.hasListeners = function() {}; 4677 4678 4679 /** 4680 * @see http://developer.chrome.com/extensions/pushMessaging.html 4681 * @const 4682 */ 4683 chrome.pushMessaging = {}; 4684 4685 4686 /** 4687 * @type {!chrome.pushMessaging.PushMessageEvent} 4688 */ 4689 chrome.pushMessaging.onMessage; 4690 4691 4692 /** 4693 * @param {boolean|function(!chrome.pushMessaging.ChannelIdResult)} 4694 * interactiveOrCallback Either a flag(optional), if set to true, user will 4695 * be asked to log in if they are not already logged in, or, when he flag is 4696 * not given, the callback. 4697 * @param {function(!chrome.pushMessaging.ChannelIdResult)=} opt_callback 4698 * Callback. 4699 */ 4700 chrome.pushMessaging.getChannelId = 4701 function(interactiveOrCallback, opt_callback) {}; 4702 4703 4704 4705 /** 4706 * Event whose listeners take a chrome.pushMessaging.Message parameter. 4707 * @constructor 4708 */ 4709 chrome.pushMessaging.PushMessageEvent = function() {}; 4710 4711 4712 /** 4713 * @param {function(!chrome.pushMessaging.Message): void} callback 4714 */ 4715 chrome.pushMessaging.PushMessageEvent.prototype.addListener = 4716 function(callback) {}; 4717 4718 4719 /** 4720 * @param {function(!chrome.pushMessaging.Message): void} callback 4721 */ 4722 chrome.pushMessaging.PushMessageEvent.prototype.removeListener = 4723 function(callback) {}; 4724 4725 4726 /** 4727 * @param {function(!chrome.pushMessaging.Message): void} callback 4728 * @return {boolean} 4729 */ 4730 chrome.pushMessaging.PushMessageEvent.prototype.hasListener = 4731 function(callback) {}; 4732 4733 4734 /** 4735 * @return {boolean} 4736 */ 4737 chrome.pushMessaging.PushMessageEvent.prototype.hasListeners = function() {}; 4738 4739 4740 4741 /** 4742 * @see http://developer.chrome.com/apps/runtime.html#type-Port 4743 * @constructor 4744 */ 4745 function Port() {} 4746 4747 4748 /** @type {string} */ 4749 Port.prototype.name; 4750 4751 4752 /** @type {!ChromeEvent} */ 4753 Port.prototype.onDisconnect; 4754 4755 4756 /** @type {!ChromeEvent} */ 4757 Port.prototype.onMessage; 4758 4759 4760 /** @type {MessageSender} */ 4761 Port.prototype.sender; 4762 4763 4764 /** 4765 * @param {Object.<string>} obj Message object. 4766 */ 4767 Port.prototype.postMessage = function(obj) {}; 4768 4769 4770 /** 4771 * Note: as of 2012-04-12, this function is no longer documented on 4772 * the public web pages, but there are still existing usages. 4773 */ 4774 Port.prototype.disconnect = function() {}; 4775 4776 4777 4778 /** 4779 * @see http://developer.chrome.com/extensions/runtime.html#type-MessageSender 4780 * @constructor 4781 */ 4782 function MessageSender() {} 4783 4784 4785 /** @type {!Tab|undefined} */ 4786 MessageSender.prototype.tab; 4787 4788 4789 /** @type {string|undefined} */ 4790 MessageSender.prototype.id; 4791 4792 4793 /** @type {string|undefined} */ 4794 MessageSender.prototype.url; 4795 4796 4797 /** @type {string|undefined} */ 4798 MessageSender.prototype.tlsChannelId; 4799 4800 4801 4802 /** 4803 * @see https://developer.chrome.com/extensions/bookmarks.html#type-BookmarkTreeNode 4804 * @constructor 4805 */ 4806 function BookmarkTreeNode() {} 4807 4808 4809 /** @type {string} */ 4810 BookmarkTreeNode.prototype.id; 4811 4812 4813 /** @type {string|undefined} */ 4814 BookmarkTreeNode.prototype.parentId; 4815 4816 4817 /** @type {number|undefined} */ 4818 BookmarkTreeNode.prototype.index; 4819 4820 4821 /** @type {string|undefined} */ 4822 BookmarkTreeNode.prototype.url; 4823 4824 4825 /** @type {string} */ 4826 BookmarkTreeNode.prototype.title; 4827 4828 4829 /** @type {number|undefined} */ 4830 BookmarkTreeNode.prototype.dateAdded; 4831 4832 4833 /** @type {number|undefined} */ 4834 BookmarkTreeNode.prototype.dateGroupModified; 4835 4836 4837 /** @type {string|undefined} */ 4838 BookmarkTreeNode.prototype.unmodifiable; 4839 4840 4841 /** @type {!Array.<!BookmarkTreeNode>|undefined} */ 4842 BookmarkTreeNode.prototype.children; 4843 4844 4845 4846 /** 4847 * @see https://developer.chrome.com/extensions/dev/cookies.html#type-Cookie 4848 * @constructor 4849 */ 4850 function Cookie() {} 4851 4852 4853 /** @type {string} */ 4854 Cookie.prototype.name; 4855 4856 4857 /** @type {string} */ 4858 Cookie.prototype.value; 4859 4860 4861 /** @type {string} */ 4862 Cookie.prototype.domain; 4863 4864 4865 /** @type {boolean} */ 4866 Cookie.prototype.hostOnly; 4867 4868 4869 /** @type {string} */ 4870 Cookie.prototype.path; 4871 4872 4873 /** @type {boolean} */ 4874 Cookie.prototype.secure; 4875 4876 4877 /** @type {boolean} */ 4878 Cookie.prototype.httpOnly; 4879 4880 4881 /** @type {boolean} */ 4882 Cookie.prototype.session; 4883 4884 4885 /** @type {number} */ 4886 Cookie.prototype.expirationDate; 4887 4888 4889 /** @type {string} */ 4890 Cookie.prototype.storeId; 4891 4892 4893 4894 /** 4895 * @see https://developer.chrome.com/extensions/dev/cookies.html#type-CookieStore 4896 * @constructor 4897 */ 4898 function CookieStore() {} 4899 4900 4901 /** @type {string} */ 4902 CookieStore.prototype.id; 4903 4904 4905 /** @type {Array.<number>} */ 4906 CookieStore.prototype.tabIds; 4907 4908 4909 4910 /** 4911 * @see https://developer.chrome.com/extensions/dev/contextMenus.html#type-OnClickData 4912 * @constructor 4913 */ 4914 function OnClickData() {} 4915 4916 4917 /** @type {number} */ 4918 OnClickData.prototype.menuItemId; 4919 4920 4921 /** @type {number} */ 4922 OnClickData.prototype.parentMenuItemId; 4923 4924 4925 /** @type {string} */ 4926 OnClickData.prototype.mediaType; 4927 4928 4929 /** @type {string} */ 4930 OnClickData.prototype.linkUrl; 4931 4932 4933 /** @type {string} */ 4934 OnClickData.prototype.srcUrl; 4935 4936 4937 /** @type {string} */ 4938 OnClickData.prototype.pageUrl; 4939 4940 4941 /** @type {string} */ 4942 OnClickData.prototype.frameUrl; 4943 4944 4945 /** @type {string} */ 4946 OnClickData.prototype.selectionText; 4947 4948 4949 /** @type {string} */ 4950 OnClickData.prototype.editable; 4951 4952 4953 4954 /** 4955 * @see https://developer.chrome.com/extensions/debugger.html#type-Debuggee 4956 * @constructor 4957 */ 4958 function Debuggee() {} 4959 4960 4961 /** @type {number} */ 4962 Debuggee.prototype.tabId; 4963 4964 4965 4966 /** 4967 * @see https://developer.chrome.com/extensions/contentSettings.html#type-ResourceIdentifier 4968 * @constructor 4969 */ 4970 function ResourceIdentifier() {} 4971 4972 4973 /** @type {string} */ 4974 ResourceIdentifier.prototype.id; 4975 4976 4977 /** @type {string} */ 4978 ResourceIdentifier.prototype.description; 4979 4980 4981 4982 /** 4983 * @see https://developer.chrome.com/extensions/contentSettings.html#type-ContentSetting 4984 * @constructor 4985 */ 4986 function ContentSetting() {} 4987 4988 4989 /** 4990 * @param {!Object.<string,string>} details Settings details. 4991 * @param {function(): void=} opt_callback Callback function. 4992 */ 4993 ContentSetting.prototype.clear = function(details, opt_callback) {}; 4994 4995 4996 /** 4997 * @param {!Object.<string,(string|boolean|ResourceIdentifier)>} details 4998 * Settings details. 4999 * @param {function(): void} callback Callback function. 5000 */ 5001 ContentSetting.prototype.get = function(details, callback) {}; 5002 5003 5004 /** 5005 * @param {function(): void} callback Callback function. 5006 */ 5007 ContentSetting.prototype.getResourceIdentifiers = function(callback) {}; 5008 5009 5010 /** 5011 * @param {!Object.<string,(string|ResourceIdentifier)>} details 5012 * Settings details. 5013 * @param {function(): void=} opt_callback Callback function. 5014 */ 5015 ContentSetting.prototype.set = function(details, opt_callback) {}; 5016 5017 5018 5019 /** 5020 * @see https://developer.chrome.com/extensions/history.html#type-HistoryItem 5021 * @constructor 5022 */ 5023 function HistoryItem() {} 5024 5025 5026 /** @type {string} */ 5027 HistoryItem.prototype.id; 5028 5029 5030 /** @type {string} */ 5031 HistoryItem.prototype.url; 5032 5033 5034 /** @type {string} */ 5035 HistoryItem.prototype.title; 5036 5037 5038 /** @type {number} */ 5039 HistoryItem.prototype.lastVisitTime; 5040 5041 5042 /** @type {number} */ 5043 HistoryItem.prototype.visitCount; 5044 5045 5046 /** @type {number} */ 5047 HistoryItem.prototype.typedCount; 5048 5049 5050 5051 /** 5052 * @see https://developer.chrome.com/extensions/history.html#type-VisitItem 5053 * @constructor 5054 */ 5055 function VisitItem() {} 5056 5057 5058 /** @type {string} */ 5059 VisitItem.prototype.id; 5060 5061 5062 /** @type {string} */ 5063 VisitItem.prototype.visitId; 5064 5065 5066 /** @type {number} */ 5067 VisitItem.prototype.visitTime; 5068 5069 5070 /** @type {string} */ 5071 VisitItem.prototype.referringVisitId; 5072 5073 5074 /** @type {string} */ 5075 VisitItem.prototype.transition; 5076 5077 5078 5079 /** 5080 * @see https://developer.chrome.com/extensions/fileBrowserHandler.html#type-FileHandlerExecuteEventDetails 5081 * @constructor 5082 */ 5083 function FileHandlerExecuteEventDetails() {} 5084 5085 5086 /** @type {!Array.<!FileEntry>} */ 5087 FileHandlerExecuteEventDetails.prototype.entries; 5088 5089 5090 /** @type {number} */ 5091 FileHandlerExecuteEventDetails.prototype.tab_id; 5092 5093 5094 5095 /** 5096 * @see https://developer.chrome.com/extensions/input.ime.html#type-KeyboardEvent 5097 * @constructor 5098 */ 5099 function ChromeKeyboardEvent() {} 5100 5101 5102 /** @type {string} */ 5103 ChromeKeyboardEvent.prototype.type; 5104 5105 5106 /** @type {string} */ 5107 ChromeKeyboardEvent.prototype.requestId; 5108 5109 5110 /** @type {string} */ 5111 ChromeKeyboardEvent.prototype.key; 5112 5113 5114 /** @type {boolean} */ 5115 ChromeKeyboardEvent.prototype.altKey; 5116 5117 5118 /** @type {boolean} */ 5119 ChromeKeyboardEvent.prototype.ctrlKey; 5120 5121 5122 /** @type {boolean} */ 5123 ChromeKeyboardEvent.prototype.shiftKey; 5124 5125 5126 5127 /** 5128 * @see https://developer.chrome.com/extensions/input.ime.html#type-InputContext 5129 * @constructor 5130 */ 5131 function InputContext() {} 5132 5133 5134 /** @type {number} */ 5135 InputContext.prototype.contextID; 5136 5137 5138 /** @type {string} */ 5139 InputContext.prototype.type; 5140 5141 5142 5143 /** 5144 * @see https://developer.chrome.com/extensions/proxy.html#type-ProxyServer 5145 * @constructor 5146 */ 5147 function ProxyServer() {} 5148 5149 5150 /** @type {string} */ 5151 ProxyServer.prototype.scheme; 5152 5153 5154 /** @type {string} */ 5155 ProxyServer.prototype.host; 5156 5157 5158 /** @type {number} */ 5159 ProxyServer.prototype.port; 5160 5161 5162 5163 /** 5164 * @see https://developer.chrome.com/extensions/proxy.html#type-ProxyRules 5165 * @constructor 5166 */ 5167 function ProxyRules() {} 5168 5169 5170 /** @type {ProxyServer} */ 5171 ProxyRules.prototype.singleProxy; 5172 5173 5174 /** @type {ProxyServer} */ 5175 ProxyRules.prototype.proxyForHttp; 5176 5177 5178 /** @type {ProxyServer} */ 5179 ProxyRules.prototype.proxyForHttps; 5180 5181 5182 /** @type {ProxyServer} */ 5183 ProxyRules.prototype.proxyForFtp; 5184 5185 5186 /** @type {ProxyServer} */ 5187 ProxyRules.prototype.fallbackProxy; 5188 5189 5190 /** @type {!Array.<string>} */ 5191 ProxyRules.prototype.bypassList; 5192 5193 5194 5195 /** 5196 * @see https://developer.chrome.com/extensions/proxy.html#type-PacScript 5197 * @constructor 5198 */ 5199 function PacScript() {} 5200 5201 5202 /** @type {string} */ 5203 PacScript.prototype.url; 5204 5205 5206 /** @type {string} */ 5207 PacScript.prototype.data; 5208 5209 5210 /** @type {boolean} */ 5211 PacScript.prototype.mandatory; 5212 5213 5214 5215 /** 5216 * @see https://developer.chrome.com/extensions/proxy.html#type-ProxyConfig 5217 * @constructor 5218 */ 5219 function ProxyConfig() {} 5220 5221 5222 /** @type {ProxyRules} */ 5223 ProxyConfig.prototype.rules; 5224 5225 5226 /** @type {PacScript} */ 5227 ProxyConfig.prototype.pacScript; 5228 5229 5230 /** @type {string} */ 5231 ProxyConfig.prototype.mode; 5232 5233 5234 5235 /** 5236 * The event listener for Storage receives an Object mapping each 5237 * key that changed to its corresponding StorageChange for that item. 5238 * 5239 * @see https://developer.chrome.com/extensions/storage.html 5240 * @constructor 5241 */ 5242 function StorageChangeEvent() {} 5243 5244 5245 /** 5246 * @param {function(!Object.<string, !StorageChange>, string)} callback 5247 * Listener will receive an object that maps each key to its StorageChange, 5248 * and the namespace ("sync" or "local") of the storage area the changes 5249 * are for. 5250 */ 5251 StorageChangeEvent.prototype.addListener = function(callback) {}; 5252 5253 5254 /** @param {function(!Object.<string, !StorageChange>, string)} callback */ 5255 StorageChangeEvent.prototype.removeListener = function(callback) {}; 5256 5257 5258 /** @param {function(!Object.<string, !StorageChange>, string)} callback */ 5259 StorageChangeEvent.prototype.hasListener = function(callback) {}; 5260 5261 5262 /** @param {function(!Object.<string, !StorageChange>, string)} callback */ 5263 StorageChangeEvent.prototype.hasListeners = function(callback) {}; 5264 5265 5266 5267 /** 5268 * @see https://developer.chrome.com/extensions/storage.html#type-StorageChange 5269 * @constructor 5270 */ 5271 function StorageChange() {} 5272 5273 5274 /** @type {?} */ 5275 StorageChange.prototype.oldValue; 5276 5277 5278 /** @type {?} */ 5279 StorageChange.prototype.newValue; 5280 5281 5282 5283 /** 5284 * @see https://developer.chrome.com/extensions/storage.html#type-StorageArea 5285 * @constructor 5286 */ 5287 function StorageArea() {} 5288 5289 5290 /** 5291 * Removes all items from storage. 5292 * @param {function(): void=} opt_callback Callback function. 5293 */ 5294 StorageArea.prototype.clear = function(opt_callback) {}; 5295 5296 5297 /** 5298 * @param {(string|!Array.<string>|!Object|null)=} opt_keys 5299 * A single key to get, list of keys to get, or a dictionary 5300 * specifying default values (see description of the 5301 * object). An empty list or object will return an empty 5302 * result object. Pass in null to get the entire contents of storage. 5303 * @param {function(Object)=} opt_callback Callback with storage items, or null 5304 * on failure. 5305 */ 5306 StorageArea.prototype.get = function(opt_keys, opt_callback) {}; 5307 5308 5309 /** 5310 * @param {(string|!Array.<string>)} keys 5311 * A single key or a list of keys for items to remove. 5312 * @param {function()=} opt_callback Callback. 5313 */ 5314 StorageArea.prototype.remove = function(keys, opt_callback) {}; 5315 5316 5317 /** 5318 * @param {!Object.<string>} keys 5319 * Object specifying items to augment storage 5320 * with. Values that cannot be serialized (functions, etc) will be ignored. 5321 * @param {function()=} opt_callback Callback. 5322 */ 5323 StorageArea.prototype.set = function(keys, opt_callback) { }; 5324 5325 5326 /** 5327 * @param {(string|!Array.<string>|null)=} opt_keys 5328 * A single key or list of keys to get the total usage for. An empty list 5329 * will return 0. Pass in null to get the total usage of all of storage. 5330 * @param {function(number)=} opt_callback 5331 * Callback with the amount of space being used by storage. 5332 */ 5333 StorageArea.prototype.getBytesInUse = function(opt_keys, opt_callback) { }; 5334 5335 5336 5337 /** 5338 * @see https://developer.chrome.com/extensions/types.html#type-ChromeSetting 5339 * @constructor 5340 */ 5341 function ChromeSetting() {} 5342 5343 5344 /** 5345 * @param {Object} details Object with a 'scope' (string) key. 5346 * @param {function(): void=} opt_callback Callback function. 5347 */ 5348 ChromeSetting.prototype.clear = function(details, opt_callback) {}; 5349 5350 5351 /** 5352 * @param {Object} details Object with an 'incognito' (boolean) key. 5353 * @param {function(Object.<string, *>): void} callback Callback function. 5354 */ 5355 ChromeSetting.prototype.get = function(details, callback) {}; 5356 5357 5358 /** 5359 * @param {Object} details Object with a 'value' (*) key and an optional 5360 * 'scope' (string) key. 5361 * @param {function(): void=} opt_callback Callback function. 5362 */ 5363 ChromeSetting.prototype.set = function(details, opt_callback) {}; 5364 5365 5366 5367 /** 5368 * @see https://developer.chrome.com/extensions/webRequest.html#type-RequestFilter 5369 * @constructor 5370 */ 5371 function RequestFilter() {} 5372 5373 5374 /** @type {!Array.<string>} */ 5375 RequestFilter.prototype.urls; 5376 5377 5378 /** @type {!Array.<string>} */ 5379 RequestFilter.prototype.types; 5380 5381 5382 /** @type {number} */ 5383 RequestFilter.prototype.tabId; 5384 5385 5386 /** @type {number} */ 5387 RequestFilter.prototype.windowId; 5388 5389 5390 5391 /** 5392 * @see https://developer.chrome.com/extensions/webRequest.html#type-HttpHeaders 5393 * @constructor 5394 */ 5395 function HttpHeader() {} 5396 5397 5398 /** @type {string} */ 5399 HttpHeader.prototype.name; 5400 5401 5402 /** @type {string} */ 5403 HttpHeader.prototype.value; 5404 5405 5406 /** @type {!Array.<number>} */ 5407 HttpHeader.prototype.binaryValue; 5408 5409 5410 /** 5411 * @see https://developer.chrome.com/extensions/webRequest.html#type-HttpHeaders 5412 * @typedef {Array.<!HttpHeader>} 5413 * @private 5414 */ 5415 var HttpHeaders_; 5416 5417 5418 5419 /** 5420 * @see https://developer.chrome.com/extensions/webRequest.html#type-BlockingResponse 5421 * @constructor 5422 */ 5423 function BlockingResponse() {} 5424 5425 5426 /** @type {boolean} */ 5427 BlockingResponse.prototype.cancel; 5428 5429 5430 /** @type {string} */ 5431 BlockingResponse.prototype.redirectUrl; 5432 5433 5434 /** @type {!HttpHeaders_} */ 5435 BlockingResponse.prototype.requestHeaders; 5436 5437 5438 /** @type {!HttpHeaders_} */ 5439 BlockingResponse.prototype.responseHeaders; 5440 5441 5442 /** @type {Object.<string,string>} */ 5443 BlockingResponse.prototype.authCredentials; 5444 5445 5446 5447 /** 5448 * @see http://developer.chrome.com/extensions/pushMessaging.html#type-Message 5449 * @constructor 5450 */ 5451 chrome.pushMessaging.Message = function() {}; 5452 5453 5454 /** 5455 * @type {number} 5456 */ 5457 chrome.pushMessaging.Message.prototype.subchannelId; 5458 5459 5460 /** 5461 * @type {string} 5462 */ 5463 chrome.pushMessaging.Message.prototype.payload; 5464 5465 5466 5467 /** 5468 * @see http://developer.chrome.com/extensions/pushMessaging.html#type-ChannelIdResult 5469 * @constructor 5470 */ 5471 chrome.pushMessaging.ChannelIdResult = function() {}; 5472 5473 5474 /** 5475 * @type {string} 5476 */ 5477 chrome.pushMessaging.ChannelIdResult.prototype.channelId; 5478 5479 5480 /** 5481 * The {@code chrome.fileSystem} API makes use of the Entry and FileEntry types 5482 * defined in {@code javascript/externs/fileapi.js}. 5483 * @const 5484 * @see http://developer.chrome.com/apps/fileSystem.html 5485 */ 5486 chrome.fileSystem = {}; 5487 5488 5489 /** 5490 * @param {!Entry} entry The entry to get the display path for. The entry can 5491 * originally be obtained through 5492 * {@code chrome.fileSystem.chooseEntry} or 5493 * {@code chrome.fileSystem.restoreEntry}. 5494 * @param {function(string)} callback A success callback. 5495 * @see http://developer.chrome.com/apps/fileSystem.html#method-getDisplayPath 5496 */ 5497 chrome.fileSystem.getDisplayPath = function(entry, callback) {}; 5498 5499 5500 /** 5501 * @param {!Entry} entry The entry to get a writable entry for. 5502 * @param {function(!Entry)} callback A success callback. 5503 * @see http://developer.chrome.com/apps/fileSystem.html#method-getWritableEntry 5504 */ 5505 chrome.fileSystem.getWritableEntry = function(entry, callback) {}; 5506 5507 5508 /** 5509 * @param {!Entry} entry The entry to query writability. 5510 * @param {function(boolean)} callback A success callback. 5511 * @see http://developer.chrome.com/apps/fileSystem.html#method-isWritableEntry 5512 */ 5513 chrome.fileSystem.isWritableEntry = function(entry, callback) {}; 5514 5515 5516 /** 5517 * @typedef {{ 5518 * description: (string|undefined), 5519 * mimeTypes: (!Array.<string>|undefined), 5520 * extensions: (!Array.<string>|undefined) 5521 * }} 5522 * @see http://developer.chrome.com/apps/fileSystem.html#method-chooseEntry 5523 */ 5524 chrome.fileSystem.AcceptsOption; 5525 5526 5527 /** 5528 * @typedef {{ 5529 * type: (string|undefined), 5530 * suggestedName: (string|undefined), 5531 * accepts: (!Array.<!chrome.fileSystem.AcceptsOption>|undefined), 5532 * acceptsAllTypes: (boolean|undefined), 5533 * acceptsMultiple: (boolean|undefined) 5534 * }} 5535 * @see http://developer.chrome.com/apps/fileSystem.html#method-chooseEntry 5536 */ 5537 chrome.fileSystem.ChooseEntryOptions; 5538 5539 5540 /** 5541 * @param {!chrome.fileSystem.ChooseEntryOptions| 5542 * function(Entry=, !Array.<!FileEntry>=)} optionsOrCallback The 5543 * options for the file prompt or the callback. 5544 * @param {function(Entry=, !Array.<!FileEntry>=)=} opt_callback A success 5545 * callback, if arg1 is options. 5546 * @see http://developer.chrome.com/apps/fileSystem.html#method-chooseEntry 5547 */ 5548 chrome.fileSystem.chooseEntry = function(optionsOrCallback, opt_callback) {}; 5549 5550 5551 /** 5552 * @param {string} id The ID of the file entry to restore. 5553 * @param {function(!Entry)} callback A success callback. 5554 * @see http://developer.chrome.com/apps/fileSystem.html#method-restoreEntry 5555 */ 5556 chrome.fileSystem.restoreEntry = function(id, callback) {}; 5557 5558 5559 /** 5560 * @param {string} id The ID of the file entry to query restorability. 5561 * @param {function(boolean)} callback A success callback. 5562 * @see http://developer.chrome.com/apps/fileSystem.html#method-isRestorable 5563 */ 5564 chrome.fileSystem.isRestorable = function(id, callback) {}; 5565 5566 5567 /** 5568 * @param {!Entry} entry The entry to regain access to. 5569 * @return {string} The ID that can be passed to restoreEntry to regain access 5570 * to the given file entry. 5571 * @see http://developer.chrome.com/apps/fileSystem.html#method-retainEntry 5572 */ 5573 chrome.fileSystem.retainEntry = function(entry) {}; 5574 5575 5576 /** 5577 * @const 5578 * @see http://developer.chrome.com/extensions/alarms.html 5579 */ 5580 chrome.alarms = {}; 5581 5582 5583 /** 5584 * Creates an alarm. Near the time(s) specified by alarmInfo, the onAlarm event 5585 * is fired. If there is another alarm with the same name (or no name if none is 5586 * specified), it will be cancelled and replaced by this alarm. 5587 * @param {string|!chrome.alarms.AlarmCreateInfo} nameOrAlarmCreateInfo Either 5588 * the name to identify this alarm or the info used to create the alarm. If 5589 * no name is passed, the empty string is used to identify the alarm. 5590 * @param {!chrome.alarms.AlarmCreateInfo=} opt_alarmInfo If a name was passed 5591 * as arg1, the info used to create the alarm. 5592 * @see http://developer.chrome.com/extensions/alarms.html#method-create 5593 */ 5594 chrome.alarms.create = function(nameOrAlarmCreateInfo, opt_alarmInfo) {}; 5595 5596 5597 /** 5598 * Retrieves details about the specified alarm. 5599 * @param {string|function(!chrome.alarms.Alarm)} nameOrCallback The name 5600 * of the alarm to get or the callback to invoke with the alarm. If no name 5601 * is passed, the empty string is used to get the alarm. 5602 * @param {function(!chrome.alarms.Alarm)=} opt_callback If a name was passed 5603 * as arg1, the callback to invoke with the alarm. 5604 * @see http://developer.chrome.com/extensions/alarms.html#method-get 5605 */ 5606 chrome.alarms.get = function(nameOrCallback, opt_callback) {}; 5607 5608 5609 /** 5610 * Gets an array of all the alarms. 5611 * @param {function(!Array.<!chrome.alarms.Alarm>)} callback 5612 * @see http://developer.chrome.com/extensions/alarms.html#method-getAll 5613 */ 5614 chrome.alarms.getAll = function(callback) {}; 5615 5616 5617 /** 5618 * Clears the alarm with the given name. 5619 * @param {string=} opt_name 5620 * @see http://developer.chrome.com/extensions/alarms.html#method-clear 5621 */ 5622 chrome.alarms.clear = function(opt_name) {}; 5623 5624 5625 /** 5626 * Clears all alarms. 5627 * @see http://developer.chrome.com/extensions/alarms.html#method-clearAll 5628 */ 5629 chrome.alarms.clearAll = function() {}; 5630 5631 5632 /** 5633 * Fired when an alarm has elapsed. Useful for event pages. 5634 * @type {!chrome.alarms.AlarmEvent} 5635 * @see http://developer.chrome.com/extensions/alarms.html#event-onAlarm 5636 */ 5637 chrome.alarms.onAlarm; 5638 5639 5640 5641 /** 5642 * @constructor 5643 */ 5644 chrome.alarms.AlarmEvent = function() {}; 5645 5646 5647 /** 5648 * @param {function(!chrome.alarms.Alarm): void} callback 5649 */ 5650 chrome.alarms.AlarmEvent.prototype.addListener = function(callback) {}; 5651 5652 5653 /** 5654 * @param {function(!chrome.alarms.Alarm): void} callback 5655 */ 5656 chrome.alarms.AlarmEvent.prototype.removeListener = function(callback) {}; 5657 5658 5659 /** 5660 * @param {function(!chrome.alarms.Alarm): void} callback 5661 * @return {boolean} 5662 */ 5663 chrome.alarms.AlarmEvent.prototype.hasListener = function(callback) {}; 5664 5665 5666 /** 5667 * @return {boolean} 5668 */ 5669 chrome.alarms.AlarmEvent.prototype.hasListeners = function() {}; 5670 5671 5672 5673 /** 5674 * @interface 5675 * @see http://developer.chrome.com/extensions/alarms.html#type-Alarm 5676 */ 5677 chrome.alarms.Alarm = function() {}; 5678 5679 5680 /** 5681 * Name of this alarm. 5682 * @type {string} 5683 */ 5684 chrome.alarms.Alarm.prototype.name; 5685 5686 5687 /** 5688 * Time at which this alarm was scheduled to fire, in milliseconds past the 5689 * epoch (e.g. Date.now() + n). For performance reasons, the alarm may have been 5690 * delayed an arbitrary amount beyond this. 5691 * @type {number} 5692 */ 5693 chrome.alarms.Alarm.prototype.scheduledTime; 5694 5695 5696 /** 5697 * If not null, the alarm is a repeating alarm and will fire again in 5698 * periodInMinutes minutes. 5699 * @type {?number} 5700 */ 5701 chrome.alarms.Alarm.prototype.periodInMinutes; 5702 5703 5704 /** 5705 * @typedef {{ 5706 * when: (number|undefined), 5707 * delayInMinutes: (number|undefined), 5708 * periodInMinutes: (number|undefined) 5709 * }} 5710 * @see http://developer.chrome.com/extensions/alarms.html#method-create 5711 */ 5712 chrome.alarms.AlarmCreateInfo; 5713 5714 5715 /** 5716 * @see https://developer.chrome.com/apps/hid 5717 * @const 5718 */ 5719 chrome.hid = {}; 5720 5721 5722 /** 5723 * @typedef {?{ 5724 * vendorId: number, 5725 * productId: number 5726 * }} 5727 * @see https://developer.chrome.com/apps/hid#method-getDevices 5728 */ 5729 chrome.hid.HidGetDevicesOptions; 5730 5731 /** 5732 * @typedef {?{ 5733 * usagePage: number, 5734 * usage: number, 5735 * reportIds: !Array.<number> 5736 * }} 5737 * @see https://developer.chrome.com/apps/hid#method-getDevices 5738 */ 5739 chrome.hid.HidDeviceUsage; 5740 5741 /** 5742 * @typedef {?{ 5743 * deviceId: number, 5744 * vendorId: number, 5745 * productId: number, 5746 * collections: !Array.<!chrome.hid.HidDeviceUsage>, 5747 * maxInputReportSize: number, 5748 * maxOutputReportSize: number, 5749 * maxFeatureReportSize: number 5750 * }} 5751 * @see https://developer.chrome.com/apps/hid#method-getDevices 5752 */ 5753 chrome.hid.HidDeviceInfo; 5754 5755 5756 /** 5757 * @typedef {?{ 5758 * connectionId: number 5759 * }} 5760 * @see https://developer.chrome.com/apps/hid#method-connect 5761 */ 5762 chrome.hid.HidConnectInfo; 5763 5764 5765 /** 5766 * @see https://developer.chrome.com/apps/hid#method-getDevices 5767 * Enumerates all the connected HID devices specified by the 5768 * vendorId/productId/interfaceId tuple. 5769 * @param {!chrome.hid.HidGetDevicesOptions} options The properties to search 5770 * for on target devices. 5771 * @param {function(!Array.<!Object>)} callback Invoked with a list of 5772 * |HidDeviceInfo|s on complete. 5773 */ 5774 chrome.hid.getDevices = function(options, callback) {}; 5775 5776 5777 /** 5778 * @see https://developer.chrome.com/apps/hid#method-connect 5779 * Opens a connection to a HID device for communication. 5780 * @param {number} deviceId The ID of the device to open. 5781 * @param {function(!Object=)} callback Invoked with an |HidConnectInfo| if the 5782 * connection succeeds, or undefined if it fails. 5783 */ 5784 chrome.hid.connect = function(deviceId, callback) {}; 5785 5786 5787 /** 5788 * @see https://developer.chrome.com/apps/hid#method-disconnect 5789 * Disconnects from a device. 5790 * @param {number} connectionId The connection to close. 5791 * @param {function()=} opt_callback The callback to invoke once the connection 5792 * is closed. 5793 */ 5794 chrome.hid.disconnect = function(connectionId, opt_callback) {}; 5795 5796 5797 /** 5798 * @see https://developer.chrome.com/apps/hid#method-receive 5799 * Receives an input report from an HID device. 5800 * @param {number} connectionId The connection from which to receive the report. 5801 * @param {function(number, !ArrayBuffer)} callback The callback to invoke with 5802 * the received report. 5803 */ 5804 chrome.hid.receive = function(connectionId, callback) {}; 5805 5806 5807 /** 5808 * @see https://developer.chrome.com/apps/hid#method-send 5809 * Sends an output report to an HID device. 5810 * @param {number} connectionId The connection to which to send the report. 5811 * @param {number} reportId The report ID to use, or 0 if none. 5812 * @param {!ArrayBuffer} data The report data. 5813 * @param {function()} callback The callback to invoke once the write is 5814 * finished. 5815 */ 5816 chrome.hid.send = function(connectionId, reportId, data, callback) {}; 5817 5818 5819 /** 5820 * @see https://developer.chrome.com/apps/hid#method-receiveFeatureReport 5821 * Receives a feature report from the device. 5822 * @param {number} connectionId The connection from which to read the feature 5823 * report. 5824 * @param {number} reportId The report ID to use, or 0 if none. 5825 * @param {number} size The size of the feature report to receive. 5826 * @param {function(!ArrayBuffer)} callback The callback to invoke with the 5827 * received report. 5828 */ 5829 chrome.hid.receiveFeatureReport = 5830 function(connectionId, reportId, size, callback) {}; 5831 5832 5833 /** 5834 * @see https://developer.chrome.com/apps/hid#method-sendFeatureReport 5835 * Sends a feature report to the device. 5836 * @param {number} connectionId The connection to which to send the feature 5837 * report. 5838 * @param {number} reportId The report ID to use, or 0 if none. 5839 * @param {!ArrayBuffer} data The report data. 5840 * @param {function()} callback The callback to invoke once the write is 5841 * finished. 5842 */ 5843 chrome.hid.sendFeatureReport = 5844 function(connectionId, reportId, data, callback) {}; 5845 5846 5847 /** 5848 * @see http://developer.chrome.com/extensions/notifications.html 5849 * @const 5850 */ 5851 chrome.notifications = {}; 5852 5853 5854 /** 5855 * @typedef {{ 5856 * title: string, 5857 * iconUrl: (string|undefined) 5858 * }} 5859 * @see http://developer.chrome.com/extensions/notifications.html#type-NotificationOptions 5860 */ 5861 chrome.notifications.NotificationButton; 5862 5863 5864 /** 5865 * @typedef {{ 5866 * title: string, 5867 * message: string 5868 * }} 5869 * @see http://developer.chrome.com/extensions/notifications.html#type-NotificationOptions 5870 */ 5871 chrome.notifications.NotificationItem; 5872 5873 5874 /** 5875 * @typedef {{ 5876 * type: (string|undefined), 5877 * iconUrl: (string|undefined), 5878 * title: (string|undefined), 5879 * message: (string|undefined), 5880 * contextMessage: (string|undefined), 5881 * priority: (number|undefined), 5882 * eventTime: (number|undefined), 5883 * buttons: (!Array.<!chrome.notifications.NotificationButton>|undefined), 5884 * imageUrl: (string|undefined), 5885 * items: (!Array.<!chrome.notifications.NotificationItem>|undefined), 5886 * progress: (number|undefined), 5887 * isClickable: (boolean|undefined) 5888 * }} 5889 * @see http://developer.chrome.com/extensions/notifications.html#type-NotificationOptions 5890 */ 5891 chrome.notifications.NotificationOptions; 5892 5893 5894 /** 5895 * @typedef {function(string): void} 5896 * @see http://developer.chrome.com/extensions/notifications.html#method-create 5897 * @see http://developer.chrome.com/extensions/notifications.html#event-onClicked 5898 */ 5899 chrome.notifications.StringCallback; 5900 5901 5902 /** 5903 * @typedef {function(boolean): void} 5904 * @see http://developer.chrome.com/extensions/notifications.html#method-update 5905 * @see http://developer.chrome.com/extensions/notifications.html#method-clear 5906 */ 5907 chrome.notifications.BooleanCallback; 5908 5909 5910 /** 5911 * @typedef {function(!Object): void} 5912 * @see http://developer.chrome.com/extensions/notifications.html#method-getAll 5913 */ 5914 chrome.notifications.ObjectCallback; 5915 5916 5917 /** 5918 * @typedef {function(string, boolean): void} 5919 * @see http://developer.chrome.com/extensions/notifications.html#event-onClosed 5920 */ 5921 chrome.notifications.ClosedCallback; 5922 5923 5924 /** 5925 * @typedef {function(string, number): void} 5926 * @see http://developer.chrome.com/extensions/notifications.html#event-onButtonClicked 5927 */ 5928 chrome.notifications.ButtonCallback; 5929 5930 5931 /** 5932 * @param {string} notificationId 5933 * @param {!chrome.notifications.NotificationOptions} options 5934 * @param {!chrome.notifications.StringCallback} callback 5935 * @see http://developer.chrome.com/extensions/notifications.html#method-create 5936 */ 5937 chrome.notifications.create = function(notificationId, options, callback) {}; 5938 5939 5940 /** 5941 * @param {string} notificationId 5942 * @param {!chrome.notifications.NotificationOptions} options 5943 * @param {!chrome.notifications.BooleanCallback} callback 5944 * @see http://developer.chrome.com/extensions/notifications.html#method-update 5945 */ 5946 chrome.notifications.update = function(notificationId, options, callback) {}; 5947 5948 5949 /** 5950 * @param {string} notificationId 5951 * @param {!chrome.notifications.BooleanCallback} callback 5952 * @see http://developer.chrome.com/extensions/notifications.html#method-clear 5953 */ 5954 chrome.notifications.clear = function(notificationId, callback) {}; 5955 5956 5957 /** 5958 * @see http://developer.chrome.com/extensions/notifications.html#method-getAll 5959 * @param {!chrome.notifications.ObjectCallback} callback 5960 */ 5961 chrome.notifications.getAll = function(callback) {}; 5962 5963 5964 /** 5965 * @see http://developer.chrome.com/extensions/notifications.html#method-getPermissionLevel 5966 * @param {function(string)} callback takes 'granted' or 'denied' 5967 */ 5968 chrome.notifications.getPermissionLevel = function(callback) {}; 5969 5970 5971 /** 5972 * @type {!chrome.notifications.ClosedEvent} 5973 * @see http://developer.chrome.com/extensions/notifications.html#event-onClosed 5974 */ 5975 chrome.notifications.onClosed; 5976 5977 5978 /** 5979 * @type {!chrome.notifications.ClickedEvent} 5980 * @see http://developer.chrome.com/extensions/notifications.html#event-onClicked 5981 */ 5982 chrome.notifications.onClicked; 5983 5984 5985 /** 5986 * @type {!chrome.notifications.ButtonClickedEvent} 5987 * @see http://developer.chrome.com/extensions/notifications.html#event-onButtonClicked 5988 */ 5989 chrome.notifications.onButtonClicked; 5990 5991 5992 5993 /** 5994 * @interface 5995 * @see http://developer.chrome.com/extensions/notifications.html#event-onClosed 5996 */ 5997 chrome.notifications.ClosedEvent = function() {}; 5998 5999 6000 /** 6001 * @param {!chrome.notifications.ClosedCallback} callback 6002 */ 6003 chrome.notifications.ClosedEvent.prototype.addListener = function(callback) {}; 6004 6005 6006 /** 6007 * @param {!chrome.notifications.ClosedCallback} callback 6008 */ 6009 chrome.notifications.ClosedEvent.prototype.removeListener = 6010 function(callback) {}; 6011 6012 6013 /** 6014 * @param {!chrome.notifications.ClosedCallback} callback 6015 * @return {boolean} 6016 */ 6017 chrome.notifications.ClosedEvent.prototype.hasListener = function(callback) {}; 6018 6019 6020 /** 6021 * @return {boolean} 6022 */ 6023 chrome.notifications.ClosedEvent.prototype.hasListeners = function() {}; 6024 6025 6026 6027 /** 6028 * @interface 6029 * @see http://developer.chrome.com/extensions/notifications.html#event-onClicked 6030 */ 6031 chrome.notifications.ClickedEvent = function() {}; 6032 6033 6034 /** 6035 * @param {!chrome.notifications.StringCallback} callback 6036 */ 6037 chrome.notifications.ClickedEvent.prototype.addListener = function(callback) {}; 6038 6039 6040 /** 6041 * @param {!chrome.notifications.StringCallback} callback 6042 */ 6043 chrome.notifications.ClickedEvent.prototype.removeListener = 6044 function(callback) {}; 6045 6046 6047 /** 6048 * @param {!chrome.notifications.StringCallback} callback 6049 * @return {boolean} 6050 */ 6051 chrome.notifications.ClickedEvent.prototype.hasListener = function(callback) {}; 6052 6053 6054 /** 6055 * @return {boolean} 6056 */ 6057 chrome.notifications.ClickedEvent.prototype.hasListeners = function() {}; 6058 6059 6060 6061 /** 6062 * @interface 6063 * @see http://developer.chrome.com/extensions/notifications.html#event-onButtonClicked 6064 */ 6065 chrome.notifications.ButtonClickedEvent = function() {}; 6066 6067 6068 /** 6069 * @param {!chrome.notifications.ButtonCallback} callback 6070 */ 6071 chrome.notifications.ButtonClickedEvent.prototype.addListener = 6072 function(callback) {}; 6073 6074 6075 /** 6076 * @param {!chrome.notifications.ButtonCallback} callback 6077 */ 6078 chrome.notifications.ButtonClickedEvent.prototype.removeListener = 6079 function(callback) {}; 6080 6081 6082 /** 6083 * @param {!chrome.notifications.ButtonCallback} callback 6084 * @return {boolean} 6085 */ 6086 chrome.notifications.ButtonClickedEvent.prototype.hasListener = 6087 function(callback) {}; 6088 6089 6090 /** 6091 * @return {boolean} 6092 */ 6093 chrome.notifications.ButtonClickedEvent.prototype.hasListeners = function() {}; 6094 6095 6096 6097 /** 6098 * @const 6099 * @see http://developer.chrome.com/apps/system_storage.html 6100 */ 6101 chrome.system.storage = {}; 6102 6103 6104 6105 /** @constructor */ 6106 chrome.system.storage.StorageUnitInfo = function() {}; 6107 6108 6109 /** @type {string} */ 6110 chrome.system.storage.StorageUnitInfo.id; 6111 6112 6113 /** @type {string} */ 6114 chrome.system.storage.StorageUnitInfo.name; 6115 6116 6117 /** @type {string} Any of 'fixed', 'removable', or 'unknown' */ 6118 chrome.system.storage.StorageUnitInfo.type; 6119 6120 6121 /** @type {number} */ 6122 chrome.system.storage.StorageUnitInfo.capacity; 6123 6124 6125 6126 /** 6127 * Event whose listeners take a StorageUnitInfoEvent parameter. 6128 * @constructor 6129 */ 6130 chrome.system.storage.StorageUnitInfoEvent = function() {}; 6131 6132 6133 /** @param {function(!chrome.system.storage.StorageUnitInfo): void} callback */ 6134 chrome.system.storage.StorageUnitInfoEvent.prototype.addListener = 6135 function(callback) {}; 6136 6137 6138 /** @param {function(!chrome.system.storage.StorageUnitInfo): void} callback */ 6139 chrome.system.storage.StorageUnitInfoEvent.prototype.removeListener = 6140 function(callback) {}; 6141 6142 6143 /** 6144 * @param {function(!chrome.system.storage.StorageUnitInfo): void} callback 6145 * @return {boolean} 6146 */ 6147 chrome.system.storage.StorageUnitInfoEvent.prototype.hasListener = 6148 function(callback) {}; 6149 6150 6151 /** @return {boolean} */ 6152 chrome.system.storage.StorageUnitInfoEvent.prototype.hasListeners = 6153 function() {}; 6154 6155 6156 /** @type {chrome.system.storage.StorageUnitInfoEvent} */ 6157 chrome.system.storage.onAttached; 6158 6159 6160 /** @type {!ChromeStringEvent} */ 6161 chrome.system.storage.onDetached; 6162 6163 6164 /** 6165 * Gets the storage information from the system. 6166 * @param {function(!Array.<!chrome.system.storage.StorageUnitInfo>)} callback 6167 */ 6168 chrome.system.storage.getInfo = function(callback) {}; 6169 6170 6171 /** 6172 * Ejects a removable storage device. 6173 * @param {string} id The transient device ID from StorageUnitInfo. 6174 * @param {function(string)} callback Callback function where the value 6175 * is any of: "success", "in_use", "no_such_device", "failure" 6176 */ 6177 chrome.system.storage.ejectDevice = function(id, callback) {}; 6178 6179 6180 /** 6181 * Gets the available capacity of a specified storage device. 6182 * @param {string} id The transient device ID from StorageUnitInfo. 6183 * @param {function(Object.<string, number>)} callback A callback function that 6184 * accepts an object with {@code id} and {@code availableCapacity} fields. 6185 */ 6186 chrome.system.storage.getAvailableCapacity = function(id, callback) {}; 6187 6188 6189 /** 6190 * @see http://developer.chrome.com/apps/usb.html 6191 * @const 6192 */ 6193 chrome.usb = {}; 6194 6195 6196 6197 /** @constructor */ 6198 chrome.usb.Device = function Device() {}; 6199 6200 6201 /** @type {number} */ 6202 chrome.usb.Device.prototype.device; 6203 6204 6205 /** @type {number} */ 6206 chrome.usb.Device.prototype.vendorId; 6207 6208 6209 /** @type {number} */ 6210 chrome.usb.Device.prototype.productId; 6211 6212 6213 6214 /** @constructor */ 6215 chrome.usb.ConnectionHandle = function ConnectionHandle() {}; 6216 6217 6218 /** @type {number} */ 6219 chrome.usb.ConnectionHandle.prototype.handle; 6220 6221 6222 /** @type {number} */ 6223 chrome.usb.ConnectionHandle.prototype.vendorId; 6224 6225 6226 /** @type {number} */ 6227 chrome.usb.ConnectionHandle.prototype.productId; 6228 6229 6230 6231 /** 6232 * @typedef {?{ 6233 * direction: string, 6234 * endpoint: number, 6235 * length: (number|undefined), 6236 * data: (!ArrayBuffer|undefined) 6237 * }} 6238 */ 6239 chrome.usb.GenericTransferInfo; 6240 6241 6242 /** 6243 * @typedef {?{ 6244 * direction: string, 6245 * recipient: string, 6246 * requestType: string, 6247 * request: number, 6248 * value: number, 6249 * index: number, 6250 * length: (number|undefined), 6251 * data: (!ArrayBuffer|undefined) 6252 * }} 6253 */ 6254 chrome.usb.ControlTransferInfo; 6255 6256 6257 6258 /** @constructor */ 6259 chrome.usb.TransferResultInfo = function() {}; 6260 6261 6262 /** @type {number|undefined} */ 6263 chrome.usb.TransferResultInfo.prototype.resultCode; 6264 6265 6266 /** @type {!ArrayBuffer|undefined} */ 6267 chrome.usb.TransferResultInfo.prototype.data; 6268 6269 6270 /** 6271 * @typedef {?{ 6272 * deviceId: number, 6273 * productId: number, 6274 * interfaceId: (number|undefined) 6275 * }} 6276 */ 6277 chrome.usb.FindDevicesOptions; 6278 6279 6280 /** 6281 * @see http://developer.chrome.com/apps/usb.html#method-getDevices 6282 * @param {!Object} options The properties to search for on target devices. 6283 * @param {function(!Array.<!chrome.usb.Device>)} callback Invoked with a list 6284 * of |Device|s on complete. 6285 */ 6286 chrome.usb.getDevices = function(options, callback) {}; 6287 6288 6289 /** 6290 * @see http://developer.chrome.com/apps/usb.html#method-requestAccess 6291 * @param {!chrome.usb.Device} device The device to request access to. 6292 * @param {number} interfaceId 6293 * @param {function(boolean)} callback 6294 */ 6295 chrome.usb.requestAccess = function(device, interfaceId, callback) {}; 6296 6297 6298 /** 6299 * @see http://developer.chrome.com/apps/usb.html#method-openDevice 6300 * @param {!chrome.usb.Device} device The device to open. 6301 * @param {function(!chrome.usb.ConnectionHandle=)} callback Invoked with the 6302 * created ConnectionHandle on complete. 6303 */ 6304 chrome.usb.openDevice = function(device, callback) {}; 6305 6306 6307 /** 6308 * @see http://developer.chrome.com/apps/usb.html#method-findDevices 6309 * @param {!chrome.usb.FindDevicesOptions} options The properties to search for 6310 * on target devices. 6311 * @param {function(!Array.<!chrome.usb.ConnectionHandle>)} callback Invoked 6312 * with the opened ConnectionHandle on complete. 6313 */ 6314 chrome.usb.findDevices = function(options, callback) {}; 6315 6316 6317 /** 6318 * @see http://developer.chrome.com/apps/usb.html#method-closeDevice 6319 * @param {!chrome.usb.ConnectionHandle} handle The connection handle to close. 6320 * @param {function()=} opt_callback The callback to invoke once the device is 6321 * closed. 6322 */ 6323 chrome.usb.closeDevice = function(handle, opt_callback) {}; 6324 6325 6326 /** 6327 * @see http://developer.chrome.com/apps/usb.html#method-listInterfaces 6328 * @param {!chrome.usb.ConnectionHandle} handle The device from which the 6329 * interfaces should be listed. 6330 * @param {function(!Array.<!Object>)} callback 6331 * The callback to invoke when the interfaces are enumerated. 6332 */ 6333 chrome.usb.listInterfaces = function(handle, callback) {}; 6334 6335 6336 /** 6337 * @see http://developer.chrome.com/apps/usb.html#method-claimInterface 6338 * @param {!chrome.usb.ConnectionHandle} handle The device on which the 6339 * interface is to be claimed. 6340 * @param {number} interfaceNumber 6341 * @param {function()} callback The callback to invoke once the interface is 6342 * claimed. 6343 */ 6344 chrome.usb.claimInterface = function(handle, interfaceNumber, callback) {}; 6345 6346 6347 /** 6348 * @see http://developer.chrome.com/apps/usb.html#method-releaseInterface 6349 * @param {!chrome.usb.ConnectionHandle} handle The device on which the 6350 * interface is to be released. 6351 * @param {number} interfaceNumber 6352 * @param {function()} callback The callback to invoke once the interface is 6353 * released. 6354 */ 6355 chrome.usb.releaseInterface = function(handle, interfaceNumber, callback) {}; 6356 6357 6358 /** 6359 * @see http://developer.chrome.com/apps/usb.html#method-setInterfaceAlternateSetting 6360 * @param {!chrome.usb.ConnectionHandle} handle The device on which the 6361 * interface settings are to be set. 6362 * @param {number} interfaceNumber 6363 * @param {number} alternateSetting The alternate setting to set. 6364 * @param {function()} callback The callback to invoke once the interface 6365 * setting is set. 6366 */ 6367 chrome.usb.setInterfaceAlternateSetting = function( 6368 handle, interfaceNumber, alternateSetting, callback) {}; 6369 6370 6371 /** 6372 * @see http://developer.chrome.com/apps/usb.html#method-controlTransfer 6373 * @param {!chrome.usb.ConnectionHandle} handle A connection handle to make the 6374 * transfer on. 6375 * @param {!chrome.usb.ControlTransferInfo} transferInfo The parameters to the 6376 * transfer. 6377 * @param {function(!chrome.usb.TransferResultInfo)} callback Invoked once the 6378 * transfer has completed. 6379 */ 6380 chrome.usb.controlTransfer = function(handle, transferInfo, callback) {}; 6381 6382 6383 /** 6384 * @see http://developer.chrome.com/apps/usb.html#method-bulkTransfer 6385 * @param {!chrome.usb.ConnectionHandle} handle A connection handle to make 6386 * the transfer on. 6387 * @param {!chrome.usb.GenericTransferInfo} transferInfo The parameters to the 6388 * transfer. See GenericTransferInfo. 6389 * @param {function(!chrome.usb.TransferResultInfo)} callback Invoked once the 6390 * transfer has completed. 6391 */ 6392 chrome.usb.bulkTransfer = function(handle, transferInfo, callback) {}; 6393 6394 6395 /** 6396 * @see http://developer.chrome.com/apps/usb.html#method-interruptTransfer 6397 * @param {!chrome.usb.ConnectionHandle} handle A connection handle to make the 6398 * transfer on. 6399 * @param {!chrome.usb.GenericTransferInfo} transferInfo The parameters to the 6400 * transfer. See GenericTransferInfo. 6401 * @param {function(!chrome.usb.TransferResultInfo)} callback Invoked once the 6402 * transfer has completed. 6403 */ 6404 chrome.usb.interruptTransfer = function(handle, transferInfo, callback) {}; 6405 6406 6407 /** 6408 * @see http://developer.chrome.com/apps/usb.html#method-isochronousTransfer 6409 * @param {!chrome.usb.ConnectionHandle} handle A connection handle to make the 6410 * transfer on. 6411 * @param {!Object} transferInfo The parameters to the transfer. See 6412 * IsochronousTransferInfo. 6413 * @param {function(!chrome.usb.TransferResultInfo)} callback Invoked once the 6414 * transfer has been completed. 6415 */ 6416 chrome.usb.isochronousTransfer = function(handle, transferInfo, callback) {}; 6417 6418 6419 /** 6420 * @see http://developer.chrome.com/apps/usb.html#method-resetDevice 6421 * @param {!chrome.usb.ConnectionHandle} handle A connection handle to reset. 6422 * @param {function(boolean)} callback Invoked once the device is reset with a 6423 * boolean indicating whether the reset completed successfully. 6424 */ 6425 chrome.usb.resetDevice = function(handle, callback) {}; 6426 6427 6428 /** 6429 * @const 6430 * @see https://developer.chrome.com/apps/webstore 6431 */ 6432 chrome.webstore = {}; 6433 6434 6435 /** 6436 * @param {string|function()|function(string)=} 6437 * opt_urlOrSuccessCallbackOrFailureCallback Either the URL to install or 6438 * the succcess callback taking no arg or the failure callback taking an 6439 * error string arg. 6440 * @param {function()|function(string)=} opt_successCallbackOrFailureCallback 6441 * Either the succcess callback taking no arg or the failure callback 6442 * taking an error string arg. 6443 * @param {function(string)=} opt_failureCallback The failure callback. 6444 */ 6445 chrome.webstore.install = function( 6446 opt_urlOrSuccessCallbackOrFailureCallback, 6447 opt_successCallbackOrFailureCallback, 6448 opt_failureCallback) {}; 6449 6450 6451 /** @type {!ChromeStringEvent} */ 6452 chrome.webstore.onInstallStageChanged; 6453 6454 6455 /** @type {!ChromeNumberEvent} */ 6456 chrome.webstore.onDownloadProgress; 6457 6458 6459 //////////////////////////////////////////////////////////////////////////////// 6460 /////////////////////////// Chrome Private APIs //////////////////////////////// 6461 //////////////////////////////////////////////////////////////////////////////// 6462 6463 6464 /** @const */ 6465 chrome.screenlockPrivate = {}; 6466 6467 6468 /** 6469 * @param {string} message Displayed on the unlock screen. 6470 */ 6471 chrome.screenlockPrivate.showMessage = function(message) {}; 6472 6473 6474 /** 6475 * @param {function(boolean)} callback 6476 */ 6477 chrome.screenlockPrivate.getLocked = function(callback) {}; 6478 6479 6480 /** 6481 * @param {boolean} locked If true and the screen is unlocked, locks the screen. 6482 * If false and the screen is locked, unlocks the screen. 6483 */ 6484 chrome.screenlockPrivate.setLocked = function(locked) {}; 6485 6486 6487 /** @type {!ChromeBooleanEvent} */ 6488 chrome.screenlockPrivate.onChanged; 6489 6490 6491 /** 6492 * @const 6493 */ 6494 chrome.musicManagerPrivate = {}; 6495 6496 6497 /** 6498 * @param {function(string): void} callback 6499 */ 6500 chrome.musicManagerPrivate.getDeviceId = function(callback) {}; 6501 6502 6503 /** 6504 * @const 6505 */ 6506 chrome.mediaGalleriesPrivate = {}; 6507 6508 6509 /** 6510 * @typedef {function({deviceId: string, deviceName: string}): void} 6511 */ 6512 chrome.mediaGalleriesPrivate.DeviceCallback; 6513 6514 6515 /** 6516 * @typedef {function({galleryId: string}): void} 6517 */ 6518 chrome.mediaGalleriesPrivate.GalleryChangeCallback; 6519 6520 6521 /** 6522 * @typedef {function({galleryId: string, success: boolean}): void} 6523 */ 6524 chrome.mediaGalleriesPrivate.AddGalleryWatchCallback; 6525 6526 6527 /** 6528 * @param {string} galleryId 6529 * @param {!chrome.mediaGalleriesPrivate.AddGalleryWatchCallback} callback 6530 */ 6531 chrome.mediaGalleriesPrivate.addGalleryWatch = function(galleryId, callback) {}; 6532 6533 6534 /** 6535 * @type {!chrome.mediaGalleriesPrivate.DeviceEvent} 6536 * @deprecated Use {chrome.system.storage.onAttach}. 6537 */ 6538 chrome.mediaGalleriesPrivate.onDeviceAttached; 6539 6540 6541 /** 6542 * @type {!chrome.mediaGalleriesPrivate.DeviceEvent} 6543 * @deprecated Use {chrome.system.storage.onDetach}. 6544 */ 6545 chrome.mediaGalleriesPrivate.onDeviceDetached; 6546 6547 6548 /** 6549 * @type {!chrome.mediaGalleriesPrivate.GalleryChangeEvent} 6550 */ 6551 chrome.mediaGalleriesPrivate.onGalleryChanged; 6552 6553 6554 6555 /** 6556 * @interface 6557 * @deprecated Use {chrome.system.storage.DeviceEvent}. 6558 */ 6559 chrome.mediaGalleriesPrivate.DeviceEvent = function() {}; 6560 6561 6562 /** 6563 * @param {!chrome.mediaGalleriesPrivate.DeviceCallback} callback 6564 * @deprecated Use {chrome.system.storage.DeviceEvent.addListener}. 6565 */ 6566 chrome.mediaGalleriesPrivate.DeviceEvent.prototype.addListener = 6567 function(callback) {}; 6568 6569 6570 /** 6571 * @param {!chrome.mediaGalleriesPrivate.DeviceCallback} callback 6572 * @deprecated Use {chrome.system.storage.DeviceEvent.removeListener}. 6573 */ 6574 chrome.mediaGalleriesPrivate.DeviceEvent.prototype.removeListener = 6575 function(callback) {}; 6576 6577 6578 /** 6579 * @param {!chrome.mediaGalleriesPrivate.DeviceCallback} callback 6580 * @deprecated Use {chrome.system.storage.DeviceEvent.hasListener}. 6581 */ 6582 chrome.mediaGalleriesPrivate.DeviceEvent.prototype.hasListener = 6583 function(callback) {}; 6584 6585 6586 /** 6587 * @return {boolean} 6588 * @deprecated Use {chrome.system.storage.DeviceEvent.hasListener} 6589 */ 6590 chrome.mediaGalleriesPrivate.DeviceEvent.prototype.hasListeners = 6591 function(callback) {}; 6592 6593 6594 6595 /** 6596 * @interface 6597 */ 6598 chrome.mediaGalleriesPrivate.GalleryChangeEvent = function() {}; 6599 6600 6601 /** 6602 * @param {!chrome.mediaGalleriesPrivate.GalleryChangeCallback} callback 6603 */ 6604 chrome.mediaGalleriesPrivate.GalleryChangeEvent.prototype.addListener = 6605 function(callback) {}; 6606 6607 6608 /** 6609 * @param {!chrome.mediaGalleriesPrivate.GalleryChangeCallback} callback 6610 */ 6611 chrome.mediaGalleriesPrivate.GalleryChangeEvent.prototype.removeListener = 6612 function(callback) {}; 6613 6614 6615 /** 6616 * @param {!chrome.mediaGalleriesPrivate.GalleryChangeCallback} callback 6617 */ 6618 chrome.mediaGalleriesPrivate.GalleryChangeEvent.prototype.hasListener = 6619 function(callback) {}; 6620 6621 6622 /** 6623 * @return {boolean} 6624 */ 6625 chrome.mediaGalleriesPrivate.GalleryChangeEvent.prototype.hasListeners = 6626 function() {}; 6627 6628 6629 /** 6630 * WARNING(2014/08/04): This API is still under active initial development and 6631 * unstable and has a number of issues: 6632 * 6633 * 1. The types NetworkProperties and ManagedNetworkProperties are not defined 6634 * in the docs; that is, there is no list of fields and their types. 6635 * Therefore, these types are treated as bags-of-objects, rather than types. 6636 * 2. According to Steven Bennetts, NetworkProperties *should* be a 6637 * bag-of-properties as it's a map containing ONC properties and the ONC 6638 * properties do not follow the JS field naming conventions; specifically, 6639 * the properties start with an uppercase letter, and at least one property 6640 * is in all uppercase. 6641 * 3. The deviceSsid and deviceBssid fields of VerticationProperties are listed 6642 * as being required while their description mentions "Only set if" which 6643 * sound optional. The dev team was unclear whether they are required or 6644 * optional. 6645 * 4. Some parameters to some functions are marked as being in the Beta channel 6646 * only (for example, the networkGuid parameter to getCaptivePortalStatus). 6647 * 6648 * Because of the above issues, this API should not be used as an example for 6649 * other APIs added to this file. Please contact mednik@ for questions on and 6650 * maintenance for this API. 6651 * @const 6652 * @see https://developer.chrome.com/extensions/networkingPrivate 6653 */ 6654 chrome.networkingPrivate = {}; 6655 6656 6657 /** 6658 * @typedef {?{ 6659 * certificate: string, 6660 * publicKey: string, 6661 * nonce: string, 6662 * signedData: string, 6663 * deviceSerial: string, 6664 * deviceSsid: string, 6665 * deviceBssid: string 6666 * }} 6667 */ 6668 chrome.networkingPrivate.VerificationProperties; 6669 6670 6671 /** 6672 * @typedef {?{ 6673 * networkType: string, 6674 * visible: (boolean|undefined), 6675 * configured: (boolean|undefined), 6676 * limit: (number|undefined) 6677 * }} 6678 */ 6679 chrome.networkingPrivate.NetworkFilter; 6680 6681 6682 /** 6683 * @param {string} guid 6684 * @param {function(!Object)} callback 6685 */ 6686 chrome.networkingPrivate.getProperties = function(guid, callback) {}; 6687 6688 6689 /** 6690 * @param {string} guid 6691 * @param {function(!Object)} callback 6692 */ 6693 chrome.networkingPrivate.getManagedProperties = function(guid, callback) {}; 6694 6695 6696 /** 6697 * @param {string} guid 6698 * @param {function(!Object)} callback 6699 */ 6700 chrome.networkingPrivate.getState = function(guid, callback) {}; 6701 6702 6703 /** 6704 * @param {string} guid 6705 * @param {!Object} properties 6706 * @param {function()} callback 6707 */ 6708 chrome.networkingPrivate.setProperties = function(guid, properties, callback) { 6709 }; 6710 6711 6712 /** 6713 * @param {boolean} shared 6714 * @param {!Object} properties 6715 * @param {function(string)} callback Returns guid of the configured 6716 * configuration. 6717 */ 6718 chrome.networkingPrivate.createNetwork = 6719 function(shared, properties, callback) {}; 6720 6721 6722 /** 6723 * @param {!chrome.networkingPrivate.NetworkFilter} filter 6724 * @param {function(!Array.<!Object>)=} opt_callback 6725 */ 6726 chrome.networkingPrivate.getNetworks = function(filter, opt_callback) {}; 6727 6728 6729 /** 6730 * @param {string} type 6731 * @param {function(!Array.<!Object>)=} opt_callback 6732 */ 6733 chrome.networkingPrivate.getVisibleNetworks = function(type, opt_callback) {}; 6734 6735 6736 /** @param {function(!Array.<string>)=} opt_callback */ 6737 chrome.networkingPrivate.getEnabledNetworkTypes = function(opt_callback) {}; 6738 6739 6740 /** @param {string} networkType */ 6741 chrome.networkingPrivate.enableNetworkType = function(networkType) {}; 6742 6743 6744 /** @param {string} networkType */ 6745 chrome.networkingPrivate.disableNetworkType = function(networkType) {}; 6746 6747 6748 /** 6749 * Requests that the networking subsystem scan for new networks and update the 6750 * list returned by getVisibleNetworks. 6751 */ 6752 chrome.networkingPrivate.requestNetworkScan = function() {}; 6753 6754 6755 /** 6756 * @param {string} guid 6757 * @param {function()=} opt_callback 6758 */ 6759 chrome.networkingPrivate.startConnect = function(guid, opt_callback) {}; 6760 6761 6762 /** 6763 * @param {string} guid 6764 * @param {function()=} opt_callback 6765 */ 6766 chrome.networkingPrivate.startDisconnect = function(guid, opt_callback) {}; 6767 6768 6769 /** 6770 * @param {!chrome.networkingPrivate.VerificationProperties} verificationInfo 6771 * @param {function(boolean)} callback 6772 */ 6773 chrome.networkingPrivate.verifyDestination = 6774 function(verificationInfo, callback) {}; 6775 6776 6777 /** 6778 * @param {!chrome.networkingPrivate.VerificationProperties} verificationInfo 6779 * @param {string} guid 6780 * @param {function(string)} callback 6781 */ 6782 chrome.networkingPrivate.verifyAndEncryptCredentials = 6783 function(verificationInfo, guid, callback) {}; 6784 6785 6786 /** 6787 * @param {!chrome.networkingPrivate.VerificationProperties} verificationInfo 6788 * @param {string} data 6789 * @param {function(string)} callback 6790 */ 6791 chrome.networkingPrivate.verifyAndEncryptData = 6792 function(verificationInfo, data, callback) {}; 6793 6794 6795 /** 6796 * @param {string} ipOrMacAddress 6797 * @param {boolean} enabled 6798 * @param {function(string)} callback 6799 */ 6800 chrome.networkingPrivate.setWifiTDLSEnabledState = 6801 function(ipOrMacAddress, enabled, callback) {}; 6802 6803 6804 /** 6805 * @param {string} ipOrMacAddress 6806 * @param {function(string)} callback 6807 */ 6808 chrome.networkingPrivate.getWifiTDLSStatus = 6809 function(ipOrMacAddress, callback) {}; 6810 6811 6812 /** 6813 * @param {string} guid 6814 * @param {function(string)} callback 6815 */ 6816 chrome.networkingPrivate.getCaptivePortalStatus = function(guid, callback) {}; 6817 6818 6819 /** @type {!ChromeStringArrayEvent} */ 6820 chrome.networkingPrivate.onNetworksChanged; 6821 6822 6823 /** @type {!ChromeStringArrayEvent} */ 6824 chrome.networkingPrivate.onNetworkListChanged; 6825 6826 6827 /** @type {!ChromeStringStringEvent} */ 6828 chrome.networkingPrivate.onPortalDetectionCompleted; 6829 6830 6831 /** 6832 * WARNING(2014/08/14): This API is still under active initial development and 6833 * unstable. The types are not well defined or documented, and this API 6834 * definition here should not be used as an example for other APIs added to this 6835 * file. Please contact mednik@ for questions on and maintenance for this API. 6836 * @const 6837 * @see http://goo.gl/afV8wB 6838 */ 6839 chrome.mdns = {}; 6840 6841 6842 /** 6843 * Data type sent to the event handler of chrome.mdns.onServiceList. 6844 * TODO: This one event handler data type is being made a typedef 6845 * as an experiment. This allows us to create these objects in tests to pass 6846 * to the handlers which isn't possible by using the object form. 6847 * @typedef {{ 6848 * serviceName: string, 6849 * serviceHostPort: string, 6850 * ipAddress: string, 6851 * serviceData: !Array.<string>}} 6852 */ 6853 chrome.mdns.MdnsService; 6854 6855 6856 /** 6857 * Event whose listeners take an array of MdnsService parameter. 6858 * @constructor 6859 */ 6860 chrome.mdns.ServiceListEvent = function() {}; 6861 6862 6863 /** 6864 * @param {function(!Array.<!chrome.mdns.MdnsService>): void} callback 6865 * @param {!Object=} opt_filter 6866 */ 6867 chrome.mdns.ServiceListEvent.prototype.addListener = 6868 function(callback, opt_filter) {}; 6869 6870 6871 /** @param {function(!Array.<!chrome.mdns.MdnsService>): void} callback */ 6872 chrome.mdns.ServiceListEvent.prototype.removeListener = function(callback) {}; 6873 6874 6875 /** 6876 * @param {function(!Array.<!chrome.mdns.MdnsService>): void} callback 6877 * @return {boolean} 6878 */ 6879 chrome.mdns.ServiceListEvent.prototype.hasListener = function(callback) {}; 6880 6881 6882 /** @return {boolean} */ 6883 chrome.mdns.ServiceListEvent.prototype.hasListeners = function() {}; 6884 6885 6886 /** @type {!chrome.mdns.ServiceListEvent} */ 6887 chrome.mdns.onServiceList; 6888 6889 6890 /** 6891 * @const 6892 * @see http://goo.gl/79p5h5 6893 */ 6894 chrome.gcdPrivate = {}; 6895 6896 6897 /** 6898 * Represents a GCD device discovered locally or registered to a given user. 6899 * deviceId: Opaque device identifier to be passed to API. 6900 * setupType: How this device was discovered. 6901 * cloudId: Cloud identifier string. 6902 * deviceName: Device human readable name. 6903 * deviceType: Device type (camera, printer, etc). 6904 * deviceDescription: Device human readable description. 6905 * @typedef {?{ 6906 * deviceId: string, 6907 * setupType: string, 6908 * cloudId: (string|undefined), 6909 * deviceType: string, 6910 * deviceName: string, 6911 * deviceDescription: string 6912 * }} 6913 */ 6914 chrome.gcdPrivate.Device; 6915 6916 6917 /** @constructor */ 6918 chrome.gcdPrivate.ConfirmationInfo = function() {}; 6919 6920 6921 /** @type {string} */ 6922 chrome.gcdPrivate.ConfirmationInfo.prototype.type; 6923 6924 6925 /** @type {string|undefined} */ 6926 chrome.gcdPrivate.ConfirmationInfo.prototype.code; 6927 6928 6929 /** 6930 * Returns the list of cloud devices visible locally or available in the 6931 * cloud for user account. 6932 * @param {function(!Array.<!chrome.gcdPrivate.Device>): void} callback 6933 */ 6934 chrome.gcdPrivate.getCloudDeviceList = function(callback) {}; 6935 6936 6937 /** 6938 * Queries network for local devices. Triggers onDeviceStateChanged and 6939 * onDeviceRemoved events. Call this function *only* after registering for 6940 * onDeviceStateChanged and onDeviceRemoved events, or it will do nothing. 6941 */ 6942 chrome.gcdPrivate.queryForNewLocalDevices = function() {}; 6943 6944 6945 /** 6946 * Cache the WiFi password in the browser process for use during 6947 * provisioning. This is done to allow the gathering of the wifi password to 6948 * not be done while connected to the device's network. Callback is called 6949 * with true if wifi password was cached and false if it was unavailable. 6950 * @param {string} ssid 6951 * @param {function(boolean): void} callback 6952 */ 6953 chrome.gcdPrivate.prefetchWifiPassword = function(ssid, callback) {}; 6954 6955 6956 /** 6957 * Establish the session. 6958 * @param {string} ipAddress 6959 * @param {number} port 6960 * @param {function(number, string, !chrome.gcdPrivate.ConfirmationInfo): void} 6961 * callback Called when the session is established or on error. 1st param, 6962 * |sessionId|, is the session ID (identifies the session for future calls). 6963 * 2nd param, |status|, is the status (success or type of error). 3rd param, 6964 * |confirmationInfo|, is the info about how the device handles 6965 * confirmation. 6966 */ 6967 chrome.gcdPrivate.establishSession = function(ipAddress, port, callback) {}; 6968 6969 6970 /** 6971 * Confirm that the code is correct. Device will still need to confirm. |code| 6972 * must be present and must match the code from the device, even when the code 6973 * is supplied in the |ConfirmationInfo| object. 6974 * @param {number} sessionId 6975 * @param {string} code 6976 * @param {function(string): void} callback 6977 */ 6978 chrome.gcdPrivate.confirmCode = function(sessionId, code, callback) {}; 6979 6980 6981 /** 6982 * Send an encrypted message to the device. If the message is a setup message 6983 * with a wifi ssid specified but no password, the password cached from 6984 * prefetchWifiPassword() will be used and the call will fail if it's not 6985 * available. For open networks use an empty string as the password. 6986 * @param {number} sessionId 6987 * @param {string} api The API path. 6988 * @param {!Object} input The input message to be sent over the encrypted 6989 * channel. 6990 * @param {function(string, ?Object): void} callback 6991 */ 6992 chrome.gcdPrivate.sendMessage = function(sessionId, api, input, callback) {}; 6993 6994 6995 /** 6996 * Terminate the session with the device. 6997 * @param {number} sessionId 6998 */ 6999 chrome.gcdPrivate.terminateSession = function(sessionId) {}; 7000 7001 7002 /** 7003 * Returns command definitions. 7004 * @param {string} deviceId The device to get command definitions for. 7005 * @param {function(!Object): void} callback The result callback. 7006 */ 7007 chrome.gcdPrivate.getCommandDefinitions = function(deviceId, callback) {}; 7008 7009 7010 /** 7011 * Creates and sends a new command. 7012 * @param {string} deviceId The device to send the command to. 7013 * @param {number} expireInMs The number of milliseconds since now before the 7014 * command expires. An expired command should not be executed by the device. 7015 * Acceptable values are 10 sec (10000 ms) to 30 days (2592000000 ms), 7016 * inclusive. All values outside that range will be replaced by 30 days. 7017 * @param {!Object} command Described at 7018 * https://developers.google.com/cloud-devices/v1/reference/commands. 7019 * @param {function(!Object): void} callback The result callback. 7020 */ 7021 chrome.gcdPrivate.insertCommand = function( 7022 deviceId, expireInMs, command, callback) {}; 7023 7024 7025 /** 7026 * Returns a particular command. 7027 * @param {string} commandId Unique command ID. 7028 * @param {function(!Object): void} callback The result callback. 7029 */ 7030 chrome.gcdPrivate.getCommand = function(commandId, callback) {}; 7031 7032 7033 /** 7034 * Cancels a command. 7035 * @param {string} commandId Unique command ID. 7036 * @param {function(!Object): void} callback The result callback. 7037 */ 7038 chrome.gcdPrivate.cancelCommand = function(commandId, callback) {}; 7039 7040 7041 /** 7042 * Lists all commands in order of creation. 7043 * @param {string} deviceId The device to send the command to. 7044 * @param {string} byUser List all the commands issued by the user. Special 7045 * value 'me' can be used to list by the current user. 7046 * @param {string} state Command state. 7047 * @param {function(!Array.<!Object>): void} callback The result callback. 7048 */ 7049 chrome.gcdPrivate.getCommandsList = function( 7050 deviceId, byUser, state, callback) {}; 7051 7052 7053 /** 7054 * Event whose listeners take a chrome.gcdPrivate.Device. 7055 * @constructor 7056 */ 7057 chrome.gcdPrivate.DeviceEvent = function() {}; 7058 7059 7060 /** @param {function(!chrome.gcdPrivate.Device): void} callback */ 7061 chrome.gcdPrivate.DeviceEvent.prototype.addListener = function(callback) {}; 7062 7063 7064 /** @param {function(!chrome.gcdPrivate.Device): void} callback */ 7065 chrome.gcdPrivate.DeviceEvent.prototype.removeListener = function(callback) {}; 7066 7067 7068 /** 7069 * @param {function(!chrome.gcdPrivate.Device): void} callback 7070 * @return {boolean} 7071 */ 7072 chrome.gcdPrivate.DeviceEvent.prototype.hasListener = function(callback) {}; 7073 7074 7075 /** @return {boolean} */ 7076 chrome.gcdPrivate.DeviceEvent.prototype.hasListeners = function() {}; 7077 7078 7079 /** 7080 * Fires when a device's state changes. When a listener is first added, this 7081 * event fires for all known devices on the network. Afterwards, it will fire 7082 * with device status updates. 7083 * @type {!chrome.gcdPrivate.DeviceEvent} 7084 */ 7085 chrome.gcdPrivate.onDeviceStateChanged; 7086 7087 7088 /** 7089 * Fires when a given device disappears. 7090 * |deviceId| The device that has disappeared. 7091 * @type {!ChromeStringEvent} 7092 */ 7093 chrome.gcdPrivate.onDeviceRemoved; 7094 7095 7096 /** 7097 * @const 7098 * @see http://goo.gl/bKHibo 7099 */ 7100 chrome.bluetoothPrivate = {}; 7101 7102 7103 /** @constructor */ 7104 chrome.bluetoothPrivate.PairingEvent = function() {}; 7105 7106 7107 /** @type {string} */ 7108 chrome.bluetoothPrivate.PairingEvent.prototype.pairing; 7109 7110 7111 /** @type {!chrome.bluetooth.Device} */ 7112 chrome.bluetoothPrivate.PairingEvent.prototype.device; 7113 7114 7115 /** @type {string|undefined} */ 7116 chrome.bluetoothPrivate.PairingEvent.prototype.pincode; 7117 7118 7119 /** @type {number|undefined} */ 7120 chrome.bluetoothPrivate.PairingEvent.prototype.passkey; 7121 7122 7123 /** @type {number|undefined} */ 7124 chrome.bluetoothPrivate.PairingEvent.prototype.enteredKey; 7125 7126 7127 /** 7128 * @typedef {{ 7129 * name: (string|undefined), 7130 * powered: (boolean|undefined), 7131 * discoverable: (boolean|undefined) 7132 * }} 7133 */ 7134 chrome.bluetoothPrivate.NewAdapterState; 7135 7136 7137 /** 7138 * @typedef {{ 7139 * device: !chrome.bluetooth.Device, 7140 * response: (string|undefined), 7141 * pincode: (string|undefined), 7142 * passkey: (number|undefined), 7143 * enteredKey: (number|undefined) 7144 * }} 7145 */ 7146 chrome.bluetoothPrivate.SetPairingResponseOptions; 7147 7148 7149 /** 7150 * @param {!chrome.bluetoothPrivate.NewAdapterState} adapterState 7151 * @param {function()} callback 7152 */ 7153 chrome.bluetoothPrivate.setAdapterState = function(adapterState, callback) {}; 7154 7155 7156 /** 7157 * @param {!chrome.bluetoothPrivate.SetPairingResponseOptions} options 7158 * @param {function()} callback 7159 */ 7160 chrome.bluetoothPrivate.setPairingResponse = function(options, callback) {}; 7161 7162 7163 /** 7164 * Event whose listeners take a PairingEvent parameter. 7165 * @constructor 7166 */ 7167 chrome.bluetoothPrivate.PairingEventEvent = function() {}; 7168 7169 7170 /** @param {function(!chrome.bluetoothPrivate.PairingEvent): void} callback */ 7171 chrome.bluetoothPrivate.PairingEventEvent.prototype.addListener = 7172 function(callback) {}; 7173 7174 7175 /** @param {function(!chrome.bluetoothPrivate.PairingEvent): void} callback */ 7176 chrome.bluetoothPrivate.PairingEventEvent.prototype.removeListener = 7177 function(callback) {}; 7178 7179 7180 /** 7181 * @param {function(!chrome.bluetoothPrivate.PairingEvent): void} callback 7182 * @return {boolean} 7183 */ 7184 chrome.bluetoothPrivate.PairingEventEvent.prototype.hasListener = 7185 function(callback) {}; 7186 7187 7188 /** @return {boolean} */ 7189 chrome.bluetoothPrivate.PairingEventEvent.prototype.hasListeners = 7190 function() {}; 7191 7192 7193 /** @type {!chrome.bluetoothPrivate.PairingEventEvent} */ 7194 chrome.bluetoothPrivate.onPairing; 7195