Bug 1208257 - [webext] idle.json (r=kmag)

This commit is contained in:
Bill McCloskey 2015-11-21 17:02:18 -08:00
parent d06d096a85
commit 00fc2b83f6
4 changed files with 73 additions and 1 deletions

View File

@ -66,6 +66,7 @@ ExtensionManagement.registerScript("chrome://extensions/content/ext-test.js");
ExtensionManagement.registerSchema("chrome://extensions/content/schemas/cookies.json");
ExtensionManagement.registerSchema("chrome://extensions/content/schemas/extension_types.json");
ExtensionManagement.registerSchema("chrome://extensions/content/schemas/idle.json");
ExtensionManagement.registerSchema("chrome://extensions/content/schemas/web_navigation.json");
ExtensionManagement.registerSchema("chrome://extensions/content/schemas/web_request.json");

View File

@ -1,6 +1,6 @@
"use strict";
extensions.registerPrivilegedAPI("idle", (extension, context) => {
extensions.registerSchemaAPI("idle", "idle", (extension, context) => {
return {
idle: {
queryState: function(detectionIntervalInSeconds, callback) {

View File

@ -0,0 +1,70 @@
// Copyright (c) 2012 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": "idle",
"description": "Use the <code>browser.idle</code> API to detect when the machine's idle state changes.",
"types": [
{
"id": "IdleState",
"type": "string",
"enum": ["active", "idle", "locked"]
}
],
"functions": [
{
"name": "queryState",
"type": "function",
"description": "Returns \"locked\" if the system is locked, \"idle\" if the user has not generated any input for a specified number of seconds, or \"active\" otherwise.",
"parameters": [
{
"name": "detectionIntervalInSeconds",
"type": "integer",
"minimum": 15,
"description": "The system is considered idle if detectionIntervalInSeconds seconds have elapsed since the last user input detected."
},
{
"name": "callback",
"type": "function",
"parameters": [
{
"name": "newState",
"$ref": "IdleState"
}
]
}
]
},
{
"name": "setDetectionInterval",
"unsupported": true,
"type": "function",
"description": "Sets the interval, in seconds, used to determine when the system is in an idle state for onStateChanged events. The default interval is 60 seconds.",
"parameters": [
{
"name": "intervalInSeconds",
"type": "integer",
"minimum": 15,
"description": "Threshold, in seconds, used to determine when the system is in an idle state."
}
]
}
],
"events": [
{
"name": "onStateChanged",
"unsupported": true,
"type": "function",
"description": "Fired when the system changes to an active, idle or locked state. The event fires with \"locked\" if the screen is locked or the screensaver activates, \"idle\" if the system is unlocked and the user has not generated any input for a specified number of seconds, and \"active\" when the user generates input on an idle system.",
"parameters": [
{
"name": "newState",
"$ref": "IdleState"
}
]
}
]
}
]

View File

@ -6,5 +6,6 @@ toolkit.jar:
% content extensions %content/extensions/
content/extensions/schemas/cookies.json
content/extensions/schemas/extension_types.json
content/extensions/schemas/idle.json
content/extensions/schemas/web_navigation.json
content/extensions/schemas/web_request.json