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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/send_tab_to_self/features.h"
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "base/time/time.h"
#include "build/build_config.h"
#if BUILDFLAG(IS_IOS)
namespace {
// The default time offset used to pre-populate the date/time picker when the
// 'Set a Reminder' UI half-sheet is first shown.
const base::TimeDelta kReminderNotificationsDefaultOffset = base::Hours(24);
} // namespace
#endif // BUILDFLAG(IS_IOS)
namespace send_tab_to_self {
BASE_FEATURE(kSendTabToSelfEnableNotificationTimeOut,
"SendTabToSelfEnableNotificationTimeOut",
base::FEATURE_DISABLED_BY_DEFAULT);
BASE_FEATURE(kSendTabToSelfIOSPushNotifications,
"SendTabToSelfIOSPushNotifications",
#if BUILDFLAG(IS_IOS)
base::FEATURE_DISABLED_BY_DEFAULT);
#else
base::FEATURE_ENABLED_BY_DEFAULT);
#endif // BUILDFLAG(IS_IOS)
const char kSendTabIOSPushNotificationsURLImageParam[] =
"variant_with_URL_image";
bool IsSendTabIOSPushNotificationsEnabledWithURLImage() {
if (base::FeatureList::IsEnabled(kSendTabToSelfIOSPushNotifications)) {
return base::GetFieldTrialParamByFeatureAsBool(
kSendTabToSelfIOSPushNotifications,
kSendTabIOSPushNotificationsURLImageParam, false);
}
return false;
}
#if BUILDFLAG(IS_IOS)
const char kSendTabIOSPushNotificationsWithMagicStackCardParam[] =
"variant_with_magic_stack_card";
bool IsSendTabIOSPushNotificationsEnabledWithMagicStackCard() {
if (base::FeatureList::IsEnabled(kSendTabToSelfIOSPushNotifications)) {
return base::GetFieldTrialParamByFeatureAsBool(
kSendTabToSelfIOSPushNotifications,
kSendTabIOSPushNotificationsWithMagicStackCardParam, false);
}
return false;
}
const char kSendTabIOSPushNotificationsWithTabRemindersParam[] =
"variant_with_tab_reminders";
bool IsSendTabIOSPushNotificationsEnabledWithTabReminders() {
if (base::FeatureList::IsEnabled(kSendTabToSelfIOSPushNotifications)) {
return base::GetFieldTrialParamByFeatureAsBool(
kSendTabToSelfIOSPushNotifications,
kSendTabIOSPushNotificationsWithTabRemindersParam, false);
}
return false;
}
const char kReminderNotificationsDefaultTimeOffset[] =
"ReminderNotificationsDefaultTimeOffset";
const base::TimeDelta GetReminderNotificationsDefaultTimeOffset() {
// Default to 24 hours.
return base::GetFieldTrialParamByFeatureAsTimeDelta(
kSendTabToSelfIOSPushNotifications,
kReminderNotificationsDefaultTimeOffset,
kReminderNotificationsDefaultOffset);
}
#endif // BUILDFLAG(IS_IOS)
} // namespace send_tab_to_self
|