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

Unified Diff: chrome/browser/resources/google_now/utility.js

Issue 24924002: Switching getting/dismissing cards to new protocol (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More rgustafson's comments Created 7 years, 2 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/browser/resources/google_now/utility.js
diff --git a/chrome/browser/resources/google_now/utility.js b/chrome/browser/resources/google_now/utility.js
index c66b9fff0fec812a4f7746999a01a58b487c1baa..27c445be3f3af284cf6d3014859d04e2c2bdfffc 100644
--- a/chrome/browser/resources/google_now/utility.js
+++ b/chrome/browser/resources/google_now/utility.js
@@ -58,16 +58,18 @@ function verify(condition, message) {
/**
* Builds a request to the notification server.
+ * @param {string} method Request method.
* @param {string} handlerName Server handler to send the request to.
- * @param {string} contentType Value for the Content-type header.
+ * @param {string=} contentType Value for the Content-type header.
* @return {XMLHttpRequest} Server request.
*/
-function buildServerRequest(handlerName, contentType) {
+function buildServerRequest(method, handlerName, contentType) {
var request = new XMLHttpRequest();
request.responseType = 'text';
- request.open('POST', NOTIFICATION_CARDS_URL + '/' + handlerName, true);
- request.setRequestHeader('Content-type', contentType);
+ request.open(method, NOTIFICATION_CARDS_URL + '/' + handlerName, true);
+ if (contentType)
+ request.setRequestHeader('Content-type', contentType);
return request;
}
@@ -125,7 +127,7 @@ function sendErrorReport(error) {
trace: filteredStack
};
- var request = buildServerRequest('jserrors', 'application/json');
+ var request = buildServerRequest('POST', 'jserrors', 'application/json');
request.onloadend = function(event) {
console.log('sendErrorReport status: ' + request.status);
};

Powered by Google App Engine
This is Rietveld 408576698