| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 10 #pragma once |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // types we'll be using. | 91 // types we'll be using. |
| 92 static void RegisterPrefs(PrefService* local_state); | 92 static void RegisterPrefs(PrefService* local_state); |
| 93 | 93 |
| 94 // Set up notifications which indicate that a user is performing work. This is | 94 // Set up notifications which indicate that a user is performing work. This is |
| 95 // useful to allow some features to sleep, until the machine becomes active, | 95 // useful to allow some features to sleep, until the machine becomes active, |
| 96 // such as precluding UMA uploads unless there was recent activity. | 96 // such as precluding UMA uploads unless there was recent activity. |
| 97 static void SetUpNotifications(NotificationRegistrar* registrar, | 97 static void SetUpNotifications(NotificationRegistrar* registrar, |
| 98 NotificationObserver* observer); | 98 NotificationObserver* observer); |
| 99 | 99 |
| 100 // Implementation of NotificationObserver | 100 // Implementation of NotificationObserver |
| 101 virtual void Observe(NotificationType type, | 101 virtual void Observe(int type, |
| 102 const NotificationSource& source, | 102 const NotificationSource& source, |
| 103 const NotificationDetails& details); | 103 const NotificationDetails& details); |
| 104 | 104 |
| 105 // Invoked when we get a WM_SESSIONEND. This places a value in prefs that is | 105 // Invoked when we get a WM_SESSIONEND. This places a value in prefs that is |
| 106 // reset when RecordCompletedSessionEnd is invoked. | 106 // reset when RecordCompletedSessionEnd is invoked. |
| 107 void RecordStartOfSessionEnd(); | 107 void RecordStartOfSessionEnd(); |
| 108 | 108 |
| 109 // This should be called when the application is shutting down. It records | 109 // This should be called when the application is shutting down. It records |
| 110 // that session end was successful. | 110 // that session end was successful. |
| 111 void RecordCompletedSessionEnd(); | 111 void RecordCompletedSessionEnd(); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 const net::URLRequestStatus& status, | 259 const net::URLRequestStatus& status, |
| 260 int response_code, | 260 int response_code, |
| 261 const net::ResponseCookies& cookies, | 261 const net::ResponseCookies& cookies, |
| 262 const std::string& data); | 262 const std::string& data); |
| 263 | 263 |
| 264 // Logs debugging details, for the case where the server returns a response | 264 // Logs debugging details, for the case where the server returns a response |
| 265 // code other than 200. | 265 // code other than 200. |
| 266 void LogBadResponseCode(); | 266 void LogBadResponseCode(); |
| 267 | 267 |
| 268 // Records a window-related notification. | 268 // Records a window-related notification. |
| 269 void LogWindowChange(NotificationType type, | 269 void LogWindowChange(int type, |
| 270 const NotificationSource& source, | 270 const NotificationSource& source, |
| 271 const NotificationDetails& details); | 271 const NotificationDetails& details); |
| 272 | 272 |
| 273 // Reads, increments and then sets the specified integer preference. | 273 // Reads, increments and then sets the specified integer preference. |
| 274 void IncrementPrefValue(const char* path); | 274 void IncrementPrefValue(const char* path); |
| 275 | 275 |
| 276 // Reads, increments and then sets the specified long preference that is | 276 // Reads, increments and then sets the specified long preference that is |
| 277 // stored as a string. | 277 // stored as a string. |
| 278 void IncrementLongPrefsValue(const char* path); | 278 void IncrementLongPrefsValue(const char* path); |
| 279 | 279 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 295 void LogBookmarks(const BookmarkNode* node, | 295 void LogBookmarks(const BookmarkNode* node, |
| 296 const char* num_bookmarks_key, | 296 const char* num_bookmarks_key, |
| 297 const char* num_folders_key); | 297 const char* num_folders_key); |
| 298 | 298 |
| 299 // Sets preferences for the number of bookmarks in model. | 299 // Sets preferences for the number of bookmarks in model. |
| 300 void LogBookmarks(BookmarkModel* model); | 300 void LogBookmarks(BookmarkModel* model); |
| 301 | 301 |
| 302 // Records a child process related notification. These are recorded to an | 302 // Records a child process related notification. These are recorded to an |
| 303 // in-object buffer because these notifications are sent on page load, and we | 303 // in-object buffer because these notifications are sent on page load, and we |
| 304 // don't want to slow that down. | 304 // don't want to slow that down. |
| 305 void LogChildProcessChange(NotificationType type, | 305 void LogChildProcessChange(int type, |
| 306 const NotificationSource& source, | 306 const NotificationSource& source, |
| 307 const NotificationDetails& details); | 307 const NotificationDetails& details); |
| 308 | 308 |
| 309 // Logs keywords specific metrics. Keyword metrics are recorded in the | 309 // Logs keywords specific metrics. Keyword metrics are recorded in the |
| 310 // profile specific metrics. | 310 // profile specific metrics. |
| 311 void LogKeywords(const TemplateURLService* url_model); | 311 void LogKeywords(const TemplateURLService* url_model); |
| 312 | 312 |
| 313 // Saves plugin-related updates from the in-object buffer to Local State | 313 // Saves plugin-related updates from the in-object buffer to Local State |
| 314 // for retrieval next time we send a Profile log (generally next launch). | 314 // for retrieval next time we send a Profile log (generally next launch). |
| 315 void RecordPluginChanges(PrefService* pref); | 315 void RecordPluginChanges(PrefService* pref); |
| 316 | 316 |
| 317 // Records state that should be periodically saved, like uptime and | 317 // Records state that should be periodically saved, like uptime and |
| 318 // buffered plugin stability statistics. | 318 // buffered plugin stability statistics. |
| 319 void RecordCurrentState(PrefService* pref); | 319 void RecordCurrentState(PrefService* pref); |
| 320 | 320 |
| 321 // Logs the initiation of a page load | 321 // Logs the initiation of a page load |
| 322 void LogLoadStarted(); | 322 void LogLoadStarted(); |
| 323 | 323 |
| 324 // Records a page load notification. | 324 // Records a page load notification. |
| 325 void LogLoadComplete(NotificationType type, | 325 void LogLoadComplete(int type, |
| 326 const NotificationSource& source, | 326 const NotificationSource& source, |
| 327 const NotificationDetails& details); | 327 const NotificationDetails& details); |
| 328 | 328 |
| 329 // Checks whether a notification can be logged. | 329 // Checks whether a notification can be logged. |
| 330 bool CanLogNotification(NotificationType type, | 330 bool CanLogNotification(int type, |
| 331 const NotificationSource& source, | 331 const NotificationSource& source, |
| 332 const NotificationDetails& details); | 332 const NotificationDetails& details); |
| 333 | 333 |
| 334 // Sets the value of the specified path in prefs and schedules a save. | 334 // Sets the value of the specified path in prefs and schedules a save. |
| 335 void RecordBooleanPrefValue(const char* path, bool value); | 335 void RecordBooleanPrefValue(const char* path, bool value); |
| 336 | 336 |
| 337 NotificationRegistrar registrar_; | 337 NotificationRegistrar registrar_; |
| 338 | 338 |
| 339 // Indicate whether recording and reporting are currently happening. | 339 // Indicate whether recording and reporting are currently happening. |
| 340 // These should not be set directly, but by calling SetRecording and | 340 // These should not be set directly, but by calling SetRecording and |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, CorruptSizeOfLogList); | 428 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, CorruptSizeOfLogList); |
| 429 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, CorruptChecksumOfLogList); | 429 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, CorruptChecksumOfLogList); |
| 430 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdGeneratesAllZeroes); | 430 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdGeneratesAllZeroes); |
| 431 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdGeneratesCorrectly); | 431 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdGeneratesCorrectly); |
| 432 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdCorrectlyFormatted); | 432 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdCorrectlyFormatted); |
| 433 | 433 |
| 434 DISALLOW_COPY_AND_ASSIGN(MetricsService); | 434 DISALLOW_COPY_AND_ASSIGN(MetricsService); |
| 435 }; | 435 }; |
| 436 | 436 |
| 437 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 437 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
| OLD | NEW |