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 9da2b04dfabc7b9f9748f1be0c405d96e575d482..f83d66c5a400cc9a036137a194b7465acb3f143b 100644 |
--- a/chrome/browser/resources/google_now/background.js |
+++ b/chrome/browser/resources/google_now/background.js |
@@ -1028,8 +1028,6 @@ function stopPollingCards() { |
*/ |
function initialize() { |
recordEvent(GoogleNowEvent.EXTENSION_START); |
- // TODO(skare): Reenable, after signin. |
- unregisterFromGcm(); |
onStateChange(); |
} |
@@ -1054,7 +1052,8 @@ function setShouldPollCards(shouldPollCardsRequest) { |
} |
/** |
- * Starts or stops the optin check. |
+ * Starts or stops the optin check and GCM channel to receive optin |
+ * notifications. |
* @param {boolean} shouldPollOptInStatus true to start and false to stop |
* polling the optin status. |
*/ |
@@ -1073,8 +1072,15 @@ function setShouldPollOptInStatus(shouldPollOptInStatus) { |
'Action Ignored setShouldPollOptInStatus=' + shouldPollOptInStatus); |
} |
}); |
+ |
+ if (shouldPollOptInStatus) { |
+ registerForGcm(); |
+ } else { |
+ unregisterFromGcm(); |
+ } |
} |
+ |
/** |
* Enables or disables the Google Now background permission. |
* @param {boolean} backgroundEnable true to run in the background. |