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

Side by Side Diff: chrome/browser/policy/cloud_policy_core.h

Issue 12189011: Split up chrome/browser/policy subdirectory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, add chrome/browser/chromeos/policy/OWNERS Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 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_POLICY_CORE_H_
6 #define CHROME_BROWSER_POLICY_CLOUD_POLICY_CORE_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/prefs/public/pref_member.h"
13 #include "chrome/browser/policy/cloud_policy_constants.h"
14
15 class PrefService;
16
17 namespace policy {
18
19 class CloudPolicyClient;
20 class CloudPolicyRefreshScheduler;
21 class CloudPolicyService;
22 class CloudPolicyStore;
23
24 // CloudPolicyCore glues together the ingredients that are essential for
25 // obtaining a fully-functional cloud policy system: CloudPolicyClient and
26 // CloudPolicyStore, which are responsible for fetching policy from the cloud
27 // and storing it locally, respectively, as well as a CloudPolicyService
28 // instance that moves data between the two former components, and
29 // CloudPolicyRefreshScheduler which triggers periodic refreshes.
30 class CloudPolicyCore {
31 public:
32 CloudPolicyCore(const PolicyNamespaceKey& policy_ns_key,
33 CloudPolicyStore* store);
34 ~CloudPolicyCore();
35
36 CloudPolicyClient* client() { return client_.get(); }
37 const CloudPolicyClient* client() const { return client_.get(); }
38
39 CloudPolicyStore* store() { return store_; }
40 const CloudPolicyStore* store() const { return store_; }
41
42 CloudPolicyService* service() { return service_.get(); }
43 const CloudPolicyService* service() const { return service_.get(); }
44
45 CloudPolicyRefreshScheduler* refresh_scheduler() {
46 return refresh_scheduler_.get();
47 }
48 const CloudPolicyRefreshScheduler* refresh_scheduler() const {
49 return refresh_scheduler_.get();
50 }
51
52 // Initializes the cloud connection.
53 void Connect(scoped_ptr<CloudPolicyClient> client);
54
55 // Shuts down the cloud connection.
56 void Disconnect();
57
58 // Requests a policy refresh to be performed soon. This may apply throttling,
59 // and the request may not be immediately sent.
60 void RefreshSoon();
61
62 // Starts a refresh scheduler in case none is running yet.
63 void StartRefreshScheduler();
64
65 // Watches the pref named |refresh_pref_name| in |pref_service| and adjusts
66 // |refresh_scheduler_|'s refresh delay accordingly.
67 void TrackRefreshDelayPref(PrefService* pref_service,
68 const std::string& refresh_pref_name);
69
70 private:
71 // Updates the refresh scheduler on refresh delay changes.
72 void UpdateRefreshDelayFromPref();
73
74 PolicyNamespaceKey policy_ns_key_;
75 CloudPolicyStore* store_;
76 scoped_ptr<CloudPolicyClient> client_;
77 scoped_ptr<CloudPolicyService> service_;
78 scoped_ptr<CloudPolicyRefreshScheduler> refresh_scheduler_;
79 scoped_ptr<IntegerPrefMember> refresh_delay_;
80
81 DISALLOW_COPY_AND_ASSIGN(CloudPolicyCore);
82 };
83
84 } // namespace policy
85
86 #endif // CHROME_BROWSER_POLICY_CLOUD_POLICY_CORE_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud_policy_constants.cc ('k') | chrome/browser/policy/cloud_policy_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698