| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "chrome/browser/sync/sessions/sync_sessions_metrics_android.h" | 5 #include "chrome/browser/sync/sessions/sync_sessions_metrics_android.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // conserve battery. This means that the foreign tab data may be quite stale. | 28 // conserve battery. This means that the foreign tab data may be quite stale. |
| 29 // This would drastically distort the metric we want to emit here, however the | 29 // This would drastically distort the metric we want to emit here, however the |
| 30 // revisit experiement disables said optimization, allowing us to collect | 30 // revisit experiement disables said optimization, allowing us to collect |
| 31 // valid data but at the cost of a much smaller sample size. | 31 // valid data but at the cost of a much smaller sample size. |
| 32 const std::string group_name = | 32 const std::string group_name = |
| 33 base::FieldTrialList::FindFullName("PageRevisitInstrumentation"); | 33 base::FieldTrialList::FindFullName("PageRevisitInstrumentation"); |
| 34 bool shouldInstrument = group_name == "Enabled"; | 34 bool shouldInstrument = group_name == "Enabled"; |
| 35 if (shouldInstrument) { | 35 if (shouldInstrument) { |
| 36 Profile* profile = ProfileManager::GetActiveUserProfile(); | 36 Profile* profile = ProfileManager::GetActiveUserProfile(); |
| 37 if (profile) { | 37 if (profile) { |
| 38 ProfileSyncService* sync = | 38 browser_sync::ProfileSyncService* sync = |
| 39 ProfileSyncServiceFactory::GetForProfile(profile); | 39 ProfileSyncServiceFactory::GetForProfile(profile); |
| 40 if (sync) { | 40 if (sync) { |
| 41 sync_sessions::SessionsSyncManager* sessions = | 41 sync_sessions::SessionsSyncManager* sessions = |
| 42 static_cast<sync_sessions::SessionsSyncManager*>( | 42 static_cast<sync_sessions::SessionsSyncManager*>( |
| 43 sync->GetSessionsSyncableService()); | 43 sync->GetSessionsSyncableService()); |
| 44 if (sessions) { | 44 if (sessions) { |
| 45 sync_sessions::SyncSessionsMetrics::RecordYoungestForeignTabAgeOnNTP( | 45 sync_sessions::SyncSessionsMetrics::RecordYoungestForeignTabAgeOnNTP( |
| 46 sessions); | 46 sessions); |
| 47 } | 47 } |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 } | 51 } |
| OLD | NEW |