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

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

Issue 22812002: Refactored ConfigurationPolicyPrefStore to not depend on chrome/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 4 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/configuration_policy_pref_store.cc
diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc
index 8b7d10a17dc1c14e4796c37a013fec5392434b1b..63ca6a9eb695827289085c3a90e90fc3ee142726 100644
--- a/chrome/browser/policy/configuration_policy_pref_store.cc
+++ b/chrome/browser/policy/configuration_policy_pref_store.cc
@@ -9,18 +9,14 @@
#include "base/bind.h"
#include "base/logging.h"
+#include "base/message_loop/message_loop.h"
#include "base/prefs/pref_value_map.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/browser_process.h"
-#include "chrome/browser/policy/browser_policy_connector.h"
#include "chrome/browser/policy/configuration_policy_handler_list.h"
#include "chrome/browser/policy/policy_error_map.h"
-#include "content/public/browser/browser_thread.h"
#include "policy/policy_constants.h"
-using content::BrowserThread;
-
namespace policy {
namespace {
@@ -40,8 +36,10 @@ void LogErrors(PolicyErrorMap* errors) {
ConfigurationPolicyPrefStore::ConfigurationPolicyPrefStore(
PolicyService* service,
+ const ConfigurationPolicyHandlerList* handler_list,
PolicyLevel level)
: policy_service_(service),
+ handler_list_(handler_list),
level_(level) {
// Read initial policy.
prefs_.reset(CreatePreferencesFromPolicies());
@@ -93,22 +91,6 @@ void ConfigurationPolicyPrefStore::OnPolicyServiceInitialized(
}
}
-// static
-ConfigurationPolicyPrefStore*
-ConfigurationPolicyPrefStore::CreateMandatoryPolicyPrefStore(
- PolicyService* policy_service) {
- return new ConfigurationPolicyPrefStore(policy_service,
- POLICY_LEVEL_MANDATORY);
-}
-
-// static
-ConfigurationPolicyPrefStore*
-ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore(
- PolicyService* policy_service) {
- return new ConfigurationPolicyPrefStore(policy_service,
- POLICY_LEVEL_RECOMMENDED);
-}
-
ConfigurationPolicyPrefStore::~ConfigurationPolicyPrefStore() {
policy_service_->RemoveObserver(POLICY_DOMAIN_CHROME, this);
}
@@ -137,18 +119,14 @@ PrefValueMap* ConfigurationPolicyPrefStore::CreatePreferencesFromPolicies() {
scoped_ptr<PolicyErrorMap> errors(new PolicyErrorMap);
- const ConfigurationPolicyHandlerList* handler_list =
- g_browser_process->browser_policy_connector()->GetHandlerList();
- handler_list->ApplyPolicySettings(filtered_policies,
- prefs.get(),
- errors.get());
+ handler_list_->ApplyPolicySettings(filtered_policies,
+ prefs.get(),
+ errors.get());
// Retrieve and log the errors once the UI loop is ready. This is only an
// issue during startup.
- BrowserThread::PostTask(BrowserThread::UI,
- FROM_HERE,
- base::Bind(&LogErrors,
- base::Owned(errors.release())));
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE, base::Bind(&LogErrors, base::Owned(errors.release())));
return prefs.release();
}

Powered by Google App Engine
This is Rietveld 408576698