| 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> |
| 9 #include <utility> |
| 10 #include <vector> |
| 11 |
| 8 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 9 #include "net/nqe/effective_connection_type.h" | 13 #include "net/nqe/effective_connection_type.h" |
| 10 | 14 |
| 11 namespace previews { | 15 namespace previews { |
| 12 | 16 |
| 13 namespace params { | 17 namespace params { |
| 14 | 18 |
| 15 // The maximum number of recent previews navigations the black list looks at to | 19 // The maximum number of recent previews navigations the black list looks at to |
| 16 // determine if a host is blacklisted. | 20 // determine if a host is blacklisted. |
| 17 size_t MaxStoredHistoryLengthForPerHostBlackList(); | 21 size_t MaxStoredHistoryLengthForPerHostBlackList(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 46 | 50 |
| 47 // The threshold of EffectiveConnectionType above which previews should not be | 51 // The threshold of EffectiveConnectionType above which previews should not be |
| 48 // served. | 52 // served. |
| 49 net::EffectiveConnectionType EffectiveConnectionTypeThreshold(); | 53 net::EffectiveConnectionType EffectiveConnectionTypeThreshold(); |
| 50 | 54 |
| 51 } // namespace params | 55 } // namespace params |
| 52 | 56 |
| 53 enum class PreviewsType { | 57 enum class PreviewsType { |
| 54 NONE = 0, | 58 NONE = 0, |
| 55 OFFLINE = 1, | 59 OFFLINE = 1, |
| 60 // Insert new enum values here. Keep values sequential to allow looping |
| 61 // from NONE+1 to LAST-1. |
| 56 LAST = 2, | 62 LAST = 2, |
| 57 }; | 63 }; |
| 58 | 64 |
| 65 typedef std::vector<std::pair<PreviewsType, int>> PreviewsTypeList; |
| 66 |
| 59 // Returns true if any client-side previews experiment is active. | 67 // Returns true if any client-side previews experiment is active. |
| 60 bool IsIncludedInClientSidePreviewsExperimentsFieldTrial(); | 68 bool IsIncludedInClientSidePreviewsExperimentsFieldTrial(); |
| 61 | 69 |
| 62 // Returns true if the field trial that should enable previews for |type| for | 70 // Returns true if the field trial that should enable previews for |type| for |
| 63 // prohibitvely slow networks is active. | 71 // prohibitvely slow networks is active. |
| 64 bool IsPreviewsTypeEnabled(PreviewsType type); | 72 bool IsPreviewsTypeEnabled(PreviewsType type); |
| 65 | 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 |
| 66 // Sets the appropriate state for field trial and variations to imitate the | 81 // Sets the appropriate state for field trial and variations to imitate the |
| 67 // offline pages field trial. | 82 // offline pages field trial. |
| 68 bool EnableOfflinePreviewsForTesting(); | 83 bool EnableOfflinePreviewsForTesting(); |
| 69 | 84 |
| 70 } // namespace previews | 85 } // namespace previews |
| 71 | 86 |
| 72 #endif // COMPONENTS_PREVIEWS_CORE_PREVIEWS_EXPERIMENTS_H_ | 87 #endif // COMPONENTS_PREVIEWS_CORE_PREVIEWS_EXPERIMENTS_H_ |
| OLD | NEW |