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

Side by Side Diff: chrome/browser/policy/cloud/user_cloud_policy_store.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/policy/cloud/user_cloud_policy_store.h" 5 #include "chrome/browser/policy/cloud/user_cloud_policy_store.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/location.h" 9 #include "base/location.h"
10 #include "base/task_runner_util.h" 10 #include "base/task_runner_util.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 void StorePolicyToDiskOnBackgroundThread( 70 void StorePolicyToDiskOnBackgroundThread(
71 const base::FilePath& path, 71 const base::FilePath& path,
72 const em::PolicyFetchResponse& policy) { 72 const em::PolicyFetchResponse& policy) {
73 DVLOG(1) << "Storing policy to " << path.value(); 73 DVLOG(1) << "Storing policy to " << path.value();
74 std::string data; 74 std::string data;
75 if (!policy.SerializeToString(&data)) { 75 if (!policy.SerializeToString(&data)) {
76 DLOG(WARNING) << "Failed to serialize policy data"; 76 DLOG(WARNING) << "Failed to serialize policy data";
77 return; 77 return;
78 } 78 }
79 79
80 if (!file_util::CreateDirectory(path.DirName())) { 80 if (!base::CreateDirectory(path.DirName())) {
81 DLOG(WARNING) << "Failed to create directory " << path.DirName().value(); 81 DLOG(WARNING) << "Failed to create directory " << path.DirName().value();
82 return; 82 return;
83 } 83 }
84 84
85 int size = data.size(); 85 int size = data.size();
86 if (file_util::WriteFile(path, data.c_str(), size) != size) { 86 if (file_util::WriteFile(path, data.c_str(), size) != size) {
87 DLOG(WARNING) << "Failed to write " << path.value(); 87 DLOG(WARNING) << "Failed to write " << path.value();
88 } 88 }
89 } 89 }
90 90
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 background_task_runner()->PostTask( 247 background_task_runner()->PostTask(
248 FROM_HERE, 248 FROM_HERE,
249 base::Bind(&StorePolicyToDiskOnBackgroundThread, 249 base::Bind(&StorePolicyToDiskOnBackgroundThread,
250 backing_file_path_, *validator->policy())); 250 backing_file_path_, *validator->policy()));
251 InstallPolicy(validator->policy_data().Pass(), validator->payload().Pass()); 251 InstallPolicy(validator->policy_data().Pass(), validator->payload().Pass());
252 status_ = STATUS_OK; 252 status_ = STATUS_OK;
253 NotifyStoreLoaded(); 253 NotifyStoreLoaded();
254 } 254 }
255 255
256 } // namespace policy 256 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud/resource_cache.cc ('k') | chrome/browser/policy/cloud/user_cloud_policy_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698