// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

[
  {
    "namespace": "webview",
    "description": "none",
    "types": [
      {
        "id": "DataTypeSet",
        "type": "object",
        "description": "A set of data types. Missing data types are interpreted as <code>false</code>.",
        "properties": {
          "appcache": {
            "type": "boolean",
            "optional": true,
            "description": "Websites' appcaches."
          },
          "cookies": {
            "type": "boolean",
            "optional": true,
            "description": "The browser's cookies."
          },
          "fileSystems": {
            "type": "boolean",
            "optional": true,
            "description": "Websites' file systems."
          },
          "indexedDB": {
            "type": "boolean",
            "optional": true,
            "description": "Websites' IndexedDB data."
          },
          "localStorage": {
            "type": "boolean",
            "optional": true,
            "description": "Websites' local storage data."
          },
          "webSQL": {
            "type": "boolean",
            "optional": true,
            "description": "Websites' WebSQL data."
          }
        }
      },
      {
        "id": "RemovalOptions",
        "type": "object",
        "description": "Options that determine exactly what data will be removed.",
        "properties": {
          "since": {
            "type": "number",
            "optional": true,
            "description": "Remove data accumulated on or after this date, represented in milliseconds since the epoch (accessible via the <code>getTime</code> method of the JavaScript <code>Date</code> object). If absent, defaults to 0 (which would remove all browsing data)."
          }
        }
      }
    ],
    "functions": [
      {
        "name": "clearData",
        "type": "function",
        "description": "Clears various types of browsing data stored in a storage partition of a <webview>.",
        "parameters": [
          {
            "type": "integer",
            "name": "instanceId",
            "description": "The instance ID of the guest <webview> process."
          },
          {
            "$ref": "RemovalOptions",
            "name": "options"
          },
          {
            "name": "dataToRemove",
            "$ref": "DataTypeSet",
            "description": "The set of data types to remove."
          },
          {
            "name": "callback",
            "type": "function",
            "description": "Called when deletion has completed.",
            "optional": true,
            "parameters": []
          }
        ]
      },
      {
        "name": "executeScript",
        "type": "function",
        "description": "Injects JavaScript code into a <webview> page.",
        "parameters": [
          {
            "type": "integer",
            "name": "instanceId",
            "description": "The instance ID of the guest <webview> process."
          },
          {
            "$ref": "tabs.InjectDetails",
            "name": "details",
            "description": "Details of the script to run."
          },
          {
            "type": "function",
            "name": "callback",
            "optional": true,
            "description": "Called after all the JavaScript has been executed.",
            "parameters": [
              {
                "name": "result",
                "optional": true,
                "type": "array",
                "items": {"type": "any", "minimum": 0},
                "description": "The result of the script in every injected frame."
              }
            ]
          }
        ]
      },
      {
        "name": "insertCSS",
        "type": "function",
        "description": "Injects JavaScript code into a <webview> page.",
        "parameters": [
          {
            "type": "integer",
            "name": "instanceId",
            "description": "The instance ID of the guest <webview> process."
          },
          {
            "$ref": "tabs.InjectDetails",
            "name": "details",
            "description": "Details of the script to run."
          },
          {
            "type": "function",
            "name": "callback",
            "optional": true,
            "description": "Called after all the JavaScript has been executed.",
            "parameters": [
              {
                "name": "result",
                "optional": true,
                "type": "array",
                "items": {"type": "any", "minimum": 0},
                "description": "The result of the script in every injected frame."
              }
            ]
          }
        ]
      },
      {
        "name": "captureVisibleRegion",
        "type": "function",
        "description": "Captures the visible area of the currently loaded page inside <webview>.",
        "parameters": [
          {
            "type": "integer",
            "name": "instanceId",
            "description": "The instance ID of the guest <webview> process."
          },
          {
            "$ref": "types.ImageDetails",
            "name": "options",
            "optional": true
          },
          {
            "type": "function", "name": "callback", "parameters": [
              {"type": "string", "name": "dataUrl", "description": "A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display."}
            ]
          }
        ]
      },
      {
        "name": "go",
        "type": "function",
        "parameters": [
          {
            "type": "integer",
            "name": "instanceId"
          },
          {
            "type": "integer",
            "name": "relativeIndex"
          }
        ]
      },
      {
        "name": "overrideUserAgent",
        "type": "function",
        "parameters": [
          {
            "type": "integer",
            "name": "instanceId"
          },
          {
            "type": "string",
            "name": "userAgentOverride"
          }
        ]
      },
      {
        "name": "reload",
        "type": "function",
        "parameters": [
          {
            "type": "integer",
            "name": "instanceId"
          }
        ]
      },
      {
        "name": "setPermission",
        "type": "function",
        "parameters": [
          {
            "type": "integer",
            "name": "instanceId"
          },
          {
            "type": "integer",
            "name": "requestId"
          },
          {
            "type": "string",
            "name": "action",
            "enum": ["allow", "deny", "default"]
          },
          {
            "type": "string",
            "name": "userInput",
            "optional": true
          },
          {
            "type": "function",
            "name": "callback",
            "optional": true,
            "parameters": [
              {
                "name": "allowed",
                "type": "boolean"
              }
            ]
          }
        ]
      },
      {
        "name": "stop",
        "type": "function",
        "parameters": [
          {
            "type": "integer",
            "name": "instanceId"
          }
        ]
      },
      {
        "name": "terminate",
        "type": "function",
        "parameters": [
          {
            "type": "integer",
            "name": "instanceId"
          }
        ]
      }
    ]
  }
]