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

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, 3 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"
11 #include "chrome/common/channel_info.h" 10 #include "chrome/common/channel_info.h"
12 #include "chrome/common/sync_util.h"
13 #include "components/gcm_driver/gcm_client_factory.h" 11 #include "components/gcm_driver/gcm_client_factory.h"
14 #include "components/gcm_driver/gcm_driver.h" 12 #include "components/gcm_driver/gcm_driver.h"
15 #include "components/gcm_driver/gcm_driver_desktop.h" 13 #include "components/gcm_driver/gcm_driver_desktop.h"
14 #include "components/sync_driver/sync_util.h"
16 #include "components/version_info/version_info.h" 15 #include "components/version_info/version_info.h"
17 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
18 #include "url/gurl.h" 17 #include "url/gurl.h"
19 18
20 namespace gcm { 19 namespace gcm {
21 20
22 namespace { 21 namespace {
23 22
24 const char kChannelStatusRelativePath[] = "/experimentstatus"; 23 const char kChannelStatusRelativePath[] = "/experimentstatus";
25 24
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 66
68 GCMClient::ChromeBuildInfo GetChromeBuildInfo() { 67 GCMClient::ChromeBuildInfo GetChromeBuildInfo() {
69 GCMClient::ChromeBuildInfo chrome_build_info; 68 GCMClient::ChromeBuildInfo chrome_build_info;
70 chrome_build_info.platform = GetPlatform(); 69 chrome_build_info.platform = GetPlatform();
71 chrome_build_info.channel = GetChannel(); 70 chrome_build_info.channel = GetChannel();
72 chrome_build_info.version = GetVersion(); 71 chrome_build_info.version = GetVersion();
73 return chrome_build_info; 72 return chrome_build_info;
74 } 73 }
75 74
76 std::string GetChannelStatusRequestUrl() { 75 std::string GetChannelStatusRequestUrl() {
77 GURL sync_url(GetSyncServiceURL(*base::CommandLine::ForCurrentProcess())); 76 GURL sync_url(GetSyncServiceURL(*base::CommandLine::ForCurrentProcess(),
77 chrome::GetChannel()));
78 return sync_url.spec() + kChannelStatusRelativePath; 78 return sync_url.spec() + kChannelStatusRelativePath;
79 } 79 }
80 80
81 std::string GetUserAgent() { 81 std::string GetUserAgent() {
82 return MakeDesktopUserAgentForSync(); 82 return MakeDesktopUserAgentForSync(chrome::GetChannel());
83 } 83 }
84 84
85 } // namespace 85 } // namespace
86 86
87 scoped_ptr<GCMDriver> CreateGCMDriverDesktop( 87 scoped_ptr<GCMDriver> CreateGCMDriverDesktop(
88 scoped_ptr<GCMClientFactory> gcm_client_factory, 88 scoped_ptr<GCMClientFactory> gcm_client_factory,
89 PrefService* prefs, 89 PrefService* prefs,
90 const base::FilePath& store_path, 90 const base::FilePath& store_path,
91 const scoped_refptr<net::URLRequestContextGetter>& request_context) { 91 const scoped_refptr<net::URLRequestContextGetter>& request_context) {
92 92
93 scoped_refptr<base::SequencedWorkerPool> worker_pool( 93 scoped_refptr<base::SequencedWorkerPool> worker_pool(
94 content::BrowserThread::GetBlockingPool()); 94 content::BrowserThread::GetBlockingPool());
95 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( 95 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner(
96 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( 96 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior(
97 worker_pool->GetSequenceToken(), 97 worker_pool->GetSequenceToken(),
98 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); 98 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
99 99
100 return scoped_ptr<GCMDriver>(new GCMDriverDesktop( 100 return scoped_ptr<GCMDriver>(new GCMDriverDesktop(
101 gcm_client_factory.Pass(), 101 gcm_client_factory.Pass(), GetChromeBuildInfo(),
102 GetChromeBuildInfo(), 102 GetChannelStatusRequestUrl(), GetUserAgent(), prefs, store_path,
103 GetChannelStatusRequestUrl(), 103 request_context, content::BrowserThread::GetMessageLoopProxyForThread(
104 GetUserAgent(), 104 content::BrowserThread::UI),
Nicolas Zea 2015/08/27 18:16:16 Did clang-format do this? Looks odd
Jitu( very slow this week) 2015/08/28 05:52:43 Yes, Done
105 prefs,
106 store_path,
107 request_context,
108 content::BrowserThread::GetMessageLoopProxyForThread(
109 content::BrowserThread::UI),
110 content::BrowserThread::GetMessageLoopProxyForThread( 105 content::BrowserThread::GetMessageLoopProxyForThread(
111 content::BrowserThread::IO), 106 content::BrowserThread::IO),
112 blocking_task_runner)); 107 blocking_task_runner));
113 } 108 }
114 109
115 } // namespace gcm 110 } // namespace gcm
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698