• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2015 The Chromium Authors
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 COMPONENTS_METRICS_UI_SCREEN_INFO_METRICS_PROVIDER_H_
6 #define COMPONENTS_METRICS_UI_SCREEN_INFO_METRICS_PROVIDER_H_
7 
8 #include "components/metrics/metrics_provider.h"
9 #include "third_party/abseil-cpp/absl/types/optional.h"
10 #include "ui/gfx/geometry/size.h"
11 
12 namespace metrics {
13 
14 // ScreenInfoMetricsProvider provides metrics related to screen info.
15 class ScreenInfoMetricsProvider : public MetricsProvider {
16  public:
17   ScreenInfoMetricsProvider();
18 
19   ScreenInfoMetricsProvider(const ScreenInfoMetricsProvider&) = delete;
20   ScreenInfoMetricsProvider& operator=(const ScreenInfoMetricsProvider&) =
21       delete;
22 
23   ~ScreenInfoMetricsProvider() override;
24 
25   // MetricsProvider:
26   void ProvideSystemProfileMetrics(
27       SystemProfileProto* system_profile_proto) override;
28 
29  protected:
30   // Exposed for the sake of mocking in test code.
31 
32   // Returns the screen size for the primary monitor if available.
33   virtual absl::optional<gfx::Size> GetScreenSize() const;
34 
35   // Returns the device scale factor for the primary monitor.
36   virtual float GetScreenDeviceScaleFactor() const;
37 
38   // Returns the number of monitors the user is using.
39   virtual int GetScreenCount() const;
40 };
41 
42 }  // namespace metrics
43 
44 #endif  // COMPONENTS_METRICS_UI_SCREEN_INFO_METRICS_PROVIDER_H_
45