Index: chrome/browser/policy/cloud/cloud_external_data_manager.h |
diff --git a/chrome/browser/policy/cloud/cloud_external_data_manager.h b/chrome/browser/policy/cloud/cloud_external_data_manager.h |
index ceee874fe7dbe6af19461ee895f8a705dca9e727..3f104a23169ad77d6c8fd91ef2f7185ecbfab0d6 100644 |
--- a/chrome/browser/policy/cloud/cloud_external_data_manager.h |
+++ b/chrome/browser/policy/cloud/cloud_external_data_manager.h |
@@ -8,10 +8,19 @@ |
#include <map> |
#include <string> |
+#include "base/basictypes.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
#include "chrome/browser/policy/external_data_manager.h" |
+namespace net { |
+class URLRequestContextGetter; |
+} |
+ |
namespace policy { |
+class CloudPolicyStore; |
+ |
// Downloads, verifies, caches and retrieves external data referenced by |
// policies. |
// This a common base class used by cloud policy implementations and mocks. |
@@ -21,12 +30,43 @@ class CloudExternalDataManager : public ExternalDataManager { |
MetadataEntry(); |
MetadataEntry(const std::string& url, const std::string& hash); |
+ bool operator!=(const MetadataEntry& other) const; |
+ |
std::string url; |
std::string hash; |
}; |
// Maps from policy names to the metadata specifying the external data that |
// each of the policies references. |
typedef std::map<std::string, MetadataEntry> Metadata; |
+ |
+ CloudExternalDataManager(); |
+ virtual ~CloudExternalDataManager(); |
+ |
+ // Sets the source of external data references to |policy_store|. The manager |
+ // will start observing |policy_store| so that when external data references |
+ // change, obsolete data can be deleted and new data can be downloaded. If the |
+ // |policy_store| is destroyed before the manager, the connection must be |
+ // severed first by calling SetPolicyStore(NULL). |
+ virtual void SetPolicyStore(CloudPolicyStore* policy_store); |
+ |
+ // Called by the |policy_store_| when policy changes. |
+ virtual void OnPolicyStoreLoaded() = 0; |
+ |
+ // Allows the manager to download external data by constructing URLFetchers |
+ // from |request_context|. |
+ virtual void Connect( |
+ scoped_refptr<net::URLRequestContextGetter> request_context) = 0; |
+ |
+ // Prevents further external data downloads and aborts any downloads currently |
+ // in progress. |
+ virtual void Disconnect() = 0; |
+ |
+ protected: |
+ CloudPolicyStore* policy_store_; // Not owned. |
+ |
+ base::WeakPtrFactory<CloudExternalDataManager> weak_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(CloudExternalDataManager); |
}; |
} // namespace policy |