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

Side by Side Diff: components/ntp_snippets/breaking_news/breaking_news_subscription_manager.cc

Issue 2914263002: [NTP::Push] Adding Breaking News Subscription Manager (Closed)
Patch Set: 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 #include "components/ntp_snippets/breaking_news/breaking_news_subscription_manag er.h"
6 #include "base/bind.h"
7 #include "components/ntp_snippets/breaking_news/subscription_json_request.h"
8
9 namespace ntp_snippets {
10
11 using internal::SubscriptionJsonRequest;
12
13 BreakingNewsSubscriptionManager::BreakingNewsSubscriptionManager(
14 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter)
15 : url_request_context_getter_(std::move(url_request_context_getter)) {}
16
17 void BreakingNewsSubscriptionManager::Subscribe(const std::string& token) {
18 SubscriptionJsonRequest::Builder builder;
19 builder.SetToken(token)
20 .SetUrlRequestContextGetter(url_request_context_getter_)
21 .SetUrl(subscribe_url_);
22
23 std::unique_ptr<SubscriptionJsonRequest> request = builder.Build();
24 SubscriptionJsonRequest* raw_request = request.get();
25 raw_request->Start(
26 base::BindOnce(&BreakingNewsSubscriptionManager::SubscribeDone,
27 base::Unretained(this), std::move(request)));
fhorschig 2017/06/02 09:11:49 I see that you did, what I did. Having aged 6 mont
mamir 2017/06/04 10:17:03 I have changed the design as per our offline discu
28 }
29
30 void BreakingNewsSubscriptionManager::SubscribeDone(
31 std::unique_ptr<SubscriptionJsonRequest> request,
32 const ntp_snippets::Status& status) {
33 // TODO(mamir): Handle success and failure cases.
34 }
35
36 void BreakingNewsSubscriptionManager::Unsubscribe(const std::string& token) {
37 // TODO(mamir): Implement.
38 }
39 } // namespace ntp_snippets
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698