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

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

Issue 2617663002: WIP: run clang-format-js on lots of things (Closed)
Patch Set: merge Created 3 years, 11 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/cards.js
diff --git a/chrome/browser/resources/google_now/cards.js b/chrome/browser/resources/google_now/cards.js
index 5c7d64fd11cff199b07789e8465071d1ae273705..57298056875e5b81438bf646afd6cf124875c307 100644
--- a/chrome/browser/resources/google_now/cards.js
+++ b/chrome/browser/resources/google_now/cards.js
@@ -136,8 +136,7 @@ function buildCardSet() {
// Try updating the notification.
instrumented.notifications.update(
- chromeNotificationId,
- receivedNotification.chromeNotificationOptions,
+ chromeNotificationId, receivedNotification.chromeNotificationOptions,
function(wasUpdated) {
if (!wasUpdated) {
// If the notification wasn't updated, it probably didn't exist.
@@ -151,9 +150,10 @@ function buildCardSet() {
function(newChromeNotificationId) {
if (!newChromeNotificationId || chrome.runtime.lastError) {
var errorMessage = chrome.runtime.lastError &&
- chrome.runtime.lastError.message;
- console.error('notifications.create: ID=' +
- newChromeNotificationId + ', ERROR=' + errorMessage);
+ chrome.runtime.lastError.message;
+ console.error(
+ 'notifications.create: ID=' + newChromeNotificationId +
+ ', ERROR=' + errorMessage);
return;
}
@@ -215,17 +215,14 @@ function buildCardSet() {
// Find a winning uncombined notification: a highest-priority notification
// that needs to be shown now.
iterateUncombinedNotifications(
- combinedCard,
- now,
- function(uncombinedCard, visible) {
+ combinedCard, now, function(uncombinedCard, visible) {
// If the uncombined notification is visible now and set the winning
// card to it if its priority is higher.
if (visible) {
if (!winningCard ||
- uncombinedCard.receivedNotification.chromeNotificationOptions.
- priority >
- winningCard.receivedNotification.chromeNotificationOptions.
- priority) {
+ uncombinedCard.receivedNotification.chromeNotificationOptions
+ .priority > winningCard.receivedNotification
+ .chromeNotificationOptions.priority) {
winningCard = uncombinedCard;
}
}
@@ -243,8 +240,7 @@ function buildCardSet() {
// Show/hide the winning card.
updateNotification(
- chromeNotificationId,
- winningCard && winningCard.receivedNotification,
+ chromeNotificationId, winningCard && winningCard.receivedNotification,
onCardShown);
if (nextEventTime) {
@@ -257,10 +253,10 @@ function buildCardSet() {
// be stored correctly to chrome.storage.
var winningActionUrls = winningCard &&
winningCard.receivedNotification.actionUrls &&
- JSON.parse(JSON.stringify(
- winningCard.receivedNotification.actionUrls));
- var winningCardTypeId = winningCard &&
- winningCard.receivedNotification.cardTypeId;
+ JSON.parse(
+ JSON.stringify(winningCard.receivedNotification.actionUrls));
+ var winningCardTypeId =
+ winningCard && winningCard.receivedNotification.cardTypeId;
return {
actionUrls: winningActionUrls,
cardTypeId: winningCardTypeId,
@@ -301,23 +297,23 @@ function buildCardSet() {
// preserved. We dismiss parts that were visible at the moment when the card
// was last updated.
iterateUncombinedNotifications(
- notificationData.combinedCard,
- notificationData.timestamp,
- function(uncombinedCard, visible) {
- if (visible) {
- dismissals.push({
- notificationId: uncombinedCard.receivedNotification.notificationId,
- parameters: uncombinedCard.receivedNotification.dismissal
- });
- } else {
- newCombinedCard.push(uncombinedCard);
- }
- });
+ notificationData.combinedCard, notificationData.timestamp,
+ function(uncombinedCard, visible) {
+ if (visible) {
+ dismissals.push({
+ notificationId:
+ uncombinedCard.receivedNotification.notificationId,
+ parameters: uncombinedCard.receivedNotification.dismissal
+ });
+ } else {
+ newCombinedCard.push(uncombinedCard);
+ }
+ });
return {
dismissals: dismissals,
- notificationData: update(
- chromeNotificationId, newCombinedCard, notificationGroups)
+ notificationData:
+ update(chromeNotificationId, newCombinedCard, notificationGroups)
};
}
@@ -358,21 +354,19 @@ function buildCardSet() {
console.log('cardManager.onAlarm.get ' + JSON.stringify(items));
var combinedCard =
- (items.notificationsData[chromeNotificationId] &&
- items.notificationsData[chromeNotificationId].combinedCard) || [];
+ (items.notificationsData[chromeNotificationId] &&
+ items.notificationsData[chromeNotificationId].combinedCard) ||
+ [];
var cardShownCallback = undefined;
if (localStorage['explanatoryCardsShown'] <
EXPLANATORY_CARDS_LINK_THRESHOLD) {
- cardShownCallback = countExplanatoryCard;
+ cardShownCallback = countExplanatoryCard;
}
- items.notificationsData[chromeNotificationId] =
- update(
- chromeNotificationId,
- combinedCard,
- items.notificationGroups,
- cardShownCallback);
+ items.notificationsData[chromeNotificationId] = update(
+ chromeNotificationId, combinedCard, items.notificationGroups,
+ cardShownCallback);
chrome.storage.local.set(items);
});
@@ -380,8 +374,5 @@ function buildCardSet() {
}
});
- return {
- update: update,
- onDismissal: onDismissal
- };
+ return {update: update, onDismissal: onDismissal};
}
« no previous file with comments | « chrome/browser/resources/google_now/background_test_util.js ('k') | chrome/browser/resources/google_now/common_test_util.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698