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 |
15 namespace policy { | 17 namespace policy { |
16 | 18 |
17 // Defines the low-level interface used by the cloud policy code to: | 19 // Defines the low-level interface used by the cloud policy code to: |
18 // 1. Validate policy blobs that should be applied locally | 20 // 1. Validate policy blobs that should be applied locally |
19 // 2. Persist policy blobs | 21 // 2. Persist policy blobs |
20 // 3. Decode policy blobs to PolicyMap representation | 22 // 3. Decode policy blobs to PolicyMap representation |
21 class CloudPolicyStore { | 23 class CloudPolicyStore { |
22 public: | 24 public: |
23 // Status codes. | 25 // Status codes. |
24 enum Status { | 26 enum Status { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // the registered observers. Otherwise, OnStoreError() reports the reason for | 86 // the registered observers. Otherwise, OnStoreError() reports the reason for |
85 // failure. | 87 // failure. |
86 virtual void Load() = 0; | 88 virtual void Load() = 0; |
87 | 89 |
88 // Registers an observer to be notified when policy changes. | 90 // Registers an observer to be notified when policy changes. |
89 void AddObserver(Observer* observer); | 91 void AddObserver(Observer* observer); |
90 | 92 |
91 // Removes the specified observer. | 93 // Removes the specified observer. |
92 void RemoveObserver(Observer* observer); | 94 void RemoveObserver(Observer* observer); |
93 | 95 |
| 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 |
94 protected: | 102 protected: |
95 // Invokes the corresponding callback on all registered observers. | 103 // Invokes the corresponding callback on all registered observers. |
96 void NotifyStoreLoaded(); | 104 void NotifyStoreLoaded(); |
97 void NotifyStoreError(); | 105 void NotifyStoreError(); |
98 | 106 |
99 // Decoded version of the currently effective policy. | 107 // Decoded version of the currently effective policy. |
100 PolicyMap policy_map_; | 108 PolicyMap policy_map_; |
101 | 109 |
102 // Currently effective policy. | 110 // Currently effective policy. |
103 scoped_ptr<enterprise_management::PolicyData> policy_; | 111 scoped_ptr<enterprise_management::PolicyData> policy_; |
(...skipping 10 matching lines...) Expand all Loading... |
114 bool is_initialized_; | 122 bool is_initialized_; |
115 | 123 |
116 ObserverList<Observer, true> observers_; | 124 ObserverList<Observer, true> observers_; |
117 | 125 |
118 DISALLOW_COPY_AND_ASSIGN(CloudPolicyStore); | 126 DISALLOW_COPY_AND_ASSIGN(CloudPolicyStore); |
119 }; | 127 }; |
120 | 128 |
121 } // namespace policy | 129 } // namespace policy |
122 | 130 |
123 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_STORE_H_ | 131 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_STORE_H_ |
OLD | NEW |