Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5356)

Unified Diff: chrome/test/data/extensions/samples/subscribe/toolstrip.html

Issue 99172: Part 1 of sample sprucing. (Closed)
Patch Set: Added buildbot.crx, since that seems like something people might want to install. Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/samples/subscribe/toolstrip.html
diff --git a/chrome/test/data/extensions/samples/subscribe/toolstrip.html b/chrome/test/data/extensions/samples/subscribe/toolstrip.html
new file mode 100644
index 0000000000000000000000000000000000000000..98de1b3e8eb0d1924515f9c5fa90e764e38d9d17
--- /dev/null
+++ b/chrome/test/data/extensions/samples/subscribe/toolstrip.html
@@ -0,0 +1,53 @@
+<html>
+<link rel="stylesheet" type="text/css" href="extensions_toolstrip.css">
+<div id="button" class="toolstrip-button">
+ <img id="icon" src="icon_disabled.png"><span>Subscribe</span>
+</div>
+
+<script>
+ var icon = document.getElementById("icon");
+ var button = document.getElementById("button");
+ var enabled = false;
+ var feedUrl, req;
+
+ button.onclick = handleClick;
+
+ chromium.self.onConnect.addListener(function(port) {
+ port.onMessage.addListener(function(feedUrls) {
+ // TODO(aa): When we have the ability to display drop downs, we should let
+ // the user pick which feed to subscribe. Right now, we just pick the
+ // first.
+ feedUrl = feedUrls[0];
+ if (!feedUrl) {
+ icon.src = "icon_disabled.png";
+ enabled = false;
+ } else {
+ icon.src = "icon.png";
+ enabled = true;
+
+ feedUrl = encodeURIComponent(feedUrl);
+ req = new XMLHttpRequest();
+ req.onload = handleResponse;
+ req.open("GET",
+ "http://www.google.com/reader/api/0/subscribed?s=feed%2F" + feedUrl,
+ false);
+ req.send(null);
+ }
+ });
+ });
+
+ function handleResponse() {
+ if (req.responseText == "true") {
+ icon.src = "icon_subscribed.png";
+ enabled = false;
+ }
+ }
+
+ function handleClick() {
+ if (enabled) {
+ var url = "http://www.google.com/reader/view/feed/" + feedUrl;
+ chromium.tabs.createTab({url: url});
+ }
+ }
+</script>
+</html>
« no previous file with comments | « chrome/test/data/extensions/samples/subscribe/manifest.json ('k') | chrome/test/data/extensions/test/Resizer/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698