| 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/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 : device_locked_(false), | 93 : device_locked_(false), |
| 94 registration_mode_(DEVICE_MODE_PENDING), | 94 registration_mode_(DEVICE_MODE_PENDING), |
| 95 cryptohome_(cryptohome), | 95 cryptohome_(cryptohome), |
| 96 cryptohome_client_(cryptohome_client), | 96 cryptohome_client_(cryptohome_client), |
| 97 weak_ptr_factory_(this) {} | 97 weak_ptr_factory_(this) {} |
| 98 | 98 |
| 99 EnterpriseInstallAttributes::~EnterpriseInstallAttributes() {} | 99 EnterpriseInstallAttributes::~EnterpriseInstallAttributes() {} |
| 100 | 100 |
| 101 void EnterpriseInstallAttributes::ReadCacheFile( | 101 void EnterpriseInstallAttributes::ReadCacheFile( |
| 102 const base::FilePath& cache_file) { | 102 const base::FilePath& cache_file) { |
| 103 if (device_locked_ || !file_util::PathExists(cache_file)) | 103 if (device_locked_ || !base::PathExists(cache_file)) |
| 104 return; | 104 return; |
| 105 | 105 |
| 106 device_locked_ = true; | 106 device_locked_ = true; |
| 107 | 107 |
| 108 char buf[16384]; | 108 char buf[16384]; |
| 109 int len = file_util::ReadFile(cache_file, buf, sizeof(buf)); | 109 int len = file_util::ReadFile(cache_file, buf, sizeof(buf)); |
| 110 if (len == -1 || len >= static_cast<int>(sizeof(buf))) { | 110 if (len == -1 || len >= static_cast<int>(sizeof(buf))) { |
| 111 PLOG(ERROR) << "Failed to read " << cache_file.value(); | 111 PLOG(ERROR) << "Failed to read " << cache_file.value(); |
| 112 return; | 112 return; |
| 113 } | 113 } |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 &consumer_kiosk_enabled) && | 358 &consumer_kiosk_enabled) && |
| 359 consumer_kiosk_enabled == "true") { | 359 consumer_kiosk_enabled == "true") { |
| 360 registration_mode_ = DEVICE_MODE_CONSUMER_KIOSK; | 360 registration_mode_ = DEVICE_MODE_CONSUMER_KIOSK; |
| 361 } else if (enterprise_user.empty() && enterprise_owned != "true") { | 361 } else if (enterprise_user.empty() && enterprise_owned != "true") { |
| 362 // |registration_user_| is empty on consumer devices. | 362 // |registration_user_| is empty on consumer devices. |
| 363 registration_mode_ = DEVICE_MODE_CONSUMER; | 363 registration_mode_ = DEVICE_MODE_CONSUMER; |
| 364 } | 364 } |
| 365 } | 365 } |
| 366 | 366 |
| 367 } // namespace policy | 367 } // namespace policy |
| OLD | NEW |