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

Side by Side Diff: chrome/browser/chromeos/settings/owner_key_util.cc

Issue 102873002: Move GetFileSize, NormalizeFilePath 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/settings/owner_key_util.h" 5 #include "chrome/browser/chromeos/settings/owner_key_util.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 21 matching lines...) Expand all
32 // OwnerKeyUtilImpl 32 // OwnerKeyUtilImpl
33 33
34 OwnerKeyUtilImpl::OwnerKeyUtilImpl(const base::FilePath& key_file) 34 OwnerKeyUtilImpl::OwnerKeyUtilImpl(const base::FilePath& key_file)
35 : key_file_(key_file) {} 35 : key_file_(key_file) {}
36 36
37 OwnerKeyUtilImpl::~OwnerKeyUtilImpl() {} 37 OwnerKeyUtilImpl::~OwnerKeyUtilImpl() {}
38 38
39 bool OwnerKeyUtilImpl::ImportPublicKey(std::vector<uint8>* output) { 39 bool OwnerKeyUtilImpl::ImportPublicKey(std::vector<uint8>* output) {
40 // Get the file size (must fit in a 32 bit int for NSS). 40 // Get the file size (must fit in a 32 bit int for NSS).
41 int64 file_size; 41 int64 file_size;
42 if (!file_util::GetFileSize(key_file_, &file_size)) { 42 if (!base::GetFileSize(key_file_, &file_size)) {
43 LOG(ERROR) << "Could not get size of " << key_file_.value(); 43 LOG(ERROR) << "Could not get size of " << key_file_.value();
44 return false; 44 return false;
45 } 45 }
46 if (file_size > static_cast<int64>(std::numeric_limits<int>::max())) { 46 if (file_size > static_cast<int64>(std::numeric_limits<int>::max())) {
47 LOG(ERROR) << key_file_.value() << "is " 47 LOG(ERROR) << key_file_.value() << "is "
48 << file_size << "bytes!!! Too big!"; 48 << file_size << "bytes!!! Too big!";
49 return false; 49 return false;
50 } 50 }
51 int32 safe_file_size = static_cast<int32>(file_size); 51 int32 safe_file_size = static_cast<int32>(file_size);
52 52
(...skipping 15 matching lines...) Expand all
68 crypto::RSAPrivateKey* OwnerKeyUtilImpl::FindPrivateKey( 68 crypto::RSAPrivateKey* OwnerKeyUtilImpl::FindPrivateKey(
69 const std::vector<uint8>& key) { 69 const std::vector<uint8>& key) {
70 return crypto::RSAPrivateKey::FindFromPublicKeyInfo(key); 70 return crypto::RSAPrivateKey::FindFromPublicKeyInfo(key);
71 } 71 }
72 72
73 bool OwnerKeyUtilImpl::IsPublicKeyPresent() { 73 bool OwnerKeyUtilImpl::IsPublicKeyPresent() {
74 return base::PathExists(key_file_); 74 return base::PathExists(key_file_);
75 } 75 }
76 76
77 } // namespace chromeos 77 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.cc ('k') | chrome/browser/diagnostics/recon_diagnostics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698