| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_SERVICE_H_ | 8 #ifndef CHROME_BROWSER_METRICS_SERVICE_H_ |
| 9 #define CHROME_BROWSER_METRICS_SERVICE_H_ | 9 #define CHROME_BROWSER_METRICS_SERVICE_H_ |
| 10 | 10 |
| 11 #include <list> | 11 #include <list> |
| 12 #include <map> | 12 #include <map> |
| 13 #include <set> | 13 #include <set> |
| 14 #include <string> | 14 #include <string> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/basictypes.h" | 17 #include "base/basictypes.h" |
| 18 #include "base/histogram.h" | 18 #include "base/histogram.h" |
| 19 #include "base/scoped_ptr.h" | 19 #include "base/scoped_ptr.h" |
| 20 #include "base/values.h" | 20 #include "base/values.h" |
| 21 #include "chrome/browser/metrics/metrics_log.h" | 21 #include "chrome/browser/metrics/metrics_log.h" |
| 22 #include "chrome/browser/net/url_fetcher.h" | 22 #include "chrome/browser/net/url_fetcher.h" |
| 23 #include "chrome/common/notification_registrar.h" | 23 #include "chrome/common/notification_registrar.h" |
| 24 #include "webkit/glue/webplugin.h" | 24 #include "webkit/glue/webplugininfo.h" |
| 25 #include "testing/gtest/include/gtest/gtest_prod.h" | 25 #include "testing/gtest/include/gtest/gtest_prod.h" |
| 26 | 26 |
| 27 class BookmarkModel; | 27 class BookmarkModel; |
| 28 class BookmarkNode; | 28 class BookmarkNode; |
| 29 class HistogramSynchronizer; | 29 class HistogramSynchronizer; |
| 30 class PrefService; | 30 class PrefService; |
| 31 class Profile; | 31 class Profile; |
| 32 class TemplateURLModel; | 32 class TemplateURLModel; |
| 33 | 33 |
| 34 // This is used to quickly log stats from child process related notifications in | 34 // This is used to quickly log stats from child process related notifications in |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 // Saves in the preferences if the crash report registration was successful. | 93 // Saves in the preferences if the crash report registration was successful. |
| 94 // This count is eventually send via UMA logs. | 94 // This count is eventually send via UMA logs. |
| 95 void RecordBreakpadRegistration(bool success); | 95 void RecordBreakpadRegistration(bool success); |
| 96 | 96 |
| 97 // Saves in the preferences if the browser is running under a debugger. | 97 // Saves in the preferences if the browser is running under a debugger. |
| 98 // This count is eventually send via UMA logs. | 98 // This count is eventually send via UMA logs. |
| 99 void RecordBreakpadHasDebugger(bool has_debugger); | 99 void RecordBreakpadHasDebugger(bool has_debugger); |
| 100 | 100 |
| 101 // Callback to let us knew that the plugin list is warmed up. | 101 // Callback to let us knew that the plugin list is warmed up. |
| 102 void OnGetPluginListTaskComplete(); | 102 void OnGetPluginListTaskComplete(const std::vector<WebPluginInfo>& plugins); |
| 103 | 103 |
| 104 // Save any unsent logs into a persistent store in a pref. We always do this | 104 // Save any unsent logs into a persistent store in a pref. We always do this |
| 105 // at shutdown, but we can do it as we reduce the list as well. | 105 // at shutdown, but we can do it as we reduce the list as well. |
| 106 void StoreUnsentLogs(); | 106 void StoreUnsentLogs(); |
| 107 | 107 |
| 108 private: | 108 private: |
| 109 // The MetricsService has a lifecycle that is stored as a state. | 109 // The MetricsService has a lifecycle that is stored as a state. |
| 110 // See metrics_service.cc for description of this lifecycle. | 110 // See metrics_service.cc for description of this lifecycle. |
| 111 enum State { | 111 enum State { |
| 112 INITIALIZED, // Constructor was called. | 112 INITIALIZED, // Constructor was called. |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 // The variable server_permits_upload_ is set true when the response | 395 // The variable server_permits_upload_ is set true when the response |
| 396 // data forbids uploading. This should coinside with the "die roll" | 396 // data forbids uploading. This should coinside with the "die roll" |
| 397 // with probability in the upload tag of the response data came out | 397 // with probability in the upload tag of the response data came out |
| 398 // affirmative. | 398 // affirmative. |
| 399 bool server_permits_upload_; | 399 bool server_permits_upload_; |
| 400 | 400 |
| 401 // The progession of states made by the browser are recorded in the following | 401 // The progession of states made by the browser are recorded in the following |
| 402 // state. | 402 // state. |
| 403 State state_; | 403 State state_; |
| 404 | 404 |
| 405 // The list of plugins which was retrieved on the file thread. |
| 406 std::vector<WebPluginInfo> plugins_; |
| 407 |
| 405 // A log that we are currently transmiting, or about to try to transmit. | 408 // A log that we are currently transmiting, or about to try to transmit. |
| 406 MetricsLog* pending_log_; | 409 MetricsLog* pending_log_; |
| 407 | 410 |
| 408 // An alternate form of pending_log_. We persistently save this text version | 411 // An alternate form of pending_log_. We persistently save this text version |
| 409 // into prefs if we can't transmit it. As a result, sometimes all we have is | 412 // into prefs if we can't transmit it. As a result, sometimes all we have is |
| 410 // the text version (recalled from a previous session). | 413 // the text version (recalled from a previous session). |
| 411 std::string pending_log_text_; | 414 std::string pending_log_text_; |
| 412 | 415 |
| 413 // The outstanding transmission appears as a URL Fetch operation. | 416 // The outstanding transmission appears as a URL Fetch operation. |
| 414 scoped_ptr<URLFetcher> current_fetch_; | 417 scoped_ptr<URLFetcher> current_fetch_; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 // Indicate that a timer for sending the next log has already been queued. | 485 // Indicate that a timer for sending the next log has already been queued. |
| 483 bool timer_pending_; | 486 bool timer_pending_; |
| 484 | 487 |
| 485 FRIEND_TEST(MetricsServiceTest, ClientIdGeneratesAllZeroes); | 488 FRIEND_TEST(MetricsServiceTest, ClientIdGeneratesAllZeroes); |
| 486 FRIEND_TEST(MetricsServiceTest, ClientIdGeneratesCorrectly); | 489 FRIEND_TEST(MetricsServiceTest, ClientIdGeneratesCorrectly); |
| 487 FRIEND_TEST(MetricsServiceTest, ClientIdCorrectlyFormatted); | 490 FRIEND_TEST(MetricsServiceTest, ClientIdCorrectlyFormatted); |
| 488 DISALLOW_COPY_AND_ASSIGN(MetricsService); | 491 DISALLOW_COPY_AND_ASSIGN(MetricsService); |
| 489 }; | 492 }; |
| 490 | 493 |
| 491 #endif // CHROME_BROWSER_METRICS_SERVICE_H_ | 494 #endif // CHROME_BROWSER_METRICS_SERVICE_H_ |
| OLD | NEW |