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

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

Issue 109043002: Move more file_util functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
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/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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/enterprise_install_attributes.cc ('k') | chrome/browser/chromeos/settings/owner_key_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698