OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_METRICS_CHROME_BROWSER_MAIN_EXTRA_PARTS_METRICS_H_ | 5 #ifndef CHROME_BROWSER_METRICS_CHROME_BROWSER_MAIN_EXTRA_PARTS_METRICS_H_ |
6 #define CHROME_BROWSER_METRICS_CHROME_BROWSER_MAIN_EXTRA_PARTS_METRICS_H_ | 6 #define CHROME_BROWSER_METRICS_CHROME_BROWSER_MAIN_EXTRA_PARTS_METRICS_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "chrome/browser/chrome_browser_main_extra_parts.h" | 11 #include "chrome/browser/chrome_browser_main_extra_parts.h" |
12 #include "chrome/browser/metrics/first_web_contents_profiler.h" | 12 #include "chrome/browser/metrics/first_web_contents_profiler.h" |
| 13 #include "ui/events/devices/input_device_event_observer.h" |
13 #include "ui/gfx/display_observer.h" | 14 #include "ui/gfx/display_observer.h" |
14 | 15 |
15 class ChromeBrowserMainParts; | 16 class ChromeBrowserMainParts; |
16 | 17 |
17 namespace chrome { | 18 namespace chrome { |
18 void AddMetricsExtraParts(ChromeBrowserMainParts* main_parts); | 19 void AddMetricsExtraParts(ChromeBrowserMainParts* main_parts); |
19 } | 20 } |
20 | 21 |
21 class ChromeBrowserMainExtraPartsMetrics | 22 class ChromeBrowserMainExtraPartsMetrics |
22 : public ChromeBrowserMainExtraParts, | 23 : public ChromeBrowserMainExtraParts, |
23 public gfx::DisplayObserver, | 24 public gfx::DisplayObserver, |
24 public FirstWebContentsProfiler::Delegate { | 25 public FirstWebContentsProfiler::Delegate, |
| 26 public ui::InputDeviceEventObserver { |
25 public: | 27 public: |
26 ChromeBrowserMainExtraPartsMetrics(); | 28 ChromeBrowserMainExtraPartsMetrics(); |
27 ~ChromeBrowserMainExtraPartsMetrics() override; | 29 ~ChromeBrowserMainExtraPartsMetrics() override; |
28 | 30 |
29 // Overridden from ChromeBrowserMainExtraParts: | 31 // Overridden from ChromeBrowserMainExtraParts: |
30 void PreProfileInit() override; | 32 void PreProfileInit() override; |
31 void PreBrowserStart() override; | 33 void PreBrowserStart() override; |
32 void PostBrowserStart() override; | 34 void PostBrowserStart() override; |
33 | 35 |
34 private: | 36 private: |
35 #if defined(OS_MACOSX) && !defined(OS_IOS) | 37 #if defined(OS_MACOSX) && !defined(OS_IOS) |
36 // Records Mac specific metrics. | 38 // Records Mac specific metrics. |
37 void RecordMacMetrics(); | 39 void RecordMacMetrics(); |
38 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 40 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
39 | 41 |
40 // DisplayObserver overrides. | 42 // DisplayObserver overrides. |
41 void OnDisplayAdded(const gfx::Display& new_display) override; | 43 void OnDisplayAdded(const gfx::Display& new_display) override; |
42 void OnDisplayRemoved(const gfx::Display& old_display) override; | 44 void OnDisplayRemoved(const gfx::Display& old_display) override; |
43 void OnDisplayMetricsChanged(const gfx::Display& display, | 45 void OnDisplayMetricsChanged(const gfx::Display& display, |
44 uint32_t changed_metrics) override; | 46 uint32_t changed_metrics) override; |
45 | 47 |
46 // FirstWebContentsProfilerDelegate overrides. | 48 // FirstWebContentsProfilerDelegate overrides. |
47 void ProfilerFinishedCollectingMetrics() override; | 49 void ProfilerFinishedCollectingMetrics() override; |
48 | 50 |
| 51 // ui::InputDeviceEventObserver overrides. |
| 52 void OnDeviceListsComplete() override; |
| 53 |
49 // If the number of displays has changed, emit a UMA metric. | 54 // If the number of displays has changed, emit a UMA metric. |
50 void EmitDisplaysChangedMetric(); | 55 void EmitDisplaysChangedMetric(); |
51 | 56 |
52 // A cached value for the number of displays. | 57 // A cached value for the number of displays. |
53 int display_count_; | 58 int display_count_; |
54 | 59 |
55 // True iff |this| instance is registered as an observer of the native | 60 // True iff |this| instance is registered as an observer of the native |
56 // screen. | 61 // screen. |
57 bool is_screen_observer_; | 62 bool is_screen_observer_; |
58 | 63 |
59 // Measures start up performance of the first active web contents. | 64 // Measures start up performance of the first active web contents. |
60 scoped_ptr<FirstWebContentsProfiler> first_web_contents_profiler_; | 65 scoped_ptr<FirstWebContentsProfiler> first_web_contents_profiler_; |
61 | 66 |
62 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsMetrics); | 67 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsMetrics); |
63 }; | 68 }; |
64 | 69 |
65 #endif // CHROME_BROWSER_METRICS_CHROME_BROWSER_MAIN_EXTRA_PARTS_METRICS_H_ | 70 #endif // CHROME_BROWSER_METRICS_CHROME_BROWSER_MAIN_EXTRA_PARTS_METRICS_H_ |
OLD | NEW |