| OLD | NEW |
| 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 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 console.log('requestDismissingCard-onloadend ' + request.status); | 811 console.log('requestDismissingCard-onloadend ' + request.status); |
| 812 if (request.status == HTTP_NOCONTENT) | 812 if (request.status == HTTP_NOCONTENT) |
| 813 recordEvent(GoogleNowEvent.DISMISS_REQUEST_SUCCESS); | 813 recordEvent(GoogleNowEvent.DISMISS_REQUEST_SUCCESS); |
| 814 | 814 |
| 815 // A dismissal doesn't require further retries if it was successful or | 815 // A dismissal doesn't require further retries if it was successful or |
| 816 // doesn't have a chance for successful completion. | 816 // doesn't have a chance for successful completion. |
| 817 return (request.status == HTTP_NOCONTENT) ? | 817 return (request.status == HTTP_NOCONTENT) ? |
| 818 Promise.resolve() : | 818 Promise.resolve() : |
| 819 Promise.reject(); | 819 Promise.reject(); |
| 820 }).catch(function(request) { | 820 }).catch(function(request) { |
| 821 request = (typeof request === 'object') ? request : {}; |
| 821 return (request.status == HTTP_BAD_REQUEST || | 822 return (request.status == HTTP_BAD_REQUEST || |
| 822 request.status == HTTP_METHOD_NOT_ALLOWED) ? | 823 request.status == HTTP_METHOD_NOT_ALLOWED) ? |
| 823 Promise.resolve() : | 824 Promise.resolve() : |
| 824 Promise.reject(); | 825 Promise.reject(); |
| 825 }); | 826 }); |
| 826 } | 827 } |
| 827 | 828 |
| 828 /** | 829 /** |
| 829 * Tries to send dismiss requests for all pending dismissals. | 830 * Tries to send dismiss requests for all pending dismissals. |
| 830 * @return {Promise} A promise to process the pending dismissals. | 831 * @return {Promise} A promise to process the pending dismissals. |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 lastPollNowPayloads: items.lastPollNowPayloads, | 1362 lastPollNowPayloads: items.lastPollNowPayloads, |
| 1362 notificationGroups: items.notificationGroups | 1363 notificationGroups: items.notificationGroups |
| 1363 }); | 1364 }); |
| 1364 | 1365 |
| 1365 pollOptedInWithRecheck(); | 1366 pollOptedInWithRecheck(); |
| 1366 } | 1367 } |
| 1367 }); | 1368 }); |
| 1368 }); | 1369 }); |
| 1369 } | 1370 } |
| 1370 }); | 1371 }); |
| OLD | NEW |