Chromium Code Reviews| 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_DECIDER_H_ | 5 #ifndef COMPONENTS_PREVIEWS_CORE_PREVIEWS_DECIDER_H_ |
| 6 #define COMPONENTS_PREVIEWS_CORE_PREVIEWS_DECIDER_H_ | 6 #define COMPONENTS_PREVIEWS_CORE_PREVIEWS_DECIDER_H_ |
| 7 | 7 |
| 8 #include "components/previews/core/previews_experiments.h" | 8 #include "components/previews/core/previews_experiments.h" |
| 9 | 9 |
| 10 #include "net/nqe/effective_connection_type.h" | |
| 11 | |
| 10 namespace net { | 12 namespace net { |
| 11 class URLRequest; | 13 class URLRequest; |
| 12 } | 14 } |
| 13 | 15 |
| 14 namespace previews { | 16 namespace previews { |
| 15 | 17 |
| 16 class PreviewsDecider { | 18 class PreviewsDecider { |
| 17 public: | 19 public: |
| 18 // Whether |request| is allowed to show a preview of |type|. | 20 // Whether |request| is allowed to show a preview of |type|. Previews that do |
| 21 // not supply a network quality in | |
| 22 // GetEffectiveConnectionTypeThresholdForPreviewsType() should check the | |
| 23 // network quality before calling ShouldAllowPreview. |request| is the main | |
|
tbansal1
2017/05/05 21:31:31
s/ShouldAllowPreview/ShouldAllowPreviewAtECT/
RyanSturm
2017/05/05 21:39:02
Done.
| |
| 24 // frame request of the page load. |type| is the type that would be allowed. | |
| 25 // If the current ECT better than |effective_connection_type_threshold|, the | |
|
tbansal1
2017/05/05 21:31:31
s/better/strictly faster/
OR s/better/at least as
RyanSturm
2017/05/05 21:39:02
Done.
| |
| 26 // preview will be disallowed. | |
| 27 virtual bool ShouldAllowPreviewAtECT( | |
| 28 const net::URLRequest& request, | |
| 29 PreviewsType type, | |
| 30 net::EffectiveConnectionType effective_connection_type_threshold) | |
| 31 const = 0; | |
| 32 | |
| 33 // Same as ShouldAllowPreviewAtECT, but uses the previews default | |
| 34 // EffectiveConnectionType. | |
| 19 virtual bool ShouldAllowPreview(const net::URLRequest& request, | 35 virtual bool ShouldAllowPreview(const net::URLRequest& request, |
| 20 PreviewsType type) const = 0; | 36 PreviewsType type) const = 0; |
| 21 | 37 |
| 22 protected: | 38 protected: |
| 23 PreviewsDecider() {} | 39 PreviewsDecider() {} |
| 24 virtual ~PreviewsDecider() {} | 40 virtual ~PreviewsDecider() {} |
| 25 }; | 41 }; |
| 26 | 42 |
| 27 } // namespace previews | 43 } // namespace previews |
| 28 | 44 |
| 29 #endif // COMPONENTS_PREVIEWS_CORE_PREVIEWS_DECIDER_H_ | 45 #endif // COMPONENTS_PREVIEWS_CORE_PREVIEWS_DECIDER_H_ |
| OLD | NEW |