Chromium Code Reviews| 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 e24f70b499b482ea73d0a51204315cb4d34bcb2f..9da2b04dfabc7b9f9748f1be0c405d96e575d482 100644 |
| --- a/chrome/browser/resources/google_now/background.js |
| +++ b/chrome/browser/resources/google_now/background.js |
| @@ -202,6 +202,7 @@ var tasks = buildTaskManager(areTasksConflicting); |
| // Add error processing to API calls. |
| wrapper.instrumentChromeApiFunction('gcm.onMessage.addListener', 0); |
| wrapper.instrumentChromeApiFunction('gcm.register', 1); |
| +wrapper.instrumentChromeApiFunction('gcm.unregister', 0); |
| wrapper.instrumentChromeApiFunction('metricsPrivate.getVariationParams', 1); |
| wrapper.instrumentChromeApiFunction('notifications.clear', 1); |
| wrapper.instrumentChromeApiFunction('notifications.create', 2); |
| @@ -1027,7 +1028,8 @@ function stopPollingCards() { |
| */ |
| function initialize() { |
| recordEvent(GoogleNowEvent.EXTENSION_START); |
| - registerForGcm(); |
| + // TODO(skare): Reenable, after signin. |
| + unregisterFromGcm(); |
| onStateChange(); |
| } |
| @@ -1311,6 +1313,21 @@ function getGcmRegistrationId() { |
| } |
| /** |
| + * Unregisters from GCM if previously registered. |
| + */ |
| +function unregisterFromGcm() { |
| + fillFromChromeLocalStorage({gcmRegistrationId: undefined}) |
| + .then(function(items) { |
| + if (items.gcmRegistrationId) { |
| + console.log('Unregistering from gcm.'); |
| + chrome.storage.local.remove( |
| + ['gcmNotificationKey', 'gcmRegistrationId']); |
| + instrumented.gcm.unregister(function() {}); |
|
fgorski
2015/04/23 22:38:37
Would it make sense to call chrome.storage.local.r
skare_
2015/04/23 22:50:53
uploaded new snapshot -- via if(!chrome.runtime.la
|
| + } |
| + }); |
| +} |
| + |
| +/** |
| * Polls the optin state. |
| * Sometimes we get the response to the opted in result too soon during |
| * push messaging. We'll recheck the optin state a few times before giving up. |