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

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: Removed debugging statements that are unneeded. 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,
26 const FilePath& policy_file);
Mattias Nissler (ping if slow) 2012/08/23 09:28:35 indentation.
Andrew T Wilson (Slow) 2012/08/23 18:00:08 Done.
25 virtual ~UserCloudPolicyStore(); 27 virtual ~UserCloudPolicyStore();
26 28
27 // CloudPolicyStore implementation. 29 // CloudPolicyStore implementation.
28 virtual void Load() OVERRIDE; 30 virtual void Load() OVERRIDE;
29 virtual void Store( 31 virtual void Store(
30 const enterprise_management::PolicyFetchResponse& policy) OVERRIDE; 32 const enterprise_management::PolicyFetchResponse& policy) OVERRIDE;
31 33
32 protected: 34 protected:
33 virtual void RemoveStoredPolicy() OVERRIDE; 35 virtual void RemoveStoredPolicy() OVERRIDE;
34 36
35 private: 37 private:
38
39 // Callback invoked when a new policy has been loaded from disk.
40 void PolicyLoaded(struct PolicyLoadResult policy_load_result);
41
36 // Starts policy blob validation. |callback| is invoked once validation is 42 // Starts policy blob validation. |callback| is invoked once validation is
37 // complete. 43 // complete.
38 void Validate( 44 void Validate(
39 scoped_ptr<enterprise_management::PolicyFetchResponse> policy, 45 scoped_ptr<enterprise_management::PolicyFetchResponse> policy,
40 const UserCloudPolicyValidator::CompletionCallback& callback); 46 const UserCloudPolicyValidator::CompletionCallback& callback);
41 47
48 // Callback invoked to install a just-loaded policy after validation has
49 // finished.
50 void InstallLoadedPolicyAfterValidation(UserCloudPolicyValidator* validator);
51
42 // Callback invoked to store the policy after validation has finished. 52 // Callback invoked to store the policy after validation has finished.
43 void StorePolicyAfterValidation(UserCloudPolicyValidator* validator); 53 void StorePolicyAfterValidation(UserCloudPolicyValidator* validator);
44 54
55 // WeakPtrFactory used to create callbacks for validating and storing policy.
45 base::WeakPtrFactory<UserCloudPolicyStore> weak_factory_; 56 base::WeakPtrFactory<UserCloudPolicyStore> weak_factory_;
46 57
47 // Weak pointer to the profile associated with this store. 58 // Weak pointer to the profile associated with this store.
48 Profile* profile_; 59 Profile* profile_;
49 60
61 // Path to file where we store persisted policy.
62 FilePath backing_file_path_;
63
50 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStore); 64 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStore);
51 }; 65 };
52 66
53 } // namespace policy 67 } // namespace policy
54 68
55 #endif // CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_STORE_H_ 69 #endif // CHROME_BROWSER_POLICY_USER_CLOUD_POLICY_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698