| Index: chrome/browser/resources/google_now/background.js
|
| diff --git a/chrome/browser/resources/google_now/background.js b/chrome/browser/resources/google_now/background.js
|
| index 5d3eaf091c5e7f18c111b89689225ea419cac77b..087b2ac97912b99ca456bfc1bb2d45d74e1c8676 100644
|
| --- a/chrome/browser/resources/google_now/background.js
|
| +++ b/chrome/browser/resources/google_now/background.js
|
| @@ -125,8 +125,8 @@ var ReceivedGroup;
|
| *
|
| * @typedef {{
|
| * googleNowDisabled: (boolean|undefined),
|
| - * groups: Object.<string, ReceivedGroup>,
|
| - * notifications: Array.<ReceivedNotification>
|
| + * groups: Object<string, ReceivedGroup>,
|
| + * notifications: Array<ReceivedNotification>
|
| * }}
|
| */
|
| var ServerResponse;
|
| @@ -139,7 +139,7 @@ var ServerResponse;
|
| * cards update and all the times after that.
|
| *
|
| * @typedef {{
|
| - * cards: Array.<ReceivedNotification>,
|
| + * cards: Array<ReceivedNotification>,
|
| * cardsTimestamp: (number|undefined),
|
| * nextPollTime: (number|undefined),
|
| * rank: (number|undefined)
|
| @@ -342,14 +342,14 @@ function requestFromServer(method, handlerName, opt_contentType) {
|
|
|
| /**
|
| * Shows the notification groups as notification cards.
|
| - * @param {Object.<string, StoredNotificationGroup>} notificationGroups Map from
|
| + * @param {Object<string, StoredNotificationGroup>} notificationGroups Map from
|
| * group name to group information.
|
| * @param {function(ReceivedNotification)=} opt_onCardShown Optional parameter
|
| * called when each card is shown.
|
| * @return {Promise} A promise to show the notification groups as cards.
|
| */
|
| function showNotificationGroups(notificationGroups, opt_onCardShown) {
|
| - /** @type {Object.<ChromeNotificationId, CombinedCard>} */
|
| + /** @type {Object<ChromeNotificationId, CombinedCard>} */
|
| var cards = combineCardsFromGroups(notificationGroups);
|
| console.log('showNotificationGroups ' + JSON.stringify(cards));
|
|
|
| @@ -365,7 +365,7 @@ function showNotificationGroups(notificationGroups, opt_onCardShown) {
|
| cards[chromeNotificationId] = cards[chromeNotificationId] || [];
|
| }
|
|
|
| - /** @type {Object.<ChromeNotificationId, NotificationDataEntry>} */
|
| + /** @type {Object<ChromeNotificationId, NotificationDataEntry>} */
|
| var notificationsData = {};
|
|
|
| // Create/update/delete notifications.
|
| @@ -402,7 +402,7 @@ function removeAllCards() {
|
|
|
| /**
|
| * Adds a card group into a set of combined cards.
|
| - * @param {Object.<ChromeNotificationId, CombinedCard>} combinedCards Map from
|
| + * @param {Object<ChromeNotificationId, CombinedCard>} combinedCards Map from
|
| * chromeNotificationId to a combined card.
|
| * This is an input/output parameter.
|
| * @param {StoredNotificationGroup} storedGroup Group to combine into the
|
| @@ -432,7 +432,7 @@ function combineGroup(combinedCards, storedGroup) {
|
|
|
| /**
|
| * Calculates the soonest poll time from a map of groups as an absolute time.
|
| - * @param {Object.<string, StoredNotificationGroup>} groups Map from group name
|
| + * @param {Object<string, StoredNotificationGroup>} groups Map from group name
|
| * to group information.
|
| * @return {number} The next poll time based off of the groups.
|
| */
|
| @@ -454,7 +454,7 @@ function calculateNextPollTimeMilliseconds(groups) {
|
|
|
| /**
|
| * Schedules next cards poll.
|
| - * @param {Object.<string, StoredNotificationGroup>} groups Map from group name
|
| + * @param {Object<string, StoredNotificationGroup>} groups Map from group name
|
| * to group information.
|
| */
|
| function scheduleNextCardsPoll(groups) {
|
| @@ -481,13 +481,13 @@ function scheduleOptInCheckPoll() {
|
|
|
| /**
|
| * Combines notification groups into a set of Chrome notifications.
|
| - * @param {Object.<string, StoredNotificationGroup>} notificationGroups Map from
|
| + * @param {Object<string, StoredNotificationGroup>} notificationGroups Map from
|
| * group name to group information.
|
| - * @return {Object.<ChromeNotificationId, CombinedCard>} Cards to show.
|
| + * @return {Object<ChromeNotificationId, CombinedCard>} Cards to show.
|
| */
|
| function combineCardsFromGroups(notificationGroups) {
|
| console.log('combineCardsFromGroups ' + JSON.stringify(notificationGroups));
|
| - /** @type {Object.<ChromeNotificationId, CombinedCard>} */
|
| + /** @type {Object<ChromeNotificationId, CombinedCard>} */
|
| var combinedCards = {};
|
|
|
| for (var groupName in notificationGroups)
|
| @@ -514,16 +514,16 @@ function processServerResponse(response) {
|
| var receivedGroups = response.groups;
|
|
|
| return fillFromChromeLocalStorage({
|
| - /** @type {Object.<string, StoredNotificationGroup>} */
|
| + /** @type {Object<string, StoredNotificationGroup>} */
|
| notificationGroups: {},
|
| - /** @type {Object.<ServerNotificationId, number>} */
|
| + /** @type {Object<ServerNotificationId, number>} */
|
| recentDismissals: {}
|
| }).then(function(items) {
|
| console.log('processServerResponse-get ' + JSON.stringify(items));
|
|
|
| // Build a set of non-expired recent dismissals. It will be used for
|
| // client-side filtering of cards.
|
| - /** @type {Object.<ServerNotificationId, number>} */
|
| + /** @type {Object<ServerNotificationId, number>} */
|
| var updatedRecentDismissals = {};
|
| var now = Date.now();
|
| for (var serverNotificationId in items.recentDismissals) {
|
| @@ -612,7 +612,7 @@ function shouldShowExplanatoryCard() {
|
|
|
| /**
|
| * Requests notification cards from the server for specified groups.
|
| - * @param {Array.<string>} groupNames Names of groups that need to be refreshed.
|
| + * @param {Array<string>} groupNames Names of groups that need to be refreshed.
|
| * @return {Promise} A promise to request the specified notification groups.
|
| */
|
| function requestNotificationGroupsFromServer(groupNames) {
|
| @@ -694,7 +694,7 @@ function requestAndUpdateOptedIn() {
|
| */
|
| function getGroupsToRequest() {
|
| return fillFromChromeLocalStorage({
|
| - /** @type {Object.<string, StoredNotificationGroup>} */
|
| + /** @type {Object<string, StoredNotificationGroup>} */
|
| notificationGroups: {}
|
| }).then(function(items) {
|
| console.log('getGroupsToRequest-storage-get ' + JSON.stringify(items));
|
| @@ -739,7 +739,7 @@ function requestNotificationCards() {
|
| * Determines if an immediate retry should occur based off of the given groups.
|
| * The NOR group is expected most often and less latency sensitive, so we will
|
| * simply wait MAXIMUM_POLLING_PERIOD_SECONDS before trying again.
|
| - * @param {Array.<string>} groupNames Names of groups that need to be refreshed.
|
| + * @param {Array<string>} groupNames Names of groups that need to be refreshed.
|
| * @return {boolean} Whether a retry should occur.
|
| */
|
| function shouldScheduleRetryFromGroupList(groupNames) {
|
| @@ -833,9 +833,9 @@ function requestCardDismissal(
|
| */
|
| function processPendingDismissals() {
|
| return fillFromChromeLocalStorage({
|
| - /** @type {Array.<PendingDismissal>} */
|
| + /** @type {Array<PendingDismissal>} */
|
| pendingDismissals: [],
|
| - /** @type {Object.<ServerNotificationId, number>} */
|
| + /** @type {Object<ServerNotificationId, number>} */
|
| recentDismissals: {}
|
| }).then(function(items) {
|
| console.log(
|
| @@ -913,7 +913,7 @@ function openUrl(url) {
|
| */
|
| function onNotificationClicked(chromeNotificationId, selector) {
|
| fillFromChromeLocalStorage({
|
| - /** @type {Object.<ChromeNotificationId, NotificationDataEntry>} */
|
| + /** @type {Object<ChromeNotificationId, NotificationDataEntry>} */
|
| notificationsData: {}
|
| }).then(function(items) {
|
| /** @type {(NotificationDataEntry|undefined)} */
|
| @@ -946,11 +946,11 @@ function onNotificationClosed(chromeNotificationId, byUser) {
|
| dismissalAttempts.start();
|
|
|
| fillFromChromeLocalStorage({
|
| - /** @type {Array.<PendingDismissal>} */
|
| + /** @type {Array<PendingDismissal>} */
|
| pendingDismissals: [],
|
| - /** @type {Object.<ChromeNotificationId, NotificationDataEntry>} */
|
| + /** @type {Object<ChromeNotificationId, NotificationDataEntry>} */
|
| notificationsData: {},
|
| - /** @type {Object.<string, StoredNotificationGroup>} */
|
| + /** @type {Object<string, StoredNotificationGroup>} */
|
| notificationGroups: {}
|
| }).then(function(items) {
|
| /** @type {NotificationDataEntry} */
|
| @@ -1258,7 +1258,7 @@ instrumented.runtime.onStartup.addListener(function() {
|
| // persistent notifications will work.
|
| tasks.add(SHOW_ON_START_TASK_NAME, function() {
|
| fillFromChromeLocalStorage({
|
| - /** @type {Object.<string, StoredNotificationGroup>} */
|
| + /** @type {Object<string, StoredNotificationGroup>} */
|
| notificationGroups: {}
|
| }).then(function(items) {
|
| console.log('onStartup-get ' + JSON.stringify(items));
|
| @@ -1346,7 +1346,7 @@ instrumented.pushMessaging.onMessage.addListener(function(message) {
|
| // preventing polling the server when the payload really didn't change.
|
| fillFromChromeLocalStorage({
|
| lastPollNowPayloads: {},
|
| - /** @type {Object.<string, StoredNotificationGroup>} */
|
| + /** @type {Object<string, StoredNotificationGroup>} */
|
| notificationGroups: {}
|
| }, PromiseRejection.ALLOW).then(function(items) {
|
| if (items.lastPollNowPayloads[message.subchannelId] !=
|
|
|