| 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>
|
|
|