summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authormkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-25 13:51:26 +0000
committermkwst@chromium.org <mkwst@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-25 13:51:26 +0000
commit344d65dda43dc14062f9692f4af70495fe277865 (patch)
treee92dbb6207108a96d6795a4dced8edf40bb153dd /chrome/common
parent2e4b7ab3b083c3f0de8ec4ba9c8d4bee06833808 (diff)
downloadchromium_src-344d65dda43dc14062f9692f4af70495fe277865.zip
chromium_src-344d65dda43dc14062f9692f4af70495fe277865.tar.gz
chromium_src-344d65dda43dc14062f9692f4af70495fe277865.tar.bz2
Converting buildbot monitor to manifest_version 2.
BUG=111049 TEST= Review URL: https://chromiumcodereview.appspot.com/9283021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119055 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/extensions/docs/examples/extensions/buildbot.zipbin27792 -> 29185 bytes
-rw-r--r--chrome/common/extensions/docs/examples/extensions/buildbot/manifest.json6
-rw-r--r--chrome/common/extensions/docs/examples/extensions/buildbot/options.html28
-rw-r--r--chrome/common/extensions/docs/examples/extensions/buildbot/options.js17
-rw-r--r--chrome/common/extensions/docs/examples/extensions/buildbot/popup.html297
-rw-r--r--chrome/common/extensions/docs/examples/extensions/buildbot/popup.js154
-rw-r--r--chrome/common/extensions/docs/samples.html4
-rw-r--r--chrome/common/extensions/docs/samples.json6
8 files changed, 269 insertions, 243 deletions
diff --git a/chrome/common/extensions/docs/examples/extensions/buildbot.zip b/chrome/common/extensions/docs/examples/extensions/buildbot.zip
index 47b40d9..f8d52f7 100644
--- a/chrome/common/extensions/docs/examples/extensions/buildbot.zip
+++ b/chrome/common/extensions/docs/examples/extensions/buildbot.zip
Binary files differ
diff --git a/chrome/common/extensions/docs/examples/extensions/buildbot/manifest.json b/chrome/common/extensions/docs/examples/extensions/buildbot/manifest.json
index 0e141f3..743bcdb9 100644
--- a/chrome/common/extensions/docs/examples/extensions/buildbot/manifest.json
+++ b/chrome/common/extensions/docs/examples/extensions/buildbot/manifest.json
@@ -1,6 +1,6 @@
{
"name": "Chromium Buildbot Monitor",
- "version": "0.7.6",
+ "version": "0.7.7",
"description": "Displays the status of the Chromium buildbot in the toolbar. Click to see more detailed status in a popup.",
"icons": { "128": "icon.png" },
"background": {
@@ -16,5 +16,7 @@
"default_icon": "chromium.png",
"default_popup": "popup.html"
},
- "options_page": "options.html"
+ "options_page": "options.html",
+
+ "manifest_version": 2
}
diff --git a/chrome/common/extensions/docs/examples/extensions/buildbot/options.html b/chrome/common/extensions/docs/examples/extensions/buildbot/options.html
index b02af77..796dd02 100644
--- a/chrome/common/extensions/docs/examples/extensions/buildbot/options.html
+++ b/chrome/common/extensions/docs/examples/extensions/buildbot/options.html
@@ -1,27 +1,15 @@
<!doctype html>
<html>
<head>
-<script>
-
-function save() {
- var prefs = JSON.parse(localStorage.prefs);
- prefs.use_notifications = document.getElementById("notifications").checked;
- localStorage.prefs = JSON.stringify(prefs);
-}
-
-// Make sure the checkbox checked state gets properly initialized from the
-// saved preference.
-window.onload = function() {
- var prefs = JSON.parse(localStorage.prefs);
- document.getElementById("notifications").checked = prefs.use_notifications;
-}
-
-</script>
+ <title>Chromium Buildbot Monitor Options</title>
+ <script src='options.js'></script>
</head>
<body>
-<h2>Options for Chromium Buildbot Monitor</h2>
-<br>
-Use desktop notifications: <input id="notifications" type="checkbox" onclick="save()">
-
+ <h2>Options for Chromium Buildbot Monitor</h2>
+ <br>
+ <label>
+ Use desktop notifications:
+ <input id="notifications" type="checkbox">
+ </label>
</body>
</html>
diff --git a/chrome/common/extensions/docs/examples/extensions/buildbot/options.js b/chrome/common/extensions/docs/examples/extensions/buildbot/options.js
new file mode 100644
index 0000000..e97f346
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/extensions/buildbot/options.js
@@ -0,0 +1,17 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function save() {
+ var prefs = JSON.parse(localStorage.prefs);
+ prefs.use_notifications = document.getElementById('notifications').checked;
+ localStorage.prefs = JSON.stringify(prefs);
+}
+
+// Make sure the checkbox checked state gets properly initialized from the
+// saved preference.
+document.addEventListener('DOMContentLoaded', function () {
+ var prefs = JSON.parse(localStorage.prefs);
+ document.getElementById('notifications').checked = prefs.use_notifications;
+ document.getElementById('notifications').addEventListener('click', save);
+});
diff --git a/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html b/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html
index 8c82c45..8d4f6b1 100644
--- a/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html
+++ b/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html
@@ -1,241 +1,100 @@
-<head>
-<script>
-var botRoot = "http://build.chromium.org/p/chromium";
-var waterfallURL = botRoot + "/waterfall/bot_status.json?json=1";
-var botList;
-var checkinResults;
-var bots;
-var failures;
-
-function updateBotList(text) {
- var results = (new RegExp('(.*)<\/body>', 'g')).exec(text);
- if (!results || results.index < 0) {
- console.log("Error: couldn't find bot JSON");
- console.log(text);
- return;
- }
- var data;
- try {
- // The build bot returns invalid JSON. Namely it uses single
- // quotes and includes commas in some invalid locations. We have to
- // run some regexps across the text to fix it up.
- var jsonString = results[1].replace(/'/g, '"').replace(/},]/g,'}]');
- data = JSON.parse(jsonString);
- } catch (e) {
- console.dir(e);
- console.log(text);
- return;
- }
- if (!data) {
- throw new Error("JSON parse fail: " + results[1]);
- }
- botList = data[0];
- checkinResults = data[1];
-
- failures = botList.filter(function(bot) {
- return (bot.color != "success");
- });
- displayFailures();
-}
-
-function displayFailures() {
- bots.innerText = "";
-
- if (failures.length == 0) {
- var anchor = document.createElement("a");
- anchor.addEventListener("click", showConsole);
- anchor.className = "open";
- anchor.innerText = "The tree is completely green.";
- bots.appendChild(anchor);
- bots.appendChild(document.createTextNode(" (no way!)"));
- } else {
- var anchor = document.createElement("a");
- anchor.addEventListener("click", showFailures);
- anchor.innerText = "failures:";
- var div = document.createElement("div");
- div.appendChild(anchor);
- bots.appendChild(div);
-
- failures.forEach(function(bot, i) {
- var div = document.createElement("div");
- div.className = "bot " + bot.color;
- div.addEventListener("click", function() {
- // Requires closure for each iteration to retain local value of |i|.
- return function() { showBot(i); }
- }());
- div.innerText = bot.title;
- bots.appendChild(div);
- });
- }
-}
-
-function showURL(url) {
- window.open(url);
- window.event.stopPropagation();
-}
-
-function showBot(botIndex) {
- var bot = failures[botIndex];
- var url = botRoot + "/waterfall/waterfall?builder=" + bot.name;
- showURL(url);
-}
-
-function showConsole() {
- var url = botRoot + "/waterfall/console";
- showURL(url);
-}
-
-function showTry() {
- var url = botRoot + "/try-server/waterfall";
- showURL(url);
-}
-
-function showFyi() {
- var url = botRoot + "/waterfall.fyi/console";
- showURL(url);
-}
-
-function showFailures() {
- var url = botRoot +
- "/waterfall/waterfall?show_events=true&failures_only=true";
- showURL(url);
-}
-
-function requestURL(url, callback) {
- console.log("requestURL: " + url);
- var xhr = new XMLHttpRequest();
- try {
- xhr.onreadystatechange = function(state) {
- if (xhr.readyState == 4) {
- if (xhr.status == 200) {
- var text = xhr.responseText;
- //console.log(text);
- callback(text);
- } else {
- bots.innerText = "Error.";
- }
- }
+<!doctype html>
+<html>
+ <head>
+ <title>Chromium Buildbot Monitor Popup</title>
+ <script src='popup.js'></script>
+ <style>
+ body {
+ font-family: sans-serif;
+ font-size: 0.8em;
+ overflow: hidden;
}
- xhr.onerror = function(error) {
- console.log("xhr error: " + JSON.stringify(error));
- console.dir(error);
+ #links {
+ background-color: #efefef;
+ border: 1px solid #cccccc;
+ border-radius: 5px;
+ margin-top: 1px;
+ padding: 3px;
+ white-space: nowrap;
+ text-align: center;
}
- xhr.open("GET", url, true);
- xhr.send({});
- } catch(e) {
- console.log("exception: " + e);
- }
-}
-window.onload = function() {
- bots = document.getElementById("bots");
-
- // XHR from onload winds up blocking the load, so we put it in a setTimeout.
- window.setTimeout(requestURL, 0, waterfallURL, updateBotList);
-}
-
-function toggle_size() {
- if (document.body.className == "big") {
- document.body.className = "small";
- } else {
- document.body.className = "big";
- }
-}
-
-</script>
-<style>
-body {
- font-family: sans-serif;
- font-size: 0.8em;
- overflow: hidden;
-}
-
-#links {
- background-color: #efefef;
- border: 1px solid #cccccc;
- border-radius: 5px;
- margin-top: 1px;
- padding: 3px;
- white-space: nowrap;
- text-align: center;
-}
-
-a {
- text-decoration: underline;
- color: #444;
-}
+ a {
+ text-decoration: underline;
+ color: #444;
+ }
-a:hover {
- color: black;
- cursor: pointer;
-}
+ a:hover {
+ color: black;
+ cursor: pointer;
+ }
-body.big .bot {
- -webkit-transition: all .5s ease-out;
- margin: 20px;
-}
+ body.big .bot {
+ -webkit-transition: all .5s ease-out;
+ margin: 20px;
+ }
-body.small .bot {
- -webkit-transition: all .5s ease-out;
-}
+ body.small .bot {
+ -webkit-transition: all .5s ease-out;
+ }
-.bot {
- cursor: pointer;
- border-radius: 5px;
- margin-top: 1px;
- padding: 3px;
- white-space: nowrap;
-}
+ .bot {
+ cursor: pointer;
+ border-radius: 5px;
+ margin-top: 1px;
+ padding: 3px;
+ white-space: nowrap;
+ }
-.bot:hover {
- border: 2px solid black;
- padding: 2px;
-}
+ .bot:hover {
+ border: 2px solid black;
+ padding: 2px;
+ }
-.open {
- color: green;
-}
+ .open {
+ color: green;
+ }
-.closed {
- color: red;
-}
+ .closed {
+ color: red;
+ }
-.running {
- background-color: rgb(255, 252, 108);
- border: 1px solid rgb(197, 197, 109);
-}
+ .running {
+ background-color: rgb(255, 252, 108);
+ border: 1px solid rgb(197, 197, 109);
+ }
-.notstarted {
- border: 1px solid rgb(170, 170, 170);
-}
+ .notstarted {
+ border: 1px solid rgb(170, 170, 170);
+ }
-.failure {
- background-color: rgb(233, 128, 128);
- border: 1px solid rgb(167, 114, 114);
-}
+ .failure {
+ background-color: rgb(233, 128, 128);
+ border: 1px solid rgb(167, 114, 114);
+ }
-.warnings {
- background-color: rgb(255, 195, 67);
- border: 1px solid rgb(194, 157, 70);
-}
+ .warnings {
+ background-color: rgb(255, 195, 67);
+ border: 1px solid rgb(194, 157, 70);
+ }
-.success {
- background-color: rgb(143, 223, 95);
- border: 1px solid rgb(79, 133, 48);
-}
+ .success {
+ background-color: rgb(143, 223, 95);
+ border: 1px solid rgb(79, 133, 48);
+ }
-.exception {
- background-color: rgb(224, 176, 255);
- border: 1px solid rgb(172, 160, 179);
-}
-</style>
+ .exception {
+ background-color: rgb(224, 176, 255);
+ border: 1px solid rgb(172, 160, 179);
+ }
+ </style>
</head>
-<body onclick="toggle_size()">
+<body>
<div id="links">
-<a href="" onclick='showConsole()'>console</a> -
-<a href="" onclick='showTry()'>try</a> -
-<a href="" onclick='showFyi()'>fyi</a>
+<a href="" id='console'>console</a> -
+<a href="" id='try'>try</a> -
+<a href="" id='fyi'>fyi</a>
</div>
<div id="bots">Loading....</div>
</body>
diff --git a/chrome/common/extensions/docs/examples/extensions/buildbot/popup.js b/chrome/common/extensions/docs/examples/extensions/buildbot/popup.js
new file mode 100644
index 0000000..d127bc6
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/extensions/buildbot/popup.js
@@ -0,0 +1,154 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var botRoot = "http://build.chromium.org/p/chromium";
+var waterfallURL = botRoot + "/waterfall/bot_status.json?json=1";
+var botList;
+var checkinResults;
+var bots;
+var failures;
+
+function updateBotList(text) {
+ var results = (new RegExp('(.*)<\/body>', 'g')).exec(text);
+ if (!results || results.index < 0) {
+ console.log("Error: couldn't find bot JSON");
+ console.log(text);
+ return;
+ }
+ var data;
+ try {
+ // The build bot returns invalid JSON. Namely it uses single
+ // quotes and includes commas in some invalid locations. We have to
+ // run some regexps across the text to fix it up.
+ var jsonString = results[1].replace(/'/g, '"').replace(/},]/g,'}]');
+ data = JSON.parse(jsonString);
+ } catch (e) {
+ console.dir(e);
+ console.log(text);
+ return;
+ }
+ if (!data) {
+ throw new Error("JSON parse fail: " + results[1]);
+ }
+ botList = data[0];
+ checkinResults = data[1];
+
+ failures = botList.filter(function(bot) {
+ return (bot.color != "success");
+ });
+ displayFailures();
+}
+
+function displayFailures() {
+ bots.innerText = "";
+
+ if (failures.length == 0) {
+ var anchor = document.createElement("a");
+ anchor.addEventListener("click", showConsole);
+ anchor.className = "open";
+ anchor.innerText = "The tree is completely green.";
+ bots.appendChild(anchor);
+ bots.appendChild(document.createTextNode(" (no way!)"));
+ } else {
+ var anchor = document.createElement("a");
+ anchor.addEventListener("click", showFailures);
+ anchor.innerText = "failures:";
+ var div = document.createElement("div");
+ div.appendChild(anchor);
+ bots.appendChild(div);
+
+ failures.forEach(function(bot, i) {
+ var div = document.createElement("div");
+ div.className = "bot " + bot.color;
+ div.addEventListener("click", function() {
+ // Requires closure for each iteration to retain local value of |i|.
+ return function() { showBot(i); }
+ }());
+ div.innerText = bot.title;
+ bots.appendChild(div);
+ });
+ }
+}
+
+function showURL(url) {
+ window.open(url);
+ window.event.stopPropagation();
+}
+
+function showBot(botIndex) {
+ var bot = failures[botIndex];
+ var url = botRoot + "/waterfall/waterfall?builder=" + bot.name;
+ showURL(url);
+}
+
+function showConsole() {
+ var url = botRoot + "/waterfall/console";
+ showURL(url);
+}
+
+function showTry() {
+ var url = botRoot + "/try-server/waterfall";
+ showURL(url);
+}
+
+function showFyi() {
+ var url = botRoot + "/waterfall.fyi/console";
+ showURL(url);
+}
+
+function showFailures() {
+ var url = botRoot +
+ "/waterfall/waterfall?show_events=true&failures_only=true";
+ showURL(url);
+}
+
+function requestURL(url, callback) {
+ console.log("requestURL: " + url);
+ var xhr = new XMLHttpRequest();
+ try {
+ xhr.onreadystatechange = function(state) {
+ if (xhr.readyState == 4) {
+ if (xhr.status == 200) {
+ var text = xhr.responseText;
+ //console.log(text);
+ callback(text);
+ } else {
+ bots.innerText = "Error.";
+ }
+ }
+ }
+
+ xhr.onerror = function(error) {
+ console.log("xhr error: " + JSON.stringify(error));
+ console.dir(error);
+ }
+
+ xhr.open("GET", url, true);
+ xhr.send({});
+ } catch(e) {
+ console.log("exception: " + e);
+ }
+}
+
+function toggle_size() {
+ if (document.body.className == "big") {
+ document.body.className = "small";
+ } else {
+ document.body.className = "big";
+ }
+}
+
+document.addEventListener('DOMContentLoaded', function () {
+ toggle_size();
+
+ bots = document.getElementById("bots");
+
+ // XHR from onload winds up blocking the load, so we put it in a setTimeout.
+ window.setTimeout(requestURL, 0, waterfallURL, updateBotList);
+
+ // Setup event handlers
+ document.querySelector('#console').addEventListener('click', showConsole);
+ document.querySelector('#try').addEventListener('click', showTry);
+ document.querySelector('#fyi').addEventListener('click', showFyi);
+});
diff --git a/chrome/common/extensions/docs/samples.html b/chrome/common/extensions/docs/samples.html
index 901f3c7c..c7396ae 100644
--- a/chrome/common/extensions/docs/samples.html
+++ b/chrome/common/extensions/docs/samples.html
@@ -1168,7 +1168,11 @@
</li><li>
<code><a target="_blank" href="examples/extensions/buildbot/options.html">options.html</a></code>
</li><li>
+ <code><a target="_blank" href="examples/extensions/buildbot/options.js">options.js</a></code>
+ </li><li>
<code><a target="_blank" href="examples/extensions/buildbot/popup.html">popup.html</a></code>
+ </li><li>
+ <code><a target="_blank" href="examples/extensions/buildbot/popup.js">popup.js</a></code>
</li>
</ul>
</div>
diff --git a/chrome/common/extensions/docs/samples.json b/chrome/common/extensions/docs/samples.json
index 16aa865..c0561b7 100644
--- a/chrome/common/extensions/docs/samples.json
+++ b/chrome/common/extensions/docs/samples.json
@@ -615,9 +615,11 @@
"bg.js",
"manifest.json",
"options.html",
- "popup.html"
+ "options.js",
+ "popup.html",
+ "popup.js"
],
- "source_hash": "9d3e6c7c84e41758e7733eab6d34e10eb0776005",
+ "source_hash": "7844fc4d1252ba91973367fa1aeff5fba78ad7b3",
"zip_path": "examples\/extensions\/buildbot.zip"
},
{