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

Unified Diff: chrome/browser/profile_impl.cc

Issue 5174006: Move DeviceManagementPolicyProvider into the profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address feedback. Created 10 years, 1 month 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/profile_impl.cc
diff --git a/chrome/browser/profile_impl.cc b/chrome/browser/profile_impl.cc
index 02f1a2e6bbf6f95343ee5916e3ddd2a8aba9c73c..8b62962ee07cfb12dc35cca2d93259779650d27c 100644
--- a/chrome/browser/profile_impl.cc
+++ b/chrome/browser/profile_impl.cc
@@ -54,6 +54,10 @@
#include "chrome/browser/net/ssl_config_service_manager.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/password_manager/password_store_default.h"
+#include "chrome/browser/policy/configuration_policy_provider.h"
+#include "chrome/browser/policy/configuration_policy_pref_store.h"
markusheintz_ 2010/11/18 15:42:33 swap the two lines above pls (alphabetic order)
+#include "chrome/browser/policy/device_management_backend_impl.h"
+#include "chrome/browser/policy/device_management_policy_provider.h"
#include "chrome/browser/prefs/browser_prefs.h"
#include "chrome/browser/prefs/pref_value_store.h"
#include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h"
@@ -510,6 +514,10 @@ ProfileImpl::~ProfileImpl() {
// Delete the NTP resource cache so we can unregister pref observers.
ntp_resource_cache_.reset();
+ // Shut down the DM policy provider before the token service dies.
+ if (device_management_policy_provider_.get())
+ device_management_policy_provider_->Shutdown();
+
// The sync service needs to be deleted before the services it calls.
sync_service_.reset();
@@ -1311,6 +1319,26 @@ ExtensionInfoMap* ProfileImpl::GetExtensionInfoMap() {
return extension_info_map_.get();
}
+policy::DeviceManagementPolicyProvider*
+ProfileImpl::GetDeviceManagementPolicyProvider() {
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ if (!command_line->HasSwitch(switches::kDeviceManagementUrl))
+ return NULL;
+
+ if (!device_management_policy_provider_.get()) {
+ device_management_policy_provider_.reset(
+ new policy::DeviceManagementPolicyProvider(
+ policy::ConfigurationPolicyPrefStore::
+ GetChromePolicyDefinitionList(),
+ new policy::DeviceManagementBackendImpl(
+ command_line->GetSwitchValueASCII(
+ switches::kDeviceManagementUrl)),
+ GetTokenService(),
+ GetPath()));
+ }
+ return device_management_policy_provider_.get();
+}
+
PromoCounter* ProfileImpl::GetInstantPromoCounter() {
#if defined(OS_WIN)
// TODO: enable this when we're ready to turn on the promo.

Powered by Google App Engine
This is Rietveld 408576698