OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_PREVIEWS_CORE_PREVIEWS_EXPERIMENTS_H_ | 5 #ifndef COMPONENTS_PREVIEWS_CORE_PREVIEWS_EXPERIMENTS_H_ |
6 #define COMPONENTS_PREVIEWS_CORE_PREVIEWS_EXPERIMENTS_H_ | 6 #define COMPONENTS_PREVIEWS_CORE_PREVIEWS_EXPERIMENTS_H_ |
7 | 7 |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 | 9 |
10 namespace previews { | 10 namespace previews { |
11 | 11 |
12 namespace params { | 12 namespace params { |
13 | 13 |
14 // The maximum number of recent previews navigations the black list looks at to | 14 // The maximum number of recent previews navigations the black list looks at to |
15 // determine if a host is blacklisted. | 15 // determine if a host is blacklisted. |
16 size_t MaxStoredHistoryLengthForBlackList(); | 16 size_t MaxStoredHistoryLengthForPerHostBlackList(); |
| 17 |
| 18 // The maximum number of recent previews navigations the black list looks at to |
| 19 // determine if all previews navigations are disallowed. |
| 20 size_t MaxStoredHistoryLengthForHostIndifferentBlackList(); |
17 | 21 |
18 // The maximum number of hosts allowed in the in memory black list. | 22 // The maximum number of hosts allowed in the in memory black list. |
19 size_t MaxInMemoryHostsInBlackList(); | 23 size_t MaxInMemoryHostsInBlackList(); |
20 | 24 |
| 25 // The number of recent navigations that were opted out of for a given host that |
| 26 // would trigger that host to be blacklisted. |
| 27 int PerHostBlackListOptOutThreshold(); |
| 28 |
21 // The number of recent navigations that were opted out of that would trigger | 29 // The number of recent navigations that were opted out of that would trigger |
22 // the host to be blacklisted. | 30 // all previews navigations to be disallowed. |
23 int BlackListOptOutThreshold(); | 31 int HostIndifferentBlackListOptOutThreshold(); |
24 | 32 |
25 // The amount of time a host remains blacklisted due to opt outs. | 33 // The amount of time a host remains blacklisted due to opt outs. |
26 base::TimeDelta BlackListDuration(); | 34 base::TimeDelta PerHostBlackListDuration(); |
| 35 |
| 36 // The amount of time all previews navigations are disallowed due to opt outs. |
| 37 base::TimeDelta HostIndifferentBlackListPerHostDuration(); |
27 | 38 |
28 // The amount of time after any opt out that no previews should be shown. | 39 // The amount of time after any opt out that no previews should be shown. |
29 base::TimeDelta SingleOptOutDuration(); | 40 base::TimeDelta SingleOptOutDuration(); |
30 | 41 |
31 } // namespace params | 42 } // namespace params |
32 | 43 |
33 enum class PreviewsType { | 44 enum class PreviewsType { |
34 NONE = 0, | 45 NONE = 0, |
35 OFFLINE = 1, | 46 OFFLINE = 1, |
36 LAST = 2, | 47 LAST = 2, |
37 }; | 48 }; |
38 | 49 |
39 // Returns true if any client-side previews experiment is active. | 50 // Returns true if any client-side previews experiment is active. |
40 bool IsIncludedInClientSidePreviewsExperimentsFieldTrial(); | 51 bool IsIncludedInClientSidePreviewsExperimentsFieldTrial(); |
41 | 52 |
42 // Returns true if the field trial that should enable previews for |type| for | 53 // Returns true if the field trial that should enable previews for |type| for |
43 // prohibitvely slow networks is active. | 54 // prohibitvely slow networks is active. |
44 bool IsPreviewsTypeEnabled(PreviewsType type); | 55 bool IsPreviewsTypeEnabled(PreviewsType type); |
45 | 56 |
46 // Sets the appropriate state for field trial and variations to imitate the | 57 // Sets the appropriate state for field trial and variations to imitate the |
47 // offline pages field trial. | 58 // offline pages field trial. |
48 bool EnableOfflinePreviewsForTesting(); | 59 bool EnableOfflinePreviewsForTesting(); |
49 | 60 |
50 } // namespace previews | 61 } // namespace previews |
51 | 62 |
52 #endif // COMPONENTS_PREVIEWS_CORE_PREVIEWS_EXPERIMENTS_H_ | 63 #endif // COMPONENTS_PREVIEWS_CORE_PREVIEWS_EXPERIMENTS_H_ |
OLD | NEW |