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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_snippets/breaking_news/subscription_manager.h
diff --git a/components/ntp_snippets/breaking_news/subscription_manager.h b/components/ntp_snippets/breaking_news/subscription_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..e30447d36432ebff63177ffedfe4fb33f977c0d2
--- /dev/null
+++ b/components/ntp_snippets/breaking_news/subscription_manager.h
@@ -0,0 +1,49 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_SUBSCRIPTION_MANAGER_H_
+#define COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_SUBSCRIPTION_MANAGER_H_
+
+#include "components/ntp_snippets/breaking_news/subscription_json_request.h"
+#include "components/prefs/pref_registry_simple.h"
+#include "net/url_request/url_request_context_getter.h"
+#include "url/gurl.h"
+
+class PrefRegistrySimple;
+
+namespace ntp_snippets {
+
+class SubscriptionManager {
+ public:
+ SubscriptionManager(
+ scoped_refptr<net::URLRequestContextGetter> url_request_context_getter,
+ PrefService* pref_service,
+ const GURL& subscribe_url);
+
+ ~SubscriptionManager();
+
+ void Subscribe(const std::string& token);
+ void Unsubscribe(const std::string& token);
+
+ static void RegisterProfilePrefs(PrefRegistrySimple* registry);
+
+ private:
+ std::string subscription_token_;
+
+ // Holds the URL request context.
+ scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
+
+ std::unique_ptr<internal::SubscriptionJsonRequest> subscription_request_;
+
+ PrefService* pref_service_;
+
+ // API endpoint for subscribing.
+ const GURL subscribe_url_;
+
+ void DidSubscribe(const ntp_snippets::Status& status);
+
+ DISALLOW_COPY_AND_ASSIGN(SubscriptionManager);
+};
+}
+#endif // COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_SUBSCRIPTION_MANAGER_H_
« 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