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

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: Rebae 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 class Profile;
17
16 namespace policy { 18 namespace policy {
17 19
18 // Implements a cloud policy store that is stored in a simple file in the user's 20 // 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 21 // profile directory. This is used on (non-chromeos) platforms that do not have
20 // a secure storage implementation. 22 // a secure storage implementation.
21 class UserCloudPolicyStore : public UserCloudPolicyStoreBase { 23 class UserCloudPolicyStore : public UserCloudPolicyStoreBase {
22 public: 24 public:
23 // Creates a policy store associated with the user signed in to this 25 // Creates a policy store associated with the user signed in to this
24 // |profile|. 26 // |profile|.
25 UserCloudPolicyStore(Profile* profile, const FilePath& policy_file); 27 UserCloudPolicyStore(Profile* profile, const FilePath& policy_file);
26 virtual ~UserCloudPolicyStore(); 28 virtual ~UserCloudPolicyStore();
27 29
28 // Loads policy immediately on the current thread. 30 // Factory method for creating a UserCloudPolicyStore for |profile|.
31 static scoped_ptr<UserCloudPolicyStore> Create(Profile* profile);
32
33 // Loads policy immediately on the current thread. Virtual for mocks.
29 virtual void LoadImmediately(); 34 virtual void LoadImmediately();
30 35
36 // Deletes any existing policy blob and notifies observers via OnStoreLoaded()
37 // that the blob has changed. Virtual for mocks.
38 virtual void Clear();
39
31 // CloudPolicyStore implementation. 40 // CloudPolicyStore implementation.
32 virtual void Load() OVERRIDE; 41 virtual void Load() OVERRIDE;
33 virtual void Store( 42 virtual void Store(
34 const enterprise_management::PolicyFetchResponse& policy) OVERRIDE; 43 const enterprise_management::PolicyFetchResponse& policy) OVERRIDE;
35 44
36 protected:
37 virtual void RemoveStoredPolicy() OVERRIDE;
38
39 private: 45 private:
40
41 // Callback invoked when a new policy has been loaded from disk. If 46 // 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 47 // |validate_in_background| is true, then policy is validated via a background
43 // thread. 48 // thread.
44 void PolicyLoaded(bool validate_in_background, 49 void PolicyLoaded(bool validate_in_background,
45 struct PolicyLoadResult policy_load_result); 50 struct PolicyLoadResult policy_load_result);
46 51
47 // Starts policy blob validation. |callback| is invoked once validation is 52 // Starts policy blob validation. |callback| is invoked once validation is
48 // complete. If |validate_in_background| is true, then the validation work 53 // complete. If |validate_in_background| is true, then the validation work
49 // occurs on a background thread (results are sent back to the calling 54 // occurs on a background thread (results are sent back to the calling
50 // thread). 55 // thread).
(...skipping 17 matching lines...) Expand all
68 73
69 // Path to file where we store persisted policy. 74 // Path to file where we store persisted policy.
70 FilePath backing_file_path_; 75 FilePath backing_file_path_;
71 76
72 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStore); 77 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStore);
73 }; 78 };
74 79
75 } // namespace policy 80 } // namespace policy
76 81
77 #endif // CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_STORE_H_ 82 #endif // CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698