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

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

Issue 44083005: policy: Remove UserCloudPolicyManagerFactory's dependency on Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 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_CLOUD_USER_CLOUD_POLICY_STORE_H_ 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_STORE_H_
6 #define CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_STORE_H_ 6 #define CHROME_BROWSER_POLICY_CLOUD_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/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "chrome/browser/policy/cloud/user_cloud_policy_store_base.h" 14 #include "chrome/browser/policy/cloud/user_cloud_policy_store_base.h"
15 15
16 class Profile;
17
18 namespace base { 16 namespace base {
19 class SequencedTaskRunner; 17 class SequencedTaskRunner;
20 } 18 }
21 19
20 namespace content {
21 class BrowserContext;
22 }
23
22 namespace policy { 24 namespace policy {
23 25
24 // Implements a cloud policy store that is stored in a simple file in the user's 26 // Implements a cloud policy store that is stored in a simple file in the user's
25 // profile directory. This is used on (non-chromeos) platforms that do not have 27 // profile directory. This is used on (non-chromeos) platforms that do not have
26 // a secure storage implementation. 28 // a secure storage implementation.
27 class UserCloudPolicyStore : public UserCloudPolicyStoreBase { 29 class UserCloudPolicyStore : public UserCloudPolicyStoreBase {
28 public: 30 public:
29 // Creates a policy store associated with the user signed in to this 31 // Creates a policy store associated with the user signed in to this
30 // |profile|. 32 // |context|.
31 UserCloudPolicyStore( 33 UserCloudPolicyStore(
32 Profile* profile, 34 content::BrowserContext* context,
33 const base::FilePath& policy_file, 35 const base::FilePath& policy_file,
34 scoped_refptr<base::SequencedTaskRunner> background_task_runner); 36 scoped_refptr<base::SequencedTaskRunner> background_task_runner);
35 virtual ~UserCloudPolicyStore(); 37 virtual ~UserCloudPolicyStore();
36 38
37 // Factory method for creating a UserCloudPolicyStore for |profile|. 39 // Factory method for creating a UserCloudPolicyStore for |context|.
38 static scoped_ptr<UserCloudPolicyStore> Create( 40 static scoped_ptr<UserCloudPolicyStore> Create(
39 Profile* profile, 41 content::BrowserContext* context,
40 scoped_refptr<base::SequencedTaskRunner> background_task_runner); 42 scoped_refptr<base::SequencedTaskRunner> background_task_runner);
41 43
42 // Loads policy immediately on the current thread. Virtual for mocks. 44 // Loads policy immediately on the current thread. Virtual for mocks.
43 virtual void LoadImmediately(); 45 virtual void LoadImmediately();
44 46
45 // Deletes any existing policy blob and notifies observers via OnStoreLoaded() 47 // Deletes any existing policy blob and notifies observers via OnStoreLoaded()
46 // that the blob has changed. Virtual for mocks. 48 // that the blob has changed. Virtual for mocks.
47 virtual void Clear(); 49 virtual void Clear();
48 50
49 // CloudPolicyStore implementation. 51 // CloudPolicyStore implementation.
(...skipping 20 matching lines...) Expand all
70 // Callback invoked to install a just-loaded policy after validation has 72 // Callback invoked to install a just-loaded policy after validation has
71 // finished. 73 // finished.
72 void InstallLoadedPolicyAfterValidation(UserCloudPolicyValidator* validator); 74 void InstallLoadedPolicyAfterValidation(UserCloudPolicyValidator* validator);
73 75
74 // Callback invoked to store the policy after validation has finished. 76 // Callback invoked to store the policy after validation has finished.
75 void StorePolicyAfterValidation(UserCloudPolicyValidator* validator); 77 void StorePolicyAfterValidation(UserCloudPolicyValidator* validator);
76 78
77 // WeakPtrFactory used to create callbacks for validating and storing policy. 79 // WeakPtrFactory used to create callbacks for validating and storing policy.
78 base::WeakPtrFactory<UserCloudPolicyStore> weak_factory_; 80 base::WeakPtrFactory<UserCloudPolicyStore> weak_factory_;
79 81
80 // Weak pointer to the profile associated with this store. 82 // Weak pointer to the context associated with this store.
81 Profile* profile_; 83 content::BrowserContext* context_;
82 84
83 // Path to file where we store persisted policy. 85 // Path to file where we store persisted policy.
84 base::FilePath backing_file_path_; 86 base::FilePath backing_file_path_;
85 87
86 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStore); 88 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStore);
87 }; 89 };
88 90
89 } // namespace policy 91 } // namespace policy
90 92
91 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_STORE_H_ 93 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698