blob: 94633ddbd586a9f971f19b4c735ee5a5ea40ad4e [file] [log] [blame] [edit]
// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
[
{
"namespace": "history",
"description": "Use the <code>chrome.history</code> API to interact with the browser's record of visited pages. You can add, remove, and query for URLs in the browser's history. To override the history page with your own version, see <a href='develop/ui/override-chrome-pages'>Override Pages</a>.",
"types": [
{
"id": "TransitionType",
"type": "string",
"enum": [{
"name": "link",
"description": "The user arrived at this page by clicking a link on another page."
}, {
"name": "typed",
"description": "The user arrived at this page by typing the URL in the address bar. This is also used for other explicit navigation actions."
}, {
"name": "auto_bookmark",
"description": "The user arrived at this page through a suggestion in the UI, for example, through a menu item."
}, {
"name": "auto_subframe",
"description": "The user arrived at this page through subframe navigation that they didn't request, such as through an ad loading in a frame on the previous page. These don't always generate new navigation entries in the back and forward menus."
}, {
"name": "manual_subframe",
"description": "The user arrived at this page by selecting something in a subframe."
}, {
"name": "generated",
"description": "The user arrived at this page by typing in the address bar and selecting an entry that didn't look like a URL, such as a Google Search suggestion. For example, a match might have the URL of a Google Search result page, but it might appear to the user as \"Search Google for ...\". These are different from typed navigations because the user didn't type or see the destination URL. They're also related to keyword navigations."
}, {
"name": "auto_toplevel",
"description": "The page was specified in the command line or is the start page."
}, {
"name": "form_submit",
"description": "The user arrived at this page by filling out values in a form and submitting the form. Not all form submissions use this transition type."
}, {
"name": "reload",
"description": "The user reloaded the page, either by clicking the reload button or by pressing Enter in the address bar. Session restore and Reopen closed tab also use this transition type."
}, {
"name": "keyword",
"description": "The URL for this page was generated from a replaceable keyword other than the default search provider."
}, {
"name": "keyword_generated",
"description": "Corresponds to a visit generated for a keyword."
}],
"description": "The <a href='#transition_types'>transition type</a> for this visit from its referrer."
},
{
"id": "HistoryItem",
"type": "object",
"description": "An object encapsulating one result of a history query.",
"properties": {
"id": {"type": "string", "minimum": 0, "description": "The unique identifier for the item."},
"url": {"type": "string", "optional": true, "description": "The URL navigated to by a user."},
"title": {"type": "string", "optional": true, "description": "The title of the page when it was last loaded."},
"lastVisitTime": {"type": "number", "optional": true, "description": "When this page was last loaded, represented in milliseconds since the epoch."},
"visitCount": {"type": "integer", "optional": true, "description": "The number of times the user has navigated to this page."},
"typedCount": {"type": "integer", "optional": true, "description": "The number of times the user has navigated to this page by typing in the address."}
}
},
{
"id": "VisitItem",
"type": "object",
"description": "An object encapsulating one visit to a URL.",
"properties": {
"id": {"type": "string", "minimum": 0, "description": "The unique identifier for the corresponding $(ref:history.HistoryItem)."},
"visitId": {"type": "string", "description": "The unique identifier for this visit."},
"visitTime": {"type": "number", "optional": true, "description": "When this visit occurred, represented in milliseconds since the epoch."},
"referringVisitId": {"type": "string", "description": "The visit ID of the referrer."},
"transition": {
"$ref": "TransitionType",
"description": "The <a href='#transition_types'>transition type</a> for this visit from its referrer."
},
"isLocal": { "type": "boolean", "description": "True if the visit originated on this device. False if it was synced from a different device." }
}
},
{
"id": "UrlDetails",
"type": "object",
"properties": {
"url": {"type": "string", "description": "The URL for the operation. It must be in the format as returned from a call to <code>history.search()</code>."}
}
}
],
"functions": [
{
"name": "search",
"type": "function",
"description": "Searches the history for the last visit time of each page matching the query.",
"parameters": [
{
"name": "query",
"type": "object",
"properties": {
"text": {"type": "string", "description": "A free-text query to the history service. Leave this empty to retrieve all pages."},
"startTime": {"type": "number", "optional": true, "description": "Limit results to those visited after this date, represented in milliseconds since the epoch. If property is not specified, it will default to 24 hours."},
"endTime": {"type": "number", "optional": true, "description": "Limit results to those visited before this date, represented in milliseconds since the epoch."},
"maxResults": {"type": "integer", "optional": true, "minimum": 0, "description": "The maximum number of results to retrieve. Defaults to 100."}
}
}
],
"returns_async": {
"name": "callback",
"parameters": [
{ "name": "results", "type": "array", "items": { "$ref": "HistoryItem"} }
]
}
},
{
"name": "getVisits",
"type": "function",
"description": "Retrieves information about visits to a URL.",
"parameters": [
{
"name": "details",
"$ref": "UrlDetails"
}
],
"returns_async": {
"name": "callback",
"parameters": [
{ "name": "results", "type": "array", "items": { "$ref": "VisitItem"} }
]
}
},
{
"name": "addUrl",
"type": "function",
"description": "Adds a URL to the history at the current time with a <a href='#transition_types'>transition type</a> of \"link\".",
"parameters": [
{
"name": "details",
"$ref": "UrlDetails"
}
],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": []
}
},
{
"name": "deleteUrl",
"type": "function",
"description": "Removes all occurrences of the given URL from the history.",
"parameters": [
{
"name": "details",
"$ref": "UrlDetails"
}
],
"returns_async": {
"name": "callback",
"optional": true,
"parameters": []
}
},
{
"name": "deleteRange",
"type": "function",
"description": "Removes all items within the specified date range from the history. Pages will not be removed from the history unless all visits fall within the range.",
"parameters": [
{
"name": "range",
"type": "object",
"properties": {
"startTime": { "type": "number", "description": "Items added to history after this date, represented in milliseconds since the epoch." },
"endTime": { "type": "number", "description": "Items added to history before this date, represented in milliseconds since the epoch." }
}
}
],
"returns_async": {
"name": "callback",
"parameters": []
}
},
{
"name": "deleteAll",
"type": "function",
"description": "Deletes all items from the history.",
"parameters": [],
"returns_async": {
"name": "callback",
"parameters": []
}
}
],
"events": [
{
"name": "onVisited",
"type": "function",
"description": "Fired when a URL is visited, providing the <code>HistoryItem</code> data for that URL. This event fires before the page has loaded.",
"parameters": [
{ "name": "result", "$ref": "HistoryItem"}
]
},
{
"name": "onVisitRemoved",
"type": "function",
"description": "Fired when one or more URLs are removed from history. When all visits have been removed the URL is purged from history.",
"parameters": [
{
"name": "removed",
"type": "object",
"properties": {
"allHistory": { "type": "boolean", "description": "True if all history was removed. If true, then urls will be empty." },
"urls": { "type": "array", "items": { "type": "string" }, "optional": true}
}
}
]
}
]
}
]