blob: fc2343e04eba8375a20278aa6fb03622c6fd5e0c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// 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 <string>
#include "components/version_info/version_info.h"
#include "url/gurl.h"
namespace ntp_snippets {
// Returns the appropriate API endpoint for subscribing for push updates, in
// consideration of the channel and field trial parameters.
GURL GetPushUpdatesSubscriptionEndpoint(version_info::Channel channel);
// Returns the appropriate API endpoint for unsubscribing for push updates, in
// consideration of the channel and field trial parameters.
GURL GetPushUpdatesUnsubscriptionEndpoint(version_info::Channel channel);
// Handles subscription to content suggestions server for push updates (e.g. via
// GCM).
class SubscriptionManager {
public:
virtual ~SubscriptionManager() = default;
virtual void Subscribe(const std::string& token) = 0;
virtual void Unsubscribe() = 0;
virtual bool IsSubscribed() = 0;
virtual void Resubscribe(const std::string& new_token) = 0;
// Checks if some data that has been used when subscribing has changed. For
// example, the user has signed in.
virtual bool NeedsToResubscribe() = 0;
};
} // namespace ntp_snippets
#endif // COMPONENTS_NTP_SNIPPETS_BREAKING_NEWS_SUBSCRIPTION_MANAGER_H_
|