chrome.experimental.omnibox
For information on how to use experimental APIs, see the chrome.experimental.* APIs page.
The omnibox API allows you to register a
keyword with Google Chrome's address bar,
which is also known as the omnibox.
When the user enters your extension's
keyword, the user starts
interacting solely with your extension.
Each keystroke is sent to your
extension, and you can provide suggestions
in response.
The suggestions can be richly formatted
in a variety of ways.
When the user accepts
a suggestion, your extension is notified
and can take action.
Manifest
To use the omnibox API, your manifest must
declare the "experimental" permission and
specify an omnibox_keyword
field. You should also
specify a 16x16-pixel icon, which will be
displayed in the omnibox when suggesting users
enter keyword mode.
For example:
{
"name": "Aaron's omnibox extension",
"version": "1.0",
"permissions": ["experimental"],
"omnibox_keyword": "aaron",
"icons": {
"16": "16-full-color.png"
},
"background_page": "background.html"
}
Note: Google Chrome
automatically creates a greyscale version of
your 16x16-pixel icon. You should provide
a full-color version so that it can also be
used in other situations that require color.
For example, the context menus API also uses a 16x16-pixel
icon, but it is displayed in color.
Examples
You can find samples of this API on the
sample page.
API reference: chrome.experimental.omnibox
Properties
getLastError
chrome.extensionlastError
Methods
method name
void
chrome.module.methodName(,
)
Undocumented.
A description from the json schema def of the function goes here.
Parameters
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(Type param1, Type param2) {...};
This function was added in version .
If you require this function, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
styleDim
void
chrome.experimental.omnibox.styleDim(, integer
offset)
Undocumented.
Constructor for the descriptionStyles parameter of the suggest callback. This style designates a region of dim helper text.
Parameters
-
offset
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(Type param1, Type param2) {...};
This function was added in version .
If you require this function, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
styleMatch
void
chrome.experimental.omnibox.styleMatch(, integer
offset)
Undocumented.
Constructor for the descriptionStyles parameter of the suggest callback. This style designates a region of text matching what the user typed.
Parameters
-
offset
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(Type param1, Type param2) {...};
This function was added in version .
If you require this function, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
styleNone
void
chrome.experimental.omnibox.styleNone(, integer
offset)
Undocumented.
Constructor for the descriptionStyles parameter of the suggest callback.
Parameters
-
offset
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(Type param1, Type param2) {...};
This function was added in version .
If you require this function, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
styleUrl
void
chrome.experimental.omnibox.styleUrl(, integer
offset)
Undocumented.
Constructor for the descriptionStyles parameter of the suggest callback. This style designates a region of text matching a URL or filename.
Parameters
-
offset
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(Type param1, Type param2) {...};
This function was added in version .
If you require this function, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
Events
onInputCancelled
chrome.experimental.omnibox.onInputCancelled.addListener(function() {...});
Undocumented.
User has ended the keyword input session without accepting the input.
Parameters
onInputChanged
chrome.experimental.omnibox.onInputChanged.addListener(function(string text, function suggest) {...});
Undocumented.
User has changed what is typed into the omnibox.
Parameters
-
text
(
optional
enumerated
Type
array of
string
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
suggest
(
optional
enumerated
Type
array of
function
)
-
Undocumented.
- A callback passed to the onInputChanged event used for sending suggestions back to the browser.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
Parameters
-
requestId
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
paramName
-
Undocumented.
- Array of suggest results
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
onInputEntered
chrome.experimental.omnibox.onInputEntered.addListener(function(string text) {...});
Undocumented.
User has accepted what is typed into the omnibox.
Parameters
-
text
(
optional
enumerated
Type
array of
string
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
onInputStarted
chrome.experimental.omnibox.onInputStarted.addListener(function() {...});
Undocumented.
User has started a keyword input session by typing the extension's keyword. This is guaranteed to be sent exactly once per input session, and before any onInputChanged events.
Parameters
Types
SuggestResult
paramName
(
optional
enumerated
Type
array of
object
)
Undocumented.
A suggest result.
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
content
(
optional
enumerated
Type
array of
string
)
-
Undocumented.
- The text that is put into the URL bar, and that is sent to the extension when the user chooses this entry.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
description
(
optional
enumerated
Type
array of
string
)
-
Undocumented.
- The text that is displayed in the URL dropdown. Can optionally be stylized by the descriptionStyles parameter.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
descriptionStyles
(
optional
enumerated
Type
array of
Type
array of
object
paramType
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-