Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/ntp_snippets/breaking_news/subscription_manager.h" | 5 #include "components/ntp_snippets/breaking_news/subscription_manager.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "components/ntp_snippets/breaking_news/subscription_json_request.h" | 7 #include "components/ntp_snippets/breaking_news/subscription_json_request.h" |
| 8 #include "components/ntp_snippets/ntp_snippets_constants.h" | |
| 8 #include "components/ntp_snippets/pref_names.h" | 9 #include "components/ntp_snippets/pref_names.h" |
| 9 #include "components/prefs/pref_service.h" | 10 #include "components/prefs/pref_service.h" |
| 10 | 11 |
| 11 namespace ntp_snippets { | 12 namespace ntp_snippets { |
| 12 | 13 |
| 13 using internal::SubscriptionJsonRequest; | 14 using internal::SubscriptionJsonRequest; |
| 14 | 15 |
| 15 SubscriptionManager::SubscriptionManager( | 16 SubscriptionManager::SubscriptionManager( |
| 16 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, | 17 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, |
| 17 PrefService* pref_service, | 18 PrefService* pref_service, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 } | 56 } |
| 56 | 57 |
| 57 void SubscriptionManager::Unsubscribe(const std::string& token) { | 58 void SubscriptionManager::Unsubscribe(const std::string& token) { |
| 58 // TODO(mamir): Implement. | 59 // TODO(mamir): Implement. |
| 59 } | 60 } |
| 60 | 61 |
| 61 void SubscriptionManager::RegisterProfilePrefs(PrefRegistrySimple* registry) { | 62 void SubscriptionManager::RegisterProfilePrefs(PrefRegistrySimple* registry) { |
| 62 registry->RegisterStringPref(prefs::kContentSuggestionsSubscriptionDataToken, | 63 registry->RegisterStringPref(prefs::kContentSuggestionsSubscriptionDataToken, |
| 63 std::string()); | 64 std::string()); |
| 64 } | 65 } |
| 66 | |
| 67 GURL GetPushUpdatesSubscriptionEndpoint(version_info::Channel channel) { | |
| 68 // TODO(mamir) do we need this? | |
|
sfiera
2017/06/07 13:58:15
I like having a param :) When I'm working, I use a
mamir
2017/06/08 09:58:28
Done.
| |
| 69 // std::string endpoint = variations::GetVariationParamValueByFeature( | |
| 70 // ntp_snippets::kArticleSuggestionsFeature, kContentSuggestionsBackend); | |
| 71 // if (!endpoint.empty()) { | |
| 72 // return GURL{endpoint}; | |
| 73 // } | |
| 74 | |
| 75 switch (channel) { | |
| 76 case version_info::Channel::STABLE: | |
| 77 case version_info::Channel::BETA: | |
| 78 return GURL{kPushUpdatesSubscriptionServer}; | |
| 79 | |
| 80 case version_info::Channel::DEV: | |
| 81 case version_info::Channel::CANARY: | |
| 82 case version_info::Channel::UNKNOWN: | |
| 83 return GURL{kPushUpdatesSubscriptionStagingServer}; | |
| 84 } | |
| 85 NOTREACHED(); | |
| 86 return GURL{kPushUpdatesSubscriptionStagingServer}; | |
| 87 } | |
| 65 } // namespace ntp_snippets | 88 } // namespace ntp_snippets |
| OLD | NEW |