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

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

Issue 100573002: Move directory creation 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_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/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 DCHECK(background_task_runner_->RunsTasksOnCurrentThread()); 114 DCHECK(background_task_runner_->RunsTasksOnCurrentThread());
115 std::string data; 115 std::string data;
116 if (!policy.SerializeToString(&data)) { 116 if (!policy.SerializeToString(&data)) {
117 LOG(WARNING) << "Failed to serialize policy data"; 117 LOG(WARNING) << "Failed to serialize policy data";
118 UMA_HISTOGRAM_ENUMERATION(policy::kMetricPolicy, 118 UMA_HISTOGRAM_ENUMERATION(policy::kMetricPolicy,
119 kMetricPolicyStoreFailed, 119 kMetricPolicyStoreFailed,
120 policy::kMetricPolicySize); 120 policy::kMetricPolicySize);
121 return; 121 return;
122 } 122 }
123 123
124 if (!file_util::CreateDirectory(backing_file_path_.DirName())) { 124 if (!base::CreateDirectory(backing_file_path_.DirName())) {
125 LOG(WARNING) << "Failed to create directory " 125 LOG(WARNING) << "Failed to create directory "
126 << backing_file_path_.DirName().value(); 126 << backing_file_path_.DirName().value();
127 UMA_HISTOGRAM_ENUMERATION(policy::kMetricPolicy, 127 UMA_HISTOGRAM_ENUMERATION(policy::kMetricPolicy,
128 kMetricPolicyStoreFailed, 128 kMetricPolicyStoreFailed,
129 policy::kMetricPolicySize); 129 policy::kMetricPolicySize);
130 return; 130 return;
131 } 131 }
132 132
133 int size = data.size(); 133 int size = data.size();
134 if (file_util::WriteFile(backing_file_path_, data.c_str(), size) != size) { 134 if (file_util::WriteFile(backing_file_path_, data.c_str(), size) != size) {
135 LOG(WARNING) << "Failed to write " << backing_file_path_.value(); 135 LOG(WARNING) << "Failed to write " << backing_file_path_.value();
136 UMA_HISTOGRAM_ENUMERATION(policy::kMetricPolicy, 136 UMA_HISTOGRAM_ENUMERATION(policy::kMetricPolicy,
137 kMetricPolicyStoreFailed, 137 kMetricPolicyStoreFailed,
138 policy::kMetricPolicySize); 138 policy::kMetricPolicySize);
139 return; 139 return;
140 } 140 }
141 UMA_HISTOGRAM_ENUMERATION(policy::kMetricPolicy, 141 UMA_HISTOGRAM_ENUMERATION(policy::kMetricPolicy,
142 kMetricPolicyStoreSucceeded, 142 kMetricPolicyStoreSucceeded,
143 policy::kMetricPolicySize); 143 policy::kMetricPolicySize);
144 } 144 }
145 145
146 } // namespace policy 146 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698