Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: chrome/browser/chromeos/policy/enterprise_install_attributes.cc

Issue 608283003: Remove retail mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 DeviceMode EnterpriseInstallAttributes::GetMode() { 296 DeviceMode EnterpriseInstallAttributes::GetMode() {
297 return registration_mode_; 297 return registration_mode_;
298 } 298 }
299 299
300 // Warning: The values for these keys (but not the keys themselves) are stored 300 // Warning: The values for these keys (but not the keys themselves) are stored
301 // in the protobuf with a trailing zero. Also note that some of these constants 301 // in the protobuf with a trailing zero. Also note that some of these constants
302 // have been copied to login_manager/device_policy_service.cc. Please make sure 302 // have been copied to login_manager/device_policy_service.cc. Please make sure
303 // that all changes to the constants are reflected there as well. 303 // that all changes to the constants are reflected there as well.
304 const char EnterpriseInstallAttributes::kConsumerDeviceMode[] = "consumer"; 304 const char EnterpriseInstallAttributes::kConsumerDeviceMode[] = "consumer";
305 const char EnterpriseInstallAttributes::kEnterpriseDeviceMode[] = "enterprise"; 305 const char EnterpriseInstallAttributes::kEnterpriseDeviceMode[] = "enterprise";
306 const char EnterpriseInstallAttributes::kRetailKioskDeviceMode[] = "kiosk";
307 const char EnterpriseInstallAttributes::kConsumerKioskDeviceMode[] = 306 const char EnterpriseInstallAttributes::kConsumerKioskDeviceMode[] =
308 "consumer_kiosk"; 307 "consumer_kiosk";
309 const char EnterpriseInstallAttributes::kUnknownDeviceMode[] = "unknown"; 308 const char EnterpriseInstallAttributes::kUnknownDeviceMode[] = "unknown";
310 309
311 const char EnterpriseInstallAttributes::kAttrEnterpriseDeviceId[] = 310 const char EnterpriseInstallAttributes::kAttrEnterpriseDeviceId[] =
312 "enterprise.device_id"; 311 "enterprise.device_id";
313 const char EnterpriseInstallAttributes::kAttrEnterpriseDomain[] = 312 const char EnterpriseInstallAttributes::kAttrEnterpriseDomain[] =
314 "enterprise.domain"; 313 "enterprise.domain";
315 const char EnterpriseInstallAttributes::kAttrEnterpriseMode[] = 314 const char EnterpriseInstallAttributes::kAttrEnterpriseMode[] =
316 "enterprise.mode"; 315 "enterprise.mode";
317 const char EnterpriseInstallAttributes::kAttrEnterpriseOwned[] = 316 const char EnterpriseInstallAttributes::kAttrEnterpriseOwned[] =
318 "enterprise.owned"; 317 "enterprise.owned";
319 const char EnterpriseInstallAttributes::kAttrEnterpriseUser[] = 318 const char EnterpriseInstallAttributes::kAttrEnterpriseUser[] =
320 "enterprise.user"; 319 "enterprise.user";
321 const char EnterpriseInstallAttributes::kAttrConsumerKioskEnabled[] = 320 const char EnterpriseInstallAttributes::kAttrConsumerKioskEnabled[] =
322 "consumer.app_kiosk_enabled"; 321 "consumer.app_kiosk_enabled";
323 322
324 std::string EnterpriseInstallAttributes::GetDeviceModeString(DeviceMode mode) { 323 std::string EnterpriseInstallAttributes::GetDeviceModeString(DeviceMode mode) {
325 switch (mode) { 324 switch (mode) {
326 case DEVICE_MODE_CONSUMER: 325 case DEVICE_MODE_CONSUMER:
327 return EnterpriseInstallAttributes::kConsumerDeviceMode; 326 return EnterpriseInstallAttributes::kConsumerDeviceMode;
328 case DEVICE_MODE_ENTERPRISE: 327 case DEVICE_MODE_ENTERPRISE:
329 return EnterpriseInstallAttributes::kEnterpriseDeviceMode; 328 return EnterpriseInstallAttributes::kEnterpriseDeviceMode;
330 case DEVICE_MODE_RETAIL_KIOSK:
331 return EnterpriseInstallAttributes::kRetailKioskDeviceMode;
332 case DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH: 329 case DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH:
333 return EnterpriseInstallAttributes::kConsumerKioskDeviceMode; 330 return EnterpriseInstallAttributes::kConsumerKioskDeviceMode;
334 case DEVICE_MODE_PENDING: 331 case DEVICE_MODE_PENDING:
335 case DEVICE_MODE_NOT_SET: 332 case DEVICE_MODE_NOT_SET:
336 break; 333 break;
337 } 334 }
338 NOTREACHED() << "Invalid device mode: " << mode; 335 NOTREACHED() << "Invalid device mode: " << mode;
339 return EnterpriseInstallAttributes::kUnknownDeviceMode; 336 return EnterpriseInstallAttributes::kUnknownDeviceMode;
340 } 337 }
341 338
342 DeviceMode EnterpriseInstallAttributes::GetDeviceModeFromString( 339 DeviceMode EnterpriseInstallAttributes::GetDeviceModeFromString(
343 const std::string& mode) { 340 const std::string& mode) {
344 if (mode == EnterpriseInstallAttributes::kConsumerDeviceMode) 341 if (mode == EnterpriseInstallAttributes::kConsumerDeviceMode)
345 return DEVICE_MODE_CONSUMER; 342 return DEVICE_MODE_CONSUMER;
346 else if (mode == EnterpriseInstallAttributes::kEnterpriseDeviceMode) 343 else if (mode == EnterpriseInstallAttributes::kEnterpriseDeviceMode)
347 return DEVICE_MODE_ENTERPRISE; 344 return DEVICE_MODE_ENTERPRISE;
348 else if (mode == EnterpriseInstallAttributes::kRetailKioskDeviceMode)
349 return DEVICE_MODE_RETAIL_KIOSK;
350 else if (mode == EnterpriseInstallAttributes::kConsumerKioskDeviceMode) 345 else if (mode == EnterpriseInstallAttributes::kConsumerKioskDeviceMode)
351 return DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH; 346 return DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH;
352 NOTREACHED() << "Unknown device mode string: " << mode; 347 NOTREACHED() << "Unknown device mode string: " << mode;
Mattias Nissler (ping if slow) 2014/10/02 09:56:47 We'll now hit the NOTREACHED() here for devices al
rkc 2014/11/20 21:06:34 Changed this code. We will now handle devices curr
353 return DEVICE_MODE_NOT_SET; 348 return DEVICE_MODE_NOT_SET;
354 } 349 }
355 350
356 void EnterpriseInstallAttributes::DecodeInstallAttributes( 351 void EnterpriseInstallAttributes::DecodeInstallAttributes(
357 const std::map<std::string, std::string>& attr_map) { 352 const std::map<std::string, std::string>& attr_map) {
358 std::string enterprise_owned; 353 std::string enterprise_owned;
359 std::string enterprise_user; 354 std::string enterprise_user;
360 std::string consumer_kiosk_enabled; 355 std::string consumer_kiosk_enabled;
361 if (ReadMapKey(attr_map, kAttrEnterpriseOwned, &enterprise_owned) && 356 if (ReadMapKey(attr_map, kAttrEnterpriseOwned, &enterprise_owned) &&
362 ReadMapKey(attr_map, kAttrEnterpriseUser, &enterprise_user) && 357 ReadMapKey(attr_map, kAttrEnterpriseUser, &enterprise_user) &&
(...skipping 24 matching lines...) Expand all
387 &consumer_kiosk_enabled) && 382 &consumer_kiosk_enabled) &&
388 consumer_kiosk_enabled == "true") { 383 consumer_kiosk_enabled == "true") {
389 registration_mode_ = DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH; 384 registration_mode_ = DEVICE_MODE_CONSUMER_KIOSK_AUTOLAUNCH;
390 } else if (enterprise_user.empty() && enterprise_owned != "true") { 385 } else if (enterprise_user.empty() && enterprise_owned != "true") {
391 // |registration_user_| is empty on consumer devices. 386 // |registration_user_| is empty on consumer devices.
392 registration_mode_ = DEVICE_MODE_CONSUMER; 387 registration_mode_ = DEVICE_MODE_CONSUMER;
393 } 388 }
394 } 389 }
395 390
396 } // namespace policy 391 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698