Chromium Code Reviews| 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..32fdbfb8e9684d3fd6fa89c371f295d019ab7a93 |
| --- /dev/null |
| +++ b/components/ntp_snippets/breaking_news/subscription_manager.h |
| @@ -0,0 +1,43 @@ |
| +// 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 "net/url_request/url_request_context_getter.h" |
| +#include "url/gurl.h" |
| + |
| +namespace ntp_snippets { |
|
Bernhard Bauer
2017/06/05 10:19:40
Empty lines please :)
mamir
2017/06/05 13:06:26
Done.
|
| +class SubscriptionManager { |
| + public: |
| + SubscriptionManager( |
| + scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, |
| + PrefService* pref_service); |
| + |
| + ~SubscriptionManager(); |
| + |
| + void Subscribe(const std::string& token); |
| + void Unsubscribe(const std::string& token); |
| + |
| + private: |
| + // Holds the URL request context. |
| + scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
| + |
| + std::unique_ptr<internal::SubscriptionJsonRequest> subscription_request_; |
| + |
| + // API endpoint for subscribing. |
| + // TODO(mamir): retrieve the correct fetch point |
| + // See: |
| + // https://cs.chromium.org/chromium/src/components/ntp_snippets/remote/remote_suggestions_fetcher.cc?type=cs&l=175 |
|
Bernhard Bauer
2017/06/05 10:19:40
Maybe just use the path (//components/...) ? Someo
mamir
2017/06/05 13:06:26
Done.
BTW: this is comment for me, and this will b
|
| + // GURL url("http://valid-url.test") |
|
Bernhard Bauer
2017/06/05 10:19:40
Remove this?
mamir
2017/06/05 13:06:26
Done.
|
| + const GURL subscribe_url_{"http://valid-url.test"}; |
| + |
| + std::string subscription_token_; |
| + PrefService* pref_service_; |
| + |
| + void DidSubscribe(const ntp_snippets::Status& status); |
| +}; |
|
Bernhard Bauer
2017/06/05 10:19:40
DISALLOW_COPY_AND_ASSIGN
mamir
2017/06/05 13:06:26
Done.
|
| +} |
| +#endif // COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_SUBSCRIPTION_MANAGER_H_ |