summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/docs/examples
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common/extensions/docs/examples')
-rw-r--r--chrome/common/extensions/docs/examples/api/bookmarks/basic.zipbin5687 -> 8600 bytes
-rw-r--r--chrome/common/extensions/docs/examples/api/bookmarks/basic/icon.pngbin0 -> 2809 bytes
-rw-r--r--chrome/common/extensions/docs/examples/api/omnibox/simple-example.zipbin1193 -> 1193 bytes
-rw-r--r--chrome/common/extensions/docs/examples/extensions/app_launcher.zipbin0 -> 24932 bytes
-rw-r--r--chrome/common/extensions/docs/examples/extensions/app_launcher/browser_action_icon.pngbin0 -> 5563 bytes
-rw-r--r--chrome/common/extensions/docs/examples/extensions/app_launcher/icon.pngbin0 -> 5397 bytes
-rw-r--r--chrome/common/extensions/docs/examples/extensions/app_launcher/manifest.json13
-rw-r--r--chrome/common/extensions/docs/examples/extensions/app_launcher/popup.css49
-rw-r--r--chrome/common/extensions/docs/examples/extensions/app_launcher/popup.html32
-rw-r--r--chrome/common/extensions/docs/examples/extensions/app_launcher/popup.js198
-rw-r--r--chrome/common/extensions/docs/examples/extensions/benchmark.zipbin258748 -> 258732 bytes
-rw-r--r--chrome/common/extensions/docs/examples/extensions/benchmark/options.html4
-rw-r--r--chrome/common/extensions/docs/examples/extensions/buildbot.zipbin28099 -> 28652 bytes
-rw-r--r--chrome/common/extensions/docs/examples/extensions/buildbot/bg.html11
-rw-r--r--chrome/common/extensions/docs/examples/extensions/buildbot/manifest.json2
-rw-r--r--chrome/common/extensions/docs/examples/extensions/buildbot/popup.html20
-rw-r--r--chrome/common/extensions/docs/examples/extensions/chrome_search.zipbin5610 -> 5806 bytes
-rw-r--r--chrome/common/extensions/docs/examples/extensions/chrome_search/manifest.json4
-rw-r--r--chrome/common/extensions/docs/examples/extensions/imageinfo.zipbin45565 -> 46603 bytes
-rw-r--r--chrome/common/extensions/docs/examples/tutorials/getstarted.zipbin5683 -> 10884 bytes
-rw-r--r--chrome/common/extensions/docs/examples/tutorials/getstarted/getstarted.zipbin0 -> 5075 bytes
21 files changed, 319 insertions, 14 deletions
diff --git a/chrome/common/extensions/docs/examples/api/bookmarks/basic.zip b/chrome/common/extensions/docs/examples/api/bookmarks/basic.zip
index 73a1258..02d772f 100644
--- a/chrome/common/extensions/docs/examples/api/bookmarks/basic.zip
+++ b/chrome/common/extensions/docs/examples/api/bookmarks/basic.zip
Binary files differ
diff --git a/chrome/common/extensions/docs/examples/api/bookmarks/basic/icon.png b/chrome/common/extensions/docs/examples/api/bookmarks/basic/icon.png
new file mode 100644
index 0000000..9a79a46
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/api/bookmarks/basic/icon.png
Binary files differ
diff --git a/chrome/common/extensions/docs/examples/api/omnibox/simple-example.zip b/chrome/common/extensions/docs/examples/api/omnibox/simple-example.zip
index 17d22b2..2a5116d 100644
--- a/chrome/common/extensions/docs/examples/api/omnibox/simple-example.zip
+++ b/chrome/common/extensions/docs/examples/api/omnibox/simple-example.zip
Binary files differ
diff --git a/chrome/common/extensions/docs/examples/extensions/app_launcher.zip b/chrome/common/extensions/docs/examples/extensions/app_launcher.zip
new file mode 100644
index 0000000..6f71c38
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/extensions/app_launcher.zip
Binary files differ
diff --git a/chrome/common/extensions/docs/examples/extensions/app_launcher/browser_action_icon.png b/chrome/common/extensions/docs/examples/extensions/app_launcher/browser_action_icon.png
new file mode 100644
index 0000000..046ee42
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/extensions/app_launcher/browser_action_icon.png
Binary files differ
diff --git a/chrome/common/extensions/docs/examples/extensions/app_launcher/icon.png b/chrome/common/extensions/docs/examples/extensions/app_launcher/icon.png
new file mode 100644
index 0000000..4aa2994
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/extensions/app_launcher/icon.png
Binary files differ
diff --git a/chrome/common/extensions/docs/examples/extensions/app_launcher/manifest.json b/chrome/common/extensions/docs/examples/extensions/app_launcher/manifest.json
new file mode 100644
index 0000000..86b0286
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/extensions/app_launcher/manifest.json
@@ -0,0 +1,13 @@
+{
+ "name": "App Launcher",
+ "version": "0.7.3",
+ "permissions": ["management"],
+ "browser_action": {
+ "default_icon": "browser_action_icon.png",
+ "default_title": "App Launcher",
+ "default_popup": "popup.html"
+ },
+ "icons": {
+ "48": "icon.png"
+ }
+}
diff --git a/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.css b/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.css
new file mode 100644
index 0000000..aa6ce07
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.css
@@ -0,0 +1,49 @@
+// Copyright (c) 2010 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.
+
+html {
+ overflow-x: hidden;
+}
+
+body {
+ font-family: Helvetica, Arial, sans-serif;
+}
+
+#search_container {
+ text-align: center;
+}
+
+#search {
+ width: 85%;
+}
+
+.app {
+ width: 100%;
+ margin-top: 7px;
+ margin-bottom: 7px;
+ margin-left: 2px;
+ margin-right: 20px;
+ white-space: nowrap;
+}
+
+.app img {
+ vertical-align: middle;
+ height: 38px;
+ width: 38px;
+}
+
+.app_title {
+ vertical-align: middle;
+ margin-left: 5px;
+}
+
+.app:hover {
+ background-color: rgb(250,250,250);
+ cursor:pointer;
+ outline: 1px dotted rgb(100,100,200);
+}
+
+.app_selected,.app_selected:hover {
+ background-color: rgb(230,230,230);
+}
diff --git a/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.html b/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.html
new file mode 100644
index 0000000..ca14080
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.html
@@ -0,0 +1,32 @@
+<!doctype html>
+<!--
+ * Copyright (c) 2010 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.
+-->
+<html>
+<head>
+<link rel="stylesheet" type="text/css" href="popup.css">
+<script src="popup.js"></script>
+</head>
+<body onload="onLoad()">
+
+<div id="spacer_dummy"></div>
+<div id="outer">
+
+<div id="appstore_link" style="display:none">
+<p>No apps installed.</p><p>
+<a href='javascript:chrome.tabs.create({"url":"https://chrome.google.com/webstore", "selected":true});window.close();'>Go get some</a></p>
+</div>
+
+<div id="search_container">
+<input id="search" type="text" placeholder="type to search"
+ oninput="onSearchInput()" spellcheck="false">
+</div>
+
+<div id="apps"></div>
+
+</div>
+
+</body>
+</html>
diff --git a/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.js b/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.js
new file mode 100644
index 0000000..8918c62
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/extensions/app_launcher/popup.js
@@ -0,0 +1,198 @@
+// Copyright (c) 2010 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 $(id) {
+ return document.getElementById(id);
+}
+
+// Returns the largest size icon, or a default icon, for the given |app|.
+function getIconURL(app) {
+ if (!app.icons || app.icons.length == 0) {
+ return chrome.extension.getURL("icon.png");
+ }
+ var largest = {size:0};
+ for (var i = 0; i < app.icons.length; i++) {
+ var icon = app.icons[i];
+ if (icon.size > largest.size) {
+ largest = icon;
+ }
+ }
+ return largest.url;
+}
+
+function launchApp(id) {
+ chrome.management.launchApp(id);
+ window.close(); // Only needed on OSX because of crbug.com/63594
+}
+
+// Adds DOM nodes for |app| into |appsDiv|.
+function addApp(appsDiv, app, selected) {
+ var div = document.createElement("div");
+ div.className = "app" + (selected ? " app_selected" : "");
+
+ div.onclick = function() {
+ launchApp(app.id);
+ };
+
+ var img = document.createElement("img");
+ img.src = getIconURL(app);
+ div.appendChild(img);
+
+ var title = document.createElement("span");
+ title.className = "app_title";
+ title.innerText = app.name;
+ div.appendChild(title);
+
+ appsDiv.appendChild(div);
+}
+
+// The list of all apps & extensions.
+var completeList = [];
+
+// A filtered list of apps we actually want to show.
+var appList = [];
+
+// The index of an app in |appList| that should be highlighted.
+var selectedIndex = 0;
+
+function reloadAppDisplay() {
+ var appsDiv = $("apps");
+
+ // Empty the current content.
+ appsDiv.innerHTML = "";
+
+ for (var i = 0; i < appList.length; i++) {
+ var item = appList[i];
+ addApp(appsDiv, item, i == selectedIndex);
+ }
+}
+
+// Puts only enabled apps from completeList into appList.
+function rebuildAppList(filter) {
+ selectedIndex = 0;
+ appList = [];
+ for (var i = 0; i < completeList.length; i++){
+ var item = completeList[i];
+ // Skip extensions and disabled apps.
+ if (!item.isApp || !item.enabled) {
+ continue;
+ }
+ if (filter && item.name.toLowerCase().search(filter) < 0) {
+ continue;
+ }
+ appList.push(item);
+ }
+}
+
+// In order to keep the popup bubble from shrinking as your search narrows the
+// list of apps shown, we set an explicit width on the outermost div.
+var didSetExplicitWidth = false;
+
+function adjustWidthIfNeeded(filter) {
+ if (filter.length > 0 && !didSetExplicitWidth) {
+ // Set an explicit width, correcting for any scroll bar present.
+ var outer = $("outer");
+ var correction = window.innerWidth - document.documentElement.clientWidth;
+ var width = outer.offsetWidth;
+ $("spacer_dummy").style.width = width + correction + "px";
+ didSetExplicitWidth = true;
+ }
+}
+
+// Shows the list of apps based on the search box contents.
+function onSearchInput() {
+ var filter = $("search").value;
+ adjustWidthIfNeeded(filter);
+ rebuildAppList(filter);
+ reloadAppDisplay();
+}
+
+function compare(a, b) {
+ return (a > b) ? 1 : (a == b ? 0 : -1);
+}
+
+function compareByName(app1, app2) {
+ return compare(app1.name.toLowerCase(), app2.name.toLowerCase());
+}
+
+function onLoad() {
+ chrome.management.getAll(function(info) {
+ var appCount = 0;
+ for (var i = 0; i < info.length; i++) {
+ if (info[i].isApp) {
+ appCount++;
+ }
+ }
+ if (appCount == 0) {
+ $("search").style.display = "none";
+ $("appstore_link").style.display = "";
+ return;
+ }
+ completeList = info.sort(compareByName);
+ onSearchInput();
+ });
+}
+
+// Changes the selected app in the list.
+function changeSelection(newIndex) {
+ if (newIndex >= 0 && newIndex <= appList.length - 1) {
+ selectedIndex = newIndex;
+ reloadAppDisplay();
+
+ var selected = document.getElementsByClassName("app_selected")[0];
+ var rect = selected.getBoundingClientRect();
+ if (newIndex == 0) {
+ window.scrollTo(0, 0);
+ } else if (newIndex == appList.length - 1) {
+ window.scrollTo(0, document.height);
+ } else if (rect.top < 0) {
+ window.scrollBy(0, rect.top);
+ } else if (rect.bottom > innerHeight) {
+ window.scrollBy(0, rect.bottom - innerHeight);
+ }
+ }
+}
+
+var keys = {
+ ENTER : 13,
+ ESCAPE : 27,
+ END : 35,
+ HOME : 36,
+ LEFT : 37,
+ UP : 38,
+ RIGHT : 39,
+ DOWN : 40
+};
+
+// Set up a key event handler that handles moving the selected app up/down,
+// hitting enter to launch the selected app, as well as auto-focusing the
+// search box as soon as you start typing.
+window.onkeydown = function(event) {
+ switch (event.keyCode) {
+ case keys.DOWN:
+ changeSelection(selectedIndex + 1);
+ break;
+ case keys.UP:
+ changeSelection(selectedIndex - 1);
+ break;
+ case keys.HOME:
+ changeSelection(0);
+ break;
+ case keys.END:
+ changeSelection(appList.length - 1);
+ break;
+ case keys.ENTER:
+ var app = appList[selectedIndex];
+ if (app) {
+ launchApp(app.id);
+ }
+ break;
+ default:
+ // Focus the search box and return true so you can just start typing even
+ // when the search box isn't focused.
+ $("search").focus();
+ return true;
+ }
+ return false;
+};
diff --git a/chrome/common/extensions/docs/examples/extensions/benchmark.zip b/chrome/common/extensions/docs/examples/extensions/benchmark.zip
index a322ab3..3d799d2 100644
--- a/chrome/common/extensions/docs/examples/extensions/benchmark.zip
+++ b/chrome/common/extensions/docs/examples/extensions/benchmark.zip
Binary files differ
diff --git a/chrome/common/extensions/docs/examples/extensions/benchmark/options.html b/chrome/common/extensions/docs/examples/extensions/benchmark/options.html
index 24adc77..6db31d2 100644
--- a/chrome/common/extensions/docs/examples/extensions/benchmark/options.html
+++ b/chrome/common/extensions/docs/examples/extensions/benchmark/options.html
@@ -36,9 +36,9 @@ div#header {
position: relative;
overflow: hidden;
background: #5296de;
- -webkit-background-size: 100%;
+ background-size: 100%;
border: 1px solid #3a75bd;
- -webkit-border-radius: 6px;
+ border-radius: 6px;
color: white;
text-shadow: 0 0 2px black;
}
diff --git a/chrome/common/extensions/docs/examples/extensions/buildbot.zip b/chrome/common/extensions/docs/examples/extensions/buildbot.zip
index d7eb8c4..9e7ad86 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/bg.html b/chrome/common/extensions/docs/examples/extensions/buildbot/bg.html
index 39dd344..dda276e 100644
--- a/chrome/common/extensions/docs/examples/extensions/buildbot/bg.html
+++ b/chrome/common/extensions/docs/examples/extensions/buildbot/bg.html
@@ -49,9 +49,14 @@ function requestURL(url, callback) {
try {
xhr.onreadystatechange = function(state) {
if (xhr.readyState == 4) {
- var text = xhr.responseText;
- //console.log(text);
- callback(text);
+ if (xhr.status == 200) {
+ var text = xhr.responseText;
+ //console.log(text);
+ callback(text);
+ } else {
+ chrome.browserAction.setBadgeText({text:"?"});
+ chrome.browserAction.setBadgeBackgroundColor({color:[0,0,255,255]});
+ }
}
}
diff --git a/chrome/common/extensions/docs/examples/extensions/buildbot/manifest.json b/chrome/common/extensions/docs/examples/extensions/buildbot/manifest.json
index 1acb250..baeca6d 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.5",
+ "version": "0.7.6",
"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_page": "bg.html",
diff --git a/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html b/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html
index 3a66636..f89511a 100644
--- a/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html
+++ b/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html
@@ -17,7 +17,11 @@ function updateBotList(text) {
}
var data;
try {
- data = JSON.parse(results[1]);
+ // 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);
@@ -104,9 +108,13 @@ function requestURL(url, callback) {
try {
xhr.onreadystatechange = function(state) {
if (xhr.readyState == 4) {
- var text = xhr.responseText;
- //console.log(text);
- callback(text);
+ if (xhr.status == 200) {
+ var text = xhr.responseText;
+ //console.log(text);
+ callback(text);
+ } else {
+ bots.innerText = "Error.";
+ }
}
}
@@ -147,7 +155,7 @@ body {
#links {
background-color: #efefef;
border: 1px solid #cccccc;
- -webkit-border-radius: 5px;
+ border-radius: 5px;
margin-top: 1px;
padding: 3px;
white-space: nowrap;
@@ -175,7 +183,7 @@ body.small .bot {
.bot {
cursor: pointer;
- -webkit-border-radius: 5px;
+ border-radius: 5px;
margin-top: 1px;
padding: 3px;
white-space: nowrap;
diff --git a/chrome/common/extensions/docs/examples/extensions/chrome_search.zip b/chrome/common/extensions/docs/examples/extensions/chrome_search.zip
index d0ad166..a38e561 100644
--- a/chrome/common/extensions/docs/examples/extensions/chrome_search.zip
+++ b/chrome/common/extensions/docs/examples/extensions/chrome_search.zip
Binary files differ
diff --git a/chrome/common/extensions/docs/examples/extensions/chrome_search/manifest.json b/chrome/common/extensions/docs/examples/extensions/chrome_search/manifest.json
index 54de17c..3254391 100644
--- a/chrome/common/extensions/docs/examples/extensions/chrome_search/manifest.json
+++ b/chrome/common/extensions/docs/examples/extensions/chrome_search/manifest.json
@@ -1,9 +1,9 @@
{
"background_page": "background.html",
"description": "Add support to the omnibox to search the Chromium source code.",
+ "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDRx0y4f/CuomPPeGxcVMo7yfYZ1apxD+9e3ItNtPRBi8WMmzG0xhjnqvm03LTfTljbzA1L93s31HkjS5Bd12qM8SSZxOOizsZveK1tdpX0QelikSUaz1wwIyjatoC/jJy7vuuk0j5kPeLkNAhYGJTqN3H/Pqt0lFF1VFX4+fCEvQIDAQAB",
"name": "Chromium Search",
"omnibox": { "keyword" : "src" },
"permissions": [ "tabs", "http://www.google.com/" ],
- "version": "5",
- "minimum_chrome_version": "9"
+ "version": "4"
}
diff --git a/chrome/common/extensions/docs/examples/extensions/imageinfo.zip b/chrome/common/extensions/docs/examples/extensions/imageinfo.zip
index 9ab6603..dbce95b 100644
--- a/chrome/common/extensions/docs/examples/extensions/imageinfo.zip
+++ b/chrome/common/extensions/docs/examples/extensions/imageinfo.zip
Binary files differ
diff --git a/chrome/common/extensions/docs/examples/tutorials/getstarted.zip b/chrome/common/extensions/docs/examples/tutorials/getstarted.zip
index 54083ae..268cc5d 100644
--- a/chrome/common/extensions/docs/examples/tutorials/getstarted.zip
+++ b/chrome/common/extensions/docs/examples/tutorials/getstarted.zip
Binary files differ
diff --git a/chrome/common/extensions/docs/examples/tutorials/getstarted/getstarted.zip b/chrome/common/extensions/docs/examples/tutorials/getstarted/getstarted.zip
new file mode 100644
index 0000000..37deb7f
--- /dev/null
+++ b/chrome/common/extensions/docs/examples/tutorials/getstarted/getstarted.zip
Binary files differ