Roll src/third_party/WebKit 8b42d1d:744641d (svn 186770:186771)
[chromium-blink-merge.git] / chrome / browser / metrics / chrome_browser_main_extra_parts_metrics.h
blob7d9eceb4be58e6ee869f450122b48229b7974dd3
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 class ChromeBrowserMainExtraPartsMetrics
22 : public ChromeBrowserMainExtraParts,
23 public gfx::DisplayObserver,
24 public FirstWebContentsProfiler::Delegate {
25 public:
26 ChromeBrowserMainExtraPartsMetrics();
27 ~ChromeBrowserMainExtraPartsMetrics() override;
29 // Overridden from ChromeBrowserMainExtraParts:
30 void PreProfileInit() override;
31 void PreBrowserStart() override;
32 void PostBrowserStart() override;
34 private:
35 #if defined(OS_MACOSX) && !defined(OS_IOS)
36 // Records Mac specific metrics.
37 void RecordMacMetrics();
38 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
40 // DisplayObserver overrides.
41 virtual void OnDisplayAdded(const gfx::Display& new_display) override;
42 virtual void OnDisplayRemoved(const gfx::Display& old_display) override;
43 virtual void OnDisplayMetricsChanged(const gfx::Display& display,
44 uint32_t changed_metrics) override;
46 // FirstWebContentsProfilerDelegate overrides.
47 void ProfilerFinishedCollectingMetrics() override;
49 // If the number of displays has changed, emit a UMA metric.
50 void EmitDisplaysChangedMetric();
52 // A cached value for the number of displays.
53 int display_count_;
55 // True iff |this| instance is registered as an observer of the native
56 // screen.
57 bool is_screen_observer_;
59 // Measures start up performance of the first active web contents.
60 scoped_ptr<FirstWebContentsProfiler> first_web_contents_profiler_;
62 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsMetrics);
65 #endif // CHROME_BROWSER_METRICS_CHROME_BROWSER_MAIN_EXTRA_PARTS_METRICS_H_