| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_METRICS_METRICS_SERVICE_H_ | 8 #ifndef COMPONENTS_METRICS_METRICS_SERVICE_H_ |
| 9 #define COMPONENTS_METRICS_METRICS_SERVICE_H_ | 9 #define COMPONENTS_METRICS_METRICS_SERVICE_H_ |
| 10 | 10 |
| 11 #include <stdint.h> |
| 12 |
| 11 #include <map> | 13 #include <map> |
| 12 #include <string> | 14 #include <string> |
| 13 #include <vector> | 15 #include <vector> |
| 14 | 16 |
| 15 #include "base/basictypes.h" | |
| 16 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
| 18 #include "base/macros.h" |
| 17 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/memory/scoped_vector.h" | 20 #include "base/memory/scoped_vector.h" |
| 19 #include "base/memory/weak_ptr.h" | 21 #include "base/memory/weak_ptr.h" |
| 20 #include "base/metrics/field_trial.h" | 22 #include "base/metrics/field_trial.h" |
| 21 #include "base/metrics/histogram_flattener.h" | 23 #include "base/metrics/histogram_flattener.h" |
| 22 #include "base/metrics/histogram_snapshot_manager.h" | 24 #include "base/metrics/histogram_snapshot_manager.h" |
| 23 #include "base/metrics/user_metrics.h" | 25 #include "base/metrics/user_metrics.h" |
| 24 #include "base/observer_list.h" | 26 #include "base/observer_list.h" |
| 25 #include "base/time/time.h" | 27 #include "base/time/time.h" |
| 28 #include "build/build_config.h" |
| 26 #include "components/metrics/clean_exit_beacon.h" | 29 #include "components/metrics/clean_exit_beacon.h" |
| 27 #include "components/metrics/metrics_log.h" | 30 #include "components/metrics/metrics_log.h" |
| 28 #include "components/metrics/metrics_log_manager.h" | 31 #include "components/metrics/metrics_log_manager.h" |
| 29 #include "components/metrics/metrics_provider.h" | 32 #include "components/metrics/metrics_provider.h" |
| 30 #include "components/metrics/net/network_metrics_provider.h" | 33 #include "components/metrics/net/network_metrics_provider.h" |
| 31 #include "components/variations/synthetic_trials.h" | 34 #include "components/variations/synthetic_trials.h" |
| 32 | 35 |
| 33 class PrefService; | 36 class PrefService; |
| 34 class PrefRegistrySimple; | 37 class PrefRegistrySimple; |
| 35 | 38 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // asyncronous so this can be called immediately after Start() to prevent | 107 // asyncronous so this can be called immediately after Start() to prevent |
| 105 // any uploading. | 108 // any uploading. |
| 106 void EnableReporting(); | 109 void EnableReporting(); |
| 107 void DisableReporting(); | 110 void DisableReporting(); |
| 108 | 111 |
| 109 // Returns the client ID for this client, or the empty string if metrics | 112 // Returns the client ID for this client, or the empty string if metrics |
| 110 // recording is not currently running. | 113 // recording is not currently running. |
| 111 std::string GetClientId(); | 114 std::string GetClientId(); |
| 112 | 115 |
| 113 // Returns the install date of the application, in seconds since the epoch. | 116 // Returns the install date of the application, in seconds since the epoch. |
| 114 int64 GetInstallDate(); | 117 int64_t GetInstallDate(); |
| 115 | 118 |
| 116 // Returns the date at which the current metrics client ID was created as | 119 // Returns the date at which the current metrics client ID was created as |
| 117 // an int64 containing seconds since the epoch. | 120 // an int64_t containing seconds since the epoch. |
| 118 int64 GetMetricsReportingEnabledDate(); | 121 int64_t GetMetricsReportingEnabledDate(); |
| 119 | 122 |
| 120 // Returns true if the last session exited cleanly. | 123 // Returns true if the last session exited cleanly. |
| 121 bool WasLastShutdownClean() const; | 124 bool WasLastShutdownClean() const; |
| 122 | 125 |
| 123 // Returns the preferred entropy provider used to seed persistent activities | 126 // Returns the preferred entropy provider used to seed persistent activities |
| 124 // based on whether or not metrics reporting will be permitted on this client. | 127 // based on whether or not metrics reporting will be permitted on this client. |
| 125 // | 128 // |
| 126 // If metrics reporting is enabled, this method returns an entropy provider | 129 // If metrics reporting is enabled, this method returns an entropy provider |
| 127 // that has a high source of entropy, partially based on the client ID. | 130 // that has a high source of entropy, partially based on the client ID. |
| 128 // Otherwise, it returns an entropy provider that is based on a low entropy | 131 // Otherwise, it returns an entropy provider that is based on a low entropy |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 // Weak pointers factory used for saving state. All weak pointers managed by | 484 // Weak pointers factory used for saving state. All weak pointers managed by |
| 482 // this factory are invalidated in ScheduleNextStateSave. | 485 // this factory are invalidated in ScheduleNextStateSave. |
| 483 base::WeakPtrFactory<MetricsService> state_saver_factory_; | 486 base::WeakPtrFactory<MetricsService> state_saver_factory_; |
| 484 | 487 |
| 485 DISALLOW_COPY_AND_ASSIGN(MetricsService); | 488 DISALLOW_COPY_AND_ASSIGN(MetricsService); |
| 486 }; | 489 }; |
| 487 | 490 |
| 488 } // namespace metrics | 491 } // namespace metrics |
| 489 | 492 |
| 490 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_ | 493 #endif // COMPONENTS_METRICS_METRICS_SERVICE_H_ |
| OLD | NEW |