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_util.h" | 5 #include "chrome/browser/ui/app_list/app_list_util.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/ui/host_desktop.h" | 9 #include "chrome/browser/ui/host_desktop.h" |
10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
11 | 11 |
12 bool IsAppLauncherEnabled() { | 12 bool IsAppLauncherEnabled() { |
13 #if !defined(ENABLE_APP_LIST) | 13 #if !defined(ENABLE_APP_LIST) |
14 return false; | 14 return false; |
15 | 15 |
16 #elif defined(OS_CHROMEOS) | 16 #elif defined(OS_CHROMEOS) |
17 return true; | 17 return true; |
18 | 18 |
19 #else // defined(ENABLE_APP_LIST) && !defined(OS_CHROMEOS) | 19 #else // defined(ENABLE_APP_LIST) && !defined(OS_CHROMEOS) |
20 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) | 20 if (chrome::GetActiveDesktop() == ui::HOST_DESKTOP_TYPE_ASH) |
21 return true; | 21 return true; |
22 | 22 |
23 PrefService* prefs = g_browser_process->local_state(); | 23 PrefService* prefs = g_browser_process->local_state(); |
24 // In some tests, the prefs aren't initialised. | 24 // In some tests, the prefs aren't initialised. |
25 return prefs && prefs->GetBoolean(prefs::kAppLauncherHasBeenEnabled); | 25 return prefs && prefs->GetBoolean(prefs::kAppLauncherHasBeenEnabled); |
26 #endif | 26 #endif |
27 } | 27 } |
28 | 28 |
29 bool ShouldShowAppLauncherPromo() { | 29 bool ShouldShowAppLauncherPromo() { |
30 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
31 PrefService* local_state = g_browser_process->local_state(); | 31 PrefService* local_state = g_browser_process->local_state(); |
32 // In some tests, the prefs aren't initialised. | 32 // In some tests, the prefs aren't initialised. |
33 if (!local_state) | 33 if (!local_state) |
34 return false; | 34 return false; |
35 return !IsAppLauncherEnabled() && | 35 return !IsAppLauncherEnabled() && |
36 local_state->GetBoolean(prefs::kShowAppLauncherPromo); | 36 local_state->GetBoolean(prefs::kShowAppLauncherPromo); |
37 #else | 37 #else |
38 return false; | 38 return false; |
39 #endif | 39 #endif |
40 } // namespace apps | 40 } // namespace apps |
OLD | NEW |