Index: chrome/browser/profile_impl.cc |
diff --git a/chrome/browser/profile_impl.cc b/chrome/browser/profile_impl.cc |
index 02f1a2e6bbf6f95343ee5916e3ddd2a8aba9c73c..cf736fc26096516f186116f2fc90be551ded554d 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" |
+#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,25 @@ ExtensionInfoMap* ProfileImpl::GetExtensionInfoMap() { |
return extension_info_map_.get(); |
} |
+policy::DeviceManagementPolicyProvider* |
+ProfileImpl::GetDeviceManagementPolicyProvider() { |
+ if (!device_management_policy_provider_.get()) { |
+ CommandLine* command_line = CommandLine::ForCurrentProcess(); |
+ if (command_line->HasSwitch(switches::kDeviceManagementUrl)) { |
+ device_management_policy_provider_.reset( |
+ new policy::DeviceManagementPolicyProvider( |
+ policy::ConfigurationPolicyPrefStore:: |
+ GetChromePolicyDefinitionList(), |
+ new policy::DeviceManagementBackendImpl( |
+ command_line->GetSwitchValueASCII( |
+ switches::kDeviceManagementUrl)), |
+ GetTokenService(), |
+ GetPath())); |
+ } |
+ } |
Nico
2010/11/18 14:34:24
I like early exits, they lead to less "indenty" co
Mattias Nissler (ping if slow)
2010/11/18 15:08:16
Yay, me too! But there are many people who don't.
|
+ 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. |