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

Side by Side Diff: chrome/browser/resources/google_now/background.js

Issue 14358006: Eliminating recordEvent call with string parameter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * @fileoverview The event page for Google Now for Chrome implementation. 8 * @fileoverview The event page for Google Now for Chrome implementation.
9 * The Google Now event page gets Google Now cards from the server and shows 9 * The Google Now event page gets Google Now cards from the server and shows
10 * them as Chrome notifications. 10 * them as Chrome notifications.
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 * showing a Chrome notification. 143 * showing a Chrome notification.
144 * @param {Object} notificationsData Map from notification id to the data 144 * @param {Object} notificationsData Map from notification id to the data
145 * associated with a notification. 145 * associated with a notification.
146 * @param {number} previousVersion The version of the shown card with this id, 146 * @param {number} previousVersion The version of the shown card with this id,
147 * if it exists, undefined otherwise. 147 * if it exists, undefined otherwise.
148 */ 148 */
149 function showNotification(card, notificationsData, previousVersion) { 149 function showNotification(card, notificationsData, previousVersion) {
150 console.log('showNotification ' + JSON.stringify(card)); 150 console.log('showNotification ' + JSON.stringify(card));
151 151
152 if (typeof card.version != 'number') { 152 if (typeof card.version != 'number') {
153 recordEvent('ERROR:version-is-not-number'); 153 console.error('card.version is not a number');
154
155 // Fix card version. 154 // Fix card version.
156 card.version = previousVersion !== undefined ? previousVersion : 0; 155 card.version = previousVersion !== undefined ? previousVersion : 0;
157 } 156 }
158 157
159 if (previousVersion !== card.version) { 158 if (previousVersion !== card.version) {
160 try { 159 try {
161 // Delete a notification with the specified id if it already exists, and 160 // Delete a notification with the specified id if it already exists, and
162 // then create a notification. 161 // then create a notification.
163 chrome.notifications.create( 162 chrome.notifications.create(
164 card.notificationId, 163 card.notificationId,
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 'GoogleNow.ButtonClicked' + buttonIndex); 588 'GoogleNow.ButtonClicked' + buttonIndex);
590 onNotificationClicked(notificationId, function(actionUrls) { 589 onNotificationClicked(notificationId, function(actionUrls) {
591 if (!Array.isArray(actionUrls.buttonUrls)) 590 if (!Array.isArray(actionUrls.buttonUrls))
592 return undefined; 591 return undefined;
593 592
594 return actionUrls.buttonUrls[buttonIndex]; 593 return actionUrls.buttonUrls[buttonIndex];
595 }); 594 });
596 }); 595 });
597 596
598 chrome.notifications.onClosed.addListener(onNotificationClosed); 597 chrome.notifications.onClosed.addListener(onNotificationClosed);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698