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