Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(951)

Unified Diff: chrome/browser/ui/views/app_list/win/app_list_service_win.cc

Issue 1016503006: Don't warmup the app list if it hasn't been used in the past 28 days. [Win] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_da_check_save
Patch Set: fix_unittests Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/app_list/app_list_service_impl.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « chrome/browser/ui/app_list/app_list_service_impl.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698