[NTP::Push] Periodically check token validity and resubscribe if not.
GCM token may become invalid (it is stored on disk and may be corrupted).
Therefore, this CL adds a periodical check (at least 24 hours, without waking
up) of the current token validity. If it is invalid, then a new token is
retrieved and used to resubscribe to our server.
Bug: 742240
Change-Id: I27d873049c6dbc7ff8c3ad0471cf20ca7f754d53
Reviewed-on: https://chromium-review.googlesource.com/574232
Reviewed-by: Bernhard Bauer <[email protected]>
Reviewed-by: Marc Treib <[email protected]>
Commit-Queue: vitaliii <[email protected]>
Cr-Commit-Position: refs/heads/master@{#491956}
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 41d9382..aed9e942 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -78,8 +78,6 @@
#include "components/gcm_driver/gcm_channel_status_syncer.h"
#include "components/language/core/browser/url_language_histogram.h"
#include "components/network_time/network_time_tracker.h"
-#include "components/ntp_snippets/breaking_news/breaking_news_gcm_app_handler.h"
-#include "components/ntp_snippets/breaking_news/subscription_manager_impl.h"
#include "components/ntp_snippets/content_suggestions_service.h"
#include "components/ntp_snippets/remote/remote_suggestions_provider_impl.h"
#include "components/ntp_snippets/remote/remote_suggestions_scheduler_impl.h"
@@ -173,6 +171,8 @@
#include "chrome/browser/geolocation/geolocation_permission_context_android.h"
#include "chrome/browser/ntp_snippets/download_suggestions_provider.h"
#include "components/cdm/browser/media_drm_storage_impl.h"
+#include "components/ntp_snippets/breaking_news/breaking_news_gcm_app_handler.h"
+#include "components/ntp_snippets/breaking_news/subscription_manager_impl.h"
#include "components/ntp_snippets/category_rankers/click_based_category_ranker.h"
#include "components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.h"
#include "components/ntp_snippets/physical_web_pages/physical_web_page_suggestions_provider.h"
@@ -473,14 +473,12 @@
MediaStreamDevicesController::RegisterProfilePrefs(registry);
NavigationCorrectionTabObserver::RegisterProfilePrefs(registry);
NotifierStateTracker::RegisterProfilePrefs(registry);
- ntp_snippets::BreakingNewsGCMAppHandler::RegisterProfilePrefs(registry);
ntp_snippets::ContentSuggestionsService::RegisterProfilePrefs(registry);
ntp_snippets::ForeignSessionsSuggestionsProvider::RegisterProfilePrefs(
registry);
ntp_snippets::RemoteSuggestionsProviderImpl::RegisterProfilePrefs(registry);
ntp_snippets::RemoteSuggestionsSchedulerImpl::RegisterProfilePrefs(registry);
ntp_snippets::RequestThrottler::RegisterProfilePrefs(registry);
- ntp_snippets::SubscriptionManagerImpl::RegisterProfilePrefs(registry);
ntp_snippets::UserClassifier::RegisterProfilePrefs(registry);
ntp_tiles::MostVisitedSites::RegisterProfilePrefs(registry);
password_bubble_experiment::RegisterPrefs(registry);
@@ -568,10 +566,12 @@
cdm::MediaDrmStorageImpl::RegisterProfilePrefs(registry);
ContentSuggestionsNotifierService::RegisterProfilePrefs(registry);
DownloadSuggestionsProvider::RegisterProfilePrefs(registry);
+ ntp_snippets::BreakingNewsGCMAppHandler::RegisterProfilePrefs(registry);
ntp_snippets::ClickBasedCategoryRanker::RegisterProfilePrefs(registry);
ntp_snippets::PhysicalWebPageSuggestionsProvider::RegisterProfilePrefs(
registry);
ntp_snippets::RecentTabSuggestionsProvider::RegisterProfilePrefs(registry);
+ ntp_snippets::SubscriptionManagerImpl::RegisterProfilePrefs(registry);
#endif // defined(OS_ANDROID)
#if !defined(OS_ANDROID)