| 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/apps/app_launcher_util.h" | 5 #include "chrome/browser/apps/app_launcher_util.h" |
| 6 | 6 |
| 7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
| 8 #include "base/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/ui/host_desktop.h" | 11 #include "chrome/browser/ui/host_desktop.h" |
| 12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 #if defined(ENABLE_APP_LIST) |
| 16 // The field trial group name that enables showing the promo. | 17 // The field trial group name that enables showing the promo. |
| 17 const char kShowLauncherPromoOnceGroupName[] = "ShowPromoUntilDismissed"; | 18 const char kShowLauncherPromoOnceGroupName[] = "ShowPromoUntilDismissed"; |
| 18 | 19 |
| 19 // The field trial group name that resets the pref to show the app launcher | 20 // The field trial group name that resets the pref to show the app launcher |
| 20 // promo on every session startup. | 21 // promo on every session startup. |
| 21 const char kResetShowLauncherPromoPrefGroupName[] = "ResetShowPromoPref"; | 22 const char kResetShowLauncherPromoPrefGroupName[] = "ResetShowPromoPref"; |
| 22 | 23 |
| 23 // The name of the field trial that controls showing the app launcher promo. | 24 // The name of the field trial that controls showing the app launcher promo. |
| 24 const char kLauncherPromoTrialName[] = "ShowAppLauncherPromo"; | 25 const char kLauncherPromoTrialName[] = "ShowAppLauncherPromo"; |
| 26 #endif // defined(ENABLE_APP_LIST) |
| 25 | 27 |
| 26 } // namespace | 28 } // namespace |
| 27 | 29 |
| 28 void SetupShowAppLauncherPromoFieldTrial(PrefService* local_state) { | 30 void SetupShowAppLauncherPromoFieldTrial(PrefService* local_state) { |
| 29 #if defined(ENABLE_APP_LIST) | 31 #if defined(ENABLE_APP_LIST) |
| 30 if (base::FieldTrialList::FindFullName(kLauncherPromoTrialName) == | 32 if (base::FieldTrialList::FindFullName(kLauncherPromoTrialName) == |
| 31 kResetShowLauncherPromoPrefGroupName) { | 33 kResetShowLauncherPromoPrefGroupName) { |
| 32 local_state->SetBoolean(prefs::kShowAppLauncherPromo, true); | 34 local_state->SetBoolean(prefs::kShowAppLauncherPromo, true); |
| 33 } | 35 } |
| 34 #endif | 36 #endif |
| (...skipping 25 matching lines...) Expand all Loading... |
| 60 if (!local_state) | 62 if (!local_state) |
| 61 return false; | 63 return false; |
| 62 std::string app_launcher_promo_group_name = | 64 std::string app_launcher_promo_group_name = |
| 63 base::FieldTrialList::FindFullName(kLauncherPromoTrialName); | 65 base::FieldTrialList::FindFullName(kLauncherPromoTrialName); |
| 64 return !IsAppLauncherEnabled() && | 66 return !IsAppLauncherEnabled() && |
| 65 local_state->GetBoolean(prefs::kShowAppLauncherPromo) && | 67 local_state->GetBoolean(prefs::kShowAppLauncherPromo) && |
| 66 (app_launcher_promo_group_name == kShowLauncherPromoOnceGroupName || | 68 (app_launcher_promo_group_name == kShowLauncherPromoOnceGroupName || |
| 67 app_launcher_promo_group_name == kResetShowLauncherPromoPrefGroupName); | 69 app_launcher_promo_group_name == kResetShowLauncherPromoPrefGroupName); |
| 68 #endif | 70 #endif |
| 69 } // namespace apps | 71 } // namespace apps |
| OLD | NEW |