Home | History | Annotate | Download | only in api
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 [
      6   {
      7     "namespace": "declarativeContent",
      8     "description": "Use the <code>chrome.declarativeContent</code> API to take actions depending on the content of a page, without requiring permission to read the page's content.",
      9     "documentation_permissions_required": ["declarative", "declarativeContent"],
     10     "types": [
     11       {
     12         "id": "PageStateMatcher",
     13         "type": "object",
     14         "description": "Matches the state of a web page by various criteria.",
     15         "properties": {
     16           "pageUrl": {
     17             "$ref": "events.UrlFilter",
     18             "description": "Matches if the condition of the UrlFilter are fulfilled for the top-level URL of the page.",
     19             "optional": true
     20           },
     21           "css": {
     22             "type": "array",
     23             "optional": true,
     24             "description": "Matches if all of the CSS selectors in the array match in a frame with the same origin as the page's main frame.  Note that listing hundreds of CSS selectors here can slow down web sites.",
     25             // TODO(jyasskin): Figure out if we want to require all
     26             // the selectors to match in the same frame, or allow several
     27             // frames to contribute to a match.
     28             "items": { "type": "string" }
     29             // TODO(jyasskin): Validate that the selectors in this
     30             // array are valid. Otherwise, we can get exceptions from
     31             // content_watcher.js:FindMatchingSelectors() long after the
     32             // rule is registered.
     33 //          },
     34 //          TODO: "text": {
     35 //            "type": "array",
     36 //            "optional": true,
     37 //            "description": "Matches if all of the regular expressions in the array match text in the page. The regular expressions use the <a href=\"http://code.google.com/p/re2/wiki/Syntax\">RE2 syntax</a>.",
     38 //            "items": { "type": "string" }
     39           },
     40           "instanceType": {
     41             "type": "string", "enum": ["declarativeContent.PageStateMatcher"],
     42             "nodoc": true
     43           }
     44         }
     45       },
     46       {
     47         "id": "ShowPageAction",
     48         "description": "Declarative event action that shows the extension's $ref:[pageAction page action] while the corresponding conditions are met.  This action can be used without <a href=\"declare_permissions.html#host-permission\">host permissions</a>.  If the extension takes the <a href=\"activeTab.html\">activeTab</a> permission, a click on the page action will grant access to the active tab.",
     49         "type": "object",
     50         "properties": {
     51           "instanceType": {
     52             "type": "string", "enum": ["declarativeContent.ShowPageAction"],
     53             "nodoc": true
     54           }
     55         }
     56       }
     57     ],
     58     "functions": [
     59     ],
     60     "events": [
     61       {
     62         "name": "onPageChanged",
     63         "options": {
     64           "supportsListeners": false,
     65           "supportsRules": true,
     66           "conditions": ["declarativeContent.PageStateMatcher"],
     67           "actions": [
     68             "declarativeContent.ShowPageAction"
     69           ]
     70         }
     71       }
     72     ]
     73   }
     74 ]
     75