Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / policy / cloud / user_cloud_policy_invalidator.h
blob52f01be56fa2422723a681853752508d7e73fd02
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/browser_context_keyed_service/browser_context_keyed_service.h"
10 #include "content/public/browser/notification_observer.h"
11 #include "content/public/browser/notification_registrar.h"
13 class Profile;
15 namespace policy {
17 class CloudPolicyManager;
19 // Provides invalidations to user policy. Implemented as a
20 // BrowserContextKeyedService to allow profile-based lifetime management.
21 class UserCloudPolicyInvalidator : public CloudPolicyInvalidator,
22 public BrowserContextKeyedService,
23 public content::NotificationObserver {
24 public:
25 // |profile| is profile associated with the invalidator. It is used to get
26 // a reference to the profile's invalidation service. Both the profile and
27 // invalidation service must remain valid until Shutdown is called.
28 // |policy_manager| is the policy manager for the user policy and must remain
29 // valid until Shutdown is called.
30 UserCloudPolicyInvalidator(
31 Profile* profile,
32 CloudPolicyManager* policy_manager);
34 // BrowserContextKeyedService:
35 virtual void Shutdown() OVERRIDE;
37 // content::NotificationObserver implementation:
38 virtual void Observe(int type,
39 const content::NotificationSource& source,
40 const content::NotificationDetails& details) OVERRIDE;
42 private:
43 // The profile associated with the invalidator.
44 Profile* profile_;
46 // Used to register for notification that profile creation is complete.
47 content::NotificationRegistrar registrar_;
49 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyInvalidator);
52 } // namespace policy
54 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_INVALIDATOR_H_