This source file includes following definitions.
- SetupShowAppLauncherPromoFieldTrial
- IsAppLauncherEnabled
- ShouldShowAppLauncherPromo
#include "chrome/browser/ui/app_list/app_list_util.h"
#include "base/metrics/field_trial.h"
#include "base/prefs/pref_registry_simple.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/ui/host_desktop.h"
#include "chrome/common/pref_names.h"
namespace {
#if defined(ENABLE_APP_LIST)
const char kShowLauncherPromoOnceGroupName[] = "ShowPromoUntilDismissed";
const char kResetShowLauncherPromoPrefGroupName[] = "ResetShowPromoPref";
const char kLauncherPromoTrialName[] = "ShowAppLauncherPromo";
#endif  
}  
void SetupShowAppLauncherPromoFieldTrial(PrefService* local_state) {
#if defined(ENABLE_APP_LIST)
  if (base::FieldTrialList::FindFullName(kLauncherPromoTrialName) ==
      kResetShowLauncherPromoPrefGroupName) {
    local_state->SetBoolean(prefs::kShowAppLauncherPromo, true);
  }
#endif
}
bool IsAppLauncherEnabled() {
#if !defined(ENABLE_APP_LIST)
  return false;
#elif defined(OS_CHROMEOS)
  return true;
#else  
  if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH)
    return true;
  PrefService* prefs = g_browser_process->local_state();
  
  return prefs && prefs->GetBoolean(prefs::kAppLauncherHasBeenEnabled);
#endif
}
bool ShouldShowAppLauncherPromo() {
#if !defined(ENABLE_APP_LIST)
  return false;
#else
  PrefService* local_state = g_browser_process->local_state();
  
  if (!local_state)
    return false;
  std::string app_launcher_promo_group_name =
      base::FieldTrialList::FindFullName(kLauncherPromoTrialName);
  return !IsAppLauncherEnabled() &&
      local_state->GetBoolean(prefs::kShowAppLauncherPromo) &&
      (app_launcher_promo_group_name == kShowLauncherPromoOnceGroupName ||
       app_launcher_promo_group_name == kResetShowLauncherPromoPrefGroupName);
#endif
}