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

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

Issue 653843003: [GCM] Start GCMChannelStatusSyncer when GCM is disabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for GCM not reenabled after being disabled on the fly 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/command_line.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
8 #include "base/sequenced_task_runner.h" 9 #include "base/sequenced_task_runner.h"
9 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
10 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h" 11 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h"
11 #include "chrome/browser/sync/profile_sync_service.h" 12 #include "chrome/browser/sync/profile_sync_service.h"
12 #include "chrome/common/chrome_version_info.h" 13 #include "chrome/common/chrome_version_info.h"
13 #include "components/gcm_driver/gcm_client.h" 14 #include "components/gcm_driver/gcm_client.h"
14 #include "components/gcm_driver/gcm_client_factory.h" 15 #include "components/gcm_driver/gcm_client_factory.h"
15 #include "components/gcm_driver/gcm_driver.h" 16 #include "components/gcm_driver/gcm_driver.h"
16 #include "components/gcm_driver/gcm_driver_desktop.h" 17 #include "components/gcm_driver/gcm_driver_desktop.h"
17 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
18 19
19 namespace gcm { 20 namespace gcm {
20 21
21 namespace { 22 namespace {
22 23
24 const char kChannelStatusRelativePath[] = "/experimentstatus";
25
23 GCMClient::ChromePlatform GetPlatform() { 26 GCMClient::ChromePlatform GetPlatform() {
24 #if defined(OS_WIN) 27 #if defined(OS_WIN)
25 return GCMClient::PLATFORM_WIN; 28 return GCMClient::PLATFORM_WIN;
26 #elif defined(OS_MACOSX) 29 #elif defined(OS_MACOSX)
27 return GCMClient::PLATFORM_MAC; 30 return GCMClient::PLATFORM_MAC;
28 #elif defined(OS_IOS) 31 #elif defined(OS_IOS)
29 return GCMClient::PLATFORM_IOS; 32 return GCMClient::PLATFORM_IOS;
30 #elif defined(OS_ANDROID) 33 #elif defined(OS_ANDROID)
31 return GCMClient::PLATFORM_ANDROID; 34 return GCMClient::PLATFORM_ANDROID;
32 #elif defined(OS_CHROMEOS) 35 #elif defined(OS_CHROMEOS)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 68
66 GCMClient::ChromeBuildInfo GetChromeBuildInfo() { 69 GCMClient::ChromeBuildInfo GetChromeBuildInfo() {
67 GCMClient::ChromeBuildInfo chrome_build_info; 70 GCMClient::ChromeBuildInfo chrome_build_info;
68 chrome_build_info.platform = GetPlatform(); 71 chrome_build_info.platform = GetPlatform();
69 chrome_build_info.channel = GetChannel(); 72 chrome_build_info.channel = GetChannel();
70 chrome_build_info.version = GetVersion(); 73 chrome_build_info.version = GetVersion();
71 return chrome_build_info; 74 return chrome_build_info;
72 } 75 }
73 76
74 std::string GetChannelStatusRequestUrl() { 77 std::string GetChannelStatusRequestUrl() {
75 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); 78 GURL sync_url(
76 if (channel == chrome::VersionInfo::CHANNEL_STABLE || 79 ProfileSyncService::GetSyncServiceURL(*CommandLine::ForCurrentProcess()));
77 channel == chrome::VersionInfo::CHANNEL_BETA) { 80 return sync_url.spec() + kChannelStatusRelativePath;
78 return ProfileSyncService::kSyncServerUrl;
79 }
80
81 return ProfileSyncService::kDevServerUrl;
82 } 81 }
83 82
84 std::string GetUserAgent() { 83 std::string GetUserAgent() {
85 chrome::VersionInfo version_info; 84 chrome::VersionInfo version_info;
86 return browser_sync::LocalDeviceInfoProviderImpl::MakeUserAgentForSyncApi( 85 return browser_sync::LocalDeviceInfoProviderImpl::MakeUserAgentForSyncApi(
87 version_info); 86 version_info);
88 } 87 }
89 88
90 } // namespace 89 } // namespace
91 90
(...skipping 17 matching lines...) Expand all
109 store_path, 108 store_path,
110 request_context, 109 request_context,
111 content::BrowserThread::GetMessageLoopProxyForThread( 110 content::BrowserThread::GetMessageLoopProxyForThread(
112 content::BrowserThread::UI), 111 content::BrowserThread::UI),
113 content::BrowserThread::GetMessageLoopProxyForThread( 112 content::BrowserThread::GetMessageLoopProxyForThread(
114 content::BrowserThread::IO), 113 content::BrowserThread::IO),
115 blocking_task_runner)); 114 blocking_task_runner));
116 } 115 }
117 116
118 } // namespace gcm 117 } // 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