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

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

Issue 635073002: [GCM] Updates to GCMChannelStatusSyncer - UserAgent and server URL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing CR nits Created 6 years, 2 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
« no previous file with comments | « no previous file | components/gcm_driver/gcm_channel_status_request.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/logging.h" 7 #include "base/logging.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/sync/glue/local_device_info_provider_impl.h"
11 #include "chrome/browser/sync/profile_sync_service.h"
10 #include "chrome/common/chrome_version_info.h" 12 #include "chrome/common/chrome_version_info.h"
11 #include "components/gcm_driver/gcm_client.h" 13 #include "components/gcm_driver/gcm_client.h"
12 #include "components/gcm_driver/gcm_client_factory.h" 14 #include "components/gcm_driver/gcm_client_factory.h"
13 #include "components/gcm_driver/gcm_driver.h" 15 #include "components/gcm_driver/gcm_driver.h"
14 #include "components/gcm_driver/gcm_driver_desktop.h" 16 #include "components/gcm_driver/gcm_driver_desktop.h"
15 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
16 18
17 namespace gcm { 19 namespace gcm {
18 20
19 namespace { 21 namespace {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 64 }
63 65
64 GCMClient::ChromeBuildInfo GetChromeBuildInfo() { 66 GCMClient::ChromeBuildInfo GetChromeBuildInfo() {
65 GCMClient::ChromeBuildInfo chrome_build_info; 67 GCMClient::ChromeBuildInfo chrome_build_info;
66 chrome_build_info.platform = GetPlatform(); 68 chrome_build_info.platform = GetPlatform();
67 chrome_build_info.channel = GetChannel(); 69 chrome_build_info.channel = GetChannel();
68 chrome_build_info.version = GetVersion(); 70 chrome_build_info.version = GetVersion();
69 return chrome_build_info; 71 return chrome_build_info;
70 } 72 }
71 73
74 std::string GetChannelStatusRequestUrl() {
75 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
76 if (channel == chrome::VersionInfo::CHANNEL_STABLE ||
77 channel == chrome::VersionInfo::CHANNEL_BETA) {
78 return ProfileSyncService::kSyncServerUrl;
79 }
80
81 return ProfileSyncService::kDevServerUrl;
82 }
83
84 std::string GetUserAgent() {
85 chrome::VersionInfo version_info;
86 return browser_sync::LocalDeviceInfoProviderImpl::MakeUserAgentForSyncApi(
87 version_info);
88 }
89
72 } // namespace 90 } // namespace
73 91
74 scoped_ptr<GCMDriver> CreateGCMDriverDesktop( 92 scoped_ptr<GCMDriver> CreateGCMDriverDesktop(
75 scoped_ptr<GCMClientFactory> gcm_client_factory, 93 scoped_ptr<GCMClientFactory> gcm_client_factory,
76 PrefService* prefs, 94 PrefService* prefs,
77 const base::FilePath& store_path, 95 const base::FilePath& store_path,
78 const scoped_refptr<net::URLRequestContextGetter>& request_context) { 96 const scoped_refptr<net::URLRequestContextGetter>& request_context) {
79 scoped_refptr<base::SequencedWorkerPool> worker_pool( 97 scoped_refptr<base::SequencedWorkerPool> worker_pool(
80 content::BrowserThread::GetBlockingPool()); 98 content::BrowserThread::GetBlockingPool());
81 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( 99 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner(
82 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( 100 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior(
83 worker_pool->GetSequenceToken(), 101 worker_pool->GetSequenceToken(),
84 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); 102 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
85 return scoped_ptr<GCMDriver>(new GCMDriverDesktop( 103 return scoped_ptr<GCMDriver>(
86 gcm_client_factory.Pass(), 104 new GCMDriverDesktop(gcm_client_factory.Pass(),
87 GetChromeBuildInfo(), 105 GetChromeBuildInfo(),
88 prefs, 106 GetChannelStatusRequestUrl(),
89 store_path, 107 GetUserAgent(),
90 request_context, 108 prefs,
91 content::BrowserThread::GetMessageLoopProxyForThread( 109 store_path,
92 content::BrowserThread::UI), 110 request_context,
93 content::BrowserThread::GetMessageLoopProxyForThread( 111 content::BrowserThread::GetMessageLoopProxyForThread(
94 content::BrowserThread::IO), 112 content::BrowserThread::UI),
95 blocking_task_runner)); 113 content::BrowserThread::GetMessageLoopProxyForThread(
114 content::BrowserThread::IO),
115 blocking_task_runner));
96 } 116 }
97 117
98 } // namespace gcm 118 } // namespace gcm
OLDNEW
« no previous file with comments | « no previous file | components/gcm_driver/gcm_channel_status_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698