treib | ec8f330 | 2016-08-04 11:05:20 | [diff] [blame] | 1 | // 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 | |
vitaliii | a64fb41f | 2017-01-04 07:40:29 | [diff] [blame] | 8 | #include <memory> |
skym | 9e961db | 2016-09-19 19:02:08 | [diff] [blame] | 9 | #include <string> |
Natalie Chouinard | 47f4db2 | 2019-03-27 21:20:34 | [diff] [blame] | 10 | #include <vector> |
skym | 9e961db | 2016-09-19 19:02:08 | [diff] [blame] | 11 | |
treib | ec8f330 | 2016-08-04 11:05:20 | [diff] [blame] | 12 | #include "base/feature_list.h" |
vitaliii | a64fb41f | 2017-01-04 07:40:29 | [diff] [blame] | 13 | #include "components/ntp_snippets/category_rankers/category_ranker.h" |
| 14 | #include "components/prefs/pref_service.h" |
treib | ec8f330 | 2016-08-04 11:05:20 | [diff] [blame] | 15 | |
vitaliii | 1e8492aea | 2017-01-04 10:53:13 | [diff] [blame] | 16 | namespace base { |
| 17 | class Clock; |
| 18 | } |
| 19 | |
treib | ec8f330 | 2016-08-04 11:05:20 | [diff] [blame] | 20 | namespace ntp_snippets { |
| 21 | |
sfiera | 429f312 | 2017-04-24 16:17:57 | [diff] [blame] | 22 | // |
| 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 Grieve | d1978b0e | 2017-07-28 15:53:41 | [diff] [blame] | 28 | extern const base::Feature* const kAllFeatures[]; |
sfiera | 429f312 | 2017-04-24 16:17:57 | [diff] [blame] | 29 | |
Vitalii Iarko | cdf7fe6d3 | 2017-09-26 10:42:10 | [diff] [blame] | 30 | //////////////////////////////////////////////////////////////////////////////// |
Vitalii Iarko | cdf7fe6d3 | 2017-09-26 10:42:10 | [diff] [blame] | 31 | // Independent features. Treat as normal |
| 32 | |
Vitalii Iarko | cdf7fe6d3 | 2017-09-26 10:42:10 | [diff] [blame] | 33 | extern const base::Feature kArticleSuggestionsFeature; |
| 34 | |
Vitalii Iarko | 1eb02f6 | 2017-09-12 13:57:10 | [diff] [blame] | 35 | // Feature for simple experimental comparison and validation of changes since |
Jan Krcal | eb0742d | 2017-06-02 14:02:31 | [diff] [blame] | 36 | // M58: enabling this brings back the M58 Stable fetching schedule (which is |
| 37 | // suitable for Holdback groups). |
Vitalii Iarko | 1eb02f6 | 2017-09-12 13:57:10 | [diff] [blame] | 38 | // TODO(jkrcal): Remove when the comparison is done (probably after M62). |
Jan Krcal | eb0742d | 2017-06-02 14:02:31 | [diff] [blame] | 39 | extern const base::Feature kRemoteSuggestionsEmulateM58FetchingSchedule; |
| 40 | |
vitaliii | a64fb41f | 2017-01-04 07:40:29 | [diff] [blame] | 41 | std::unique_ptr<CategoryRanker> BuildSelectedCategoryRanker( |
vitaliii | 1e8492aea | 2017-01-04 10:53:13 | [diff] [blame] | 42 | PrefService* pref_service, |
Natalie Chouinard | 361ed44 | 2019-04-04 17:14:27 | [diff] [blame] | 43 | base::Clock* clock); |
vitaliii | a64fb41f | 2017-01-04 07:40:29 | [diff] [blame] | 44 | |
sfiera | 429f312 | 2017-04-24 16:17:57 | [diff] [blame] | 45 | // Enables and configures notifications for content suggestions on Android. |
| 46 | extern 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. |
| 50 | extern const char kNotificationsPriorityParam[]; |
| 51 | constexpr 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. |
| 56 | extern const char kNotificationsTextParam[]; |
| 57 | extern const char kNotificationsTextValuePublisher[]; |
| 58 | extern const char kNotificationsTextValueSnippet[]; |
| 59 | extern const char kNotificationsTextValueAndMore[]; |
| 60 | |
| 61 | // "true": when Chrome becomes frontmost, leave notifications open. |
| 62 | // "false": automatically dismiss notification when Chrome becomes frontmost. |
| 63 | extern const char kNotificationsKeepWhenFrontmostParam[]; |
| 64 | |
| 65 | // "true": notifications link to chrome://newtab, with appropriate text. |
| 66 | // "false": notifications link to URL of notifying article. |
| 67 | extern const char kNotificationsOpenToNTPParam[]; |
| 68 | |
| 69 | // An integer. The maximum number of notifications that will be shown in 1 day. |
| 70 | extern const char kNotificationsDailyLimit[]; |
| 71 | constexpr 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. |
| 75 | extern const char kNotificationsIgnoredLimitParam[]; |
| 76 | constexpr int kNotificationsIgnoredDefaultLimit = 3; |
| 77 | |
Vitalii Iarko | 112f918 | 2017-06-20 11:59:55 | [diff] [blame] | 78 | // Whether to keep some prefetched content suggestions even when new suggestions |
| 79 | // have been fetched. |
| 80 | extern const base::Feature kKeepPrefetchedContentSuggestions; |
| 81 | |
Justin DeWitt | 7943cde | 2019-07-24 17:28:52 | [diff] [blame] | 82 | // Whether this version of the client supports responses without an image. |
| 83 | extern const base::Feature kOptionalImagesEnabledFeature; |
| 84 | |
Brandon Wylie | 40c6f21 | 2018-05-16 19:28:32 | [diff] [blame] | 85 | // Return all the features as a vector. |
| 86 | std::vector<const base::Feature*> GetAllFeatures(); |
| 87 | |
Filip Gorski | 3978211e | 2018-08-27 18:53:19 | [diff] [blame] | 88 | // Return a referrer URL for content suggestions. |
| 89 | std::string GetContentSuggestionsReferrerURL(); |
treib | ec8f330 | 2016-08-04 11:05:20 | [diff] [blame] | 90 | } // namespace ntp_snippets |
| 91 | |
| 92 | #endif // COMPONENTS_NTP_SNIPPETS_FEATURES_H_ |