Index: ios/chrome/browser/application_context_impl.cc |
diff --git a/ios/chrome/browser/application_context_impl.cc b/ios/chrome/browser/application_context_impl.cc |
index 4f7ace27c42356a3cf80bf31b99e06da561a19dd..5f35e1304d95c3e3101d482671e11a54f2ff0212 100644 |
--- a/ios/chrome/browser/application_context_impl.cc |
+++ b/ios/chrome/browser/application_context_impl.cc |
@@ -338,6 +338,19 @@ void ApplicationContextImpl::CreateGCMDriver() { |
base::FilePath store_path; |
CHECK(PathService::Get(ios::DIR_GLOBAL_GCM_STORE, &store_path)); |
+ |
+// These strings must never change during the lifetime of a Chrome install, |
+// since e.g. to unregister an Instance ID token we must pass the same |
+// category to FCM as we originally passed when registering it. |
Peter Beverloo
2016/07/28 12:34:10
nit: avoid "we" here too (2x)
johnme
2016/08/04 17:47:14
Done.
|
+#if defined(GOOGLE_CHROME_BUILD) |
+ std::string channel = ::GetChannelString(); |
+ if (channel.empty()) |
+ channel = "stable"; |
+ std::string category_for_subtypes = "com.chrome." + channel + ".ios"; |
+#else |
+ std::string category_for_subtypes = "org.chromium.unknown.ios"; |
+#endif |
+ |
base::SequencedWorkerPool* worker_pool = web::WebThread::GetBlockingPool(); |
scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( |
worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( |
@@ -347,7 +360,8 @@ void ApplicationContextImpl::CreateGCMDriver() { |
gcm_driver_ = gcm::CreateGCMDriverDesktop( |
base::WrapUnique(new gcm::GCMClientFactory), GetLocalState(), store_path, |
GetSystemURLRequestContext(), ::GetChannel(), |
- web::WebThread::GetTaskRunnerForThread(web::WebThread::UI), |
+ category_for_subtypes web::WebThread::GetTaskRunnerForThread( |
+ web::WebThread::UI), |
web::WebThread::GetTaskRunnerForThread(web::WebThread::IO), |
blocking_task_runner); |
} |