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

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

Issue 10825415: Added code to persist downloaded cloud policy to disk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More review feedback addressed. Created 8 years, 4 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
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/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/policy/user_cloud_policy_store_base.h" 14 #include "chrome/browser/policy/user_cloud_policy_store_base.h"
14 15
15 namespace policy { 16 namespace policy {
16 17
17 // 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
18 // 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
19 // a secure storage implementation. 20 // a secure storage implementation.
20 class UserCloudPolicyStore : public UserCloudPolicyStoreBase { 21 class UserCloudPolicyStore : public UserCloudPolicyStoreBase {
21 public: 22 public:
22 // 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
23 // |profile|. 24 // |profile|.
24 explicit UserCloudPolicyStore(Profile* profile); 25 UserCloudPolicyStore(Profile* profile, const FilePath& policy_file);
25 virtual ~UserCloudPolicyStore(); 26 virtual ~UserCloudPolicyStore();
26 27
27 // CloudPolicyStore implementation. 28 // CloudPolicyStore implementation.
28 virtual void Load() OVERRIDE; 29 virtual void Load() OVERRIDE;
29 virtual void Store( 30 virtual void Store(
30 const enterprise_management::PolicyFetchResponse& policy) OVERRIDE; 31 const enterprise_management::PolicyFetchResponse& policy) OVERRIDE;
31 32
32 protected: 33 protected:
33 virtual void RemoveStoredPolicy() OVERRIDE; 34 virtual void RemoveStoredPolicy() OVERRIDE;
34 35
35 private: 36 private:
37
38 // Callback invoked when a new policy has been loaded from disk.
39 void PolicyLoaded(struct PolicyLoadResult policy_load_result);
40
36 // Starts policy blob validation. |callback| is invoked once validation is 41 // Starts policy blob validation. |callback| is invoked once validation is
37 // complete. 42 // complete.
38 void Validate( 43 void Validate(
39 scoped_ptr<enterprise_management::PolicyFetchResponse> policy, 44 scoped_ptr<enterprise_management::PolicyFetchResponse> policy,
40 const UserCloudPolicyValidator::CompletionCallback& callback); 45 const UserCloudPolicyValidator::CompletionCallback& callback);
41 46
47 // Callback invoked to install a just-loaded policy after validation has
48 // finished.
49 void InstallLoadedPolicyAfterValidation(UserCloudPolicyValidator* validator);
50
42 // Callback invoked to store the policy after validation has finished. 51 // Callback invoked to store the policy after validation has finished.
43 void StorePolicyAfterValidation(UserCloudPolicyValidator* validator); 52 void StorePolicyAfterValidation(UserCloudPolicyValidator* validator);
44 53
54 // WeakPtrFactory used to create callbacks for validating and storing policy.
45 base::WeakPtrFactory<UserCloudPolicyStore> weak_factory_; 55 base::WeakPtrFactory<UserCloudPolicyStore> weak_factory_;
46 56
47 // Weak pointer to the profile associated with this store. 57 // Weak pointer to the profile associated with this store.
48 Profile* profile_; 58 Profile* profile_;
49 59
60 // Path to file where we store persisted policy.
61 FilePath backing_file_path_;
62
50 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStore); 63 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStore);
51 }; 64 };
52 65
53 } // namespace policy 66 } // namespace policy
54 67
55 #endif // CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_STORE_H_ 68 #endif // CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_STORE_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/user_cloud_policy_manager.cc ('k') | chrome/browser/policy/user_cloud_policy_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698