blob: c70f4073e90827c774af4ee0d14f8e0bf1014e75 [file] [log] [blame]
treibec8f3302016-08-04 11:05:201// Copyright 2016 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_FEATURES_H_
6#define COMPONENTS_NTP_SNIPPETS_FEATURES_H_
7
vitaliiia64fb41f2017-01-04 07:40:298#include <memory>
skym9e961db2016-09-19 19:02:089#include <string>
Natalie Chouinard47f4db22019-03-27 21:20:3410#include <vector>
skym9e961db2016-09-19 19:02:0811
treibec8f3302016-08-04 11:05:2012#include "base/feature_list.h"
vitaliiia64fb41f2017-01-04 07:40:2913#include "components/ntp_snippets/category_rankers/category_ranker.h"
14#include "components/prefs/pref_service.h"
treibec8f3302016-08-04 11:05:2015
vitaliii1e8492aea2017-01-04 10:53:1316namespace base {
17class Clock;
18}
19
treibec8f3302016-08-04 11:05:2020namespace ntp_snippets {
21
sfiera429f3122017-04-24 16:17:5722//
23// Null-terminated list of all features related to content suggestions.
24//
25// If you add a base::Feature below, you must add it to this list. It is used in
26// internal pages to list relevant parameters and settings.
27//
Andrew Grieved1978b0e2017-07-28 15:53:4128extern const base::Feature* const kAllFeatures[];
sfiera429f3122017-04-24 16:17:5729
Vitalii Iarkocdf7fe6d32017-09-26 10:42:1030////////////////////////////////////////////////////////////////////////////////
Vitalii Iarkocdf7fe6d32017-09-26 10:42:1031// Independent features. Treat as normal
32
Vitalii Iarkocdf7fe6d32017-09-26 10:42:1033extern const base::Feature kArticleSuggestionsFeature;
34
Vitalii Iarko1eb02f62017-09-12 13:57:1035// Feature for simple experimental comparison and validation of changes since
Jan Krcaleb0742d2017-06-02 14:02:3136// M58: enabling this brings back the M58 Stable fetching schedule (which is
37// suitable for Holdback groups).
Vitalii Iarko1eb02f62017-09-12 13:57:1038// TODO(jkrcal): Remove when the comparison is done (probably after M62).
Jan Krcaleb0742d2017-06-02 14:02:3139extern const base::Feature kRemoteSuggestionsEmulateM58FetchingSchedule;
40
vitaliiia64fb41f2017-01-04 07:40:2941std::unique_ptr<CategoryRanker> BuildSelectedCategoryRanker(
vitaliii1e8492aea2017-01-04 10:53:1342 PrefService* pref_service,
Natalie Chouinard361ed442019-04-04 17:14:2743 base::Clock* clock);
vitaliiia64fb41f2017-01-04 07:40:2944
sfiera429f3122017-04-24 16:17:5745// Enables and configures notifications for content suggestions on Android.
46extern const base::Feature kNotificationsFeature;
47
48// An integer. The priority of the notification, ranging from -2 (PRIORITY_MIN)
49// to 2 (PRIORITY_MAX). Vibrates and makes sound if >= 0.
50extern const char kNotificationsPriorityParam[];
51constexpr int kNotificationsDefaultPriority = -1;
52
53// "publisher": use article's publisher as notification's text (default).
54// "snippet": use article's snippet as notification's text.
55// "and_more": use "From $1. Read this article and $2 more." as text.
56extern const char kNotificationsTextParam[];
57extern const char kNotificationsTextValuePublisher[];
58extern const char kNotificationsTextValueSnippet[];
59extern const char kNotificationsTextValueAndMore[];
60
61// "true": when Chrome becomes frontmost, leave notifications open.
62// "false": automatically dismiss notification when Chrome becomes frontmost.
63extern const char kNotificationsKeepWhenFrontmostParam[];
64
65// "true": notifications link to chrome://newtab, with appropriate text.
66// "false": notifications link to URL of notifying article.
67extern const char kNotificationsOpenToNTPParam[];
68
69// An integer. The maximum number of notifications that will be shown in 1 day.
70extern const char kNotificationsDailyLimit[];
71constexpr int kNotificationsDefaultDailyLimit = 1;
72
73// An integer. The number of notifications that can be ignored. If the user
74// ignores this many notifications or more, we stop sending them.
75extern const char kNotificationsIgnoredLimitParam[];
76constexpr int kNotificationsIgnoredDefaultLimit = 3;
77
Vitalii Iarko112f9182017-06-20 11:59:5578// Whether to keep some prefetched content suggestions even when new suggestions
79// have been fetched.
80extern const base::Feature kKeepPrefetchedContentSuggestions;
81
Justin DeWitt7943cde2019-07-24 17:28:5282// Whether this version of the client supports responses without an image.
83extern const base::Feature kOptionalImagesEnabledFeature;
84
Brandon Wylie40c6f212018-05-16 19:28:3285// Return all the features as a vector.
86std::vector<const base::Feature*> GetAllFeatures();
87
Filip Gorski3978211e2018-08-27 18:53:1988// Return a referrer URL for content suggestions.
89std::string GetContentSuggestionsReferrerURL();
treibec8f3302016-08-04 11:05:2090} // namespace ntp_snippets
91
92#endif // COMPONENTS_NTP_SNIPPETS_FEATURES_H_