| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/policy/enterprise_install_attributes.h" | 5 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 DeviceMode EnterpriseInstallAttributes::GetMode() { | 297 DeviceMode EnterpriseInstallAttributes::GetMode() { |
| 298 return registration_mode_; | 298 return registration_mode_; |
| 299 } | 299 } |
| 300 | 300 |
| 301 // Warning: The values for these keys (but not the keys themselves) are stored | 301 // Warning: The values for these keys (but not the keys themselves) are stored |
| 302 // in the protobuf with a trailing zero. Also note that some of these constants | 302 // in the protobuf with a trailing zero. Also note that some of these constants |
| 303 // have been copied to login_manager/device_policy_service.cc. Please make sure | 303 // have been copied to login_manager/device_policy_service.cc. Please make sure |
| 304 // that all changes to the constants are reflected there as well. | 304 // that all changes to the constants are reflected there as well. |
| 305 const char EnterpriseInstallAttributes::kConsumerDeviceMode[] = "consumer"; | 305 const char EnterpriseInstallAttributes::kConsumerDeviceMode[] = "consumer"; |
| 306 const char EnterpriseInstallAttributes::kEnterpriseDeviceMode[] = "enterprise"; | 306 const char EnterpriseInstallAttributes::kEnterpriseDeviceMode[] = "enterprise"; |
| 307 const char EnterpriseInstallAttributes::kRetailKioskDeviceMode[] = "kiosk"; | 307 const char EnterpriseInstallAttributes::kLegacyRetailDeviceMode[] = "kiosk"; |
| 308 const char EnterpriseInstallAttributes::kConsumerKioskDeviceMode[] = | 308 const char EnterpriseInstallAttributes::kConsumerKioskDeviceMode[] = |
| 309 "consumer_kiosk"; | 309 "consumer_kiosk"; |
| 310 const char EnterpriseInstallAttributes::kUnknownDeviceMode[] = "unknown"; | 310 const char EnterpriseInstallAttributes::kUnknownDeviceMode[] = "unknown"; |
| 311 | 311 |
| 312 const char EnterpriseInstallAttributes::kAttrEnterpriseDeviceId[] = | 312 const char EnterpriseInstallAttributes::kAttrEnterpriseDeviceId[] = |
| 313 "enterprise.device_id"; | 313 "enterprise.device_id"; |
| 314 const char EnterpriseInstallAttributes::kAttrEnterpriseDomain[] = | 314 const char EnterpriseInstallAttributes::kAttrEnterpriseDomain[] = |
| 315 "enterprise.domain"; | 315 "enterprise.domain"; |
| 316 const char EnterpriseInstallAttributes::kAttrEnterpriseMode[] = | 316 const char EnterpriseInstallAttributes::kAttrEnterpriseMode[] = |
| 317 "enterprise.mode"; | 317 "enterprise.mode"; |
| 318 const char EnterpriseInstallAttributes::kAttrEnterpriseOwned[] = | 318 const char EnterpriseInstallAttributes::kAttrEnterpriseOwned[] = |
| 319 "enterprise.owned"; | 319 "enterprise.owned"; |
| 320 const char EnterpriseInstallAttributes::kAttrEnterpriseUser[] = | 320 const char EnterpriseInstallAttributes::kAttrEnterpriseUser[] = |
| 321 "enterprise.user"; | 321 "enterprise.user"; |
| 322 const char EnterpriseInstallAttributes::kAttrConsumerKioskEnabled[] = | 322 const char EnterpriseInstallAttributes::kAttrConsumerKioskEnabled[] = |
| 323 "consumer.app_kiosk_enabled"; | 323 "consumer.app_kiosk_enabled"; |
| 324 | 324 |
| 325 std::string EnterpriseInstallAttributes::GetDeviceModeString(DeviceMode mode) { | 325 std::string EnterpriseInstallAttributes::GetDeviceModeString(DeviceMode mode) { |
| 326 switch (mode) { | 326 switch (mode) { |
| 327 case DEVICE_MODE_CONSUMER: | 327 case DEVICE_MODE_CONSUMER: |
| 328 return EnterpriseInstallAttributes::kConsumerDeviceMode; | 328 return EnterpriseInstallAttributes::kConsumerDeviceMode; |
| 329 case DEVICE_MODE_ENTERPRISE: | 329 case DEVICE_MODE_ENTERPRISE: |
| 330 return EnterpriseInstallAttributes::kEnterpriseDeviceMode; | 330 return EnterpriseInstallAttributes::kEnterpriseDeviceMode; |
| 331 case DEVICE_MODE_RETAIL_KIOSK: | 331 case DEVICE_MODE_LEGACY_RETAIL_MODE: |
| 332 return EnterpriseInstallAttributes::kRetailKioskDeviceMode; | 332 return EnterpriseInstallAttributes::kLegacyRetailDeviceMode; |
| 333 case DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH: | 333 case DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH: |
| 334 return EnterpriseInstallAttributes::kConsumerKioskDeviceMode; | 334 return EnterpriseInstallAttributes::kConsumerKioskDeviceMode; |
| 335 case DEVICE_MODE_PENDING: | 335 case DEVICE_MODE_PENDING: |
| 336 case DEVICE_MODE_NOT_SET: | 336 case DEVICE_MODE_NOT_SET: |
| 337 break; | 337 break; |
| 338 } | 338 } |
| 339 NOTREACHED() << "Invalid device mode: " << mode; | 339 NOTREACHED() << "Invalid device mode: " << mode; |
| 340 return EnterpriseInstallAttributes::kUnknownDeviceMode; | 340 return EnterpriseInstallAttributes::kUnknownDeviceMode; |
| 341 } | 341 } |
| 342 | 342 |
| 343 DeviceMode EnterpriseInstallAttributes::GetDeviceModeFromString( | 343 DeviceMode EnterpriseInstallAttributes::GetDeviceModeFromString( |
| 344 const std::string& mode) { | 344 const std::string& mode) { |
| 345 if (mode == EnterpriseInstallAttributes::kConsumerDeviceMode) | 345 if (mode == EnterpriseInstallAttributes::kConsumerDeviceMode) |
| 346 return DEVICE_MODE_CONSUMER; | 346 return DEVICE_MODE_CONSUMER; |
| 347 else if (mode == EnterpriseInstallAttributes::kEnterpriseDeviceMode) | 347 else if (mode == EnterpriseInstallAttributes::kEnterpriseDeviceMode) |
| 348 return DEVICE_MODE_ENTERPRISE; | 348 return DEVICE_MODE_ENTERPRISE; |
| 349 else if (mode == EnterpriseInstallAttributes::kRetailKioskDeviceMode) | 349 else if (mode == EnterpriseInstallAttributes::kLegacyRetailDeviceMode) |
| 350 return DEVICE_MODE_RETAIL_KIOSK; | 350 return DEVICE_MODE_LEGACY_RETAIL_MODE; |
| 351 else if (mode == EnterpriseInstallAttributes::kConsumerKioskDeviceMode) | 351 else if (mode == EnterpriseInstallAttributes::kConsumerKioskDeviceMode) |
| 352 return DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH; | 352 return DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH; |
| 353 NOTREACHED() << "Unknown device mode string: " << mode; | 353 NOTREACHED() << "Unknown device mode string: " << mode; |
| 354 return DEVICE_MODE_NOT_SET; | 354 return DEVICE_MODE_NOT_SET; |
| 355 } | 355 } |
| 356 | 356 |
| 357 void EnterpriseInstallAttributes::DecodeInstallAttributes( | 357 void EnterpriseInstallAttributes::DecodeInstallAttributes( |
| 358 const std::map<std::string, std::string>& attr_map) { | 358 const std::map<std::string, std::string>& attr_map) { |
| 359 std::string enterprise_owned; | 359 std::string enterprise_owned; |
| 360 std::string enterprise_user; | 360 std::string enterprise_user; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 388 &consumer_kiosk_enabled) && | 388 &consumer_kiosk_enabled) && |
| 389 consumer_kiosk_enabled == "true") { | 389 consumer_kiosk_enabled == "true") { |
| 390 registration_mode_ = DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH; | 390 registration_mode_ = DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH; |
| 391 } else if (enterprise_user.empty() && enterprise_owned != "true") { | 391 } else if (enterprise_user.empty() && enterprise_owned != "true") { |
| 392 // |registration_user_| is empty on consumer devices. | 392 // |registration_user_| is empty on consumer devices. |
| 393 registration_mode_ = DEVICE_MODE_CONSUMER; | 393 registration_mode_ = DEVICE_MODE_CONSUMER; |
| 394 } | 394 } |
| 395 } | 395 } |
| 396 | 396 |
| 397 } // namespace policy | 397 } // namespace policy |
| OLD | NEW |