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

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

Issue 7147015: Move user cloud policy to BrowserProcess (was 6979011) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit_test include breakage Created 9 years, 6 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
« no previous file with comments | « chrome/browser/policy/user_policy_cache.h ('k') | chrome/browser/policy/user_policy_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d0484f5e465ef84b6188d6f96aa6f73daeec4a2c..4ed00cc49ec0879db62cb8f609afbe44a3827843 100644
--- a/chrome/browser/policy/user_policy_cache.cc
+++ b/chrome/browser/policy/user_policy_cache.cc
@@ -10,7 +10,9 @@
#include "base/basictypes.h"
#include "base/logging.h"
#include "base/values.h"
-#include "chrome/browser/policy/configuration_policy_pref_store.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/policy_map.h"
#include "chrome/browser/policy/proto/cloud_policy.pb.h"
#include "chrome/browser/policy/proto/device_management_local.pb.h"
@@ -26,7 +28,8 @@ void DecodePolicy(const em::CloudPolicySettings& policy,
PolicyMap* mandatory, PolicyMap* recommended);
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 UserPolicyDiskCache(weak_ptr_factory_.GetWeakPtr(),
backing_file_path);
}
@@ -67,8 +70,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;
@@ -149,7 +157,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(
« no previous file with comments | « chrome/browser/policy/user_policy_cache.h ('k') | chrome/browser/policy/user_policy_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698