| 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 <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 base::TimeDelta SingleOptOutDuration(); | 45 base::TimeDelta SingleOptOutDuration(); |
| 46 | 46 |
| 47 // The amount of time that an offline page is considered fresh enough to be | 47 // The amount of time that an offline page is considered fresh enough to be |
| 48 // shown as a preview. | 48 // shown as a preview. |
| 49 base::TimeDelta OfflinePreviewFreshnessDuration(); | 49 base::TimeDelta OfflinePreviewFreshnessDuration(); |
| 50 | 50 |
| 51 // The threshold of EffectiveConnectionType above which previews should not be | 51 // The threshold of EffectiveConnectionType above which previews should not be |
| 52 // served. | 52 // served. |
| 53 net::EffectiveConnectionType EffectiveConnectionTypeThreshold(); | 53 net::EffectiveConnectionType EffectiveConnectionTypeThreshold(); |
| 54 | 54 |
| 55 // Whether offline previews are enabled. |
| 56 bool IsOfflinePreviewsEnabled(); |
| 57 |
| 58 // The blacklist version for offline previews. |
| 59 int OfflinePreviewsVersion(); |
| 60 |
| 55 } // namespace params | 61 } // namespace params |
| 56 | 62 |
| 57 enum class PreviewsType { | 63 enum class PreviewsType { |
| 58 NONE = 0, | 64 NONE = 0, |
| 65 // The user is shown an offline page as a preview. |
| 59 OFFLINE = 1, | 66 OFFLINE = 1, |
| 60 // Insert new enum values here. Keep values sequential to allow looping | 67 // Insert new enum values here. Keep values sequential to allow looping |
| 61 // from NONE+1 to LAST-1. | 68 // from NONE+1 to LAST-1. |
| 62 LAST = 2, | 69 LAST = 2, |
| 63 }; | 70 }; |
| 64 | 71 |
| 65 typedef std::vector<std::pair<PreviewsType, int>> PreviewsTypeList; | 72 typedef std::vector<std::pair<PreviewsType, int>> PreviewsTypeList; |
| 66 | 73 |
| 67 // Returns true if any client-side previews experiment is active. | 74 // Returns true if any client-side previews experiment is active. |
| 68 bool IsIncludedInClientSidePreviewsExperimentsFieldTrial(); | 75 bool IsIncludedInClientSidePreviewsExperimentsFieldTrial(); |
| 69 | 76 |
| 70 // Returns true if the field trial that should enable previews for |type| for | |
| 71 // prohibitvely slow networks is active. | |
| 72 bool IsPreviewsTypeEnabled(PreviewsType type); | |
| 73 | |
| 74 // Returns the version of preview treatment |type|. Defaults to 0 if not | |
| 75 // specified in field trial config. | |
| 76 int GetPreviewsTypeVersion(PreviewsType type); | |
| 77 | |
| 78 // Returns the enabled PreviewsTypes with their version. | |
| 79 std::unique_ptr<PreviewsTypeList> GetEnabledPreviews(); | |
| 80 | |
| 81 // Sets the appropriate state for field trial and variations to imitate the | 77 // Sets the appropriate state for field trial and variations to imitate the |
| 82 // offline pages field trial. | 78 // offline pages field trial. |
| 83 bool EnableOfflinePreviewsForTesting(); | 79 bool EnableOfflinePreviewsForTesting(); |
| 84 | 80 |
| 85 } // namespace previews | 81 } // namespace previews |
| 86 | 82 |
| 87 #endif // COMPONENTS_PREVIEWS_CORE_PREVIEWS_EXPERIMENTS_H_ | 83 #endif // COMPONENTS_PREVIEWS_CORE_PREVIEWS_EXPERIMENTS_H_ |
| OLD | NEW |