| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ios/chrome/browser/application_context_impl.h" | 5 #include "ios/chrome/browser/application_context_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 local_state_->GetBoolean(prefs::kLastSessionExitedCleanly); | 331 local_state_->GetBoolean(prefs::kLastSessionExitedCleanly); |
| 332 } | 332 } |
| 333 } | 333 } |
| 334 | 334 |
| 335 void ApplicationContextImpl::CreateGCMDriver() { | 335 void ApplicationContextImpl::CreateGCMDriver() { |
| 336 DCHECK(thread_checker_.CalledOnValidThread()); | 336 DCHECK(thread_checker_.CalledOnValidThread()); |
| 337 DCHECK(!gcm_driver_); | 337 DCHECK(!gcm_driver_); |
| 338 | 338 |
| 339 base::FilePath store_path; | 339 base::FilePath store_path; |
| 340 CHECK(PathService::Get(ios::DIR_GLOBAL_GCM_STORE, &store_path)); | 340 CHECK(PathService::Get(ios::DIR_GLOBAL_GCM_STORE, &store_path)); |
| 341 |
| 342 // These strings must never change during the lifetime of a Chrome install, |
| 343 // since e.g. to unregister an Instance ID token the same category must be |
| 344 // passed to FCM as was originally passed when registering it. |
| 345 #if defined(GOOGLE_CHROME_BUILD) |
| 346 std::string channel = ::GetChannelString(); |
| 347 if (channel.empty()) |
| 348 channel = "stable"; |
| 349 std::string product_category_for_subtypes = "com.chrome." + channel + ".ios"; |
| 350 #else |
| 351 std::string product_category_for_subtypes = "org.chromium.unknown.ios"; |
| 352 #endif |
| 353 |
| 341 base::SequencedWorkerPool* worker_pool = web::WebThread::GetBlockingPool(); | 354 base::SequencedWorkerPool* worker_pool = web::WebThread::GetBlockingPool(); |
| 342 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( | 355 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( |
| 343 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( | 356 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( |
| 344 worker_pool->GetSequenceToken(), | 357 worker_pool->GetSequenceToken(), |
| 345 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 358 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
| 346 | 359 |
| 347 gcm_driver_ = gcm::CreateGCMDriverDesktop( | 360 gcm_driver_ = gcm::CreateGCMDriverDesktop( |
| 348 base::WrapUnique(new gcm::GCMClientFactory), GetLocalState(), store_path, | 361 base::WrapUnique(new gcm::GCMClientFactory), GetLocalState(), store_path, |
| 349 GetSystemURLRequestContext(), ::GetChannel(), | 362 GetSystemURLRequestContext(), ::GetChannel(), |
| 363 product_category_for_subtypes, |
| 350 web::WebThread::GetTaskRunnerForThread(web::WebThread::UI), | 364 web::WebThread::GetTaskRunnerForThread(web::WebThread::UI), |
| 351 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO), | 365 web::WebThread::GetTaskRunnerForThread(web::WebThread::IO), |
| 352 blocking_task_runner); | 366 blocking_task_runner); |
| 353 } | 367 } |
| OLD | NEW |