summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 00:50:17 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 00:50:17 +0000
commitd0a1ad7c3099db9c9a92290d17df672066544e2c (patch)
treebce64130635f94dc6b1fd49bf2c07e452bb32f89 /chrome/test
parentb80d7d860852a3c4553b98e84ef4f70a4a7cc5e1 (diff)
downloadchromium_src-d0a1ad7c3099db9c9a92290d17df672066544e2c.zip
chromium_src-d0a1ad7c3099db9c9a92290d17df672066544e2c.tar.gz
chromium_src-d0a1ad7c3099db9c9a92290d17df672066544e2c.tar.bz2
Make some minor improvements to browser action samples:
Gmail checker: a) fix the name an description b) add an icon to the install dialog c) make the icons in the toolbar a little nicer d) put a question mark in a grey badge when not logged in e) get rid of the blinking Test browser action a) Make it continuously animate since that is really the point of this sample. Review URL: http://codereview.chromium.org/270037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28494 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/data/extensions/samples/gmail_browser_action/background.html35
-rw-r--r--chrome/test/data/extensions/samples/gmail_browser_action/gmail_logged_in.pngbin48123 -> 3661 bytes
-rw-r--r--chrome/test/data/extensions/samples/gmail_browser_action/gmail_not_logged_in.pngbin48088 -> 3585 bytes
-rw-r--r--chrome/test/data/extensions/samples/gmail_browser_action/gmail_whiteout.pngbin47947 -> 0 bytes
-rw-r--r--chrome/test/data/extensions/samples/gmail_browser_action/manifest.json8
-rw-r--r--chrome/test/data/extensions/samples/test_browser_action/background.html13
-rw-r--r--chrome/test/data/extensions/samples/test_browser_action/manifest.json6
-rw-r--r--chrome/test/data/extensions/samples/test_browser_action/print2_16x16.pngbin578 -> 0 bytes
8 files changed, 29 insertions, 33 deletions
diff --git a/chrome/test/data/extensions/samples/gmail_browser_action/background.html b/chrome/test/data/extensions/samples/gmail_browser_action/background.html
index 99a5ec0..f8068bd 100644
--- a/chrome/test/data/extensions/samples/gmail_browser_action/background.html
+++ b/chrome/test/data/extensions/samples/gmail_browser_action/background.html
@@ -10,7 +10,18 @@ var defaultIconId = 1;
var whiteoutIconId = 2;
var numberOfBlinks = 0;
+chrome.tabs.onUpdated.addListener(function(tabId, changeInfo) {
+ if (changeInfo.url && changeInfo.url.indexOf(gmail) == 0) {
+ console.log("saw gmail! updating...");
+ getInboxCount(function(count) {
+ updateUnreadCount(count);
+ });
+ }
+});
+
function init() {
+ chrome.browserAction.setBadgeBackgroundColor([230, 190, 190, 190]);
+ chrome.browserAction.setBadgeText("?");
window.setTimeout(startRequest, 0);
}
@@ -40,12 +51,14 @@ function getInboxCount(onSuccess, onError) {
function handleSuccess(count) {
window.clearTimeout(abortTimerId);
- onSuccess(count);
+ if (onSuccess)
+ onSuccess(count);
}
function handleError() {
window.clearTimeout(abortTimerId);
- onError();
+ if (onError)
+ onError();
}
try {
@@ -98,27 +111,13 @@ function gmailNSResolver(prefix) {
function updateUnreadCount(count) {
if (unreadCount != count) {
unreadCount = count;
- startBlink();
- }
-}
-
-function startBlink() {
- chrome.browserAction.setIcon(defaultIconId);
- if (numberOfBlinks < 2) {
- setTimeout(doWhiteout, 200);
- numberOfBlinks = numberOfBlinks + 1;
- } else {
- numberOfBlinks = 0;
chrome.browserAction.setBadgeText(unreadCount);
+ chrome.browserAction.setBadgeBackgroundColor([255, 208, 0, 24]);
+ chrome.browserAction.setIcon(defaultIconId);
chrome.browserAction.setName(unreadCount + " unread emails");
}
}
-function doWhiteout() {
- chrome.browserAction.setIcon(whiteoutIconId);
- setTimeout(startBlink, 200);
-}
-
function goToInbox() {
chrome.tabs.create({url: gmail});
}
diff --git a/chrome/test/data/extensions/samples/gmail_browser_action/gmail_logged_in.png b/chrome/test/data/extensions/samples/gmail_browser_action/gmail_logged_in.png
index 24180e0..5ec1f83 100644
--- a/chrome/test/data/extensions/samples/gmail_browser_action/gmail_logged_in.png
+++ b/chrome/test/data/extensions/samples/gmail_browser_action/gmail_logged_in.png
Binary files differ
diff --git a/chrome/test/data/extensions/samples/gmail_browser_action/gmail_not_logged_in.png b/chrome/test/data/extensions/samples/gmail_browser_action/gmail_not_logged_in.png
index 91a203c..92808c6 100644
--- a/chrome/test/data/extensions/samples/gmail_browser_action/gmail_not_logged_in.png
+++ b/chrome/test/data/extensions/samples/gmail_browser_action/gmail_not_logged_in.png
Binary files differ
diff --git a/chrome/test/data/extensions/samples/gmail_browser_action/gmail_whiteout.png b/chrome/test/data/extensions/samples/gmail_browser_action/gmail_whiteout.png
deleted file mode 100644
index 4cc4996..0000000
--- a/chrome/test/data/extensions/samples/gmail_browser_action/gmail_whiteout.png
+++ /dev/null
Binary files differ
diff --git a/chrome/test/data/extensions/samples/gmail_browser_action/manifest.json b/chrome/test/data/extensions/samples/gmail_browser_action/manifest.json
index e0e3a3c..ed16067 100644
--- a/chrome/test/data/extensions/samples/gmail_browser_action/manifest.json
+++ b/chrome/test/data/extensions/samples/gmail_browser_action/manifest.json
@@ -1,5 +1,5 @@
{
- "name": "Browser action test",
+ "name": "Gmail Checker 2",
"description": "This extension adds a Gmail button to the toolbar which notifies when new email comes",
"version": "1.0",
"background_page": "background.html",
@@ -9,7 +9,9 @@
"browser_action": {
"name": "Gmail",
"icons": ["gmail_not_logged_in.png",
- "gmail_logged_in.png",
- "gmail_whiteout.png"]
+ "gmail_logged_in.png"]
+ },
+ "icons": {
+ "128": "icon_128.png"
}
}
diff --git a/chrome/test/data/extensions/samples/test_browser_action/background.html b/chrome/test/data/extensions/samples/test_browser_action/background.html
index eff9c26c..ba799cb 100644
--- a/chrome/test/data/extensions/samples/test_browser_action/background.html
+++ b/chrome/test/data/extensions/samples/test_browser_action/background.html
@@ -3,16 +3,11 @@
<script>
// Called when the user clicks on the browser action.
var i = 0;
- chrome.browserAction.onClicked.addListener(function(windowId) {
+
+ window.setInterval(function() {
i++;
- chrome.browserAction.setName("Ouch" + i);
- if (i < 4) {
- chrome.browserAction.setIcon(i % 2);
- } else {
- var image = draw(i * 2, i * 4);
- chrome.browserAction.setIcon(image);
- }
- });
+ chrome.browserAction.setIcon(draw(i*2, i*4));
+ }, 50);
function draw(starty, startx) {
var canvas = document.getElementById('canvas');
diff --git a/chrome/test/data/extensions/samples/test_browser_action/manifest.json b/chrome/test/data/extensions/samples/test_browser_action/manifest.json
index cec6945..1134f3c 100644
--- a/chrome/test/data/extensions/samples/test_browser_action/manifest.json
+++ b/chrome/test/data/extensions/samples/test_browser_action/manifest.json
@@ -1,10 +1,10 @@
{
- "name": "Browser action test",
- "description": "This extension adds a changeable button to the toolbar",
+ "name": "Animated Browser Action",
+ "description": "This extension adds an animated browser action to the toolbar.",
"version": "1.0",
"background_page": "background.html",
"browser_action": {
"name": "First icon",
- "icons": ["print_16x16.png", "print2_16x16.png"]
+ "icons": ["print_16x16.png"]
}
}
diff --git a/chrome/test/data/extensions/samples/test_browser_action/print2_16x16.png b/chrome/test/data/extensions/samples/test_browser_action/print2_16x16.png
deleted file mode 100644
index 4ac4f34..0000000
--- a/chrome/test/data/extensions/samples/test_browser_action/print2_16x16.png
+++ /dev/null
Binary files differ