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/user_cloud_policy_store_chromeos.h" | 5 #include "chrome/browser/policy/user_cloud_policy_store_chromeos.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 175 } |
176 | 176 |
177 void UserCloudPolicyStoreChromeOS::Load() { | 177 void UserCloudPolicyStoreChromeOS::Load() { |
178 // Cancel all pending requests. | 178 // Cancel all pending requests. |
179 weak_factory_.InvalidateWeakPtrs(); | 179 weak_factory_.InvalidateWeakPtrs(); |
180 session_manager_client_->RetrieveUserPolicy( | 180 session_manager_client_->RetrieveUserPolicy( |
181 base::Bind(&UserCloudPolicyStoreChromeOS::OnPolicyRetrieved, | 181 base::Bind(&UserCloudPolicyStoreChromeOS::OnPolicyRetrieved, |
182 weak_factory_.GetWeakPtr())); | 182 weak_factory_.GetWeakPtr())); |
183 } | 183 } |
184 | 184 |
| 185 void UserCloudPolicyStoreChromeOS::RemoveStoredPolicy() { |
| 186 // This should never be called on ChromeOS since it is not possible to sign |
| 187 // out of a Profile. The underlying policy store is only removed if the |
| 188 // Profile itself is deleted. |
| 189 NOTREACHED(); |
| 190 } |
| 191 |
185 void UserCloudPolicyStoreChromeOS::OnPolicyRetrieved( | 192 void UserCloudPolicyStoreChromeOS::OnPolicyRetrieved( |
186 const std::string& policy_blob) { | 193 const std::string& policy_blob) { |
187 if (policy_blob.empty()) { | 194 if (policy_blob.empty()) { |
188 // Policy fetch failed. Try legacy caches if we haven't done that already. | 195 // Policy fetch failed. Try legacy caches if we haven't done that already. |
189 if (!legacy_caches_loaded_ && legacy_loader_.get()) { | 196 if (!legacy_caches_loaded_ && legacy_loader_.get()) { |
190 legacy_caches_loaded_ = true; | 197 legacy_caches_loaded_ = true; |
191 legacy_loader_->Load( | 198 legacy_loader_->Load( |
192 base::Bind(&UserCloudPolicyStoreChromeOS::OnLegacyLoadFinished, | 199 base::Bind(&UserCloudPolicyStoreChromeOS::OnLegacyLoadFinished, |
193 weak_factory_.GetWeakPtr())); | 200 weak_factory_.GetWeakPtr())); |
194 } else { | 201 } else { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 .Append(kPolicyDir); | 370 .Append(kPolicyDir); |
364 const FilePath policy_cache_file = policy_dir.Append(kPolicyCacheFile); | 371 const FilePath policy_cache_file = policy_dir.Append(kPolicyCacheFile); |
365 const FilePath token_cache_file = policy_dir.Append(kTokenCacheFile); | 372 const FilePath token_cache_file = policy_dir.Append(kTokenCacheFile); |
366 | 373 |
367 return scoped_ptr<CloudPolicyStore>(new UserCloudPolicyStoreChromeOS( | 374 return scoped_ptr<CloudPolicyStore>(new UserCloudPolicyStoreChromeOS( |
368 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), | 375 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), |
369 token_cache_file, policy_cache_file)); | 376 token_cache_file, policy_cache_file)); |
370 } | 377 } |
371 | 378 |
372 } // namespace policy | 379 } // namespace policy |
OLD | NEW |