| 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 set of user experience metrics data recorded by | 5 // This file defines a set of user experience metrics data recorded by |
| 6 // the MetricsService. This is the unit of data that is sent to the server. | 6 // the MetricsService. This is the unit of data that is sent to the server. |
| 7 | 7 |
| 8 #ifndef COMPONENTS_METRICS_METRICS_LOG_H_ | 8 #ifndef COMPONENTS_METRICS_METRICS_LOG_H_ |
| 9 #define COMPONENTS_METRICS_METRICS_LOG_H_ | 9 #define COMPONENTS_METRICS_METRICS_LOG_H_ |
| 10 | 10 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // trial IDs as a parameter. A synthetic trial is one that is set up | 93 // trial IDs as a parameter. A synthetic trial is one that is set up |
| 94 // dynamically by code in Chrome. For example, a pref may be mapped to a | 94 // dynamically by code in Chrome. For example, a pref may be mapped to a |
| 95 // synthetic trial such that the group is determined by the pref value. The | 95 // synthetic trial such that the group is determined by the pref value. The |
| 96 // current environment is returned serialized as a string. | 96 // current environment is returned serialized as a string. |
| 97 std::string RecordEnvironment( | 97 std::string RecordEnvironment( |
| 98 const std::vector<std::unique_ptr<MetricsProvider>>& metrics_providers, | 98 const std::vector<std::unique_ptr<MetricsProvider>>& metrics_providers, |
| 99 const std::vector<variations::ActiveGroupId>& synthetic_trials, | 99 const std::vector<variations::ActiveGroupId>& synthetic_trials, |
| 100 int64_t install_date, | 100 int64_t install_date, |
| 101 int64_t metrics_reporting_enabled_date); | 101 int64_t metrics_reporting_enabled_date); |
| 102 | 102 |
| 103 // Loads the environment proto as known to the passed |metrics provider|. |
| 104 // On success, returns true and |app_version| contains the recovered version. |
| 105 // Otherwise (if there was no saved environment or it could not be decoded), |
| 106 // returns false and |app_version| is empty. |
| 107 bool LoadSavedEnvironmentFromProvider(MetricsProvider* metrics_provider, |
| 108 std::string* app_version); |
| 109 |
| 103 // Loads the environment proto that was saved by the last RecordEnvironment() | 110 // Loads the environment proto that was saved by the last RecordEnvironment() |
| 104 // call from prefs. On success, returns true and |app_version| contains the | 111 // call from prefs. On success, returns true and |app_version| contains the |
| 105 // recovered version. Otherwise (if there was no saved environment in prefs | 112 // recovered version. Otherwise (if there was no saved environment in prefs |
| 106 // or it could not be decoded), returns false and |app_version| is empty. | 113 // or it could not be decoded), returns false and |app_version| is empty. |
| 107 bool LoadSavedEnvironmentFromPrefs(std::string* app_version); | 114 bool LoadSavedEnvironmentFromPrefs(std::string* app_version); |
| 108 | 115 |
| 109 // Writes application stability metrics, including stability metrics provided | 116 // Writes application stability metrics, including stability metrics provided |
| 110 // by the specified set of |metrics_providers|. The system profile portion of | 117 // by the specified set of |metrics_providers|. The system profile portion of |
| 111 // the log must have already been filled in by a call to RecordEnvironment() | 118 // the log must have already been filled in by a call to RecordEnvironment() |
| 112 // or LoadSavedEnvironmentFromPrefs(). | 119 // or LoadSavedEnvironmentFromPrefs(). |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 const base::TimeTicks creation_time_; | 204 const base::TimeTicks creation_time_; |
| 198 | 205 |
| 199 PrefService* local_state_; | 206 PrefService* local_state_; |
| 200 | 207 |
| 201 DISALLOW_COPY_AND_ASSIGN(MetricsLog); | 208 DISALLOW_COPY_AND_ASSIGN(MetricsLog); |
| 202 }; | 209 }; |
| 203 | 210 |
| 204 } // namespace metrics | 211 } // namespace metrics |
| 205 | 212 |
| 206 #endif // COMPONENTS_METRICS_METRICS_LOG_H_ | 213 #endif // COMPONENTS_METRICS_METRICS_LOG_H_ |
| OLD | NEW |