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

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

Issue 2914263002: [NTP::Push] Adding Breaking News Subscription Manager (Closed)
Patch Set: Subscription endpoint as a parameter. 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 "components/prefs/pref_registry_simple.h"
10 #include "net/url_request/url_request_context_getter.h"
11 #include "url/gurl.h"
12
13 class PrefRegistrySimple;
14
15 namespace ntp_snippets {
16
17 class SubscriptionManager {
18 public:
19 SubscriptionManager(
20 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter,
21 PrefService* pref_service,
22 const GURL& subscribe_url);
23
24 ~SubscriptionManager();
25
26 void Subscribe(const std::string& token);
27 void Unsubscribe(const std::string& token);
28
29 static void RegisterProfilePrefs(PrefRegistrySimple* registry);
30
31 private:
32 std::string subscription_token_;
33
34 // Holds the URL request context.
35 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
36
37 std::unique_ptr<internal::SubscriptionJsonRequest> subscription_request_;
38
39 PrefService* pref_service_;
40
41 // API endpoint for subscribing.
42 const GURL subscribe_url_;
43
44 void DidSubscribe(const ntp_snippets::Status& status);
45
46 DISALLOW_COPY_AND_ASSIGN(SubscriptionManager);
47 };
48 }
49 #endif // COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_SUBSCRIPTION_MANAGER_H_
OLDNEW
« no previous file with comments | « components/ntp_snippets/BUILD.gn ('k') | components/ntp_snippets/breaking_news/subscription_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698