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

Unified Diff: chrome/browser/policy/cloud/cloud_external_data_manager.h

Issue 19462006: Implement fetching, caching and retrieval of external policy data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 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 side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « chrome/app/policy/syntax_check_policy_template_json.py ('k') | chrome/browser/policy/cloud/cloud_external_data_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698