OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/extensions/app_launcher.h" | 5 #include "chrome/browser/extensions/app_launcher.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/threading/sequenced_worker_pool.h" | 8 #include "base/threading/sequenced_worker_pool.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/prefs/pref_registry_simple.h" |
10 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
11 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
12 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
14 | 15 |
15 #if defined(OS_WIN) | 16 #if defined(OS_WIN) |
16 #include "chrome/installer/launcher_support/chrome_launcher_support.h" | 17 #include "chrome/installer/launcher_support/chrome_launcher_support.h" |
17 #include "chrome/installer/util/browser_distribution.h" | 18 #include "chrome/installer/util/browser_distribution.h" |
18 #endif | 19 #endif |
19 | 20 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 PrefService* prefs = g_browser_process->local_state(); | 96 PrefService* prefs = g_browser_process->local_state(); |
96 // In some tests, the prefs aren't initialised, but the NTP still needs to | 97 // In some tests, the prefs aren't initialised, but the NTP still needs to |
97 // work. | 98 // work. |
98 if (!prefs) | 99 if (!prefs) |
99 return SynchronousAppLauncherChecks() == APP_LAUNCHER_ENABLED; | 100 return SynchronousAppLauncherChecks() == APP_LAUNCHER_ENABLED; |
100 return prefs->GetBoolean(prefs::kAppLauncherIsEnabled); | 101 return prefs->GetBoolean(prefs::kAppLauncherIsEnabled); |
101 } | 102 } |
102 | 103 |
103 namespace app_launcher { | 104 namespace app_launcher { |
104 | 105 |
105 void RegisterPrefs(PrefServiceSimple* pref_service) { | 106 void RegisterPrefs(PrefRegistrySimple* pref_service) { |
106 // If it is impossible to synchronously determine whether the app launcher is | 107 // If it is impossible to synchronously determine whether the app launcher is |
107 // enabled, assume it is disabled. Anything that needs to know the absolute | 108 // enabled, assume it is disabled. Anything that needs to know the absolute |
108 // truth should call UpdateIsAppLauncherEnabled(). | 109 // truth should call UpdateIsAppLauncherEnabled(). |
109 // | 110 // |
110 // This pref is just a cache of the value from the registry from last time | 111 // This pref is just a cache of the value from the registry from last time |
111 // Chrome ran. To avoid having the NTP block on a registry check, it guesses | 112 // Chrome ran. To avoid having the NTP block on a registry check, it guesses |
112 // that the value hasn't changed since last time it was checked, using this | 113 // that the value hasn't changed since last time it was checked, using this |
113 // preference. | 114 // preference. |
114 bool is_enabled = SynchronousAppLauncherChecks() == APP_LAUNCHER_ENABLED; | 115 bool is_enabled = SynchronousAppLauncherChecks() == APP_LAUNCHER_ENABLED; |
115 pref_service->RegisterBooleanPref(prefs::kAppLauncherIsEnabled, is_enabled); | 116 pref_service->RegisterBooleanPref(prefs::kAppLauncherIsEnabled, is_enabled); |
116 } | 117 } |
117 | 118 |
118 } // namespace app_launcher | 119 } // namespace app_launcher |
119 | 120 |
120 } // namespace extensions | 121 } // namespace extensions |
OLD | NEW |