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

Unified Diff: chrome/browser/policy/user_policy_cache.cc

Issue 9404011: Explicitly wait for user policy before completing login. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/user_policy_cache.cc
diff --git a/chrome/browser/policy/user_policy_cache.cc b/chrome/browser/policy/user_policy_cache.cc
index ec5afd94add6ab8c29be81d1ed09466eb0981bfc..e352f2b7c39fb15d578fffeb9679edfab1c76118 100644
--- a/chrome/browser/policy/user_policy_cache.cc
+++ b/chrome/browser/policy/user_policy_cache.cc
@@ -27,10 +27,12 @@ namespace policy {
void DecodePolicy(const em::CloudPolicySettings& policy, PolicyMap* map);
UserPolicyCache::UserPolicyCache(const FilePath& backing_file_path,
- bool wait_for_policy_fetch)
+ bool wait_for_policy_fetch,
+ const base::Closure& callback)
: ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)),
disk_cache_ready_(false),
- fetch_ready_(!wait_for_policy_fetch) {
+ fetch_ready_(!wait_for_policy_fetch),
+ ready_callback_(callback) {
disk_cache_ = new UserPolicyDiskCache(weak_ptr_factory_.GetWeakPtr(),
backing_file_path);
}
@@ -117,8 +119,13 @@ bool UserPolicyCache::DecodePolicyData(const em::PolicyData& policy_data,
}
void UserPolicyCache::CheckIfReady() {
- if (!IsReady() && disk_cache_ready_ && fetch_ready_)
+ if (!IsReady() && disk_cache_ready_ && fetch_ready_) {
SetReady();
Mattias Nissler (ping if slow) 2012/02/16 10:24:11 Are you going to clean up all the existing ready-s
+ if (!ready_callback_.is_null()) {
+ ready_callback_.Run();
+ ready_callback_.Reset();
+ }
+ }
}
// Everything below is only needed for supporting old-style GenericNamedValue

Powered by Google App Engine
This is Rietveld 408576698