toolkit/components/extensions/schemas/theme.json
author Tim Nguyen <ntim.bugs@gmail.com>
Mon, 23 Jul 2018 18:46:40 +0100
changeset 485890 20d0116ece9a1b88eceaf1876aabd2a162ca5496
parent 485881 249570f5e1ba0dcddb6b0b562a28a03a38a715ef
child 485893 65a6a118cb1a7bbe4c2af3ee41e89eb6704f48bc
permissions -rw-r--r--
Bug 1347207 - Implement theme_experiment manifest field. r=jaws MozReview-Commit-ID: DuUiVAMcti2

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

[
  {
    "namespace": "manifest",
    "types": [
      {
        "$extend": "Permission",
        "choices": [{
          "type": "string",
          "enum": [
            "theme"
          ]
        }]
      },
      {
        "id": "ThemeColor",
        "choices": [
          {
            "type": "string"
          },
          {
            "type": "array",
            "minItems": 3,
            "maxItems": 3,
            "items": {
              "type": "integer",
              "minimum": 0,
              "maximum": 255
            }
          },
          {
            "type": "array",
            "minItems": 4,
            "maxItems": 4,
            "items": {
              "type": "number"
            }
          }
        ]
      },
      {
        "id": "ThemeExperiment",
        "type": "object",
        "properties": {
          "stylesheet": {
            "optional": true,
            "$ref": "ExtensionURL"
          },
          "images": {
            "type": "object",
            "optional": true,
            "additionalProperties": {
              "type": "string"
            }
          },
          "colors": {
            "type": "object",
            "optional": true,
            "additionalProperties": {
              "type": "string"
            }
          },
          "properties": {
            "type": "object",
            "optional": true,
            "additionalProperties": {
              "type": "string"
            }
          }
        }
      },
      {
        "id": "ThemeType",
        "type": "object",
        "properties": {
          "images": {
            "type": "object",
            "optional": true,
            "properties": {
              "additional_backgrounds": {
                "type": "array",
                "items": { "$ref": "ImageDataOrExtensionURL" },
                "maxItems": 15,
                "optional": true
              },
              "headerURL": {
                "$ref": "ImageDataOrExtensionURL",
                "optional": true
              },
              "theme_frame": {
                "$ref": "ImageDataOrExtensionURL",
                "optional": true
              }
            },
            "additionalProperties": { "$ref": "ImageDataOrExtensionURL" }
          },
          "colors": {
            "type": "object",
            "optional": true,
            "properties": {
              "tab_selected": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "accentcolor": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "frame": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "frame_inactive": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "textcolor": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "tab_background_text": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "tab_background_separator": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "tab_loading": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "tab_text": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "tab_line": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "toolbar": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "toolbar_text": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "bookmark_text": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "toolbar_field": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "toolbar_field_text": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "toolbar_field_border": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "toolbar_field_separator": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "toolbar_top_separator": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "toolbar_bottom_separator": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "toolbar_vertical_separator": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "icons": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "icons_attention": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "button_background_hover": {
               "$ref": "ThemeColor",
               "optional": true
              },
              "button_background_active": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "popup": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "popup_text": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "popup_border": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "toolbar_field_focus": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "toolbar_field_text_focus": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "toolbar_field_border_focus": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "popup_highlight": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "popup_highlight_text": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "ntp_background": {
                "$ref": "ThemeColor",
                "optional": true
              },
              "ntp_text": {
                "$ref": "ThemeColor",
                "optional": true
              }
            },
            "additionalProperties": { "$ref": "ThemeColor" }
          },
          "icons": {
            "type": "object",
            "optional": true,
            "properties": {
              "back": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "forward": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "reload": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "stop": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "bookmark_star": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "bookmark_menu": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "downloads": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "home": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "app_menu": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "cut": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "copy": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "paste": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "new_window": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "new_private_window": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "save_page": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "print": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "history": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "full_screen": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "find": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "options": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "addons": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "developer": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "synced_tabs": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "open_file": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "sidebars": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "subscribe": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "text_encoding": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "email_link": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "forget": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "pocket": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "getmsg": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "newmsg": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "address": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "reply": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "replyall": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "replylist": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "forwarding": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "delete": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "junk": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "file": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "nextUnread": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "prevUnread": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "mark": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "tag": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "compact": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "archive": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "chat": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "nextMsg": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "prevMsg": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "QFB": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "conversation": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "newcard": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "newlist": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "editcard": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "newim": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "send": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "spelling": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "attach": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "security": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "save": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "quote": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "buddy": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "join_chat": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "chat_accounts": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "calendar": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "tasks": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "synchronize": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "newevent": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "newtask": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "editevent": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "today": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "category": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "complete": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "priority": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "saveandclose": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "attendees": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "privacy": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "status": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "freebusy": {
                "$ref": "ExtensionURL",
                "optional": true
              },
              "timezones": {
                "$ref": "ExtensionURL",
                "optional": true
              }
            },
            "additionalProperties": { "$ref": "UnrecognizedProperty" }
          },
          "properties": {
            "type": "object",
            "optional": true,
            "properties": {
              "additional_backgrounds_alignment": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "bottom", "center", "left", "right", "top",
                    "center bottom", "center center", "center top",
                    "left bottom", "left center", "left top",
                    "right bottom", "right center", "right top"
                  ]
                },
                "maxItems": 15,
                "optional": true
              },
              "additional_backgrounds_tiling": {
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": ["no-repeat", "repeat", "repeat-x", "repeat-y"]
                },
                "maxItems": 15,
                "optional": true
              }
            },
            "additionalProperties": { "type": "string" }
          }
        },
        "additionalProperties": { "$ref": "UnrecognizedProperty" }
      },
      {
        "id": "ThemeManifest",
        "type": "object",
        "description": "Contents of manifest.json for a static theme",
        "$import": "manifest.ManifestBase",
        "properties": {
          "theme": {
            "$ref": "ThemeType"
          },
          "default_locale": {
            "type": "string",
            "optional": true
          },
          "theme_experiment": {
            "$ref": "ThemeExperiment",
            "optional": true
          },
          "icons": {
            "type": "object",
            "optional": true,
            "patternProperties": {
              "^[1-9]\\d*$": { "type": "string" }
            }
          }
        }
      },
      {
        "$extend": "WebExtensionManifest",
        "properties": {
          "theme_experiment": {
            "$ref": "ThemeExperiment",
            "optional": true
          }
        }
      }
    ]
  },
  {
    "namespace": "theme",
    "description": "The theme API allows customizing of visual elements of the browser.",
    "types": [
      {
        "id": "ThemeUpdateInfo",
        "type": "object",
        "description": "Info provided in the onUpdated listener.",
        "properties": {
          "theme": {
            "type": "object",
            "description": "The new theme after update"
          },
          "windowId": {
            "type": "integer",
            "description": "The id of the window the theme has been applied to",
            "optional": true
          }
        }
      }
    ],
    "events": [
      {
        "name": "onUpdated",
        "type": "function",
        "description": "Fired when a new theme has been applied",
        "parameters": [
          {
            "$ref": "ThemeUpdateInfo",
            "name": "updateInfo",
            "description": "Details of the theme update"
          }
        ]
      }
    ],
    "functions": [
      {
        "name": "getCurrent",
        "type": "function",
        "async": true,
        "description": "Returns the current theme for the specified window or the last focused window.",
        "parameters": [
          {
            "type": "integer",
            "name": "windowId",
            "optional": true,
            "description": "The window for which we want the theme."
          }
        ]
      },
      {
        "name": "update",
        "type": "function",
        "async": true,
        "description": "Make complete updates to the theme. Resolves when the update has completed.",
        "permissions": ["theme"],
        "parameters": [
          {
            "type": "integer",
            "name": "windowId",
            "optional": true,
            "description": "The id of the window to update. No id updates all windows."
          },
          {
            "name": "details",
            "$ref": "manifest.ThemeType",
            "description": "The properties of the theme to update."
          }
        ]
      },
      {
        "name": "reset",
        "type": "function",
        "async": true,
        "description": "Removes the updates made to the theme.",
        "permissions": ["theme"],
        "parameters": [
          {
            "type": "integer",
            "name": "windowId",
            "optional": true,
            "description": "The id of the window to reset. No id resets all windows."
          }
        ]
      }
    ]
  }
]