OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file defines a service that collects information about the user | 5 // This file defines a service that collects information about the user |
6 // experience in order to help improve future versions of the app. | 6 // experience in order to help improve future versions of the app. |
7 | 7 |
8 #ifndef CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 8 #ifndef CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
9 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 9 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "base/observer_list.h" | 25 #include "base/observer_list.h" |
26 #include "base/strings/string16.h" | 26 #include "base/strings/string16.h" |
27 #include "base/threading/thread_checker.h" | 27 #include "base/threading/thread_checker.h" |
28 #include "base/time/time.h" | 28 #include "base/time/time.h" |
29 #include "chrome/browser/metrics/metrics_log.h" | 29 #include "chrome/browser/metrics/metrics_log.h" |
30 #include "chrome/browser/metrics/tracking_synchronizer_observer.h" | 30 #include "chrome/browser/metrics/tracking_synchronizer_observer.h" |
31 #include "components/metrics/metrics_log_manager.h" | 31 #include "components/metrics/metrics_log_manager.h" |
32 #include "components/metrics/metrics_provider.h" | 32 #include "components/metrics/metrics_provider.h" |
33 #include "components/metrics/metrics_service_observer.h" | 33 #include "components/metrics/metrics_service_observer.h" |
34 #include "components/variations/active_field_trials.h" | 34 #include "components/variations/active_field_trials.h" |
35 #include "content/public/browser/browser_child_process_observer.h" | |
36 #include "content/public/browser/user_metrics.h" | |
37 #include "net/url_request/url_fetcher_delegate.h" | 35 #include "net/url_request/url_fetcher_delegate.h" |
38 | 36 |
39 class GoogleUpdateMetricsProviderWin; | 37 class GoogleUpdateMetricsProviderWin; |
40 class MetricsReportingScheduler; | 38 class MetricsReportingScheduler; |
41 class PrefService; | 39 class PrefService; |
42 class PrefRegistrySimple; | 40 class PrefRegistrySimple; |
43 class PluginMetricsProvider; | 41 class PluginMetricsProvider; |
44 | 42 |
45 namespace base { | 43 namespace base { |
46 class DictionaryValue; | 44 class DictionaryValue; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 82 |
85 // This constructor is private specifically so as to control which code is | 83 // This constructor is private specifically so as to control which code is |
86 // able to access it. New code that wishes to use it should be added as a | 84 // able to access it. New code that wishes to use it should be added as a |
87 // friend class. | 85 // friend class. |
88 SyntheticTrialGroup(uint32 trial, uint32 group); | 86 SyntheticTrialGroup(uint32 trial, uint32 group); |
89 }; | 87 }; |
90 | 88 |
91 class MetricsService | 89 class MetricsService |
92 : public base::HistogramFlattener, | 90 : public base::HistogramFlattener, |
93 public chrome_browser_metrics::TrackingSynchronizerObserver, | 91 public chrome_browser_metrics::TrackingSynchronizerObserver, |
94 public content::BrowserChildProcessObserver, | |
95 public net::URLFetcherDelegate { | 92 public net::URLFetcherDelegate { |
96 public: | 93 public: |
97 // The execution phase of the browser. | 94 // The execution phase of the browser. |
98 enum ExecutionPhase { | 95 enum ExecutionPhase { |
99 UNINITIALIZED_PHASE = 0, | 96 UNINITIALIZED_PHASE = 0, |
100 START_METRICS_RECORDING = 100, | 97 START_METRICS_RECORDING = 100, |
101 CREATE_PROFILE = 200, | 98 CREATE_PROFILE = 200, |
102 STARTUP_TIMEBOMB_ARM = 300, | 99 STARTUP_TIMEBOMB_ARM = 300, |
103 THREAD_WATCHER_START = 400, | 100 THREAD_WATCHER_START = 400, |
104 MAIN_MESSAGE_LOOP_RUN = 500, | 101 MAIN_MESSAGE_LOOP_RUN = 500, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 161 |
165 // HistogramFlattener: | 162 // HistogramFlattener: |
166 virtual void RecordDelta(const base::HistogramBase& histogram, | 163 virtual void RecordDelta(const base::HistogramBase& histogram, |
167 const base::HistogramSamples& snapshot) OVERRIDE; | 164 const base::HistogramSamples& snapshot) OVERRIDE; |
168 virtual void InconsistencyDetected( | 165 virtual void InconsistencyDetected( |
169 base::HistogramBase::Inconsistency problem) OVERRIDE; | 166 base::HistogramBase::Inconsistency problem) OVERRIDE; |
170 virtual void UniqueInconsistencyDetected( | 167 virtual void UniqueInconsistencyDetected( |
171 base::HistogramBase::Inconsistency problem) OVERRIDE; | 168 base::HistogramBase::Inconsistency problem) OVERRIDE; |
172 virtual void InconsistencyDetectedInLoggedCount(int amount) OVERRIDE; | 169 virtual void InconsistencyDetectedInLoggedCount(int amount) OVERRIDE; |
173 | 170 |
174 // Implementation of content::BrowserChildProcessObserver | |
175 virtual void BrowserChildProcessCrashed( | |
176 const content::ChildProcessData& data) OVERRIDE; | |
177 | |
178 // This should be called when the application is not idle, i.e. the user seems | 171 // This should be called when the application is not idle, i.e. the user seems |
179 // to be interacting with the application. | 172 // to be interacting with the application. |
180 void OnApplicationNotIdle(); | 173 void OnApplicationNotIdle(); |
181 | 174 |
182 // Invoked when we get a WM_SESSIONEND. This places a value in prefs that is | 175 // Invoked when we get a WM_SESSIONEND. This places a value in prefs that is |
183 // reset when RecordCompletedSessionEnd is invoked. | 176 // reset when RecordCompletedSessionEnd is invoked. |
184 void RecordStartOfSessionEnd(); | 177 void RecordStartOfSessionEnd(); |
185 | 178 |
186 // This should be called when the application is shutting down. It records | 179 // This should be called when the application is shutting down. It records |
187 // that session end was successful. | 180 // that session end was successful. |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, IsPluginProcess); | 520 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, IsPluginProcess); |
528 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, MetricsServiceObserver); | 521 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, MetricsServiceObserver); |
529 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, | 522 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, |
530 PermutedEntropyCacheClearedWhenLowEntropyReset); | 523 PermutedEntropyCacheClearedWhenLowEntropyReset); |
531 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial); | 524 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial); |
532 | 525 |
533 DISALLOW_COPY_AND_ASSIGN(MetricsService); | 526 DISALLOW_COPY_AND_ASSIGN(MetricsService); |
534 }; | 527 }; |
535 | 528 |
536 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 529 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
OLD | NEW |