| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 true, | 203 true, |
| 204 base::Bind(&UserCloudPolicyStore::StorePolicyAfterValidation, | 204 base::Bind(&UserCloudPolicyStore::StorePolicyAfterValidation, |
| 205 weak_factory_.GetWeakPtr())); | 205 weak_factory_.GetWeakPtr())); |
| 206 } | 206 } |
| 207 | 207 |
| 208 void UserCloudPolicyStore::Validate( | 208 void UserCloudPolicyStore::Validate( |
| 209 scoped_ptr<em::PolicyFetchResponse> policy, | 209 scoped_ptr<em::PolicyFetchResponse> policy, |
| 210 bool validate_in_background, | 210 bool validate_in_background, |
| 211 const UserCloudPolicyValidator::CompletionCallback& callback) { | 211 const UserCloudPolicyValidator::CompletionCallback& callback) { |
| 212 // Configure the validator. | 212 // Configure the validator. |
| 213 scoped_ptr<UserCloudPolicyValidator> validator = | 213 scoped_ptr<UserCloudPolicyValidator> validator = CreateValidator( |
| 214 CreateValidator(policy.Pass()); | 214 policy.Pass(), |
| 215 CloudPolicyValidatorBase::TIMESTAMP_NOT_BEFORE); |
| 215 SigninManager* signin = SigninManagerFactory::GetForProfileIfExists(profile_); | 216 SigninManager* signin = SigninManagerFactory::GetForProfileIfExists(profile_); |
| 216 if (signin) { | 217 if (signin) { |
| 217 std::string username = signin->GetAuthenticatedUsername(); | 218 std::string username = signin->GetAuthenticatedUsername(); |
| 218 if (username.empty()) | 219 if (username.empty()) |
| 219 username = signin->GetUsernameForAuthInProgress(); | 220 username = signin->GetUsernameForAuthInProgress(); |
| 220 | 221 |
| 221 // Validate the username if the user is signed in (or in the process of | 222 // Validate the username if the user is signed in (or in the process of |
| 222 // signing in). | 223 // signing in). |
| 223 if (!username.empty()) | 224 if (!username.empty()) |
| 224 validator->ValidateUsername(username); | 225 validator->ValidateUsername(username); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 250 content::BrowserThread::PostTask( | 251 content::BrowserThread::PostTask( |
| 251 content::BrowserThread::FILE, FROM_HERE, | 252 content::BrowserThread::FILE, FROM_HERE, |
| 252 base::Bind(&StorePolicyToDiskOnFileThread, | 253 base::Bind(&StorePolicyToDiskOnFileThread, |
| 253 backing_file_path_, *validator->policy())); | 254 backing_file_path_, *validator->policy())); |
| 254 InstallPolicy(validator->policy_data().Pass(), validator->payload().Pass()); | 255 InstallPolicy(validator->policy_data().Pass(), validator->payload().Pass()); |
| 255 status_ = STATUS_OK; | 256 status_ = STATUS_OK; |
| 256 NotifyStoreLoaded(); | 257 NotifyStoreLoaded(); |
| 257 } | 258 } |
| 258 | 259 |
| 259 } // namespace policy | 260 } // namespace policy |
| OLD | NEW |