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

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

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months 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_policy_disk_cache.h" 5 #include "chrome/browser/chromeos/policy/user_policy_disk_cache.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 BrowserThread::FILE, FROM_HERE, 59 BrowserThread::FILE, FROM_HERE,
60 base::Bind(&UserPolicyDiskCache::StoreOnFileThread, this, policy)); 60 base::Bind(&UserPolicyDiskCache::StoreOnFileThread, this, policy));
61 } 61 }
62 62
63 UserPolicyDiskCache::~UserPolicyDiskCache() {} 63 UserPolicyDiskCache::~UserPolicyDiskCache() {}
64 64
65 void UserPolicyDiskCache::LoadOnFileThread() { 65 void UserPolicyDiskCache::LoadOnFileThread() {
66 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 66 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
67 67
68 em::CachedCloudPolicyResponse cached_response; 68 em::CachedCloudPolicyResponse cached_response;
69 if (!file_util::PathExists(backing_file_path_)) { 69 if (!base::PathExists(backing_file_path_)) {
70 LoadDone(LOAD_RESULT_NOT_FOUND, cached_response); 70 LoadDone(LOAD_RESULT_NOT_FOUND, cached_response);
71 return; 71 return;
72 } 72 }
73 73
74 // Read the protobuf from the file. 74 // Read the protobuf from the file.
75 std::string data; 75 std::string data;
76 if (!file_util::ReadFileToString(backing_file_path_, &data)) { 76 if (!file_util::ReadFileToString(backing_file_path_, &data)) {
77 LOG(WARNING) << "Failed to read policy data from " 77 LOG(WARNING) << "Failed to read policy data from "
78 << backing_file_path_.value(); 78 << backing_file_path_.value();
79 LoadDone(LOAD_RESULT_READ_ERROR, cached_response); 79 LoadDone(LOAD_RESULT_READ_ERROR, cached_response);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 int size = data.size(); 140 int size = data.size();
141 if (file_util::WriteFile(backing_file_path_, data.c_str(), size) != size) { 141 if (file_util::WriteFile(backing_file_path_, data.c_str(), size) != size) {
142 LOG(WARNING) << "Failed to write " << backing_file_path_.value(); 142 LOG(WARNING) << "Failed to write " << backing_file_path_.value();
143 SampleUMA(kMetricPolicyStoreFailed); 143 SampleUMA(kMetricPolicyStoreFailed);
144 return; 144 return;
145 } 145 }
146 SampleUMA(kMetricPolicyStoreSucceeded); 146 SampleUMA(kMetricPolicyStoreSucceeded);
147 } 147 }
148 148
149 } // namespace policy 149 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698