Chromium Code Reviews| 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..4259ea98870bb083c6d2e1e053fbd9e53c3c2367 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, |
| @@ -1468,6 +1478,13 @@ void ProfileManager::BrowserListObserver::OnBrowserRemoved( |
| !IsProfileMarkedForDeletion(path)) { |
| g_browser_process->profile_manager()->ScheduleProfileForDeletion( |
| path, ProfileManager::CreateCallback()); |
| + return; |
| + } |
| + |
| + // Otherwise store statistics into ProfileInfoCache. |
| + if (!profile->IsOffTheRecord()) { |
|
lwchkg
2015/12/22 13:26:00
Mike said that this function handles incognito pro
Mike Lerman
2015/12/23 20:25:50
This, uh, really should handle incognito (and gues
lwchkg
2015/12/24 07:14:32
Thanks. This is likely a bug behind. Maybe someone
lwchkg
2015/12/29 04:51:43
(1) Investigated the code about the BrowserListObs
|
| + profiles::GatherProfileStatistics( |
| + profile, profiles::ProfileStatisticsCallback(), nullptr); |
| } |
| } |