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

Unified Diff: components/policy/core/common/cloud/cloud_policy_client.h

Issue 756133002: Purge cache when the server removes the policy for an extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/policy/core/common/cloud/cloud_policy_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/core/common/cloud/cloud_policy_client.h
diff --git a/components/policy/core/common/cloud/cloud_policy_client.h b/components/policy/core/common/cloud/cloud_policy_client.h
index bcf43530890981f62d1a4ea6778527451b772dac..3a8b68eb9f45ace9877033aa343b11dde3ba932c 100644
--- a/components/policy/core/common/cloud/cloud_policy_client.h
+++ b/components/policy/core/common/cloud/cloud_policy_client.h
@@ -38,6 +38,9 @@ class DeviceManagementService;
// installed in the cloud policy cache.
class POLICY_EXPORT CloudPolicyClient {
public:
+ // A set of PolicyNamespaceKeys to fetch.
+ typedef std::set<PolicyNamespaceKey> NamespaceSet;
+
// Maps a PolicyNamespaceKey to its corresponding PolicyFetchResponse.
typedef std::map<PolicyNamespaceKey,
enterprise_management::PolicyFetchResponse*> ResponseMap;
@@ -196,6 +199,14 @@ class POLICY_EXPORT CloudPolicyClient {
return responses_;
}
+ // Returns a set with the policy namespaces that were included in the fetch
+ // request that produced the current |responses()|. This can be used to
+ // determine if a namespace is missing because it wasn't requested or because
+ // the server didn't include a response.
Mattias Nissler (ping if slow) 2014/11/26 13:44:14 Hm, this moves the responsibility to do the diffin
+ const NamespaceSet& namespaces_requested() const {
+ return namespaces_requested_;
+ }
+
// Returns the policy response for |policy_ns_key|, if found in |responses()|;
// otherwise returns NULL.
const enterprise_management::PolicyFetchResponse* GetPolicyFor(
@@ -219,9 +230,6 @@ class POLICY_EXPORT CloudPolicyClient {
scoped_refptr<net::URLRequestContextGetter> GetRequestContext();
protected:
- // A set of PolicyNamespaceKeys to fetch.
- typedef std::set<PolicyNamespaceKey> NamespaceSet;
-
// Callback for retries of registration requests.
void OnRetryRegister(DeviceManagementRequestJob* job);
@@ -233,6 +241,7 @@ class POLICY_EXPORT CloudPolicyClient {
// Callback for policy fetch requests.
void OnPolicyFetchCompleted(
+ const NamespaceSet& namespaces_requested,
DeviceManagementStatus status,
int net_error,
const enterprise_management::DeviceManagementResponse& response);
@@ -297,6 +306,9 @@ class POLICY_EXPORT CloudPolicyClient {
ResponseMap responses_;
DeviceManagementStatus status_;
+ // The namespaces that were requested in the last successful policy fetch.
+ NamespaceSet namespaces_requested_;
+
ObserverList<Observer, true> observers_;
scoped_refptr<net::URLRequestContextGetter> request_context_;
« no previous file with comments | « no previous file | components/policy/core/common/cloud/cloud_policy_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698