Update include paths in miscellaneous content/ directories for base/process changes.
[chromium-blink-merge.git] / apps / app_launcher.cc
blob4e1f379c29a3a326d2e6d4a7d014d0641c82b1c7
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
3 // found in the LICENSE file.
5 #include "apps/app_launcher.h"
7 #include "apps/field_trial_names.h"
8 #include "apps/pref_names.h"
9 #include "base/metrics/field_trial.h"
10 #include "base/prefs/pref_registry_simple.h"
11 #include "base/prefs/pref_service.h"
12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/ui/host_desktop.h"
15 #if defined(OS_WIN)
16 #include "chrome/installer/launcher_support/chrome_launcher_support.h"
17 #include "chrome/installer/util/browser_distribution.h"
18 #endif
20 namespace apps {
22 bool IsAppLauncherEnabled() {
23 #if !defined(ENABLE_APP_LIST)
24 return false;
26 #elif defined(OS_CHROMEOS)
27 return true;
29 #else // defined(ENABLE_APP_LIST) && !defined(OS_CHROMEOS)
30 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH)
31 return true;
33 PrefService* prefs = g_browser_process->local_state();
34 // In some tests, the prefs aren't initialised.
35 return prefs && prefs->GetBoolean(prefs::kAppLauncherHasBeenEnabled);
36 #endif
39 bool ShouldShowAppLauncherPromo() {
40 PrefService* local_state = g_browser_process->local_state();
41 // In some tests, the prefs aren't initialised.
42 if (!local_state)
43 return false;
44 std::string app_launcher_promo_group_name =
45 base::FieldTrialList::FindFullName(apps::kLauncherPromoTrialName);
46 return !IsAppLauncherEnabled() &&
47 local_state->GetBoolean(apps::prefs::kShowAppLauncherPromo) &&
48 (app_launcher_promo_group_name == apps::kShowLauncherPromoOnceGroupName ||
49 app_launcher_promo_group_name ==
50 apps::kResetShowLauncherPromoPrefGroupName);
53 } // namespace apps