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 "apps/app_launcher.h" | 5 #include "apps/app_launcher.h" |
| 6 | 6 |
| 7 #include "apps/field_trial_names.h" | 7 #include "apps/field_trial_names.h" |
| 8 #include "apps/pref_names.h" | 8 #include "apps/pref_names.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/prefs/pref_registry_simple.h" | 10 #include "base/prefs/pref_registry_simple.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/ui/host_desktop.h" | 13 #include "chrome/browser/ui/host_desktop.h" |
| 14 | 14 |
| 15 #if defined(OS_WIN) | 15 #if defined(OS_WIN) |
| 16 #include "chrome/installer/launcher_support/chrome_launcher_support.h" | 16 #include "chrome/installer/launcher_support/chrome_launcher_support.h" |
| 17 #include "chrome/installer/util/browser_distribution.h" | 17 #include "chrome/installer/util/browser_distribution.h" |
| 18 #endif | 18 #endif |
| 19 | 19 |
| 20 namespace apps { | 20 namespace apps { |
| 21 | 21 |
| 22 bool IsAppLauncherEnabled() { | 22 bool IsAppLauncherEnabled() { |
|
tapted
2013/07/11 06:54:45
note: since /apps is skipped on andriod and iOS, t
benwells
2013/07/12 01:41:48
Why would that be better? It is longer, and couple
tapted
2013/07/12 04:58:27
The alternative makes it possible to #error in cas
| |
| 23 #if defined(USE_ASH) && !defined(OS_WIN) | 23 #if !defined(ENABLE_APP_LIST) |
| 24 return false; | |
| 25 | |
| 26 #elif defined(OS_CHROMEOS) | |
| 24 return true; | 27 return true; |
| 25 #elif !defined(OS_WIN) | 28 |
| 26 return false; | 29 #else // defined(ENABLE_APP_LIST) && !defined(OS_CHROMEOS) |
| 27 #else | |
| 28 #if defined(USE_ASH) | |
|
tapted
2013/07/11 06:54:45
guarding the next two lines doesn't really add any
| |
| 29 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) | 30 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) |
| 30 return true; | 31 return true; |
| 31 #endif | 32 |
| 32 PrefService* prefs = g_browser_process->local_state(); | 33 PrefService* prefs = g_browser_process->local_state(); |
| 33 // In some tests, the prefs aren't initialised. | 34 // In some tests, the prefs aren't initialised. |
| 34 if (!prefs) | 35 return prefs && prefs->GetBoolean(prefs::kAppLauncherHasBeenEnabled); |
| 35 return false; | |
| 36 return prefs->GetBoolean(prefs::kAppLauncherHasBeenEnabled); | |
| 37 #endif | 36 #endif |
| 38 } | 37 } |
| 39 | 38 |
| 40 bool ShouldShowAppLauncherPromo() { | 39 bool ShouldShowAppLauncherPromo() { |
| 41 PrefService* local_state = g_browser_process->local_state(); | 40 PrefService* local_state = g_browser_process->local_state(); |
| 42 // In some tests, the prefs aren't initialised. | 41 // In some tests, the prefs aren't initialised. |
| 43 if (!local_state) | 42 if (!local_state) |
| 44 return false; | 43 return false; |
| 45 std::string app_launcher_promo_group_name = | 44 std::string app_launcher_promo_group_name = |
| 46 base::FieldTrialList::FindFullName(apps::kLauncherPromoTrialName); | 45 base::FieldTrialList::FindFullName(apps::kLauncherPromoTrialName); |
| 47 return !IsAppLauncherEnabled() && | 46 return !IsAppLauncherEnabled() && |
| 48 local_state->GetBoolean(apps::prefs::kShowAppLauncherPromo) && | 47 local_state->GetBoolean(apps::prefs::kShowAppLauncherPromo) && |
| 49 (app_launcher_promo_group_name == apps::kShowLauncherPromoOnceGroupName || | 48 (app_launcher_promo_group_name == apps::kShowLauncherPromoOnceGroupName || |
| 50 app_launcher_promo_group_name == | 49 app_launcher_promo_group_name == |
| 51 apps::kResetShowLauncherPromoPrefGroupName); | 50 apps::kResetShowLauncherPromoPrefGroupName); |
| 52 } | 51 } |
| 53 | 52 |
| 54 } // namespace apps | 53 } // namespace apps |
| OLD | NEW |