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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 EnterpriseInstallAttributes::~EnterpriseInstallAttributes() {} | 100 EnterpriseInstallAttributes::~EnterpriseInstallAttributes() {} |
101 | 101 |
102 void EnterpriseInstallAttributes::ReadCacheFile( | 102 void EnterpriseInstallAttributes::ReadCacheFile( |
103 const base::FilePath& cache_file) { | 103 const base::FilePath& cache_file) { |
104 if (device_locked_ || !base::PathExists(cache_file)) | 104 if (device_locked_ || !base::PathExists(cache_file)) |
105 return; | 105 return; |
106 | 106 |
107 device_locked_ = true; | 107 device_locked_ = true; |
108 | 108 |
109 char buf[16384]; | 109 char buf[16384]; |
110 int len = base::ReadFile(cache_file, buf, sizeof(buf)); | 110 int len = file_util::ReadFile(cache_file, buf, sizeof(buf)); |
111 if (len == -1 || len >= static_cast<int>(sizeof(buf))) { | 111 if (len == -1 || len >= static_cast<int>(sizeof(buf))) { |
112 PLOG(ERROR) << "Failed to read " << cache_file.value(); | 112 PLOG(ERROR) << "Failed to read " << cache_file.value(); |
113 return; | 113 return; |
114 } | 114 } |
115 | 115 |
116 cryptohome::SerializedInstallAttributes install_attrs_proto; | 116 cryptohome::SerializedInstallAttributes install_attrs_proto; |
117 if (!install_attrs_proto.ParseFromArray(buf, len)) { | 117 if (!install_attrs_proto.ParseFromArray(buf, len)) { |
118 LOG(ERROR) << "Failed to parse install attributes cache"; | 118 LOG(ERROR) << "Failed to parse install attributes cache"; |
119 return; | 119 return; |
120 } | 120 } |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 &consumer_kiosk_enabled) && | 366 &consumer_kiosk_enabled) && |
367 consumer_kiosk_enabled == "true") { | 367 consumer_kiosk_enabled == "true") { |
368 registration_mode_ = DEVICE_MODE_CONSUMER_KIOSK; | 368 registration_mode_ = DEVICE_MODE_CONSUMER_KIOSK; |
369 } else if (enterprise_user.empty() && enterprise_owned != "true") { | 369 } else if (enterprise_user.empty() && enterprise_owned != "true") { |
370 // |registration_user_| is empty on consumer devices. | 370 // |registration_user_| is empty on consumer devices. |
371 registration_mode_ = DEVICE_MODE_CONSUMER; | 371 registration_mode_ = DEVICE_MODE_CONSUMER; |
372 } | 372 } |
373 } | 373 } |
374 | 374 |
375 } // namespace policy | 375 } // namespace policy |
OLD | NEW |