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

Unified Diff: ios/chrome/browser/application_context_impl.cc

Issue 2111973002: Add support for GCM subtypes to desktop Instance ID implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@iid9push
Patch Set: Address review comments Created 4 years, 5 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
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);
}

Powered by Google App Engine
This is Rietveld 408576698