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 bool metrics_ids_reset_check_performed_; | |
Alexei Svitkine (slow)
2014/03/28 19:02:50
Nit: Add a comment.
jwd
2014/03/28 19:43:15
Done.
| |
531 | |
526 // Indicate whether recording and reporting are currently happening. | 532 // Indicate whether recording and reporting are currently happening. |
527 // These should not be set directly, but by calling SetRecording and | 533 // These should not be set directly, but by calling SetRecording and |
528 // SetReporting. | 534 // SetReporting. |
529 bool recording_active_; | 535 bool recording_active_; |
530 bool reporting_active_; | 536 bool reporting_active_; |
531 | 537 |
532 // Indicate whether test mode is enabled, where the initial log should never | 538 // Indicate whether test mode is enabled, where the initial log should never |
533 // be cut, and logs are neither persisted nor uploaded. | 539 // be cut, and logs are neither persisted nor uploaded. |
534 bool test_mode_active_; | 540 bool test_mode_active_; |
535 | 541 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
632 SyntheticTrialGroups synthetic_trial_groups_; | 638 SyntheticTrialGroups synthetic_trial_groups_; |
633 | 639 |
634 scoped_ptr<metrics::ClonedInstallDetector> cloned_install_detector_; | 640 scoped_ptr<metrics::ClonedInstallDetector> cloned_install_detector_; |
635 | 641 |
636 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdCorrectlyFormatted); | 642 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ClientIdCorrectlyFormatted); |
637 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, IsPluginProcess); | 643 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, IsPluginProcess); |
638 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, LowEntropySource0NotReset); | 644 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, LowEntropySource0NotReset); |
639 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, | 645 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, |
640 PermutedEntropyCacheClearedWhenLowEntropyReset); | 646 PermutedEntropyCacheClearedWhenLowEntropyReset); |
641 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial); | 647 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, RegisterSyntheticTrial); |
648 FRIEND_TEST_ALL_PREFIXES(MetricsServiceTest, ResetMetricsIDs); | |
642 FRIEND_TEST_ALL_PREFIXES(MetricsServiceBrowserTest, | 649 FRIEND_TEST_ALL_PREFIXES(MetricsServiceBrowserTest, |
643 CheckLowEntropySourceUsed); | 650 CheckLowEntropySourceUsed); |
644 FRIEND_TEST_ALL_PREFIXES(MetricsServiceReportingTest, | 651 FRIEND_TEST_ALL_PREFIXES(MetricsServiceReportingTest, |
645 CheckHighEntropySourceUsed); | 652 CheckHighEntropySourceUsed); |
646 | 653 |
647 DISALLOW_COPY_AND_ASSIGN(MetricsService); | 654 DISALLOW_COPY_AND_ASSIGN(MetricsService); |
648 }; | 655 }; |
649 | 656 |
650 // This class limits and documents access to the IsMetricsReportingEnabled() and | 657 // This class limits and documents access to the IsMetricsReportingEnabled() and |
651 // IsCrashReportingEnabled() methods. Since these methods are private, each user | 658 // IsCrashReportingEnabled() methods. Since these methods are private, each user |
(...skipping 16 matching lines...) Expand all Loading... | |
668 | 675 |
669 // Returns true if crash reporting is enabled. This is set at the platform | 676 // 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 | 677 // level for Android and ChromeOS, and otherwise is the same as |
671 // IsMetricsReportingEnabled for desktop Chrome. | 678 // IsMetricsReportingEnabled for desktop Chrome. |
672 static bool IsCrashReportingEnabled(); | 679 static bool IsCrashReportingEnabled(); |
673 | 680 |
674 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); | 681 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); |
675 }; | 682 }; |
676 | 683 |
677 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ | 684 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ |
OLD | NEW |