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

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

Issue 154653003: Count All Cards for Explanatory Link Support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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
« no previous file with comments | « no previous file | chrome/browser/resources/google_now/cards.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 75a8324cbc491e59406c4a07ffa8994d630be0eb..400409e630bec2dc23485853748e5ab47a3f700a 100644
--- a/chrome/browser/resources/google_now/background.js
+++ b/chrome/browser/resources/google_now/background.js
@@ -84,9 +84,9 @@ var DEFAULT_OPTIN_CHECK_PERIOD_SECONDS = 60 * 60 * 24 * 7; // 1 week
var SETTINGS_URL = 'https://support.google.com/chrome/?p=ib_google_now_welcome';
/**
- * Number of location cards that need an explanatory link.
+ * Number of cards that need an explanatory link.
*/
-var LOCATION_CARDS_LINK_THRESHOLD = 10;
+var EXPLANATORY_CARDS_LINK_THRESHOLD = 4;
/**
* Names for tasks that can be created by the extension.
@@ -551,14 +551,10 @@ function processServerResponse(response, onCardShown) {
}
/**
- * Update Location Cards Shown Count.
- * @param {ReceivedNotification} receivedNotification Notification as it was
- * received from the server.
+ * Update the Explanatory Total Cards Shown Count.
*/
-function countLocationCard(receivedNotification) {
- if (receivedNotification.locationBased) {
- localStorage['locationCardsShown']++;
- }
+function countExplanatoryCard() {
+ localStorage['explanatoryCardsShown']++;
}
/**
@@ -575,9 +571,11 @@ function requestNotificationGroups(groupNames) {
(-new Date().getTimezoneOffset() * MS_IN_MINUTE);
var cardShownCallback = undefined;
- if (localStorage['locationCardsShown'] < LOCATION_CARDS_LINK_THRESHOLD) {
- requestParameters += '&locationExplanation=true';
- cardShownCallback = countLocationCard;
+ var belowExplanatoryThreshold =
+ localStorage['explanatoryCardsShown'] < EXPLANATORY_CARDS_LINK_THRESHOLD;
+ if (belowExplanatoryThreshold) {
+ requestParameters += '&cardExplanation=true';
+ cardShownCallback = countExplanatoryCard;
}
groupNames.forEach(function(groupName) {
« no previous file with comments | « no previous file | chrome/browser/resources/google_now/cards.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698