Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / chrome / browser / metrics / chrome_browser_main_extra_parts_metrics.h
blob4d0cd6c3b526d05c2c3d8247c4ba83870ffb3d6a
1 // Copyright (c) 2013 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.
5 #ifndef CHROME_BROWSER_METRICS_CHROME_BROWSER_MAIN_EXTRA_PARTS_METRICS_H_
6 #define CHROME_BROWSER_METRICS_CHROME_BROWSER_MAIN_EXTRA_PARTS_METRICS_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/chrome_browser_main_extra_parts.h"
12 #include "chrome/browser/metrics/first_web_contents_profiler.h"
13 #include "ui/gfx/display_observer.h"
15 class ChromeBrowserMainParts;
17 namespace chrome {
18 void AddMetricsExtraParts(ChromeBrowserMainParts* main_parts);
21 namespace ui {
22 class InputDeviceEventObserver;
23 } // namespace ui
25 class ChromeBrowserMainExtraPartsMetrics
26 : public ChromeBrowserMainExtraParts,
27 public gfx::DisplayObserver,
28 public FirstWebContentsProfiler::Delegate {
29 public:
30 ChromeBrowserMainExtraPartsMetrics();
31 ~ChromeBrowserMainExtraPartsMetrics() override;
33 // Overridden from ChromeBrowserMainExtraParts:
34 void PreProfileInit() override;
35 void PreBrowserStart() override;
36 void PostBrowserStart() override;
38 private:
39 #if defined(OS_MACOSX) && !defined(OS_IOS)
40 // Records Mac specific metrics.
41 void RecordMacMetrics();
42 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
44 // DisplayObserver overrides.
45 void OnDisplayAdded(const gfx::Display& new_display) override;
46 void OnDisplayRemoved(const gfx::Display& old_display) override;
47 void OnDisplayMetricsChanged(const gfx::Display& display,
48 uint32_t changed_metrics) override;
50 // FirstWebContentsProfilerDelegate overrides.
51 void ProfilerFinishedCollectingMetrics() override;
53 // If the number of displays has changed, emit a UMA metric.
54 void EmitDisplaysChangedMetric();
56 // A cached value for the number of displays.
57 int display_count_;
59 // True iff |this| instance is registered as an observer of the native
60 // screen.
61 bool is_screen_observer_;
63 // Measures start up performance of the first active web contents.
64 scoped_ptr<FirstWebContentsProfiler> first_web_contents_profiler_;
66 #if defined(USE_OZONE) || defined(USE_X11)
67 scoped_ptr<ui::InputDeviceEventObserver> input_device_event_observer_;
68 #endif // defined(USE_OZONE) || defined(USE_X11)
70 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsMetrics);
73 #endif // CHROME_BROWSER_METRICS_CHROME_BROWSER_MAIN_EXTRA_PARTS_METRICS_H_