Index: chrome/browser/ui/views/app_list/win/app_list_service_win.cc |
diff --git a/chrome/browser/ui/views/app_list/win/app_list_service_win.cc b/chrome/browser/ui/views/app_list/win/app_list_service_win.cc |
index 1ad6547045e7ec8073f38a6652a0faaa8542ff7d..6c00856ce856d71fc63449d5647467c75841a56f 100644 |
--- a/chrome/browser/ui/views/app_list/win/app_list_service_win.cc |
+++ b/chrome/browser/ui/views/app_list/win/app_list_service_win.cc |
@@ -72,6 +72,8 @@ void AppListService::InitAll(Profile* initial_profile, |
namespace { |
+const int kUnusedAppListNoWarmupDays = 28; |
+ |
int GetAppListIconIndex() { |
BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
return dist->GetIconIndex(BrowserDistribution::SHORTCUT_APP_LAUNCHER); |
@@ -356,6 +358,21 @@ bool AppListServiceWin::IsWarmupNeeded() { |
return false; |
} |
+ // Don't warm up the app list if it hasn't been used for a while. If the last |
+ // launch is unknown, record it as "used" on the first warmup. |
+ PrefService* local_state = g_browser_process->local_state(); |
+ int64 last_launch_time_pref = |
+ local_state->GetInt64(prefs::kAppListLastLaunchTime); |
+ if (last_launch_time_pref == 0) |
+ RecordAppListLastLaunch(); |
+ |
+ base::Time last_launch_time = |
+ base::Time::FromInternalValue(last_launch_time_pref); |
+ if (base::Time::Now() - last_launch_time > |
+ base::TimeDelta::FromDays(kUnusedAppListNoWarmupDays)) { |
+ return false; |
+ } |
+ |
// We only need to initialize the view if there's no view already created and |
// there's no profile loading to be shown. |
return !shower().HasView() && !profile_loader().IsAnyProfileLoading(); |