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

Unified Diff: chrome/browser/ui/app_list/app_list_service.cc

Issue 350883002: Refactor handling of --show-app-list command line. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix disabled stub [android] Created 6 years, 5 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
Index: chrome/browser/ui/app_list/app_list_service.cc
diff --git a/chrome/browser/ui/app_list/app_list_service.cc b/chrome/browser/ui/app_list/app_list_service.cc
index 3fb43fe204de50c8aa57a98a4220aa4b27c41b93..467110509272c6d4dc4e44105ddac7a4ac1b2e83 100644
--- a/chrome/browser/ui/app_list/app_list_service.cc
+++ b/chrome/browser/ui/app_list/app_list_service.cc
@@ -57,11 +57,6 @@ int64 g_original_process_start_time;
// The type of startup the the current app list show has gone through.
StartupType g_app_show_startup_type;
-void RecordStartupInfo(StartupType startup_type, const base::Time& start_time) {
- g_original_process_start_time = start_time.ToInternalValue();
- g_app_show_startup_type = startup_type;
-}
-
void RecordFirstPaintTiming() {
base::Time start_time(
base::Time::FromInternalValue(g_original_process_start_time));
@@ -80,6 +75,31 @@ void RecordFirstPaintTiming() {
}
}
+void RecordStartupInfo(AppListService* service,
+ const CommandLine& command_line) {
+ base::Time start_time = GetOriginalProcessStartTime(command_line);
+ if (start_time.is_null())
+ return;
+
+ base::TimeDelta elapsed = base::Time::Now() - start_time;
+ StartupType startup_type = GetStartupType(command_line);
+ switch (startup_type) {
+ case COLD_START:
+ UMA_HISTOGRAM_LONG_TIMES("Startup.ShowAppListColdStart", elapsed);
+ break;
+ case WARM_START:
+ UMA_HISTOGRAM_LONG_TIMES("Startup.ShowAppListWarmStart", elapsed);
+ break;
+ case WARM_START_FAST:
+ UMA_HISTOGRAM_LONG_TIMES("Startup.ShowAppListWarmStartFast", elapsed);
+ break;
+ }
+
+ g_original_process_start_time = start_time.ToInternalValue();
+ g_app_show_startup_type = startup_type;
+ service->SetAppListNextPaintCallback(RecordFirstPaintTiming);
+}
+
} // namespace
// static
@@ -106,26 +126,17 @@ void AppListService::RegisterPrefs(PrefRegistrySimple* registry) {
}
// static
-void AppListService::RecordShowTimings(const CommandLine& command_line) {
- base::Time start_time = GetOriginalProcessStartTime(command_line);
- if (start_time.is_null())
- return;
-
- base::TimeDelta elapsed = base::Time::Now() - start_time;
- StartupType startup = GetStartupType(command_line);
- switch (startup) {
- case COLD_START:
- UMA_HISTOGRAM_LONG_TIMES("Startup.ShowAppListColdStart", elapsed);
- break;
- case WARM_START:
- UMA_HISTOGRAM_LONG_TIMES("Startup.ShowAppListWarmStart", elapsed);
- break;
- case WARM_START_FAST:
- UMA_HISTOGRAM_LONG_TIMES("Startup.ShowAppListWarmStartFast", elapsed);
- break;
- }
-
- RecordStartupInfo(startup, start_time);
- Get(chrome::HOST_DESKTOP_TYPE_NATIVE)->SetAppListNextPaintCallback(
- RecordFirstPaintTiming);
+bool AppListService::HandleLaunchCommandLine(
+ const base::CommandLine& command_line,
+ Profile* launch_profile) {
+ InitAll(launch_profile);
+ if (!command_line.HasSwitch(switches::kShowAppList))
+ return false;
+
+ // The --show-app-list switch is used for shortcuts on the native desktop.
+ AppListService* service = Get(chrome::HOST_DESKTOP_TYPE_NATIVE);
+ DCHECK(service);
+ RecordStartupInfo(service, command_line);
+ service->ShowForProfile(launch_profile);
+ return true;
}
« no previous file with comments | « chrome/browser/ui/app_list/app_list_service.h ('k') | chrome/browser/ui/app_list/app_list_service_disabled.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698