| 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 //------------------------------------------------------------------------------ | 5 //------------------------------------------------------------------------------ |
| 6 // Description of the life cycle of a instance of MetricsService. | 6 // Description of the life cycle of a instance of MetricsService. |
| 7 // | 7 // |
| 8 // OVERVIEW | 8 // OVERVIEW |
| 9 // | 9 // |
| 10 // A MetricsService instance is typically created at application startup. It is | 10 // A MetricsService instance is typically created at application startup. It is |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 } | 376 } |
| 377 | 377 |
| 378 void MetricsService::DisableReporting() { | 378 void MetricsService::DisableReporting() { |
| 379 reporting_active_ = false; | 379 reporting_active_ = false; |
| 380 } | 380 } |
| 381 | 381 |
| 382 std::string MetricsService::GetClientId() { | 382 std::string MetricsService::GetClientId() { |
| 383 return state_manager_->client_id(); | 383 return state_manager_->client_id(); |
| 384 } | 384 } |
| 385 | 385 |
| 386 int64 MetricsService::GetInstallDate() { |
| 387 return client_->GetInstallDate(); |
| 388 } |
| 389 |
| 386 scoped_ptr<const base::FieldTrial::EntropyProvider> | 390 scoped_ptr<const base::FieldTrial::EntropyProvider> |
| 387 MetricsService::CreateEntropyProvider() { | 391 MetricsService::CreateEntropyProvider() { |
| 388 // TODO(asvitkine): Refactor the code so that MetricsService does not expose | 392 // TODO(asvitkine): Refactor the code so that MetricsService does not expose |
| 389 // this method. | 393 // this method. |
| 390 return state_manager_->CreateEntropyProvider(); | 394 return state_manager_->CreateEntropyProvider(); |
| 391 } | 395 } |
| 392 | 396 |
| 393 void MetricsService::EnableRecording() { | 397 void MetricsService::EnableRecording() { |
| 394 DCHECK(IsSingleThreaded()); | 398 DCHECK(IsSingleThreaded()); |
| 395 | 399 |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 RecordCurrentState(local_state_); | 1201 RecordCurrentState(local_state_); |
| 1198 } | 1202 } |
| 1199 | 1203 |
| 1200 void MetricsService::RecordCurrentState(PrefService* pref) { | 1204 void MetricsService::RecordCurrentState(PrefService* pref) { |
| 1201 pref->SetInt64(metrics::prefs::kStabilityLastTimestampSec, | 1205 pref->SetInt64(metrics::prefs::kStabilityLastTimestampSec, |
| 1202 Time::Now().ToTimeT()); | 1206 Time::Now().ToTimeT()); |
| 1203 | 1207 |
| 1204 for (size_t i = 0; i < metrics_providers_.size(); ++i) | 1208 for (size_t i = 0; i < metrics_providers_.size(); ++i) |
| 1205 metrics_providers_[i]->RecordCurrentState(); | 1209 metrics_providers_[i]->RecordCurrentState(); |
| 1206 } | 1210 } |
| OLD | NEW |