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/chromeos/app_mode/kiosk_app_manager.h" | 5 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/chromeos/chromeos_version.h" | |
12 #include "base/logging.h" | 11 #include "base/logging.h" |
13 #include "base/path_service.h" | 12 #include "base/path_service.h" |
14 #include "base/prefs/pref_registry_simple.h" | 13 #include "base/prefs/pref_registry_simple.h" |
15 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
16 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
| 16 #include "base/sys_info.h" |
17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/chromeos/app_mode/kiosk_app_data.h" | 18 #include "chrome/browser/chromeos/app_mode/kiosk_app_data.h" |
19 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager_observer.h" | 19 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager_observer.h" |
20 #include "chrome/browser/chromeos/login/user_manager.h" | 20 #include "chrome/browser/chromeos/login/user_manager.h" |
21 #include "chrome/browser/chromeos/policy/device_local_account.h" | 21 #include "chrome/browser/chromeos/policy/device_local_account.h" |
22 #include "chrome/browser/chromeos/settings/cros_settings.h" | 22 #include "chrome/browser/chromeos/settings/cros_settings.h" |
23 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 23 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
24 #include "chrome/browser/chromeos/settings/owner_key_util.h" | 24 #include "chrome/browser/chromeos/settings/owner_key_util.h" |
25 #include "chrome/browser/policy/browser_policy_connector.h" | 25 #include "chrome/browser/policy/browser_policy_connector.h" |
26 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 26 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 void KioskAppManager::OnReadImmutableAttributes( | 161 void KioskAppManager::OnReadImmutableAttributes( |
162 const KioskAppManager::GetConsumerKioskModeStatusCallback& callback) { | 162 const KioskAppManager::GetConsumerKioskModeStatusCallback& callback) { |
163 if (callback.is_null()) | 163 if (callback.is_null()) |
164 return; | 164 return; |
165 | 165 |
166 ConsumerKioskModeStatus status = CONSUMER_KIOSK_MODE_DISABLED; | 166 ConsumerKioskModeStatus status = CONSUMER_KIOSK_MODE_DISABLED; |
167 policy::EnterpriseInstallAttributes* attributes = | 167 policy::EnterpriseInstallAttributes* attributes = |
168 g_browser_process->browser_policy_connector()->GetInstallAttributes(); | 168 g_browser_process->browser_policy_connector()->GetInstallAttributes(); |
169 switch (attributes->GetMode()) { | 169 switch (attributes->GetMode()) { |
170 case policy::DEVICE_MODE_NOT_SET: { | 170 case policy::DEVICE_MODE_NOT_SET: { |
171 if (!base::chromeos::IsRunningOnChromeOS()) { | 171 if (!base::SysInfo::IsRunningOnChromeOS()) { |
172 status = CONSUMER_KIOSK_MODE_CONFIGURABLE; | 172 status = CONSUMER_KIOSK_MODE_CONFIGURABLE; |
173 } else if (!ownership_established_) { | 173 } else if (!ownership_established_) { |
174 bool* owner_present = new bool(false); | 174 bool* owner_present = new bool(false); |
175 content::BrowserThread::PostBlockingPoolTaskAndReply( | 175 content::BrowserThread::PostBlockingPoolTaskAndReply( |
176 FROM_HERE, | 176 FROM_HERE, |
177 base::Bind(&CheckOwnerFilePresence, | 177 base::Bind(&CheckOwnerFilePresence, |
178 owner_present), | 178 owner_present), |
179 base::Bind(&KioskAppManager::OnOwnerFileChecked, | 179 base::Bind(&KioskAppManager::OnOwnerFileChecked, |
180 base::Unretained(this), | 180 base::Unretained(this), |
181 callback, | 181 callback, |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 | 427 |
428 void KioskAppManager::SetAutoLoginState(AutoLoginState state) { | 428 void KioskAppManager::SetAutoLoginState(AutoLoginState state) { |
429 PrefService* prefs = g_browser_process->local_state(); | 429 PrefService* prefs = g_browser_process->local_state(); |
430 DictionaryPrefUpdate dict_update(prefs, | 430 DictionaryPrefUpdate dict_update(prefs, |
431 KioskAppManager::kKioskDictionaryName); | 431 KioskAppManager::kKioskDictionaryName); |
432 dict_update->SetInteger(kKeyAutoLoginState, state); | 432 dict_update->SetInteger(kKeyAutoLoginState, state); |
433 prefs->CommitPendingWrite(); | 433 prefs->CommitPendingWrite(); |
434 } | 434 } |
435 | 435 |
436 } // namespace chromeos | 436 } // namespace chromeos |
OLD | NEW |