Chromium Code Reviews| Index: components/previews/core/previews_experiments.cc |
| diff --git a/components/previews/core/previews_experiments.cc b/components/previews/core/previews_experiments.cc |
| index 97ab3e9a0783b0317bd5adf3c015f5acdd9c0685..fc7922cca8a83bf8b79c8419372e9c5761183a63 100644 |
| --- a/components/previews/core/previews_experiments.cc |
| +++ b/components/previews/core/previews_experiments.cc |
| @@ -59,6 +59,11 @@ const char kHostIndifferentBlackListDurationInDays[] = |
| const char kSingleOptOutDurationInSeconds[] = |
| "single_opt_out_duration_in_seconds"; |
| +// The amount of time that an offline page is considered fresh enough to be |
| +// shown as a preview. |
| +const char kOfflinePreviewFreshnessDurationInDays[] = |
| + "offline_preview_freshness_duration_in_days"; |
| + |
| // The string that corresponds to enabled for the variation param experiments. |
| const char kExperimentEnabled[] = "true"; |
| @@ -153,6 +158,15 @@ base::TimeDelta SingleOptOutDuration() { |
| return base::TimeDelta::FromSeconds(duration); |
| } |
| +base::TimeDelta OfflinePreviewFreshnessDuration() { |
| + std::string param_value = ParamValue(kOfflinePreviewFreshnessDurationInDays); |
| + int duration; |
| + if (!base::StringToInt(param_value, &duration)) { |
| + return base::TimeDelta::FromDays(7); |
|
jianli
2016/11/29 22:28:43
nit: Would it be simpler to say "duration = 7;", w
RyanSturm
2016/11/29 22:43:00
I will write a follow-up CL to change all of the m
|
| + } |
| + return base::TimeDelta::FromDays(duration); |
|
tbansal1
2016/11/29 18:05:38
nit: Add:
DCHECK_LE(0, duration);
RyanSturm
2016/11/29 18:22:19
Acknowledged. I don't think this is necessary, and
|
| +} |
| + |
| } // namespace params |
| bool IsIncludedInClientSidePreviewsExperimentsFieldTrial() { |