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

Unified Diff: chrome/common/extensions/docs/examples/howto/contentscript_xhr/background.html

Issue 7210049: Update contentscript xhr example to remove background page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebuilding docs Created 9 years, 5 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/common/extensions/docs/examples/howto/contentscript_xhr/background.html
diff --git a/chrome/common/extensions/docs/examples/howto/contentscript_xhr/background.html b/chrome/common/extensions/docs/examples/howto/contentscript_xhr/background.html
deleted file mode 100644
index e99fbf1798cca8f201e7892b04e758cca56e5d1c..0000000000000000000000000000000000000000
--- a/chrome/common/extensions/docs/examples/howto/contentscript_xhr/background.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!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>
- </head>
- <body>
- <script>
- /**
- * Performs an XMLHttpRequest to Twitter's API to get trending topics.
- * @param callback Function If the response from fetching url has a
- * HTTP status of 200, this function is called with a JSON decoded
- * response. Otherwise, this function is called with null.
- */
- function fetchTwitterFeed(callback) {
- var xhr = new XMLHttpRequest();
- xhr.onreadystatechange = function(data) {
- if (xhr.readyState == 4) {
- if (xhr.status == 200) {
- var data = JSON.parse(xhr.responseText);
- callback(data);
- } else {
- callback(null);
- }
- }
- }
- // Note that any URL fetched here must be matched by a permission in
- // the manifest.json file!
- var url = 'http://api.twitter.com/1/trends/current.json?exclude=hashtags';
- xhr.open('GET', url, true);
- xhr.send();
- };
-
- /**
- * Handles data sent via chrome.extension.sendRequest().
- * @param request Object Data sent in the request.
- * @param sender Object Origin of the request.
- * @param callback Function The method to call when the request completes.
- */
- function onRequest(request, sender, callback) {
- // Only supports the 'fetchTwitterFeed' method, although this could be
- // generalized into a more robust RPC system.
- if (request.action == 'fetchTwitterFeed') {
- fetchTwitterFeed(callback);
- }
- };
-
- // Wire up the listener.
- chrome.extension.onRequest.addListener(onRequest);
- </script>
- </body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698