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

Side by Side Diff: chrome/browser/policy/cloud/component_cloud_policy_updater.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 (c) 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_COMPONENT_CLOUD_POLICY_UPDATER_H_
6 #define CHROME_BROWSER_POLICY_CLOUD_COMPONENT_CLOUD_POLICY_UPDATER_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "chrome/browser/policy/cloud/external_policy_data_updater.h"
14 #include "components/policy/core/common/policy_namespace.h"
15
16 namespace base {
17 class SequencedTaskRunner;
18 }
19
20 namespace enterprise_management {
21 class PolicyFetchResponse;
22 }
23
24 namespace policy {
25
26 class ComponentCloudPolicyStore;
27 class ExternalPolicyDataFetcher;
28
29 // This class downloads external policy data, given PolicyFetchResponses.
30 // It validates the PolicyFetchResponse and its corresponding data, and caches
31 // them in a ComponentCloudPolicyStore. It also enforces size limits on what's
32 // cached.
33 // It retries to download the policy data periodically when a download fails.
34 class ComponentCloudPolicyUpdater {
35 public:
36 // This class runs on the background thread represented by |task_runner|,
37 // which must support file I/O. All network I/O is delegated to the
38 // |external_policy_data_fetcher|.
39 ComponentCloudPolicyUpdater(
40 scoped_refptr<base::SequencedTaskRunner> task_runner,
41 scoped_ptr<ExternalPolicyDataFetcher> external_policy_data_fetcher,
42 ComponentCloudPolicyStore* store);
43 ~ComponentCloudPolicyUpdater();
44
45 // |response| is the latest policy information fetched for some component.
46 // This method schedules the download of the policy data, if |response| is
47 // validated. If the downloaded data also passes validation then that data
48 // will be passed to the |store_|.
49 void UpdateExternalPolicy(
50 scoped_ptr<enterprise_management::PolicyFetchResponse> response);
51
52 // Cancels any pending operations for the given namespace.
53 void CancelUpdate(const PolicyNamespace& ns);
54
55 private:
56 std::string NamespaceToKey(const PolicyNamespace& ns);
57
58 ComponentCloudPolicyStore* store_;
59 ExternalPolicyDataUpdater external_policy_data_updater_;
60
61 DISALLOW_COPY_AND_ASSIGN(ComponentCloudPolicyUpdater);
62 };
63
64 } // namespace policy
65
66 #endif // CHROME_BROWSER_POLICY_CLOUD_COMPONENT_CLOUD_POLICY_UPDATER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698