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
3 // found in the LICENSE file.
5 #include "chrome/browser/services/gcm/gcm_desktop_utils.h"
7 #include "base/sequenced_task_runner.h"
8 #include "base/threading/sequenced_worker_pool.h"
9 #include "chrome/common/gcm_desktop_util.h"
10 #include "components/gcm_driver/gcm_client_factory.h"
11 #include "components/gcm_driver/gcm_driver.h"
12 #include "content/public/browser/browser_thread.h"
16 scoped_ptr
<GCMDriver
> CreateGCMDriverDesktop(
17 scoped_ptr
<GCMClientFactory
> gcm_client_factory
,
19 const base::FilePath
& store_path
,
20 const scoped_refptr
<net::URLRequestContextGetter
>& request_context
) {
22 scoped_refptr
<base::SequencedWorkerPool
> worker_pool(
23 content::BrowserThread::GetBlockingPool());
24 scoped_refptr
<base::SequencedTaskRunner
> blocking_task_runner(
25 worker_pool
->GetSequencedTaskRunnerWithShutdownBehavior(
26 worker_pool
->GetSequenceToken(),
27 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN
));
29 return CreateGCMDriverDesktopWithTaskRunners(
30 gcm_client_factory
.Pass(),
34 content::BrowserThread::GetMessageLoopProxyForThread(
35 content::BrowserThread::UI
),
36 content::BrowserThread::GetMessageLoopProxyForThread(
37 content::BrowserThread::IO
),
38 blocking_task_runner
);