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

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

Issue 1308313003: Componentize chrome/common/sync_util (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
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_desktop_utils.h" 5 #include "chrome/browser/services/gcm/gcm_desktop_utils.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/sequenced_task_runner.h" 8 #include "base/sequenced_task_runner.h"
9 #include "base/threading/sequenced_worker_pool.h" 9 #include "base/threading/sequenced_worker_pool.h"
10 #include "chrome/browser/services/gcm/gcm_desktop_utils.h" 10 #include "chrome/browser/services/gcm/gcm_desktop_utils.h"
11 #include "chrome/common/channel_info.h" 11 #include "chrome/common/channel_info.h"
12 #include "chrome/common/sync_util.h"
13 #include "components/gcm_driver/gcm_client_factory.h" 12 #include "components/gcm_driver/gcm_client_factory.h"
14 #include "components/gcm_driver/gcm_driver.h" 13 #include "components/gcm_driver/gcm_driver.h"
15 #include "components/gcm_driver/gcm_driver_desktop.h" 14 #include "components/gcm_driver/gcm_driver_desktop.h"
15 #include "components/sync_driver/sync_util.h"
16 #include "components/version_info/version_info.h" 16 #include "components/version_info/version_info.h"
17 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
18 #include "url/gurl.h" 18 #include "url/gurl.h"
19 19
20 namespace gcm { 20 namespace gcm {
21 21
22 namespace { 22 namespace {
23 23
24 const char kChannelStatusRelativePath[] = "/experimentstatus"; 24 const char kChannelStatusRelativePath[] = "/experimentstatus";
25 25
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 GCMClient::ChromeBuildInfo GetChromeBuildInfo() { 68 GCMClient::ChromeBuildInfo GetChromeBuildInfo() {
69 GCMClient::ChromeBuildInfo chrome_build_info; 69 GCMClient::ChromeBuildInfo chrome_build_info;
70 chrome_build_info.platform = GetPlatform(); 70 chrome_build_info.platform = GetPlatform();
71 chrome_build_info.channel = GetChannel(); 71 chrome_build_info.channel = GetChannel();
72 chrome_build_info.version = GetVersion(); 72 chrome_build_info.version = GetVersion();
73 return chrome_build_info; 73 return chrome_build_info;
74 } 74 }
75 75
76 std::string GetChannelStatusRequestUrl() { 76 std::string GetChannelStatusRequestUrl() {
77 GURL sync_url(GetSyncServiceURL(*base::CommandLine::ForCurrentProcess())); 77 GURL sync_url(GetSyncServiceURL(*base::CommandLine::ForCurrentProcess(),
78 chrome::GetChannel()));
78 return sync_url.spec() + kChannelStatusRelativePath; 79 return sync_url.spec() + kChannelStatusRelativePath;
79 } 80 }
80 81
81 std::string GetUserAgent() { 82 std::string GetUserAgent() {
82 return MakeDesktopUserAgentForSync(); 83 return MakeDesktopUserAgentForSync(chrome::GetChannel());
83 } 84 }
84 85
85 } // namespace 86 } // namespace
86 87
87 scoped_ptr<GCMDriver> CreateGCMDriverDesktop( 88 scoped_ptr<GCMDriver> CreateGCMDriverDesktop(
88 scoped_ptr<GCMClientFactory> gcm_client_factory, 89 scoped_ptr<GCMClientFactory> gcm_client_factory,
89 PrefService* prefs, 90 PrefService* prefs,
90 const base::FilePath& store_path, 91 const base::FilePath& store_path,
91 const scoped_refptr<net::URLRequestContextGetter>& request_context) { 92 const scoped_refptr<net::URLRequestContextGetter>& request_context) {
92 93
93 scoped_refptr<base::SequencedWorkerPool> worker_pool( 94 scoped_refptr<base::SequencedWorkerPool> worker_pool(
94 content::BrowserThread::GetBlockingPool()); 95 content::BrowserThread::GetBlockingPool());
95 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( 96 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner(
96 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( 97 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior(
97 worker_pool->GetSequenceToken(), 98 worker_pool->GetSequenceToken(),
98 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); 99 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
99 100
100 return scoped_ptr<GCMDriver>(new GCMDriverDesktop( 101 return scoped_ptr<GCMDriver>(new GCMDriverDesktop(
101 gcm_client_factory.Pass(), 102 gcm_client_factory.Pass(), GetChromeBuildInfo(),
102 GetChromeBuildInfo(), 103 GetChannelStatusRequestUrl(), GetUserAgent(), prefs, store_path,
103 GetChannelStatusRequestUrl(), 104 request_context, content::BrowserThread::GetMessageLoopProxyForThread(
104 GetUserAgent(), 105 content::BrowserThread::UI),
105 prefs,
106 store_path,
107 request_context,
108 content::BrowserThread::GetMessageLoopProxyForThread(
109 content::BrowserThread::UI),
110 content::BrowserThread::GetMessageLoopProxyForThread( 106 content::BrowserThread::GetMessageLoopProxyForThread(
111 content::BrowserThread::IO), 107 content::BrowserThread::IO),
112 blocking_task_runner)); 108 blocking_task_runner));
113 } 109 }
114 110
115 } // namespace gcm 111 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698