| Index: chrome/browser/profiles/profile_manager.cc
|
| diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
|
| index 716adf8e208510dba59be5adee534fec0da59a1c..073bcd7c9d9a1f786eeb18848bf3b14887944949 100644
|
| --- a/chrome/browser/profiles/profile_manager.cc
|
| +++ b/chrome/browser/profiles/profile_manager.cc
|
| @@ -38,6 +38,7 @@
|
| #include "chrome/browser/profiles/profile_destroyer.h"
|
| #include "chrome/browser/profiles/profile_info_cache.h"
|
| #include "chrome/browser/profiles/profile_metrics.h"
|
| +#include "chrome/browser/profiles/profile_statistics.h"
|
| #include "chrome/browser/profiles/profiles_state.h"
|
| #include "chrome/browser/signin/account_fetcher_service_factory.h"
|
| #include "chrome/browser/signin/account_reconcilor_factory.h"
|
| @@ -1055,6 +1056,15 @@ void ProfileManager::DoFinalInit(Profile* profile, bool go_off_the_record) {
|
| chrome::NOTIFICATION_PROFILE_ADDED,
|
| content::Source<Profile>(profile),
|
| content::NotificationService::NoDetails());
|
| +
|
| + // Record statistics to ProfileInfoCache if statistics were not recorded
|
| + // during shutdown, i.e. the last shutdown was a system shutdown or a crash.
|
| + if (!profile->IsGuestSession() && !profile->IsSystemProfile() &&
|
| + !profile->IsNewProfile() && !go_off_the_record &&
|
| + profile->GetLastSessionExitType() != Profile::EXIT_NORMAL) {
|
| + profiles::GatherProfileStatistics(
|
| + profile, profiles::ProfileStatisticsCallback(), nullptr);
|
| + }
|
| }
|
|
|
| void ProfileManager::DoFinalInitForServices(Profile* profile,
|
| @@ -1461,6 +1471,10 @@ void ProfileManager::BrowserListObserver::OnBrowserRemoved(
|
| return;
|
| }
|
|
|
| + // Store statistics into ProfileInfoCache.
|
| + profiles::GatherProfileStatistics(
|
| + profile, profiles::ProfileStatisticsCallback(), nullptr);
|
| +
|
| // If the last browser of a profile that is scheduled for deletion is closed
|
| // do that now.
|
| base::FilePath path = profile->GetPath();
|
|
|