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

Side by Side Diff: chrome/browser/services/gcm/gcm_desktop_utils.cc

Issue 301973009: Add browser-global GCMDriver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build on Android. Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/browser/services/gcm/gcm_utils.h" 5 #include "chrome/browser/services/gcm/gcm_desktop_utils.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/sequenced_task_runner.h"
9 #include "base/threading/sequenced_worker_pool.h"
8 #include "chrome/common/chrome_version_info.h" 10 #include "chrome/common/chrome_version_info.h"
11 #include "components/gcm_driver/gcm_client_factory.h"
12 #include "components/gcm_driver/gcm_driver.h"
13 #include "components/gcm_driver/gcm_driver_desktop.h"
14 #include "content/public/browser/browser_thread.h"
15 #include "google_apis/gcm/gcm_client.h"
9 16
10 namespace gcm { 17 namespace gcm {
11 18
12 namespace { 19 namespace {
13 20
14 GCMClient::ChromePlatform GetPlatform() { 21 GCMClient::ChromePlatform GetPlatform() {
15 #if defined(OS_WIN) 22 #if defined(OS_WIN)
16 return GCMClient::PLATFORM_WIN; 23 return GCMClient::PLATFORM_WIN;
17 #elif defined(OS_MACOSX) 24 #elif defined(OS_MACOSX)
18 return GCMClient::PLATFORM_MAC; 25 return GCMClient::PLATFORM_MAC;
(...skipping 28 matching lines...) Expand all
47 NOTREACHED(); 54 NOTREACHED();
48 return GCMClient::CHANNEL_UNKNOWN; 55 return GCMClient::CHANNEL_UNKNOWN;
49 } 56 }
50 } 57 }
51 58
52 std::string GetVersion() { 59 std::string GetVersion() {
53 chrome::VersionInfo version_info; 60 chrome::VersionInfo version_info;
54 return version_info.Version(); 61 return version_info.Version();
55 } 62 }
56 63
57 } // namespace
58
59 GCMClient::ChromeBuildInfo GetChromeBuildInfo() { 64 GCMClient::ChromeBuildInfo GetChromeBuildInfo() {
60 GCMClient::ChromeBuildInfo chrome_build_info; 65 GCMClient::ChromeBuildInfo chrome_build_info;
61 chrome_build_info.platform = GetPlatform(); 66 chrome_build_info.platform = GetPlatform();
62 chrome_build_info.channel = GetChannel(); 67 chrome_build_info.channel = GetChannel();
63 chrome_build_info.version = GetVersion(); 68 chrome_build_info.version = GetVersion();
64 return chrome_build_info; 69 return chrome_build_info;
65 } 70 }
66 71
72 } // namespace
73
74 scoped_ptr<GCMDriver> CreateGCMDriverDesktop(
75 scoped_ptr<GCMClientFactory> gcm_client_factory,
76 scoped_ptr<IdentityProvider> identity_provider,
77 const base::FilePath& store_path,
78 const scoped_refptr<net::URLRequestContextGetter>& request_context) {
79 scoped_refptr<base::SequencedWorkerPool> worker_pool(
80 content::BrowserThread::GetBlockingPool());
81 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner(
82 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior(
83 worker_pool->GetSequenceToken(),
84 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
85 return scoped_ptr<GCMDriver>(new GCMDriverDesktop(
86 gcm_client_factory.Pass(),
87 identity_provider.Pass(),
88 GetChromeBuildInfo(),
89 store_path,
90 request_context,
91 content::BrowserThread::GetMessageLoopProxyForThread(
92 content::BrowserThread::UI),
93 content::BrowserThread::GetMessageLoopProxyForThread(
94 content::BrowserThread::IO),
95 blocking_task_runner));
96 }
97
67 } // namespace gcm 98 } // namespace gcm
OLDNEW
« no previous file with comments | « chrome/browser/services/gcm/gcm_desktop_utils.h ('k') | chrome/browser/services/gcm/gcm_profile_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698