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     "types": [
     10       {
     11         "id": "PageStateMatcher",
     12         "type": "object",
     13         "description": "Matches the state of a web page by various criteria.",
     14         "properties": {
     15           "pageUrl": {
     16             "$ref": "events.UrlFilter",
     17             "description": "Matches if the condition of the UrlFilter are fulfilled for the top-level URL of the page.",
     18             "optional": true
     19           },
     20           "css": {
     21             "type": "array",
     22             "optional": true,
     23             "description": "Matches if all of the CSS selectors in the array match displayed elements in a frame with the same origin as the page's main frame.  All selectors in this array must be <a href=\"http://www.w3.org/TR/selectors4/#compound\">compound selectors</a> to speed up matching.  Note that listing hundreds of CSS selectors or CSS selectors that match hundreds of times per page can still slow down web sites.",
     24             // TODO(jyasskin): Figure out if we want to require all
     25             // the selectors to match in the same frame, or allow several
     26             // frames to contribute to a match.
     27             "items": { "type": "string" }
     28 //        },
     29 //          TODO: "text": {
     30 //            "type": "array",
     31 //            "optional": true,
     32 //            "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>.",
     33 //            "items": { "type": "string" }
     34           },
     35           "instanceType": {
     36             "type": "string", "enum": ["declarativeContent.PageStateMatcher"],
     37             "nodoc": true
     38           }
     39         }
     40       },
     41       {
     42         "id": "ShowPageAction",
     43         "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-permissions\">host permissions</a>, but the extension must have a page action.  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.",
     44         "type": "object",
     45         "properties": {
     46           "instanceType": {
     47             "type": "string", "enum": ["declarativeContent.ShowPageAction"],
     48             "nodoc": true
     49           }
     50         }
     51       }
     52     ],
     53     "functions": [
     54     ],
     55     "events": [
     56       {
     57         "name": "onPageChanged",
     58         "options": {
     59           "supportsListeners": false,
     60           "supportsRules": true,
     61           "conditions": ["declarativeContent.PageStateMatcher"],
     62           "actions": [
     63             "declarativeContent.ShowPageAction"
     64           ]
     65         }
     66       }
     67     ]
     68   }
     69 ]
     70