| 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 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 19 #include "base/metrics/field_trial.h" | 19 #include "base/metrics/field_trial.h" |
| 20 #include "base/process_util.h" | 20 #include "base/process_util.h" |
| 21 #include "chrome/browser/metrics/metrics_log.h" | 21 #include "chrome/browser/metrics/metrics_log.h" |
| 22 #include "chrome/browser/metrics/tracking_synchronizer_observer.h" | 22 #include "chrome/browser/metrics/tracking_synchronizer_observer.h" |
| 23 #include "chrome/common/metrics/metrics_service_base.h" | 23 #include "chrome/common/metrics/metrics_service_base.h" |
| 24 #include "chrome/installer/util/google_update_settings.h" | 24 #include "chrome/installer/util/google_update_settings.h" |
| 25 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
| 26 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
| 27 #include "content/public/browser/user_metrics.h" |
| 27 #include "net/url_request/url_fetcher_delegate.h" | 28 #include "net/url_request/url_fetcher_delegate.h" |
| 28 | 29 |
| 29 #if defined(OS_CHROMEOS) | 30 #if defined(OS_CHROMEOS) |
| 30 #include "chrome/browser/chromeos/external_metrics.h" | 31 #include "chrome/browser/chromeos/external_metrics.h" |
| 31 #endif | 32 #endif |
| 32 | 33 |
| 33 class BookmarkModel; | 34 class BookmarkModel; |
| 34 class BookmarkNode; | 35 class BookmarkNode; |
| 35 class MetricsReportingScheduler; | 36 class MetricsReportingScheduler; |
| 36 class PrefService; | 37 class PrefService; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // useful to allow some features to sleep, until the machine becomes active, | 131 // useful to allow some features to sleep, until the machine becomes active, |
| 131 // such as precluding UMA uploads unless there was recent activity. | 132 // such as precluding UMA uploads unless there was recent activity. |
| 132 static void SetUpNotifications(content::NotificationRegistrar* registrar, | 133 static void SetUpNotifications(content::NotificationRegistrar* registrar, |
| 133 content::NotificationObserver* observer); | 134 content::NotificationObserver* observer); |
| 134 | 135 |
| 135 // Implementation of content::NotificationObserver | 136 // Implementation of content::NotificationObserver |
| 136 virtual void Observe(int type, | 137 virtual void Observe(int type, |
| 137 const content::NotificationSource& source, | 138 const content::NotificationSource& source, |
| 138 const content::NotificationDetails& details) OVERRIDE; | 139 const content::NotificationDetails& details) OVERRIDE; |
| 139 | 140 |
| 141 void OnUserAction(const std::string& action); |
| 142 |
| 140 // Invoked when we get a WM_SESSIONEND. This places a value in prefs that is | 143 // Invoked when we get a WM_SESSIONEND. This places a value in prefs that is |
| 141 // reset when RecordCompletedSessionEnd is invoked. | 144 // reset when RecordCompletedSessionEnd is invoked. |
| 142 void RecordStartOfSessionEnd(); | 145 void RecordStartOfSessionEnd(); |
| 143 | 146 |
| 144 // This should be called when the application is shutting down. It records | 147 // This should be called when the application is shutting down. It records |
| 145 // that session end was successful. | 148 // that session end was successful. |
| 146 void RecordCompletedSessionEnd(); | 149 void RecordCompletedSessionEnd(); |
| 147 | 150 |
| 148 #if defined(OS_ANDROID) || defined(OS_IOS) | 151 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 149 // Called when the application is going into background mode. | 152 // Called when the application is going into background mode. |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 | 394 |
| 392 // Logs the initiation of a page load | 395 // Logs the initiation of a page load |
| 393 void LogLoadStarted(); | 396 void LogLoadStarted(); |
| 394 | 397 |
| 395 // Records a page load notification. | 398 // Records a page load notification. |
| 396 void LogLoadComplete(int type, | 399 void LogLoadComplete(int type, |
| 397 const content::NotificationSource& source, | 400 const content::NotificationSource& source, |
| 398 const content::NotificationDetails& details); | 401 const content::NotificationDetails& details); |
| 399 | 402 |
| 400 // Checks whether a notification can be logged. | 403 // Checks whether a notification can be logged. |
| 401 bool CanLogNotification(int type, | 404 bool CanLogNotification(); |
| 402 const content::NotificationSource& source, | |
| 403 const content::NotificationDetails& details); | |
| 404 | 405 |
| 405 // Sets the value of the specified path in prefs and schedules a save. | 406 // Sets the value of the specified path in prefs and schedules a save. |
| 406 void RecordBooleanPrefValue(const char* path, bool value); | 407 void RecordBooleanPrefValue(const char* path, bool value); |
| 407 | 408 |
| 408 // Returns true if process of type |type| should be counted as a plugin | 409 // Returns true if process of type |type| should be counted as a plugin |
| 409 // process, and false otherwise. | 410 // process, and false otherwise. |
| 410 static bool IsPluginProcess(content::ProcessType type); | 411 static bool IsPluginProcess(content::ProcessType type); |
| 411 | 412 |
| 412 content::NotificationRegistrar registrar_; | 413 content::NotificationRegistrar registrar_; |
| 413 | 414 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 friend class extensions::ExtensionDownloader; | 529 friend class extensions::ExtensionDownloader; |
| 529 friend class extensions::ManifestFetchData; | 530 friend class extensions::ManifestFetchData; |
| 530 | 531 |
| 531 // Returns true if prefs::kMetricsReportingEnabled is set. | 532 // Returns true if prefs::kMetricsReportingEnabled is set. |
| 532 static bool IsMetricsReportingEnabled(); | 533 static bool IsMetricsReportingEnabled(); |
| 533 | 534 |
| 534 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); | 535 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); |
| 535 }; | 536 }; |
| 536 | 537 |
| 537 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 538 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
| OLD | NEW |