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/pref_names.h" | 7 #include "apps/pref_names.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/prefs/pref_registry_simple.h" | 9 #include "base/prefs/pref_registry_simple.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
11 #include "base/threading/sequenced_worker_pool.h" | 11 #include "base/threading/sequenced_worker_pool.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/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
14 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
15 | 16 |
16 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
17 #include "chrome/installer/launcher_support/chrome_launcher_support.h" | 18 #include "chrome/installer/launcher_support/chrome_launcher_support.h" |
18 #include "chrome/installer/util/browser_distribution.h" | 19 #include "chrome/installer/util/browser_distribution.h" |
19 #endif | 20 #endif |
20 | 21 |
21 namespace apps { | 22 namespace apps { |
22 | 23 |
23 namespace { | 24 namespace { |
24 | 25 |
25 enum AppLauncherState { | 26 enum AppLauncherState { |
26 APP_LAUNCHER_UNKNOWN, | 27 APP_LAUNCHER_UNKNOWN, |
27 APP_LAUNCHER_ENABLED, | 28 APP_LAUNCHER_ENABLED, |
28 APP_LAUNCHER_DISABLED, | 29 APP_LAUNCHER_DISABLED, |
29 }; | 30 }; |
30 | 31 |
31 AppLauncherState SynchronousAppLauncherChecks() { | 32 AppLauncherState SynchronousAppLauncherChecks() { |
32 #if defined(USE_ASH) | 33 #if defined(USE_ASH) && !defined(OS_WIN) |
33 return APP_LAUNCHER_ENABLED; | 34 return APP_LAUNCHER_ENABLED; |
34 #elif !defined(OS_WIN) | 35 #elif !defined(OS_WIN) |
35 return APP_LAUNCHER_DISABLED; | 36 return APP_LAUNCHER_DISABLED; |
36 #else | 37 #else |
37 if (CommandLine::ForCurrentProcess()->HasSwitch( | 38 if (CommandLine::ForCurrentProcess()->HasSwitch( |
38 switches::kShowAppListShortcut)) { | 39 switches::kShowAppListShortcut)) { |
39 return APP_LAUNCHER_ENABLED; | 40 return APP_LAUNCHER_ENABLED; |
40 } | 41 } |
41 | 42 |
| 43 #if defined(USE_ASH) |
| 44 if (chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_ASH) |
| 45 return APP_LAUNCHER_ENABLED; |
| 46 #endif |
| 47 |
42 if (!BrowserDistribution::GetDistribution()->AppHostIsSupported()) | 48 if (!BrowserDistribution::GetDistribution()->AppHostIsSupported()) |
43 return APP_LAUNCHER_DISABLED; | 49 return APP_LAUNCHER_DISABLED; |
44 | 50 |
45 return APP_LAUNCHER_UNKNOWN; | 51 return APP_LAUNCHER_UNKNOWN; |
46 #endif | 52 #endif |
47 } | 53 } |
48 | 54 |
49 #if defined(OS_WIN) | 55 #if defined(OS_WIN) |
50 void UpdatePrefAndCallCallbackOnUI( | 56 void UpdatePrefAndCallCallbackOnUI( |
51 bool result, | 57 bool result, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 104 |
99 bool WasAppLauncherEnabled() { | 105 bool WasAppLauncherEnabled() { |
100 PrefService* prefs = g_browser_process->local_state(); | 106 PrefService* prefs = g_browser_process->local_state(); |
101 // In some tests, the prefs aren't initialised. | 107 // In some tests, the prefs aren't initialised. |
102 if (!prefs) | 108 if (!prefs) |
103 return SynchronousAppLauncherChecks() == APP_LAUNCHER_ENABLED; | 109 return SynchronousAppLauncherChecks() == APP_LAUNCHER_ENABLED; |
104 return prefs->GetBoolean(prefs::kAppLauncherIsEnabled); | 110 return prefs->GetBoolean(prefs::kAppLauncherIsEnabled); |
105 } | 111 } |
106 | 112 |
107 } // namespace apps | 113 } // namespace apps |
OLD | NEW |