| 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 18 matching lines...) Expand all Loading... |
| 29 #include "chrome/installer/util/google_update_settings.h" | 29 #include "chrome/installer/util/google_update_settings.h" |
| 30 #include "components/metrics/metrics_provider.h" | 30 #include "components/metrics/metrics_provider.h" |
| 31 #include "components/metrics/metrics_service_observer.h" | 31 #include "components/metrics/metrics_service_observer.h" |
| 32 #include "components/variations/active_field_trials.h" | 32 #include "components/variations/active_field_trials.h" |
| 33 #include "content/public/browser/browser_child_process_observer.h" | 33 #include "content/public/browser/browser_child_process_observer.h" |
| 34 #include "content/public/browser/notification_observer.h" | 34 #include "content/public/browser/notification_observer.h" |
| 35 #include "content/public/browser/notification_registrar.h" | 35 #include "content/public/browser/notification_registrar.h" |
| 36 #include "content/public/browser/user_metrics.h" | 36 #include "content/public/browser/user_metrics.h" |
| 37 #include "net/url_request/url_fetcher_delegate.h" | 37 #include "net/url_request/url_fetcher_delegate.h" |
| 38 | 38 |
| 39 #if defined(OS_ANDROID) | |
| 40 #include "chrome/browser/android/activity_type_ids.h" | |
| 41 #endif | |
| 42 | |
| 43 class ChromeBrowserMetricsServiceObserver; | 39 class ChromeBrowserMetricsServiceObserver; |
| 44 class MetricsReportingScheduler; | 40 class MetricsReportingScheduler; |
| 45 class PrefService; | 41 class PrefService; |
| 46 class PrefRegistrySimple; | 42 class PrefRegistrySimple; |
| 47 class Profile; | 43 class Profile; |
| 48 class TemplateURLService; | 44 class TemplateURLService; |
| 49 | 45 |
| 50 namespace { | 46 namespace { |
| 51 class CrashesDOMHandler; | 47 class CrashesDOMHandler; |
| 52 class FlashDOMHandler; | 48 class FlashDOMHandler; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 // | 177 // |
| 182 // If metrics reporting is enabled, this method returns an entropy provider | 178 // If metrics reporting is enabled, this method returns an entropy provider |
| 183 // that has a high source of entropy, partially based on the client ID. | 179 // that has a high source of entropy, partially based on the client ID. |
| 184 // Otherwise, it returns an entropy provider that is based on a low entropy | 180 // Otherwise, it returns an entropy provider that is based on a low entropy |
| 185 // source. | 181 // source. |
| 186 scoped_ptr<const base::FieldTrial::EntropyProvider> CreateEntropyProvider(); | 182 scoped_ptr<const base::FieldTrial::EntropyProvider> CreateEntropyProvider(); |
| 187 | 183 |
| 188 // At startup, prefs needs to be called with a list of all the pref names and | 184 // At startup, prefs needs to be called with a list of all the pref names and |
| 189 // types we'll be using. | 185 // types we'll be using. |
| 190 static void RegisterPrefs(PrefRegistrySimple* registry); | 186 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 191 #if defined(OS_ANDROID) | |
| 192 static void RegisterPrefsAndroid(PrefRegistrySimple* registry); | |
| 193 #endif // defined(OS_ANDROID) | |
| 194 | 187 |
| 195 // Set up notifications which indicate that a user is performing work. This is | 188 // Set up notifications which indicate that a user is performing work. This is |
| 196 // useful to allow some features to sleep, until the machine becomes active, | 189 // useful to allow some features to sleep, until the machine becomes active, |
| 197 // such as precluding UMA uploads unless there was recent activity. | 190 // such as precluding UMA uploads unless there was recent activity. |
| 198 static void SetUpNotifications(content::NotificationRegistrar* registrar, | 191 static void SetUpNotifications(content::NotificationRegistrar* registrar, |
| 199 content::NotificationObserver* observer); | 192 content::NotificationObserver* observer); |
| 200 | 193 |
| 201 // Implementation of content::BrowserChildProcessObserver | 194 // Implementation of content::BrowserChildProcessObserver |
| 202 virtual void BrowserChildProcessHostConnected( | 195 virtual void BrowserChildProcessHostConnected( |
| 203 const content::ChildProcessData& data) OVERRIDE; | 196 const content::ChildProcessData& data) OVERRIDE; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 216 void OnApplicationNotIdle(); | 209 void OnApplicationNotIdle(); |
| 217 | 210 |
| 218 // Invoked when we get a WM_SESSIONEND. This places a value in prefs that is | 211 // Invoked when we get a WM_SESSIONEND. This places a value in prefs that is |
| 219 // reset when RecordCompletedSessionEnd is invoked. | 212 // reset when RecordCompletedSessionEnd is invoked. |
| 220 void RecordStartOfSessionEnd(); | 213 void RecordStartOfSessionEnd(); |
| 221 | 214 |
| 222 // This should be called when the application is shutting down. It records | 215 // This should be called when the application is shutting down. It records |
| 223 // that session end was successful. | 216 // that session end was successful. |
| 224 void RecordCompletedSessionEnd(); | 217 void RecordCompletedSessionEnd(); |
| 225 | 218 |
| 226 #if defined(OS_ANDROID) | |
| 227 // Called to log launch and crash stats to preferences. | |
| 228 void LogAndroidStabilityToPrefs(PrefService* pref); | |
| 229 | |
| 230 // Converts crash stats stored in the preferences into histograms. | |
| 231 void ConvertAndroidStabilityPrefsToHistograms(PrefService* pref); | |
| 232 | |
| 233 // Called when the Activity that the user interacts with is swapped out. | |
| 234 void OnForegroundActivityChanged(PrefService* pref, | |
| 235 ActivityTypeIds::Type type); | |
| 236 #endif // defined(OS_ANDROID) | |
| 237 | |
| 238 #if defined(OS_ANDROID) || defined(OS_IOS) | 219 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 239 // Called when the application is going into background mode. | 220 // Called when the application is going into background mode. |
| 240 void OnAppEnterBackground(); | 221 void OnAppEnterBackground(); |
| 241 | 222 |
| 242 // Called when the application is coming out of background mode. | 223 // Called when the application is coming out of background mode. |
| 243 void OnAppEnterForeground(); | 224 void OnAppEnterForeground(); |
| 244 #else | 225 #else |
| 245 // Set the dirty flag, which will require a later call to LogCleanShutdown(). | 226 // Set the dirty flag, which will require a later call to LogCleanShutdown(). |
| 246 static void LogNeedForCleanShutdown(); | 227 static void LogNeedForCleanShutdown(); |
| 247 #endif // defined(OS_ANDROID) || defined(OS_IOS) | 228 #endif // defined(OS_ANDROID) || defined(OS_IOS) |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 | 632 |
| 652 // Registers/unregisters |observer| to receive MetricsLog notifications | 633 // Registers/unregisters |observer| to receive MetricsLog notifications |
| 653 // from metrics service. | 634 // from metrics service. |
| 654 static void AddMetricsServiceObserver(MetricsServiceObserver* observer); | 635 static void AddMetricsServiceObserver(MetricsServiceObserver* observer); |
| 655 static void RemoveMetricsServiceObserver(MetricsServiceObserver* observer); | 636 static void RemoveMetricsServiceObserver(MetricsServiceObserver* observer); |
| 656 | 637 |
| 657 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); | 638 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); |
| 658 }; | 639 }; |
| 659 | 640 |
| 660 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 641 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
| OLD | NEW |