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 22 matching lines...) Expand all Loading... |
33 class MetricsReportingScheduler; | 33 class MetricsReportingScheduler; |
34 class PrefService; | 34 class PrefService; |
35 class TemplateURLService; | 35 class TemplateURLService; |
36 | 36 |
37 namespace base { | 37 namespace base { |
38 class DictionaryValue; | 38 class DictionaryValue; |
39 class ListValue; | 39 class ListValue; |
40 } | 40 } |
41 | 41 |
42 namespace webkit { | 42 namespace webkit { |
43 namespace npapi { | |
44 struct WebPluginInfo; | 43 struct WebPluginInfo; |
45 } | 44 } |
46 } | |
47 | |
48 | 45 |
49 class MetricsService : public NotificationObserver, | 46 class MetricsService : public NotificationObserver, |
50 public URLFetcher::Delegate, | 47 public URLFetcher::Delegate, |
51 public MetricsServiceBase { | 48 public MetricsServiceBase { |
52 public: | 49 public: |
53 // Used to produce a historgram that keeps track of the status of recalling | 50 // Used to produce a historgram that keeps track of the status of recalling |
54 // persisted per logs. | 51 // persisted per logs. |
55 enum LogRecallStatus { | 52 enum LogRecallStatus { |
56 RECALL_SUCCESS, // We were able to correctly recall a persisted log. | 53 RECALL_SUCCESS, // We were able to correctly recall a persisted log. |
57 LIST_EMPTY, // Attempting to recall from an empty list. | 54 LIST_EMPTY, // Attempting to recall from an empty list. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 SENDING_OLD_LOGS, // Sending unsent logs from previous session. | 146 SENDING_OLD_LOGS, // Sending unsent logs from previous session. |
150 SENDING_CURRENT_LOGS, // Sending standard current logs as they acrue. | 147 SENDING_CURRENT_LOGS, // Sending standard current logs as they acrue. |
151 }; | 148 }; |
152 | 149 |
153 class InitTask; | 150 class InitTask; |
154 class InitTaskComplete; | 151 class InitTaskComplete; |
155 | 152 |
156 // Callback to let us know that the init task is done. | 153 // Callback to let us know that the init task is done. |
157 void OnInitTaskComplete( | 154 void OnInitTaskComplete( |
158 const std::string& hardware_class, | 155 const std::string& hardware_class, |
159 const std::vector<webkit::npapi::WebPluginInfo>& plugins); | 156 const std::vector<webkit::WebPluginInfo>& plugins); |
160 | 157 |
161 // When we start a new version of Chromium (different from our last run), we | 158 // When we start a new version of Chromium (different from our last run), we |
162 // need to discard the old crash stats so that we don't attribute crashes etc. | 159 // need to discard the old crash stats so that we don't attribute crashes etc. |
163 // in the old version to the current version (via current logs). | 160 // in the old version to the current version (via current logs). |
164 // Without this, a common reason to finally start a new version is to crash | 161 // Without this, a common reason to finally start a new version is to crash |
165 // the old version (after an autoupdate has arrived), and so we'd bias | 162 // the old version (after an autoupdate has arrived), and so we'd bias |
166 // initial results towards showing crashes :-(. | 163 // initial results towards showing crashes :-(. |
167 static void DiscardOldStabilityStats(PrefService* local_state); | 164 static void DiscardOldStabilityStats(PrefService* local_state); |
168 | 165 |
169 // Sets and gets whether metrics recording is active. | 166 // Sets and gets whether metrics recording is active. |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 // state. | 346 // state. |
350 State state_; | 347 State state_; |
351 | 348 |
352 // Chrome OS hardware class (e.g., hardware qualification ID). This | 349 // Chrome OS hardware class (e.g., hardware qualification ID). This |
353 // class identifies the configured system components such as CPU, | 350 // class identifies the configured system components such as CPU, |
354 // WiFi adapter, etc. For non Chrome OS hosts, this will be an | 351 // WiFi adapter, etc. For non Chrome OS hosts, this will be an |
355 // empty string. | 352 // empty string. |
356 std::string hardware_class_; | 353 std::string hardware_class_; |
357 | 354 |
358 // The list of plugins which was retrieved on the file thread. | 355 // The list of plugins which was retrieved on the file thread. |
359 std::vector<webkit::npapi::WebPluginInfo> plugins_; | 356 std::vector<webkit::WebPluginInfo> plugins_; |
360 | 357 |
361 // The outstanding transmission appears as a URL Fetch operation. | 358 // The outstanding transmission appears as a URL Fetch operation. |
362 scoped_ptr<URLFetcher> current_fetch_; | 359 scoped_ptr<URLFetcher> current_fetch_; |
363 | 360 |
364 // The URL for the metrics server. | 361 // The URL for the metrics server. |
365 std::wstring server_url_; | 362 std::wstring server_url_; |
366 | 363 |
367 // The TCP/UDP echo server to collect network connectivity stats. | 364 // The TCP/UDP echo server to collect network connectivity stats. |
368 std::string network_stats_server_; | 365 std::string network_stats_server_; |
369 | 366 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, CorruptSizeOfLogList); | 428 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, CorruptSizeOfLogList); |
432 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, CorruptChecksumOfLogList); | 429 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, CorruptChecksumOfLogList); |
433 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdGeneratesAllZeroes); | 430 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdGeneratesAllZeroes); |
434 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdGeneratesCorrectly); | 431 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdGeneratesCorrectly); |
435 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdCorrectlyFormatted); | 432 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdCorrectlyFormatted); |
436 | 433 |
437 DISALLOW_COPY_AND_ASSIGN(MetricsService); | 434 DISALLOW_COPY_AND_ASSIGN(MetricsService); |
438 }; | 435 }; |
439 | 436 |
440 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 437 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
OLD | NEW |