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

Side by Side Diff: chrome/browser/policy/cloud/cloud_external_data_manager.h

Issue 109743002: Move policy code into components/policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moar fixes Created 7 years 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
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_POLICY_CLOUD_CLOUD_EXTERNAL_DATA_MANAGER_H_
6 #define CHROME_BROWSER_POLICY_CLOUD_CLOUD_EXTERNAL_DATA_MANAGER_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h"
14 #include "components/policy/core/common/external_data_manager.h"
15
16 namespace net {
17 class URLRequestContextGetter;
18 }
19
20 namespace policy {
21
22 class CloudPolicyStore;
23
24 // Downloads, verifies, caches and retrieves external data referenced by
25 // policies.
26 // This a common base class used by cloud policy implementations and mocks.
27 class CloudExternalDataManager : public ExternalDataManager {
28 public:
29 struct MetadataEntry {
30 MetadataEntry();
31 MetadataEntry(const std::string& url, const std::string& hash);
32
33 bool operator!=(const MetadataEntry& other) const;
34
35 std::string url;
36 std::string hash;
37 };
38 // Maps from policy names to the metadata specifying the external data that
39 // each of the policies references.
40 typedef std::map<std::string, MetadataEntry> Metadata;
41
42 CloudExternalDataManager();
43 virtual ~CloudExternalDataManager();
44
45 // Sets the source of external data references to |policy_store|. The manager
46 // will start observing |policy_store| so that when external data references
47 // change, obsolete data can be deleted and new data can be downloaded. If the
48 // |policy_store| is destroyed before the manager, the connection must be
49 // severed first by calling SetPolicyStore(NULL).
50 virtual void SetPolicyStore(CloudPolicyStore* policy_store);
51
52 // Called by the |policy_store_| when policy changes.
53 virtual void OnPolicyStoreLoaded() = 0;
54
55 // Allows the manager to download external data by constructing URLFetchers
56 // from |request_context|.
57 virtual void Connect(
58 scoped_refptr<net::URLRequestContextGetter> request_context) = 0;
59
60 // Prevents further external data downloads and aborts any downloads currently
61 // in progress.
62 virtual void Disconnect() = 0;
63
64 protected:
65 CloudPolicyStore* policy_store_; // Not owned.
66
67 base::WeakPtrFactory<CloudExternalDataManager> weak_factory_;
68
69 DISALLOW_COPY_AND_ASSIGN(CloudExternalDataManager);
70 };
71
72 } // namespace policy
73
74 #endif // CHROME_BROWSER_POLICY_CLOUD_CLOUD_EXTERNAL_DATA_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud/DEPS ('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