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 #ifndef COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_SUBSCRIPTION_MANAGER_H_ | 5 #ifndef COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_SUBSCRIPTION_MANAGER_H_ |
6 #define COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_SUBSCRIPTION_MANAGER_H_ | 6 #define COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_SUBSCRIPTION_MANAGER_H_ |
7 | 7 |
8 #include "components/ntp_snippets/breaking_news/subscription_json_request.h" | 8 #include "components/ntp_snippets/breaking_news/subscription_json_request.h" |
9 #include "components/prefs/pref_registry_simple.h" | 9 #include "components/prefs/pref_registry_simple.h" |
| 10 #include "components/version_info/version_info.h" |
10 #include "net/url_request/url_request_context_getter.h" | 11 #include "net/url_request/url_request_context_getter.h" |
11 #include "url/gurl.h" | 12 #include "url/gurl.h" |
12 | 13 |
13 class PrefRegistrySimple; | 14 class PrefRegistrySimple; |
14 | 15 |
15 namespace ntp_snippets { | 16 namespace ntp_snippets { |
16 | 17 |
| 18 // Returns the appropriate API endpoint for subscribing for push updates, in |
| 19 // consideration of the channel and field trial parameters. |
| 20 GURL GetPushUpdatesSubscriptionEndpoint(version_info::Channel channel); |
| 21 |
| 22 // Returns the appropriate API endpoint for unsubscribing for push updates, in |
| 23 // consideration of the channel and field trial parameters. |
| 24 GURL GetPushUpdatesUnsubscriptionEndpoint(version_info::Channel channel); |
| 25 |
17 // Class that wraps around the functionality of SubscriptionJsonRequest. It uses | 26 // Class that wraps around the functionality of SubscriptionJsonRequest. It uses |
18 // the SubscriptionJsonRequest to send subscription and unsubscription requests | 27 // the SubscriptionJsonRequest to send subscription and unsubscription requests |
19 // to the content suggestions server and does the bookkeeping for the data used | 28 // to the content suggestions server and does the bookkeeping for the data used |
20 // for subscription. Bookkeeping is required to detect any change (e.g. the | 29 // for subscription. Bookkeeping is required to detect any change (e.g. the |
21 // token render invalid), and resubscribe accordingly. | 30 // token render invalid), and resubscribe accordingly. |
22 class SubscriptionManager { | 31 class SubscriptionManager { |
23 public: | 32 public: |
24 SubscriptionManager( | 33 SubscriptionManager( |
25 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, | 34 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, |
26 PrefService* pref_service, | 35 PrefService* pref_service, |
(...skipping 26 matching lines...) Expand all Loading... |
53 const GURL subscribe_url_; | 62 const GURL subscribe_url_; |
54 const GURL unsubscribe_url_; | 63 const GURL unsubscribe_url_; |
55 | 64 |
56 void DidSubscribe(const ntp_snippets::Status& status); | 65 void DidSubscribe(const ntp_snippets::Status& status); |
57 void DidUnsubscribe(const ntp_snippets::Status& status); | 66 void DidUnsubscribe(const ntp_snippets::Status& status); |
58 | 67 |
59 DISALLOW_COPY_AND_ASSIGN(SubscriptionManager); | 68 DISALLOW_COPY_AND_ASSIGN(SubscriptionManager); |
60 }; | 69 }; |
61 } | 70 } |
62 #endif // COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_SUBSCRIPTION_MANAGER_H_ | 71 #endif // COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_SUBSCRIPTION_MANAGER_H_ |
OLD | NEW |