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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
575 localStorage['explanatoryCardsShown'] < EXPLANATORY_CARDS_LINK_THRESHOLD; | 575 localStorage['explanatoryCardsShown'] < EXPLANATORY_CARDS_LINK_THRESHOLD; |
576 if (belowExplanatoryThreshold) { | 576 if (belowExplanatoryThreshold) { |
577 requestParameters += '&cardExplanation=true'; | 577 requestParameters += '&cardExplanation=true'; |
578 cardShownCallback = countExplanatoryCard; | 578 cardShownCallback = countExplanatoryCard; |
579 } | 579 } |
580 | 580 |
581 groupNames.forEach(function(groupName) { | 581 groupNames.forEach(function(groupName) { |
582 requestParameters += ('&requestTypes=' + groupName); | 582 requestParameters += ('&requestTypes=' + groupName); |
583 }); | 583 }); |
584 | 584 |
585 requestParameters += '&uiLocale=' + navigator.language; | |
rgustafson
2014/02/19 19:18:14
https://developer.mozilla.org/en-US/docs/Web/API/N
robliao
2014/02/19 19:26:47
Works for me.
accept-language:en-US,en;q=0.8,de;q
rgustafson
2014/02/19 19:39:16
Do you know the actual standard that these strings
robliao
2014/02/19 19:49:19
A bit more context. The reason why this works is b
| |
586 | |
585 console.log('requestNotificationGroups: request=' + requestParameters); | 587 console.log('requestNotificationGroups: request=' + requestParameters); |
586 | 588 |
587 var request = buildServerRequest('GET', 'notifications' + requestParameters); | 589 var request = buildServerRequest('GET', 'notifications' + requestParameters); |
588 | 590 |
589 request.onloadend = function(event) { | 591 request.onloadend = function(event) { |
590 console.log('requestNotificationGroups-onloadend ' + request.status); | 592 console.log('requestNotificationGroups-onloadend ' + request.status); |
591 if (request.status == HTTP_OK) { | 593 if (request.status == HTTP_OK) { |
592 recordEvent(GoogleNowEvent.REQUEST_FOR_CARDS_SUCCESS); | 594 recordEvent(GoogleNowEvent.REQUEST_FOR_CARDS_SUCCESS); |
593 processServerResponse( | 595 processServerResponse( |
594 JSON.parse(request.responseText), cardShownCallback); | 596 JSON.parse(request.responseText), cardShownCallback); |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1278 lastPollNowPayloads: items.lastPollNowPayloads, | 1280 lastPollNowPayloads: items.lastPollNowPayloads, |
1279 notificationGroups: items.notificationGroups | 1281 notificationGroups: items.notificationGroups |
1280 }); | 1282 }); |
1281 | 1283 |
1282 updateNotificationsCards(); | 1284 updateNotificationsCards(); |
1283 } | 1285 } |
1284 }); | 1286 }); |
1285 }); | 1287 }); |
1286 } | 1288 } |
1287 }); | 1289 }); |
OLD | NEW |