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