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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 } | 231 } |
232 | 232 |
233 void KioskAppManager::InitSession(Profile* profile, | 233 void KioskAppManager::InitSession(Profile* profile, |
234 const std::string& app_id) { | 234 const std::string& app_id) { |
235 LOG_IF(FATAL, app_session_) << "Kiosk session is already initialized."; | 235 LOG_IF(FATAL, app_session_) << "Kiosk session is already initialized."; |
236 | 236 |
237 app_session_.reset(new AppSession); | 237 app_session_.reset(new AppSession); |
238 app_session_->Init(profile, app_id); | 238 app_session_->Init(profile, app_id); |
239 } | 239 } |
240 | 240 |
| 241 void KioskAppManager::AddAppForTest( |
| 242 const std::string& app_id, |
| 243 const AccountId& account_id, |
| 244 const GURL& update_url, |
| 245 const std::string& required_platform_version) { |
| 246 for (auto it = apps_.begin(); it != apps_.end(); ++it) { |
| 247 if ((*it)->app_id() == app_id) { |
| 248 apps_.erase(it); |
| 249 break; |
| 250 } |
| 251 } |
| 252 |
| 253 apps_.emplace_back(KioskAppData::CreateForTest( |
| 254 this, app_id, account_id, update_url, required_platform_version)); |
| 255 } |
| 256 |
241 void KioskAppManager::EnableConsumerKioskAutoLaunch( | 257 void KioskAppManager::EnableConsumerKioskAutoLaunch( |
242 const KioskAppManager::EnableKioskAutoLaunchCallback& callback) { | 258 const KioskAppManager::EnableKioskAutoLaunchCallback& callback) { |
243 policy::BrowserPolicyConnectorChromeOS* connector = | 259 policy::BrowserPolicyConnectorChromeOS* connector = |
244 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 260 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
245 connector->GetInstallAttributes()->LockDevice( | 261 connector->GetInstallAttributes()->LockDevice( |
246 std::string(), // user | 262 std::string(), // user |
247 policy::DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH, | 263 policy::DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH, |
248 std::string(), // device_id | 264 std::string(), // device_id |
249 base::Bind( | 265 base::Bind( |
250 &KioskAppManager::OnLockDevice, base::Unretained(this), callback)); | 266 &KioskAppManager::OnLockDevice, base::Unretained(this), callback)); |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 base::TimeDelta KioskAppManager::GetAutoLaunchDelay() const { | 881 base::TimeDelta KioskAppManager::GetAutoLaunchDelay() const { |
866 int delay; | 882 int delay; |
867 if (!CrosSettings::Get()->GetInteger( | 883 if (!CrosSettings::Get()->GetInteger( |
868 kAccountsPrefDeviceLocalAccountAutoLoginDelay, &delay)) { | 884 kAccountsPrefDeviceLocalAccountAutoLoginDelay, &delay)) { |
869 return base::TimeDelta(); // Default delay is 0ms. | 885 return base::TimeDelta(); // Default delay is 0ms. |
870 } | 886 } |
871 return base::TimeDelta::FromMilliseconds(delay); | 887 return base::TimeDelta::FromMilliseconds(delay); |
872 } | 888 } |
873 | 889 |
874 } // namespace chromeos | 890 } // namespace chromeos |
OLD | NEW |