| 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_impl.h" | 5 #include "chrome/browser/ui/app_list/app_list_service_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 AppListService::ENABLE_NUM_ENABLE_SOURCES); | 206 AppListService::ENABLE_NUM_ENABLE_SOURCES); |
| 207 } | 207 } |
| 208 | 208 |
| 209 } // namespace | 209 } // namespace |
| 210 | 210 |
| 211 void AppListServiceImpl::RecordAppListLaunch() { | 211 void AppListServiceImpl::RecordAppListLaunch() { |
| 212 RecordDailyEventFrequency(prefs::kLastAppListLaunchPing, | 212 RecordDailyEventFrequency(prefs::kLastAppListLaunchPing, |
| 213 prefs::kAppListLaunchCount, | 213 prefs::kAppListLaunchCount, |
| 214 &SendAppListLaunch); | 214 &SendAppListLaunch); |
| 215 RecordAppListDiscoverability(local_state_, false); | 215 RecordAppListDiscoverability(local_state_, false); |
| 216 RecordAppListLastLaunch(); |
| 216 } | 217 } |
| 217 | 218 |
| 218 // static | 219 // static |
| 219 void AppListServiceImpl::RecordAppListAppLaunch() { | 220 void AppListServiceImpl::RecordAppListAppLaunch() { |
| 220 RecordDailyEventFrequency(prefs::kLastAppListAppLaunchPing, | 221 RecordDailyEventFrequency(prefs::kLastAppListAppLaunchPing, |
| 221 prefs::kAppListAppLaunchCount, | 222 prefs::kAppListAppLaunchCount, |
| 222 &SendAppListAppLaunch); | 223 &SendAppListAppLaunch); |
| 223 } | 224 } |
| 224 | 225 |
| 225 // static | 226 // static |
| 227 void AppListServiceImpl::RecordAppListLastLaunch() { |
| 228 if (!g_browser_process) |
| 229 return; // In a unit test. |
| 230 |
| 231 PrefService* local_state = g_browser_process->local_state(); |
| 232 if (!local_state) |
| 233 return; // In a unit test. |
| 234 |
| 235 local_state->SetInt64(prefs::kAppListLastLaunchTime, |
| 236 base::Time::Now().ToInternalValue()); |
| 237 } |
| 238 |
| 239 // static |
| 226 void AppListServiceImpl::SendAppListStats() { | 240 void AppListServiceImpl::SendAppListStats() { |
| 227 if (!g_browser_process || g_browser_process->IsShuttingDown()) | 241 if (!g_browser_process || g_browser_process->IsShuttingDown()) |
| 228 return; | 242 return; |
| 229 | 243 |
| 230 SendDailyEventFrequency(prefs::kLastAppListLaunchPing, | 244 SendDailyEventFrequency(prefs::kLastAppListLaunchPing, |
| 231 prefs::kAppListLaunchCount, | 245 prefs::kAppListLaunchCount, |
| 232 &SendAppListLaunch); | 246 &SendAppListLaunch); |
| 233 SendDailyEventFrequency(prefs::kLastAppListAppLaunchPing, | 247 SendDailyEventFrequency(prefs::kLastAppListAppLaunchPing, |
| 234 prefs::kAppListAppLaunchCount, | 248 prefs::kAppListAppLaunchCount, |
| 235 &SendAppListAppLaunch); | 249 &SendAppListAppLaunch); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 if (!base::MessageLoop::current()) | 430 if (!base::MessageLoop::current()) |
| 417 return; // In a unit test. | 431 return; // In a unit test. |
| 418 | 432 |
| 419 // Send app list usage stats after a delay. | 433 // Send app list usage stats after a delay. |
| 420 const int kSendUsageStatsDelay = 5; | 434 const int kSendUsageStatsDelay = 5; |
| 421 base::MessageLoop::current()->PostDelayedTask( | 435 base::MessageLoop::current()->PostDelayedTask( |
| 422 FROM_HERE, | 436 FROM_HERE, |
| 423 base::Bind(&AppListServiceImpl::SendAppListStats), | 437 base::Bind(&AppListServiceImpl::SendAppListStats), |
| 424 base::TimeDelta::FromSeconds(kSendUsageStatsDelay)); | 438 base::TimeDelta::FromSeconds(kSendUsageStatsDelay)); |
| 425 } | 439 } |
| OLD | NEW |