OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_POLICY_CLOUD_POLICY_STORE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_POLICY_STORE_H_ |
6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_STORE_H_ | 6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_STORE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
11 #include "chrome/browser/policy/cloud_policy_validator.h" | 11 #include "chrome/browser/policy/cloud_policy_validator.h" |
12 #include "chrome/browser/policy/policy_map.h" | 12 #include "chrome/browser/policy/policy_map.h" |
13 #include "chrome/browser/policy/proto/device_management_backend.pb.h" | 13 #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
14 | 14 |
15 class Profile; | |
16 | |
17 namespace policy { | 15 namespace policy { |
18 | 16 |
19 // Defines the low-level interface used by the cloud policy code to: | 17 // Defines the low-level interface used by the cloud policy code to: |
20 // 1. Validate policy blobs that should be applied locally | 18 // 1. Validate policy blobs that should be applied locally |
21 // 2. Persist policy blobs | 19 // 2. Persist policy blobs |
22 // 3. Decode policy blobs to PolicyMap representation | 20 // 3. Decode policy blobs to PolicyMap representation |
23 class CloudPolicyStore { | 21 class CloudPolicyStore { |
24 public: | 22 public: |
25 // Status codes. | 23 // Status codes. |
26 enum Status { | 24 enum Status { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // the registered observers. Otherwise, OnStoreError() reports the reason for | 84 // the registered observers. Otherwise, OnStoreError() reports the reason for |
87 // failure. | 85 // failure. |
88 virtual void Load() = 0; | 86 virtual void Load() = 0; |
89 | 87 |
90 // Registers an observer to be notified when policy changes. | 88 // Registers an observer to be notified when policy changes. |
91 void AddObserver(Observer* observer); | 89 void AddObserver(Observer* observer); |
92 | 90 |
93 // Removes the specified observer. | 91 // Removes the specified observer. |
94 void RemoveObserver(Observer* observer); | 92 void RemoveObserver(Observer* observer); |
95 | 93 |
96 // Factory method to create a CloudPolicyStore appropriate for the current | |
97 // platform, for storing user policy for the user associated with the passed | |
98 // |profile|. Implementation is defined in the individual platform store | |
99 // files. | |
100 static scoped_ptr<CloudPolicyStore> CreateUserPolicyStore(Profile* profile); | |
101 | |
102 protected: | 94 protected: |
103 // Invokes the corresponding callback on all registered observers. | 95 // Invokes the corresponding callback on all registered observers. |
104 void NotifyStoreLoaded(); | 96 void NotifyStoreLoaded(); |
105 void NotifyStoreError(); | 97 void NotifyStoreError(); |
106 | 98 |
107 // Decoded version of the currently effective policy. | 99 // Decoded version of the currently effective policy. |
108 PolicyMap policy_map_; | 100 PolicyMap policy_map_; |
109 | 101 |
110 // Currently effective policy. | 102 // Currently effective policy. |
111 scoped_ptr<enterprise_management::PolicyData> policy_; | 103 scoped_ptr<enterprise_management::PolicyData> policy_; |
(...skipping 10 matching lines...) Expand all Loading... |
122 bool is_initialized_; | 114 bool is_initialized_; |
123 | 115 |
124 ObserverList<Observer, true> observers_; | 116 ObserverList<Observer, true> observers_; |
125 | 117 |
126 DISALLOW_COPY_AND_ASSIGN(CloudPolicyStore); | 118 DISALLOW_COPY_AND_ASSIGN(CloudPolicyStore); |
127 }; | 119 }; |
128 | 120 |
129 } // namespace policy | 121 } // namespace policy |
130 | 122 |
131 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_STORE_H_ | 123 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_STORE_H_ |
OLD | NEW |