Separate UMA histograms for user and device policy invalidation
[chromium-blink-merge.git] / chrome / browser / policy / cloud / user_cloud_policy_invalidator.h
blobf9bea6cbc90ac116ca9c9a1506266f2fdfff5cbd
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_INVALIDATOR_H_
6 #define CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_INVALIDATOR_H_
8 #include "chrome/browser/policy/cloud/cloud_policy_invalidator.h"
9 #include "components/keyed_service/core/keyed_service.h"
10 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h"
12 #include "policy/proto/device_management_backend.pb.h"
14 class Profile;
16 namespace policy {
18 class CloudPolicyManager;
20 // Provides invalidations to user policy. Implemented as a
21 // KeyedService to allow profile-based lifetime management.
22 class UserCloudPolicyInvalidator : public CloudPolicyInvalidator,
23 public KeyedService,
24 public content::NotificationObserver {
25 public:
26 // |profile| is profile associated with the invalidator. It is used to get
27 // a reference to the profile's invalidation service. Both the profile and
28 // invalidation service must remain valid until Shutdown is called.
29 // |policy_manager| is the policy manager for the user policy and must remain
30 // valid until Shutdown is called.
31 UserCloudPolicyInvalidator(
32 Profile* profile,
33 CloudPolicyManager* policy_manager);
35 static enterprise_management::DeviceRegisterRequest::Type GetPolicyType();
37 // KeyedService:
38 virtual void Shutdown() OVERRIDE;
40 // content::NotificationObserver implementation:
41 virtual void Observe(int type,
42 const content::NotificationSource& source,
43 const content::NotificationDetails& details) OVERRIDE;
45 private:
46 // The profile associated with the invalidator.
47 Profile* profile_;
49 // Used to register for notification that profile creation is complete.
50 content::NotificationRegistrar registrar_;
52 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyInvalidator);
55 } // namespace policy
57 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_INVALIDATOR_H_