Home | History | Annotate | Download | only in google_now

Lines Matching refs:card

10  * Builds an object to manage notification card set.
11 * @return {Object} Card set interface.
14 var cardShowPrefix = 'card-show-';
15 var cardHidePrefix = 'card-hide-';
19 * @param {string} cardId Card ID.
20 * @param {number=} opt_timeHide If specified, epoch time to hide the card. If
21 * undefined, the card will be kept shown at least until next update.
34 * @param {string} cardId Card ID.
35 * @param {Object} cardCreateInfo Google Now card represented as a set of
87 * Updates/creates a card notification with new data.
88 * @param {Object} card Google Now from the server.
89 * @param {number=} previousVersion The version of the shown card with
91 * @return {Object} Notification data entry for this card.
93 function update(card, previousVersion) {
94 console.log('cardManager.update ' + JSON.stringify(card) + ' ' +
97 if (typeof card.version != 'number') {
99 // Fix card version.
100 card.version = previousVersion || 0;
105 chrome.alarms.clear(cardHidePrefix + card.notificationId);
107 var timeHide = card.trigger && card.trigger.hideTimeSec !== undefined ?
108 Date.now() + card.trigger.hideTimeSec * MS_IN_SECOND : undefined;
110 notification: card.notification,
112 version: card.version,
116 var cardShowAlarmName = cardShowPrefix + card.notificationId;
117 if (card.trigger && card.trigger.showTimeSec) {
118 // Card needs to be shown later.
121 when: Date.now() + card.trigger.showTimeSec * MS_IN_SECOND
125 // Card needs to be shown immediately.
128 showNotification(card.notificationId, cardCreateInfo);
132 actionUrls: card.actionUrls,
134 dismissalParameters: card.dismissal
139 * Removes a card notification.
140 * @param {string} cardId Card ID.
154 // Alarm to show the card.
166 // Alarm to hide the card.