features.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. #ifndef COMPONENTS_NTP_SNIPPETS_FEATURES_H_
  5. #define COMPONENTS_NTP_SNIPPETS_FEATURES_H_
  6. #include <memory>
  7. #include <string>
  8. #include <vector>
  9. #include "base/feature_list.h"
  10. #include "components/ntp_snippets/category_rankers/category_ranker.h"
  11. #include "components/prefs/pref_service.h"
  12. namespace base {
  13. class Clock;
  14. }
  15. namespace ntp_snippets {
  16. //
  17. // Null-terminated list of all features related to content suggestions.
  18. //
  19. // If you add a base::Feature below, you must add it to this list. It is used in
  20. // internal pages to list relevant parameters and settings.
  21. //
  22. extern const base::Feature* const kAllFeatures[];
  23. ////////////////////////////////////////////////////////////////////////////////
  24. // Independent features. Treat as normal
  25. extern const base::Feature kArticleSuggestionsFeature;
  26. // Feature for simple experimental comparison and validation of changes since
  27. // M58: enabling this brings back the M58 Stable fetching schedule (which is
  28. // suitable for Holdback groups).
  29. // TODO(jkrcal): Remove when the comparison is done (probably after M62).
  30. extern const base::Feature kRemoteSuggestionsEmulateM58FetchingSchedule;
  31. std::unique_ptr<CategoryRanker> BuildSelectedCategoryRanker(
  32. PrefService* pref_service,
  33. base::Clock* clock);
  34. // Enables and configures notifications for content suggestions on Android.
  35. extern const base::Feature kNotificationsFeature;
  36. // An integer. The priority of the notification, ranging from -2 (PRIORITY_MIN)
  37. // to 2 (PRIORITY_MAX). Vibrates and makes sound if >= 0.
  38. extern const char kNotificationsPriorityParam[];
  39. constexpr int kNotificationsDefaultPriority = -1;
  40. // "publisher": use article's publisher as notification's text (default).
  41. // "snippet": use article's snippet as notification's text.
  42. // "and_more": use "From $1. Read this article and $2 more." as text.
  43. extern const char kNotificationsTextParam[];
  44. extern const char kNotificationsTextValuePublisher[];
  45. extern const char kNotificationsTextValueSnippet[];
  46. extern const char kNotificationsTextValueAndMore[];
  47. // "true": when Chrome becomes frontmost, leave notifications open.
  48. // "false": automatically dismiss notification when Chrome becomes frontmost.
  49. extern const char kNotificationsKeepWhenFrontmostParam[];
  50. // "true": notifications link to chrome://newtab, with appropriate text.
  51. // "false": notifications link to URL of notifying article.
  52. extern const char kNotificationsOpenToNTPParam[];
  53. // An integer. The maximum number of notifications that will be shown in 1 day.
  54. extern const char kNotificationsDailyLimit[];
  55. constexpr int kNotificationsDefaultDailyLimit = 1;
  56. // An integer. The number of notifications that can be ignored. If the user
  57. // ignores this many notifications or more, we stop sending them.
  58. extern const char kNotificationsIgnoredLimitParam[];
  59. constexpr int kNotificationsIgnoredDefaultLimit = 3;
  60. // Whether to keep some prefetched content suggestions even when new suggestions
  61. // have been fetched.
  62. extern const base::Feature kKeepPrefetchedContentSuggestions;
  63. // Whether this version of the client supports responses without an image.
  64. extern const base::Feature kOptionalImagesEnabledFeature;
  65. // Return all the features as a vector.
  66. std::vector<const base::Feature*> GetAllFeatures();
  67. // Return a referrer URL for content suggestions.
  68. // This is deprecated, and only used on iOS.
  69. std::string GetContentSuggestionsReferrerURL();
  70. } // namespace ntp_snippets
  71. #endif // COMPONENTS_NTP_SNIPPETS_FEATURES_H_