OLD | NEW |
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 "chrome/browser/policy/proto/cloud/device_management_backend.pb.h" | 9 #include "chrome/browser/policy/proto/cloud/device_management_backend.pb.h" |
10 #include "chrome/browser/policy/proto/cloud/device_management_local.pb.h" | 10 #include "chrome/browser/policy/proto/cloud/device_management_local.pb.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 weak_factory_.InvalidateWeakPtrs(); | 115 weak_factory_.InvalidateWeakPtrs(); |
116 // Load the policy from disk... | 116 // Load the policy from disk... |
117 PolicyLoadResult result = LoadPolicyFromDisk(backing_file_path_); | 117 PolicyLoadResult result = LoadPolicyFromDisk(backing_file_path_); |
118 // ...and install it, reporting success/failure to any observers. | 118 // ...and install it, reporting success/failure to any observers. |
119 PolicyLoaded(false, result); | 119 PolicyLoaded(false, result); |
120 } | 120 } |
121 | 121 |
122 void UserCloudPolicyStore::Clear() { | 122 void UserCloudPolicyStore::Clear() { |
123 content::BrowserThread::PostTask( | 123 content::BrowserThread::PostTask( |
124 content::BrowserThread::FILE, FROM_HERE, | 124 content::BrowserThread::FILE, FROM_HERE, |
125 base::Bind(base::IgnoreResult(&base::Delete), | 125 base::Bind(base::IgnoreResult(&base::DeleteFile), |
126 backing_file_path_, | 126 backing_file_path_, |
127 false)); | 127 false)); |
128 policy_.reset(); | 128 policy_.reset(); |
129 policy_map_.Clear(); | 129 policy_map_.Clear(); |
130 NotifyStoreLoaded(); | 130 NotifyStoreLoaded(); |
131 } | 131 } |
132 | 132 |
133 void UserCloudPolicyStore::Load() { | 133 void UserCloudPolicyStore::Load() { |
134 DVLOG(1) << "Initiating policy load from disk"; | 134 DVLOG(1) << "Initiating policy load from disk"; |
135 // Cancel any pending Load/Store/Validate operations. | 135 // Cancel any pending Load/Store/Validate operations. |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 content::BrowserThread::PostTask( | 250 content::BrowserThread::PostTask( |
251 content::BrowserThread::FILE, FROM_HERE, | 251 content::BrowserThread::FILE, FROM_HERE, |
252 base::Bind(&StorePolicyToDiskOnFileThread, | 252 base::Bind(&StorePolicyToDiskOnFileThread, |
253 backing_file_path_, *validator->policy())); | 253 backing_file_path_, *validator->policy())); |
254 InstallPolicy(validator->policy_data().Pass(), validator->payload().Pass()); | 254 InstallPolicy(validator->policy_data().Pass(), validator->payload().Pass()); |
255 status_ = STATUS_OK; | 255 status_ = STATUS_OK; |
256 NotifyStoreLoaded(); | 256 NotifyStoreLoaded(); |
257 } | 257 } |
258 | 258 |
259 } // namespace policy | 259 } // namespace policy |
OLD | NEW |