OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/app_list/app_list_service.h" | 5 #include "chrome/browser/ui/app_list/app_list_service.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 if (command_line.HasSwitch(switches::kOriginalProcessStartTime)) { | 38 if (command_line.HasSwitch(switches::kOriginalProcessStartTime)) { |
39 std::string start_time_string = | 39 std::string start_time_string = |
40 command_line.GetSwitchValueASCII(switches::kOriginalProcessStartTime); | 40 command_line.GetSwitchValueASCII(switches::kOriginalProcessStartTime); |
41 int64_t remote_start_time; | 41 int64_t remote_start_time; |
42 base::StringToInt64(start_time_string, &remote_start_time); | 42 base::StringToInt64(start_time_string, &remote_start_time); |
43 return base::Time::FromInternalValue(remote_start_time); | 43 return base::Time::FromInternalValue(remote_start_time); |
44 } | 44 } |
45 | 45 |
46 // base::CurrentProcessInfo::CreationTime() is only defined on some | 46 // base::CurrentProcessInfo::CreationTime() is only defined on some |
47 // platforms. | 47 // platforms. |
48 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX) | 48 #if defined(OS_LINUX) |
49 return base::CurrentProcessInfo::CreationTime(); | 49 return base::CurrentProcessInfo::CreationTime(); |
50 #else | 50 #else |
51 return base::Time(); | 51 return base::Time(); |
52 #endif | 52 #endif |
53 } | 53 } |
54 | 54 |
55 StartupType GetStartupType(const base::CommandLine& command_line) { | 55 StartupType GetStartupType(const base::CommandLine& command_line) { |
56 // The presence of kOriginalProcessStartTime implies that another process | 56 // The presence of kOriginalProcessStartTime implies that another process |
57 // has sent us its command line to handle, ie: we are already running. | 57 // has sent us its command line to handle, ie: we are already running. |
58 if (command_line.HasSwitch(switches::kOriginalProcessStartTime)) { | 58 if (command_line.HasSwitch(switches::kOriginalProcessStartTime)) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 void AppListService::RegisterPrefs(PrefRegistrySimple* registry) { | 141 void AppListService::RegisterPrefs(PrefRegistrySimple* registry) { |
142 registry->RegisterInt64Pref(prefs::kLastAppListLaunchPing, 0); | 142 registry->RegisterInt64Pref(prefs::kLastAppListLaunchPing, 0); |
143 registry->RegisterIntegerPref(prefs::kAppListLaunchCount, 0); | 143 registry->RegisterIntegerPref(prefs::kAppListLaunchCount, 0); |
144 registry->RegisterInt64Pref(prefs::kLastAppListAppLaunchPing, 0); | 144 registry->RegisterInt64Pref(prefs::kLastAppListAppLaunchPing, 0); |
145 registry->RegisterIntegerPref(prefs::kAppListAppLaunchCount, 0); | 145 registry->RegisterIntegerPref(prefs::kAppListAppLaunchCount, 0); |
146 registry->RegisterStringPref(prefs::kAppListProfile, std::string()); | 146 registry->RegisterStringPref(prefs::kAppListProfile, std::string()); |
147 registry->RegisterBooleanPref(prefs::kAppLauncherHasBeenEnabled, false); | 147 registry->RegisterBooleanPref(prefs::kAppLauncherHasBeenEnabled, false); |
148 registry->RegisterIntegerPref(prefs::kAppListEnableMethod, | 148 registry->RegisterIntegerPref(prefs::kAppListEnableMethod, |
149 ENABLE_NOT_RECORDED); | 149 ENABLE_NOT_RECORDED); |
150 registry->RegisterInt64Pref(prefs::kAppListEnableTime, 0); | 150 registry->RegisterInt64Pref(prefs::kAppListEnableTime, 0); |
151 registry->RegisterInt64Pref(prefs::kAppListLastLaunchTime, 0); | |
152 | 151 |
153 #if defined(OS_MACOSX) | 152 #if defined(OS_MACOSX) |
154 registry->RegisterIntegerPref(prefs::kAppLauncherShortcutVersion, 0); | 153 registry->RegisterIntegerPref(prefs::kAppLauncherShortcutVersion, 0); |
155 #endif | 154 #endif |
156 | 155 |
157 // Identifies whether we should show the app launcher promo or not. This | 156 // Identifies whether we should show the app launcher promo or not. This |
158 // becomes false when the user dismisses the promo. | 157 // becomes false when the user dismisses the promo. |
159 registry->RegisterBooleanPref(prefs::kShowAppLauncherPromo, true); | 158 registry->RegisterBooleanPref(prefs::kShowAppLauncherPromo, true); |
160 } | 159 } |
161 | 160 |
162 // static | 161 // static |
163 bool AppListService::HandleLaunchCommandLine( | 162 bool AppListService::HandleLaunchCommandLine( |
164 const base::CommandLine& command_line, | 163 const base::CommandLine& command_line, |
165 Profile* launch_profile) { | 164 Profile* launch_profile) { |
166 InitAll(launch_profile, launch_profile->GetPath()); | 165 InitAll(launch_profile, launch_profile->GetPath()); |
167 if (!command_line.HasSwitch(switches::kShowAppList)) | 166 if (!command_line.HasSwitch(switches::kShowAppList)) |
168 return false; | 167 return false; |
169 | 168 |
170 AppListService* service = Get(); | 169 AppListService* service = Get(); |
171 DCHECK(service); | 170 DCHECK(service); |
172 RecordStartupInfo(service, command_line, launch_profile); | 171 RecordStartupInfo(service, command_line, launch_profile); |
173 service->ShowForProfile(launch_profile); | 172 service->ShowForProfile(launch_profile); |
174 return true; | 173 return true; |
175 } | 174 } |
OLD | NEW |