Chromium Code Reviews| 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 361 // Get the amount of uptime since this process started and since the last | 361 // Get the amount of uptime since this process started and since the last |
| 362 // call to this function. Also updates the cumulative uptime metric (stored | 362 // call to this function. Also updates the cumulative uptime metric (stored |
| 363 // as a pref) for uninstall. Uptimes are measured using TimeTicks, which | 363 // as a pref) for uninstall. Uptimes are measured using TimeTicks, which |
| 364 // guarantees that it is monotonic and does not jump if the user changes | 364 // guarantees that it is monotonic and does not jump if the user changes |
| 365 // his/her clock. The TimeTicks implementation also makes the clock not | 365 // his/her clock. The TimeTicks implementation also makes the clock not |
| 366 // count time the computer is suspended. | 366 // count time the computer is suspended. |
| 367 void GetUptimes(PrefService* pref, | 367 void GetUptimes(PrefService* pref, |
| 368 base::TimeDelta* incremental_uptime, | 368 base::TimeDelta* incremental_uptime, |
| 369 base::TimeDelta* uptime); | 369 base::TimeDelta* uptime); |
| 370 | 370 |
| 371 // Reset the client id and low entropy source if the kMetricsResetMetricIDs | |
| 372 // pref is true. | |
| 373 void ResetMetricsIDsIfNecessary(); | |
| 374 | |
| 371 // Returns the low entropy source for this client. This is a random value | 375 // Returns the low entropy source for this client. This is a random value |
| 372 // that is non-identifying amongst browser clients. This method will | 376 // that is non-identifying amongst browser clients. This method will |
| 373 // generate the entropy source value if it has not been called before. | 377 // generate the entropy source value if it has not been called before. |
| 374 int GetLowEntropySource(); | 378 int GetLowEntropySource(); |
| 375 | 379 |
| 376 // Returns the first entropy source that was returned by this service since | 380 // Returns the first entropy source that was returned by this service since |
| 377 // start up, or NONE if neither was returned yet. This is exposed for testing | 381 // start up, or NONE if neither was returned yet. This is exposed for testing |
| 378 // only. | 382 // only. |
| 379 EntropySourceReturned entropy_source_returned() const { | 383 EntropySourceReturned entropy_source_returned() const { |
| 380 return entropy_source_returned_; | 384 return entropy_source_returned_; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 516 | 520 |
| 517 // Returns a list of synthetic field trials that were active for the entire | 521 // Returns a list of synthetic field trials that were active for the entire |
| 518 // duration of the current log. | 522 // duration of the current log. |
| 519 void GetCurrentSyntheticFieldTrials( | 523 void GetCurrentSyntheticFieldTrials( |
| 520 std::vector<chrome_variations::ActiveGroupId>* synthetic_trials); | 524 std::vector<chrome_variations::ActiveGroupId>* synthetic_trials); |
| 521 | 525 |
| 522 base::ActionCallback action_callback_; | 526 base::ActionCallback action_callback_; |
| 523 | 527 |
| 524 content::NotificationRegistrar registrar_; | 528 content::NotificationRegistrar registrar_; |
| 525 | 529 |
| 530 // Set to true when the client id and low entropy source have been reset due | |
| 531 // to the kMetricsResetIds pref being true. This prevents multiple resets | |
|
Alexei Svitkine (slow)
2014/03/28 19:49:02
This comment isn't correct. It's also set to true
jwd
2014/03/28 19:58:58
Done.
| |
| 532 // within the same chrome session. | |
| 533 bool metrics_ids_reset_check_performed_; | |
| 534 | |
| 526 // Indicate whether recording and reporting are currently happening. | 535 // Indicate whether recording and reporting are currently happening. |
| 527 // These should not be set directly, but by calling SetRecording and | 536 // These should not be set directly, but by calling SetRecording and |
| 528 // SetReporting. | 537 // SetReporting. |
| 529 bool recording_active_; | 538 bool recording_active_; |
| 530 bool reporting_active_; | 539 bool reporting_active_; |
| 531 | 540 |
| 532 // Indicate whether test mode is enabled, where the initial log should never | 541 // Indicate whether test mode is enabled, where the initial log should never |
| 533 // be cut, and logs are neither persisted nor uploaded. | 542 // be cut, and logs are neither persisted nor uploaded. |
| 534 bool test_mode_active_; | 543 bool test_mode_active_; |
| 535 | 544 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 632 SyntheticTrialGroups synthetic_trial_groups_; | 641 SyntheticTrialGroups synthetic_trial_groups_; |
| 633 | 642 |
| 634 scoped_ptr<metrics::ClonedInstallDetector> cloned_install_detector_; | 643 scoped_ptr<metrics::ClonedInstallDetector> cloned_install_detector_; |
| 635 | 644 |
| 636 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdCorrectlyFormatted); | 645 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdCorrectlyFormatted); |
| 637 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, IsPluginProcess); | 646 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, IsPluginProcess); |
| 638 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, LowEntropySource0NotReset); | 647 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, LowEntropySource0NotReset); |
| 639 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, | 648 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, |
| 640 PermutedEntropyCacheClearedWhenLowEntropyReset); | 649 PermutedEntropyCacheClearedWhenLowEntropyReset); |
| 641 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial); | 650 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial); |
| 651 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ResetMetricsIDs); | |
| 642 FRIEND_TEST_ALL_PREFIXES(MetricsServiceBrowserTest, | 652 FRIEND_TEST_ALL_PREFIXES(MetricsServiceBrowserTest, |
| 643 CheckLowEntropySourceUsed); | 653 CheckLowEntropySourceUsed); |
| 644 FRIEND_TEST_ALL_PREFIXES(MetricsServiceReportingTest, | 654 FRIEND_TEST_ALL_PREFIXES(MetricsServiceReportingTest, |
| 645 CheckHighEntropySourceUsed); | 655 CheckHighEntropySourceUsed); |
| 646 | 656 |
| 647 DISALLOW_COPY_AND_ASSIGN(MetricsService); | 657 DISALLOW_COPY_AND_ASSIGN(MetricsService); |
| 648 }; | 658 }; |
| 649 | 659 |
| 650 // This class limits and documents access to the IsMetricsReportingEnabled() and | 660 // This class limits and documents access to the IsMetricsReportingEnabled() and |
| 651 // IsCrashReportingEnabled() methods. Since these methods are private, each user | 661 // IsCrashReportingEnabled() methods. Since these methods are private, each user |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 668 | 678 |
| 669 // Returns true if crash reporting is enabled. This is set at the platform | 679 // Returns true if crash reporting is enabled. This is set at the platform |
| 670 // level for Android and ChromeOS, and otherwise is the same as | 680 // level for Android and ChromeOS, and otherwise is the same as |
| 671 // IsMetricsReportingEnabled for desktop Chrome. | 681 // IsMetricsReportingEnabled for desktop Chrome. |
| 672 static bool IsCrashReportingEnabled(); | 682 static bool IsCrashReportingEnabled(); |
| 673 | 683 |
| 674 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); | 684 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); |
| 675 }; | 685 }; |
| 676 | 686 |
| 677 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 687 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
| OLD | NEW |