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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 bool KioskAppManager::IsConsumerKioskDeviceWithAutoLaunch() { | 279 bool KioskAppManager::IsConsumerKioskDeviceWithAutoLaunch() { |
280 policy::BrowserPolicyConnectorChromeOS* connector = | 280 policy::BrowserPolicyConnectorChromeOS* connector = |
281 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 281 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
282 return connector->GetInstallAttributes() && | 282 return connector->GetInstallAttributes() && |
283 connector->GetInstallAttributes() | 283 connector->GetInstallAttributes() |
284 ->IsConsumerKioskDeviceWithAutoLaunch(); | 284 ->IsConsumerKioskDeviceWithAutoLaunch(); |
285 } | 285 } |
286 | 286 |
287 void KioskAppManager::OnLockDevice( | 287 void KioskAppManager::OnLockDevice( |
288 const KioskAppManager::EnableKioskAutoLaunchCallback& callback, | 288 const KioskAppManager::EnableKioskAutoLaunchCallback& callback, |
289 policy::EnterpriseInstallAttributes::LockResult result) { | 289 InstallAttributes::LockResult result) { |
290 if (callback.is_null()) | 290 if (callback.is_null()) |
291 return; | 291 return; |
292 | 292 |
293 callback.Run(result == policy::EnterpriseInstallAttributes::LOCK_SUCCESS); | 293 callback.Run(result == InstallAttributes::LOCK_SUCCESS); |
294 } | 294 } |
295 | 295 |
296 void KioskAppManager::OnOwnerFileChecked( | 296 void KioskAppManager::OnOwnerFileChecked( |
297 const KioskAppManager::GetConsumerKioskAutoLaunchStatusCallback& callback, | 297 const KioskAppManager::GetConsumerKioskAutoLaunchStatusCallback& callback, |
298 bool* owner_present) { | 298 bool* owner_present) { |
299 ownership_established_ = *owner_present; | 299 ownership_established_ = *owner_present; |
300 | 300 |
301 if (callback.is_null()) | 301 if (callback.is_null()) |
302 return; | 302 return; |
303 | 303 |
304 // If we have owner already established on the machine, don't let | 304 // If we have owner already established on the machine, don't let |
305 // consumer kiosk to be enabled. | 305 // consumer kiosk to be enabled. |
306 if (ownership_established_) | 306 if (ownership_established_) |
307 callback.Run(CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED); | 307 callback.Run(CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED); |
308 else | 308 else |
309 callback.Run(CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE); | 309 callback.Run(CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE); |
310 } | 310 } |
311 | 311 |
312 void KioskAppManager::OnReadImmutableAttributes( | 312 void KioskAppManager::OnReadImmutableAttributes( |
313 const KioskAppManager::GetConsumerKioskAutoLaunchStatusCallback& | 313 const KioskAppManager::GetConsumerKioskAutoLaunchStatusCallback& |
314 callback) { | 314 callback) { |
315 if (callback.is_null()) | 315 if (callback.is_null()) |
316 return; | 316 return; |
317 | 317 |
318 ConsumerKioskAutoLaunchStatus status = | 318 ConsumerKioskAutoLaunchStatus status = |
319 CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED; | 319 CONSUMER_KIOSK_AUTO_LAUNCH_DISABLED; |
320 policy::BrowserPolicyConnectorChromeOS* connector = | 320 policy::BrowserPolicyConnectorChromeOS* connector = |
321 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 321 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
322 policy::EnterpriseInstallAttributes* attributes = | 322 InstallAttributes* attributes = connector->GetInstallAttributes(); |
323 connector->GetInstallAttributes(); | |
324 switch (attributes->GetMode()) { | 323 switch (attributes->GetMode()) { |
325 case policy::DEVICE_MODE_NOT_SET: { | 324 case policy::DEVICE_MODE_NOT_SET: { |
326 if (!base::SysInfo::IsRunningOnChromeOS()) { | 325 if (!base::SysInfo::IsRunningOnChromeOS()) { |
327 status = CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE; | 326 status = CONSUMER_KIOSK_AUTO_LAUNCH_CONFIGURABLE; |
328 } else if (!ownership_established_) { | 327 } else if (!ownership_established_) { |
329 bool* owner_present = new bool(false); | 328 bool* owner_present = new bool(false); |
330 content::BrowserThread::PostBlockingPoolTaskAndReply( | 329 content::BrowserThread::PostBlockingPoolTaskAndReply( |
331 FROM_HERE, | 330 FROM_HERE, |
332 base::Bind(&CheckOwnerFilePresence, | 331 base::Bind(&CheckOwnerFilePresence, |
333 owner_present), | 332 owner_present), |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 base::TimeDelta KioskAppManager::GetAutoLaunchDelay() const { | 880 base::TimeDelta KioskAppManager::GetAutoLaunchDelay() const { |
882 int delay; | 881 int delay; |
883 if (!CrosSettings::Get()->GetInteger( | 882 if (!CrosSettings::Get()->GetInteger( |
884 kAccountsPrefDeviceLocalAccountAutoLoginDelay, &delay)) { | 883 kAccountsPrefDeviceLocalAccountAutoLoginDelay, &delay)) { |
885 return base::TimeDelta(); // Default delay is 0ms. | 884 return base::TimeDelta(); // Default delay is 0ms. |
886 } | 885 } |
887 return base::TimeDelta::FromMilliseconds(delay); | 886 return base::TimeDelta::FromMilliseconds(delay); |
888 } | 887 } |
889 | 888 |
890 } // namespace chromeos | 889 } // namespace chromeos |
OLD | NEW |