| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 default: | 56 default: |
| 57 NOTREACHED(); | 57 NOTREACHED(); |
| 58 return GCMClient::CHANNEL_UNKNOWN; | 58 return GCMClient::CHANNEL_UNKNOWN; |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 std::string GetVersion() { | 62 std::string GetVersion() { |
| 63 return version_info::GetVersionNumber(); | 63 return version_info::GetVersionNumber(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 GCMClient::ChromeBuildInfo GetChromeBuildInfo(version_info::Channel channel) { | 66 GCMClient::ChromeBuildInfo GetChromeBuildInfo( |
| 67 version_info::Channel channel, |
| 68 const std::string& category_for_subtypes) { |
| 67 GCMClient::ChromeBuildInfo chrome_build_info; | 69 GCMClient::ChromeBuildInfo chrome_build_info; |
| 68 chrome_build_info.platform = GetPlatform(); | 70 chrome_build_info.platform = GetPlatform(); |
| 69 chrome_build_info.channel = GetChannel(channel); | 71 chrome_build_info.channel = GetChannel(channel); |
| 70 chrome_build_info.version = GetVersion(); | 72 chrome_build_info.version = GetVersion(); |
| 73 chrome_build_info.category_for_subtypes = category_for_subtypes; |
| 71 return chrome_build_info; | 74 return chrome_build_info; |
| 72 } | 75 } |
| 73 | 76 |
| 74 std::string GetChannelStatusRequestUrl(version_info::Channel channel) { | 77 std::string GetChannelStatusRequestUrl(version_info::Channel channel) { |
| 75 GURL sync_url(GetSyncServiceURL(*base::CommandLine::ForCurrentProcess(), | 78 GURL sync_url(GetSyncServiceURL(*base::CommandLine::ForCurrentProcess(), |
| 76 channel)); | 79 channel)); |
| 77 return sync_url.spec() + kChannelStatusRelativePath; | 80 return sync_url.spec() + kChannelStatusRelativePath; |
| 78 } | 81 } |
| 79 | 82 |
| 80 std::string GetUserAgent(version_info::Channel channel) { | 83 std::string GetUserAgent(version_info::Channel channel) { |
| 81 // TODO(pavely): Fix hardcoded is_tablet value in following call to | 84 // TODO(pavely): Fix hardcoded is_tablet value in following call to |
| 82 // MakeUserAgentForSync. Current implementation returns iPhone UserAgent for | 85 // MakeUserAgentForSync. Current implementation returns iPhone UserAgent for |
| 83 // iPad devices. | 86 // iPad devices. |
| 84 return MakeUserAgentForSync(channel, false); | 87 return MakeUserAgentForSync(channel, false); |
| 85 } | 88 } |
| 86 | 89 |
| 87 } // namespace | 90 } // namespace |
| 88 | 91 |
| 89 std::unique_ptr<GCMDriver> CreateGCMDriverDesktop( | 92 std::unique_ptr<GCMDriver> CreateGCMDriverDesktop( |
| 90 std::unique_ptr<GCMClientFactory> gcm_client_factory, | 93 std::unique_ptr<GCMClientFactory> gcm_client_factory, |
| 91 PrefService* prefs, | 94 PrefService* prefs, |
| 92 const base::FilePath& store_path, | 95 const base::FilePath& store_path, |
| 93 const scoped_refptr<net::URLRequestContextGetter>& request_context, | 96 const scoped_refptr<net::URLRequestContextGetter>& request_context, |
| 94 version_info::Channel channel, | 97 version_info::Channel channel, |
| 98 const std::string& category_for_subtypes, |
| 95 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner, | 99 const scoped_refptr<base::SequencedTaskRunner>& ui_task_runner, |
| 96 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, | 100 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner, |
| 97 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner) { | 101 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner) { |
| 98 return std::unique_ptr<GCMDriver>(new GCMDriverDesktop( | 102 return std::unique_ptr<GCMDriver>(new GCMDriverDesktop( |
| 99 std::move(gcm_client_factory), GetChromeBuildInfo(channel), | 103 std::move(gcm_client_factory), |
| 104 GetChromeBuildInfo(channel, category_for_subtypes), |
| 100 GetChannelStatusRequestUrl(channel), GetUserAgent(channel), prefs, | 105 GetChannelStatusRequestUrl(channel), GetUserAgent(channel), prefs, |
| 101 store_path, request_context, ui_task_runner, io_task_runner, | 106 store_path, request_context, ui_task_runner, io_task_runner, |
| 102 blocking_task_runner)); | 107 blocking_task_runner)); |
| 103 } | 108 } |
| 104 | 109 |
| 105 } // namespace gcm | 110 } // namespace gcm |
| OLD | NEW |