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