| 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 "components/gcm_driver/gcm_desktop_utils.h" | 5 #include "components/gcm_driver/gcm_desktop_utils.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(channel); | 71 chrome_build_info.channel = GetChannel(channel); |
| 72 chrome_build_info.version = GetVersion(); | 72 chrome_build_info.version = GetVersion(); |
| 73 chrome_build_info.product_category_for_subtypes = | 73 chrome_build_info.product_category_for_subtypes = |
| 74 product_category_for_subtypes; | 74 product_category_for_subtypes; |
| 75 return chrome_build_info; | 75 return chrome_build_info; |
| 76 } | 76 } |
| 77 | 77 |
| 78 std::string GetChannelStatusRequestUrl(version_info::Channel channel) { | 78 std::string GetChannelStatusRequestUrl(version_info::Channel channel) { |
| 79 GURL sync_url(GetSyncServiceURL(*base::CommandLine::ForCurrentProcess(), | 79 GURL sync_url(syncer::GetSyncServiceURL( |
| 80 channel)); | 80 *base::CommandLine::ForCurrentProcess(), channel)); |
| 81 return sync_url.spec() + kChannelStatusRelativePath; | 81 return sync_url.spec() + kChannelStatusRelativePath; |
| 82 } | 82 } |
| 83 | 83 |
| 84 std::string GetUserAgent(version_info::Channel channel) { | 84 std::string GetUserAgent(version_info::Channel channel) { |
| 85 // TODO(pavely): Fix hardcoded is_tablet value in following call to | 85 // TODO(pavely): Fix hardcoded is_tablet value in following call to |
| 86 // MakeUserAgentForSync. Current implementation returns iPhone UserAgent for | 86 // MakeUserAgentForSync. Current implementation returns iPhone UserAgent for |
| 87 // iPad devices. | 87 // iPad devices. |
| 88 return MakeUserAgentForSync(channel, false); | 88 return syncer::MakeUserAgentForSync(channel, false); |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace | 91 } // namespace |
| 92 | 92 |
| 93 std::unique_ptr<GCMDriver> CreateGCMDriverDesktop( | 93 std::unique_ptr<GCMDriver> CreateGCMDriverDesktop( |
| 94 std::unique_ptr<GCMClientFactory> gcm_client_factory, | 94 std::unique_ptr<GCMClientFactory> gcm_client_factory, |
| 95 PrefService* prefs, | 95 PrefService* prefs, |
| 96 const base::FilePath& store_path, | 96 const base::FilePath& store_path, |
| 97 const scoped_refptr<net::URLRequestContextGetter>& request_context, | 97 const scoped_refptr<net::URLRequestContextGetter>& request_context, |
| 98 version_info::Channel channel, | 98 version_info::Channel channel, |
| 99 const std::string& product_category_for_subtypes, | 99 const std::string& product_category_for_subtypes, |
| 100 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner, | 100 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner, |
| 101 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, | 101 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, |
| 102 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner) { | 102 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner) { |
| 103 return std::unique_ptr<GCMDriver>(new GCMDriverDesktop( | 103 return std::unique_ptr<GCMDriver>(new GCMDriverDesktop( |
| 104 std::move(gcm_client_factory), | 104 std::move(gcm_client_factory), |
| 105 GetChromeBuildInfo(channel, product_category_for_subtypes), | 105 GetChromeBuildInfo(channel, product_category_for_subtypes), |
| 106 GetChannelStatusRequestUrl(channel), GetUserAgent(channel), prefs, | 106 GetChannelStatusRequestUrl(channel), GetUserAgent(channel), prefs, |
| 107 store_path, request_context, ui_task_runner, io_task_runner, | 107 store_path, request_context, ui_task_runner, io_task_runner, |
| 108 blocking_task_runner)); | 108 blocking_task_runner)); |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace gcm | 111 } // namespace gcm |
| OLD | NEW |