Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: components/ntp_snippets/breaking_news/subscription_manager.h

Issue 2914263002: [NTP::Push] Adding Breaking News Subscription Manager (Closed)
Patch Set: bauerb@ comments. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_SUBSCRIPTION_MANAGER_H_
6 #define COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_SUBSCRIPTION_MANAGER_H_
7
8 #include "components/ntp_snippets/breaking_news/subscription_json_request.h"
9 #include "net/url_request/url_request_context_getter.h"
10 #include "url/gurl.h"
11
12 namespace ntp_snippets {
13
14 class SubscriptionManager {
15 public:
16 SubscriptionManager(
17 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter,
18 PrefService* pref_service);
19
20 ~SubscriptionManager();
21
22 void Subscribe(const std::string& token);
23 void Unsubscribe(const std::string& token);
24
25 private:
26 // Holds the URL request context.
27 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
28
29 std::unique_ptr<internal::SubscriptionJsonRequest> subscription_request_;
30
31 // API endpoint for subscribing.
32 // TODO(mamir): retrieve the correct fetch point
33 // See:
34 // components/ntp_snippets/remote/remote_suggestions_fetcher.cc?type=cs&l=175
35 const GURL subscribe_url_{"http://valid-url.test"};
36
37 std::string subscription_token_;
38 PrefService* pref_service_;
39
40 void DidSubscribe(const ntp_snippets::Status& status);
41
42 DISALLOW_COPY_AND_ASSIGN(SubscriptionManager);
43 };
44 }
45 #endif // COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_SUBSCRIPTION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698