Commit 244de53c authored by frankf@google.com's avatar frankf@google.com

Add test extensions for browser/page actions.

TEST=None
BUG=chromium:104530
TBR=dennisjeffrey@chromium.org

Review URL: http://codereview.chromium.org/8764009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112347 0039d316-1c4b-4281-b951-d872f2087c98
parent 349465f7
<html>
<head>
<script>
// Turn the background red when the user clicks on the browser action.
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.executeScript(
null, {code: "document.body.style.backgroundColor='red'"});
});
</script>
</head>
</html>
{
"name": "A browser action that makes the active tab's background red",
"version": "1.0",
"background_page": "background.html",
"permissions": [
"tabs", "file://*"
],
"browser_action": {
"name": "Make this page red",
"default_icon": "icon.png"
}
}
{
"name": "A browser action with a popup displaying a simple message",
"version": "1.0",
"permissions": [
"tabs", "http://*/*", "https://*/*"
],
"browser_action": {
"default_icon": "icon.png",
"popup": "popup.html"
}
}
<style>
body {
background: red;
}
</style>
I'm an extension popup!!!
<html>
<head>
<script>
// Show the page action icon for all tabs.
chrome.tabs.onCreated.addListener(function(tab) {
chrome.tabs.getAllInWindow(null, function(tabs) {
for (var i = 0, t; t = tabs[i]; i++) {
chrome.pageAction.show(t.id);
}
});
});
// Turn the background red when the user clicks on the page action.
chrome.pageAction.onClicked.addListener(function(tab) {
chrome.tabs.executeScript(
null, {code: "document.body.style.backgroundColor='red'"});
});
</script>
</head>
</html>
{
"name": "A page action that makes the active tab's background red",
"version": "1.0",
"background_page": "background.html",
"permissions": [
"tabs", "file://*"
],
"page_action": {
"name": "Make this page red",
"default_icon": "icon.png"
}
}
<html>
<head>
<script>
// Show the page action icon for all tabs.
chrome.tabs.onCreated.addListener(function(tab) {
chrome.tabs.getAllInWindow(null, function(tabs) {
for (var i = 0, t; t = tabs[i]; i++) {
chrome.pageAction.show(t.id);
}
});
});
</script>
</head>
</html>
{
"name": "A page action with a popup displaying a simple message",
"version": "1.0",
"background_page": "background.html",
"permissions": [
"tabs", "http://*/*", "https://*/*"
],
"page_action": {
"default_icon": "icon.png",
"popup": "popup.html"
}
}
<style>
body {
background: red;
}
</style>
I'm an extension popup!!!
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment