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/user_cloud_policy_store_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 return; | 498 return; |
499 } | 499 } |
500 | 500 |
501 int64 size; | 501 int64 size; |
502 if (!base::GetFileSize(path, &size)) { | 502 if (!base::GetFileSize(path, &size)) { |
503 LOG(ERROR) << "Could not get size of " << path.value(); | 503 LOG(ERROR) << "Could not get size of " << path.value(); |
504 } else if (size == 0 || size > kKeySizeLimit) { | 504 } else if (size == 0 || size > kKeySizeLimit) { |
505 LOG(ERROR) << "Key at " << path.value() << " has bad size " << size; | 505 LOG(ERROR) << "Key at " << path.value() << " has bad size " << size; |
506 } else { | 506 } else { |
507 key->resize(size); | 507 key->resize(size); |
508 int read_size = file_util::ReadFile( | 508 int read_size = base::ReadFile( |
509 path, reinterpret_cast<char*>(vector_as_array(key)), size); | 509 path, reinterpret_cast<char*>(vector_as_array(key)), size); |
510 if (read_size != size) { | 510 if (read_size != size) { |
511 LOG(ERROR) << "Failed to read key at " << path.value(); | 511 LOG(ERROR) << "Failed to read key at " << path.value(); |
512 key->clear(); | 512 key->clear(); |
513 } | 513 } |
514 } | 514 } |
515 | 515 |
516 if (key->empty()) | 516 if (key->empty()) |
517 SampleValidationFailure(VALIDATION_FAILURE_LOAD_KEY); | 517 SampleValidationFailure(VALIDATION_FAILURE_LOAD_KEY); |
518 } | 518 } |
(...skipping 29 matching lines...) Expand all Loading... |
548 !sanitized_username.empty()) { | 548 !sanitized_username.empty()) { |
549 policy_key_path_ = user_policy_key_dir_.Append( | 549 policy_key_path_ = user_policy_key_dir_.Append( |
550 base::StringPrintf(kPolicyKeyFile, sanitized_username.c_str())); | 550 base::StringPrintf(kPolicyKeyFile, sanitized_username.c_str())); |
551 } else { | 551 } else { |
552 SampleValidationFailure(VALIDATION_FAILURE_DBUS); | 552 SampleValidationFailure(VALIDATION_FAILURE_DBUS); |
553 } | 553 } |
554 ReloadPolicyKey(callback); | 554 ReloadPolicyKey(callback); |
555 } | 555 } |
556 | 556 |
557 } // namespace policy | 557 } // namespace policy |
OLD | NEW |