Chromium Code Reviews| 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 "apps/pref_names.h" | 9 #include "apps/pref_names.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
| 14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "chrome/browser/apps/shortcut_manager.h" | |
| 17 #include "chrome/browser/apps/shortcut_manager_factory.h" | |
| 18 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/browser_shutdown.h" | 17 #include "chrome/browser/browser_shutdown.h" |
| 20 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
| 21 #include "chrome/browser/ui/app_list/profile_loader.h" | 19 #include "chrome/browser/ui/app_list/profile_loader.h" |
| 22 #include "chrome/browser/ui/app_list/profile_store.h" | 20 #include "chrome/browser/ui/app_list/profile_store.h" |
| 23 #include "chrome/common/chrome_constants.h" | 21 #include "chrome/common/chrome_constants.h" |
| 24 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 26 | 24 |
| 27 namespace { | 25 namespace { |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 local_state_->SetInteger(prefs::kAppListEnableMethod, enable_source); | 337 local_state_->SetInteger(prefs::kAppListEnableMethod, enable_source); |
| 340 if (base::MessageLoop::current()) { | 338 if (base::MessageLoop::current()) { |
| 341 // Ensure a value is recorded if the user "never" shows the app list. Note | 339 // Ensure a value is recorded if the user "never" shows the app list. Note |
| 342 // there is no message loop in unit tests. | 340 // there is no message loop in unit tests. |
| 343 base::MessageLoop::current()->PostDelayedTask( | 341 base::MessageLoop::current()->PostDelayedTask( |
| 344 FROM_HERE, | 342 FROM_HERE, |
| 345 base::Bind(&RecordAppListDiscoverability, | 343 base::Bind(&RecordAppListDiscoverability, |
| 346 base::Unretained(local_state_), | 344 base::Unretained(local_state_), |
| 347 false), | 345 false), |
| 348 base::TimeDelta::FromMinutes(kDiscoverabilityTimeoutMinutes)); | 346 base::TimeDelta::FromMinutes(kDiscoverabilityTimeoutMinutes)); |
| 349 } | 347 } |
|
Matt Giuca
2014/05/23 07:01:57
Can you explain why this call to OnceOffCreateShor
jackhou1
2014/05/26 07:57:37
We don't need it any more since we've had app shor
Matt Giuca
2014/05/26 08:07:36
Yeah would you be able to split it, if it's not to
jackhou1
2014/05/27 01:03:57
As per discussion, keeping this CL has the benefit
| |
| 350 | |
| 351 AppShortcutManager* shortcut_manager = | |
| 352 AppShortcutManagerFactory::GetForProfile(initial_profile); | |
| 353 if (shortcut_manager) | |
| 354 shortcut_manager->OnceOffCreateShortcuts(); | |
| 355 } | 348 } |
| 356 | 349 |
| 357 void AppListServiceImpl::InvalidatePendingProfileLoads() { | 350 void AppListServiceImpl::InvalidatePendingProfileLoads() { |
| 358 profile_loader_->InvalidatePendingProfileLoads(); | 351 profile_loader_->InvalidatePendingProfileLoads(); |
| 359 } | 352 } |
| 360 | 353 |
| 361 void AppListServiceImpl::PerformStartupChecks(Profile* initial_profile) { | 354 void AppListServiceImpl::PerformStartupChecks(Profile* initial_profile) { |
| 362 // Except in rare, once-off cases, this just checks that a pref is "0" and | 355 // Except in rare, once-off cases, this just checks that a pref is "0" and |
| 363 // returns. | 356 // returns. |
| 364 RecordAppListDiscoverability(local_state_, true); | 357 RecordAppListDiscoverability(local_state_, true); |
| 365 | 358 |
| 366 if (command_line_.HasSwitch(switches::kResetAppListInstallState)) | 359 if (command_line_.HasSwitch(switches::kResetAppListInstallState)) |
| 367 local_state_->SetBoolean(prefs::kAppLauncherHasBeenEnabled, false); | 360 local_state_->SetBoolean(prefs::kAppLauncherHasBeenEnabled, false); |
| 368 | 361 |
| 369 if (command_line_.HasSwitch(switches::kEnableAppList)) | 362 if (command_line_.HasSwitch(switches::kEnableAppList)) |
| 370 EnableAppList(initial_profile, ENABLE_VIA_COMMAND_LINE); | 363 EnableAppList(initial_profile, ENABLE_VIA_COMMAND_LINE); |
| 371 | 364 |
| 372 if (!base::MessageLoop::current()) | 365 if (!base::MessageLoop::current()) |
| 373 return; // In a unit test. | 366 return; // In a unit test. |
| 374 | 367 |
| 375 // Send app list usage stats after a delay. | 368 // Send app list usage stats after a delay. |
| 376 const int kSendUsageStatsDelay = 5; | 369 const int kSendUsageStatsDelay = 5; |
| 377 base::MessageLoop::current()->PostDelayedTask( | 370 base::MessageLoop::current()->PostDelayedTask( |
| 378 FROM_HERE, | 371 FROM_HERE, |
| 379 base::Bind(&AppListServiceImpl::SendAppListStats), | 372 base::Bind(&AppListServiceImpl::SendAppListStats), |
| 380 base::TimeDelta::FromSeconds(kSendUsageStatsDelay)); | 373 base::TimeDelta::FromSeconds(kSendUsageStatsDelay)); |
| 381 } | 374 } |
| OLD | NEW |