1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_CSS_MEDIA_VALUES_DYNAMIC_H_
6 #define THIRD_PARTY_BLINK_RENDERER_CORE_CSS_MEDIA_VALUES_DYNAMIC_H_
7 
8 #include "third_party/blink/renderer/core/css/media_values.h"
9 
10 namespace blink {
11 
12 class Document;
13 
14 class CORE_EXPORT MediaValuesDynamic : public MediaValues {
15  public:
16   static MediaValues* Create(Document&);
17   static MediaValues* Create(LocalFrame*);
18 
19   MediaValuesDynamic(LocalFrame*);
20   MediaValuesDynamic(LocalFrame*,
21                      bool overridden_viewport_dimensions,
22                      double viewport_width,
23                      double viewport_height);
24 
25   MediaValues* Copy() const override;
26   bool ComputeLength(double value,
27                      CSSPrimitiveValue::UnitType,
28                      int& result) const override;
29   bool ComputeLength(double value,
30                      CSSPrimitiveValue::UnitType,
31                      double& result) const override;
32 
33   double ViewportWidth() const override;
34   double ViewportHeight() const override;
35   int DeviceWidth() const override;
36   int DeviceHeight() const override;
37   float DevicePixelRatio() const override;
38   int ColorBitsPerComponent() const override;
39   int MonochromeBitsPerComponent() const override;
40   ui::PointerType PrimaryPointerType() const override;
41   int AvailablePointerTypes() const override;
42   ui::HoverType PrimaryHoverType() const override;
43   int AvailableHoverTypes() const override;
44   bool ThreeDEnabled() const override;
45   bool InImmersiveMode() const override;
46   bool StrictMode() const override;
47   const String MediaType() const override;
48   blink::mojom::DisplayMode DisplayMode() const override;
49   ColorSpaceGamut ColorGamut() const override;
50   mojom::blink::PreferredColorScheme GetPreferredColorScheme() const override;
51   mojom::blink::PreferredContrast GetPreferredContrast() const override;
52   bool PrefersReducedMotion() const override;
53   bool PrefersReducedData() const override;
54   ForcedColors GetForcedColors() const override;
55   NavigationControls GetNavigationControls() const override;
56   ScreenSpanning GetScreenSpanning() const override;
57   Document* GetDocument() const override;
58   bool HasValues() const override;
59   void OverrideViewportDimensions(double width, double height) override;
60 
61   void Trace(Visitor*) const override;
62 
63  protected:
64   Member<LocalFrame> frame_;
65   bool viewport_dimensions_overridden_;
66   double viewport_width_override_;
67   double viewport_height_override_;
68 };
69 
70 }  // namespace blink
71 
72 #endif  // THIRD_PARTY_BLINK_RENDERER_CORE_CSS_MEDIA_VALUES_DYNAMIC_H_
73