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

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

Issue 11027070: Moved JsonPrefStore to use SequencedWorkerPool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_POLICY_MANAGED_MODE_POLICY_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_POLICY_MANAGED_MODE_POLICY_PROVIDER_H_
6 #define CHROME_BROWSER_POLICY_MANAGED_MODE_POLICY_PROVIDER_H_ 6 #define CHROME_BROWSER_POLICY_MANAGED_MODE_POLICY_PROVIDER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/prefs/persistent_pref_store.h" 9 #include "base/prefs/persistent_pref_store.h"
10 #include "chrome/browser/policy/configuration_policy_provider.h" 10 #include "chrome/browser/policy/configuration_policy_provider.h"
11 11
12 class Profile; 12 class Profile;
13 13
14 namespace base {
15 class SequencedTaskRunner;
16 }
17
14 namespace policy { 18 namespace policy {
15 19
16 // This class sets policies that are defined by a local user via "Managed Mode". 20 // This class sets policies that are defined by a local user via "Managed Mode".
17 // It offers methods to set and read policies, and persists them on disk in 21 // It offers methods to set and read policies, and persists them on disk in
18 // JSON format. 22 // JSON format.
19 class ManagedModePolicyProvider 23 class ManagedModePolicyProvider
20 : public ConfigurationPolicyProvider, 24 : public ConfigurationPolicyProvider,
21 public PrefStore::Observer { 25 public PrefStore::Observer {
22 public: 26 public:
23 // The dictionary key under which we store the policy dictionary. Public for 27 // The dictionary key under which we store the policy dictionary. Public for
24 // testing. 28 // testing.
25 static const char kPolicies[]; 29 static const char kPolicies[];
26 30
27 // Creates a new ManagedModePolicyProvider that caches its policies in a JSON 31 // Creates a new ManagedModePolicyProvider that caches its policies in a JSON
28 // file inside the profile folder. 32 // file inside the profile folder. |sequenced_task_runner| ensures that all
29 static ManagedModePolicyProvider* Create(Profile* profile); 33 // file I/O operations are executed in the order that does not collide
34 // with Profile's file operations.
35 static ManagedModePolicyProvider* Create(
36 Profile* profile,
37 base::SequencedTaskRunner* sequenced_task_runner);
30 38
31 // Use this constructor to inject a different PrefStore (e.g. for testing). 39 // Use this constructor to inject a different PrefStore (e.g. for testing).
32 explicit ManagedModePolicyProvider(PersistentPrefStore* store); 40 explicit ManagedModePolicyProvider(PersistentPrefStore* store);
33 virtual ~ManagedModePolicyProvider(); 41 virtual ~ManagedModePolicyProvider();
34 42
35 // Returns the stored value for a policy with the given |key|, or NULL if no 43 // Returns the stored value for a policy with the given |key|, or NULL if no
36 // such policy is defined. 44 // such policy is defined.
37 const base::Value* GetPolicy(const std::string& key) const; 45 const base::Value* GetPolicy(const std::string& key) const;
38 // Sets the policy with the given |key| to a copy of the given |value|. 46 // Sets the policy with the given |key| to a copy of the given |value|.
39 void SetPolicy(const std::string& key, const base::Value* value); 47 void SetPolicy(const std::string& key, const base::Value* value);
(...skipping 12 matching lines...) Expand all
52 void UpdatePolicyFromCache(); 60 void UpdatePolicyFromCache();
53 61
54 // Used for persisting policies. Unlike other PrefStores, this one is not 62 // Used for persisting policies. Unlike other PrefStores, this one is not
55 // hooked up to the PrefService. 63 // hooked up to the PrefService.
56 scoped_refptr<PersistentPrefStore> store_; 64 scoped_refptr<PersistentPrefStore> store_;
57 }; 65 };
58 66
59 } // namespace policy 67 } // namespace policy
60 68
61 #endif // CHROME_BROWSER_POLICY_MANAGED_MODE_POLICY_PROVIDER_H_ 69 #endif // CHROME_BROWSER_POLICY_MANAGED_MODE_POLICY_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698