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

Unified Diff: chrome/browser/profile_impl.cc

Issue 5178005: Rework the device management backend implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « chrome/browser/profile_impl.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profile_impl.cc
diff --git a/chrome/browser/profile_impl.cc b/chrome/browser/profile_impl.cc
index 02f1a2e6bbf6f95343ee5916e3ddd2a8aba9c73c..baaa07552617b354f851e0bfef783f8144baa4f7 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_service.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"
@@ -351,6 +355,11 @@ ProfileImpl::ProfileImpl(const FilePath& path)
extension_info_map_ = new ExtensionInfoMap();
+ policy::DeviceManagementService* device_management_service =
+ GetDeviceManagementService();
+ if (device_management_service)
+ device_management_service->Initialize(GetRequestContext());
+
// Log the profile size after a reasonable startup delay.
BrowserThread::PostDelayedTask(BrowserThread::FILE, FROM_HERE,
new ProfileSizeTask(path_), 112000);
@@ -485,6 +494,9 @@ ProfileImpl::~ProfileImpl() {
Source<Profile>(this),
NotificationService::NoDetails());
+ if (device_management_service_.get())
+ device_management_service_->Shutdown();
+
tab_restore_service_ = NULL;
StopCreateSessionServiceTimer();
@@ -510,6 +522,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 +1327,39 @@ ExtensionInfoMap* ProfileImpl::GetExtensionInfoMap() {
return extension_info_map_.get();
}
+policy::DeviceManagementService*
+ProfileImpl::GetDeviceManagementService() {
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ if (device_management_service_.get())
+ return device_management_service_.get();
+
+ if (!command_line->HasSwitch(switches::kDeviceManagementUrl));
+ return NULL;
+
+ device_management_service_.reset(
+ new policy::DeviceManagementService(
+ command_line->GetSwitchValueASCII(switches::kDeviceManagementUrl)));
+ return device_management_service_.get();
+}
+
+policy::DeviceManagementPolicyProvider*
+ProfileImpl::GetDeviceManagementPolicyProvider() {
+ policy::DeviceManagementService* service = GetDeviceManagementService();
+ if (!service)
+ return NULL;
+
+ if (!device_management_policy_provider_.get()) {
+ device_management_policy_provider_.reset(
+ new policy::DeviceManagementPolicyProvider(
+ policy::ConfigurationPolicyPrefStore::
+ GetChromePolicyDefinitionList(),
+ service->CreateBackend(),
+ 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.
« no previous file with comments | « chrome/browser/profile_impl.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698