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 6d0a53edb90d11437ca986ddc402764237ae56ce..fdcaec7c6060d5715d4f35634ef8f37021267d83 100644 |
--- a/chrome/browser/policy/user_policy_cache.cc |
+++ b/chrome/browser/policy/user_policy_cache.cc |
@@ -12,6 +12,9 @@ |
#include "base/logging.h" |
#include "base/task.h" |
#include "base/values.h" |
+#include "chrome/browser/browser_process.h" |
+#include "chrome/browser/policy/browser_policy_connector.h" |
+#include "chrome/browser/policy/cloud_policy_provider.h" |
#include "chrome/browser/policy/configuration_policy_pref_store.h" |
#include "chrome/browser/policy/policy_map.h" |
#include "chrome/browser/policy/proto/cloud_policy.pb.h" |
@@ -141,7 +144,8 @@ void UserPolicyCache::DiskCache::StoreOnFileThread( |
} |
UserPolicyCache::UserPolicyCache(const FilePath& backing_file_path) |
- : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { |
+ : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), |
+ first_load_complete_(false) { |
disk_cache_ = new DiskCache(weak_ptr_factory_.GetWeakPtr(), |
backing_file_path); |
} |
@@ -182,8 +186,13 @@ void UserPolicyCache::SetUnmanaged() { |
disk_cache_->Store(cached_policy); |
} |
+bool UserPolicyCache::IsReady() { |
+ return initialization_complete() || first_load_complete_; |
+} |
+ |
void UserPolicyCache::OnDiskCacheLoaded( |
const em::CachedCloudPolicyResponse& cached_response) { |
+ first_load_complete_ = true; |
if (initialization_complete()) |
return; |
@@ -264,7 +273,8 @@ void UserPolicyCache::MaybeDecodeOldstylePolicy( |
// Hack: Let one of the providers do the transformation from DictionaryValue |
// to PolicyMap, since they have the required code anyway. |
PolicyMapProxy map_proxy(mandatory); |
- GetManagedPolicyProvider()->ApplyPolicyValueTree(&result, &map_proxy); |
+ g_browser_process->browser_policy_connector()->GetManagedCloudProvider()-> |
+ ApplyPolicyValueTree(&result, &map_proxy); |
} |
Value* UserPolicyCache::DecodeIntegerValue( |