| OLD | NEW |
| 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 Loading... |
| 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 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 106 store_path, | 106 store_path, |
| 107 request_context, | 107 request_context, |
| 108 content::BrowserThread::GetMessageLoopProxyForThread( | 108 content::BrowserThread::GetMessageLoopProxyForThread( |
| 109 content::BrowserThread::UI), | 109 content::BrowserThread::UI), |
| 110 content::BrowserThread::GetMessageLoopProxyForThread( | 110 content::BrowserThread::GetMessageLoopProxyForThread( |
| 111 content::BrowserThread::IO), | 111 content::BrowserThread::IO), |
| 112 blocking_task_runner)); | 112 blocking_task_runner)); |
| 113 } | 113 } |
| 114 | 114 |
| 115 } // namespace gcm | 115 } // namespace gcm |
| OLD | NEW |