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