This source file includes following definitions.
- profile_
- Shutdown
- Observe
#include "chrome/browser/policy/cloud/user_cloud_policy_invalidator.h"
#include "base/bind.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop_proxy.h"
#include "base/time/default_clock.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/invalidation/invalidation_service_factory.h"
#include "components/policy/core/common/cloud/cloud_policy_manager.h"
#include "content/public/browser/notification_source.h"
namespace policy {
UserCloudPolicyInvalidator::UserCloudPolicyInvalidator(
Profile* profile,
CloudPolicyManager* policy_manager)
: CloudPolicyInvalidator(
policy_manager->core(),
base::MessageLoopProxy::current(),
scoped_ptr<base::Clock>(new base::DefaultClock())),
profile_(profile) {
DCHECK(profile);
registrar_.Add(this,
chrome::NOTIFICATION_PROFILE_ADDED,
content::Source<Profile>(profile));
}
void UserCloudPolicyInvalidator::Shutdown() {
CloudPolicyInvalidator::Shutdown();
}
void UserCloudPolicyInvalidator::Observe(
int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK(type == chrome::NOTIFICATION_PROFILE_ADDED);
invalidation::InvalidationService* invalidation_service =
invalidation::InvalidationServiceFactory::GetForProfile(profile_);
if (invalidation_service)
Initialize(invalidation_service);
}
}