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

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

Issue 11415094: Split UserCloudPolicyManager implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bring back ProxyPolicyProvider, fix local_state policy provider, fix Joao's fine CloudPolicyTest. 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_USER_CLOUD_POLICY_STORE_H_ 5 #ifndef CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_STORE_H_
6 #define CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_STORE_H_ 6 #define CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_STORE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/file_path.h" 12 #include "base/file_path.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "chrome/browser/policy/user_cloud_policy_store_base.h" 14 #include "chrome/browser/policy/user_cloud_policy_store_base.h"
15 15
16 namespace policy { 16 namespace policy {
17 17
18 // Implements a cloud policy store that is stored in a simple file in the user's 18 // Implements a cloud policy store that is stored in a simple file in the user's
19 // profile directory. This is used on (non-chromeos) platforms that do not have 19 // profile directory. This is used on (non-chromeos) platforms that do not have
20 // a secure storage implementation. 20 // a secure storage implementation.
21 class UserCloudPolicyStore : public UserCloudPolicyStoreBase { 21 class UserCloudPolicyStore : public UserCloudPolicyStoreBase {
22 public: 22 public:
23 // Creates a policy store associated with the user signed in to this 23 // Creates a policy store associated with the user signed in to this
24 // |profile|. 24 // |profile|.
25 UserCloudPolicyStore(Profile* profile, const FilePath& policy_file); 25 UserCloudPolicyStore(Profile* profile, const FilePath& policy_file);
26 virtual ~UserCloudPolicyStore(); 26 virtual ~UserCloudPolicyStore();
27 27
28 // Factory method for creating a UserCloudPolicyStore for |profile|.
29 static scoped_ptr<UserCloudPolicyStore> Create(Profile* profile);
Joao da Silva 2012/11/21 17:06:34 Profile needs to be forward-declared after the dec
Mattias Nissler (ping if slow) 2012/11/22 20:51:59 Done.
30
28 // Loads policy immediately on the current thread. 31 // Loads policy immediately on the current thread.
29 virtual void LoadImmediately(); 32 virtual void LoadImmediately();
Joao da Silva 2012/11/21 17:06:34 Mention that this is virtual for mocks.
Mattias Nissler (ping if slow) 2012/11/22 20:51:59 Done.
30 33
34 // Deletes any existing policy blob and notifies observers via OnStoreLoaded()
35 // that the blob has changed. Virtual for mocks.
36 virtual void Clear();
37
31 // CloudPolicyStore implementation. 38 // CloudPolicyStore implementation.
32 virtual void Load() OVERRIDE; 39 virtual void Load() OVERRIDE;
33 virtual void Store( 40 virtual void Store(
34 const enterprise_management::PolicyFetchResponse& policy) OVERRIDE; 41 const enterprise_management::PolicyFetchResponse& policy) OVERRIDE;
35 42
36 protected:
37 virtual void RemoveStoredPolicy() OVERRIDE;
38
39 private: 43 private:
40
41 // Callback invoked when a new policy has been loaded from disk. If 44 // Callback invoked when a new policy has been loaded from disk. If
42 // |validate_in_background| is true, then policy is validated via a background 45 // |validate_in_background| is true, then policy is validated via a background
43 // thread. 46 // thread.
44 void PolicyLoaded(bool validate_in_background, 47 void PolicyLoaded(bool validate_in_background,
45 struct PolicyLoadResult policy_load_result); 48 struct PolicyLoadResult policy_load_result);
46 49
47 // Starts policy blob validation. |callback| is invoked once validation is 50 // Starts policy blob validation. |callback| is invoked once validation is
48 // complete. If |validate_in_background| is true, then the validation work 51 // complete. If |validate_in_background| is true, then the validation work
49 // occurs on a background thread (results are sent back to the calling 52 // occurs on a background thread (results are sent back to the calling
50 // thread). 53 // thread).
(...skipping 17 matching lines...) Expand all
68 71
69 // Path to file where we store persisted policy. 72 // Path to file where we store persisted policy.
70 FilePath backing_file_path_; 73 FilePath backing_file_path_;
71 74
72 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStore); 75 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStore);
73 }; 76 };
74 77
75 } // namespace policy 78 } // namespace policy
76 79
77 #endif // CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_STORE_H_ 80 #endif // CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698