Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(538)

Side by Side Diff: chrome/browser/policy/cloud_policy_store.h

Issue 10854213: Added UserCloudPolicyManager::ShutdownAndRemovePolicy() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/policy/cloud_policy_store.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // generate OnStoreError() notifications. 80 // generate OnStoreError() notifications.
81 virtual void Store( 81 virtual void Store(
82 const enterprise_management::PolicyFetchResponse& policy) = 0; 82 const enterprise_management::PolicyFetchResponse& policy) = 0;
83 83
84 // Load the current policy blob from persistent storage. This may trigger 84 // Load the current policy blob from persistent storage. This may trigger
85 // asynchronous operations. Upon success, OnStoreLoaded() will be called on 85 // asynchronous operations. Upon success, OnStoreLoaded() will be called on
86 // the registered observers. Otherwise, OnStoreError() reports the reason for 86 // the registered observers. Otherwise, OnStoreError() reports the reason for
87 // failure. 87 // failure.
88 virtual void Load() = 0; 88 virtual void Load() = 0;
89 89
90 // Deletes any existing policy blob and notifies observers via OnStoreLoaded()
91 // that the blob has changed. Virtual for mocks.
92 virtual void Clear();
93
90 // Registers an observer to be notified when policy changes. 94 // Registers an observer to be notified when policy changes.
91 void AddObserver(Observer* observer); 95 void AddObserver(Observer* observer);
92 96
93 // Removes the specified observer. 97 // Removes the specified observer.
94 void RemoveObserver(Observer* observer); 98 void RemoveObserver(Observer* observer);
95 99
96 // Factory method to create a CloudPolicyStore appropriate for the current 100 // Factory method to create a CloudPolicyStore appropriate for the current
97 // platform, for storing user policy for the user associated with the passed 101 // platform, for storing user policy for the user associated with the passed
98 // |profile|. Implementation is defined in the individual platform store 102 // |profile|. Implementation is defined in the individual platform store
99 // files. 103 // files.
100 static scoped_ptr<CloudPolicyStore> CreateUserPolicyStore(Profile* profile); 104 static scoped_ptr<CloudPolicyStore> CreateUserPolicyStore(Profile* profile);
101 105
102 protected: 106 protected:
103 // Invokes the corresponding callback on all registered observers. 107 // Invokes the corresponding callback on all registered observers.
104 void NotifyStoreLoaded(); 108 void NotifyStoreLoaded();
105 void NotifyStoreError(); 109 void NotifyStoreError();
106 110
111 // Invoked by Clear() to remove stored policy.
112 virtual void RemoveStoredPolicy() = 0;
113
107 // Decoded version of the currently effective policy. 114 // Decoded version of the currently effective policy.
108 PolicyMap policy_map_; 115 PolicyMap policy_map_;
109 116
110 // Currently effective policy. 117 // Currently effective policy.
111 scoped_ptr<enterprise_management::PolicyData> policy_; 118 scoped_ptr<enterprise_management::PolicyData> policy_;
112 119
113 // Latest status code. 120 // Latest status code.
114 Status status_; 121 Status status_;
115 122
116 // Latest validation status. 123 // Latest validation status.
117 CloudPolicyValidatorBase::Status validation_status_; 124 CloudPolicyValidatorBase::Status validation_status_;
118 125
119 private: 126 private:
120 // Whether the store has completed asynchronous initialization, which is 127 // Whether the store has completed asynchronous initialization, which is
121 // triggered by calling Load(). 128 // triggered by calling Load().
122 bool is_initialized_; 129 bool is_initialized_;
123 130
124 ObserverList<Observer, true> observers_; 131 ObserverList<Observer, true> observers_;
125 132
126 DISALLOW_COPY_AND_ASSIGN(CloudPolicyStore); 133 DISALLOW_COPY_AND_ASSIGN(CloudPolicyStore);
127 }; 134 };
128 135
129 } // namespace policy 136 } // namespace policy
130 137
131 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_STORE_H_ 138 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_STORE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/policy/cloud_policy_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698