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

Side by Side Diff: chrome/browser/policy/cloud/user_cloud_policy_manager.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_MANAGER_H_ 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_MANAGER_H_
6 #define CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_MANAGER_H_ 6 #define CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_MANAGER_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/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/policy/cloud/cloud_policy_manager.h" 14 #include "chrome/browser/policy/cloud/cloud_policy_manager.h"
15 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 15 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
16 16
17 class PrefService; 17 class PrefService;
18 class Profile;
19 18
20 namespace base { 19 namespace base {
21 class SequencedTaskRunner; 20 class SequencedTaskRunner;
22 } 21 }
23 22
23 namespace content {
24 class BrowserContext;
25 }
26
24 namespace net { 27 namespace net {
25 class URLRequestContextGetter; 28 class URLRequestContextGetter;
26 } 29 }
27 30
28 namespace policy { 31 namespace policy {
29 32
30 class CloudExternalDataManager; 33 class CloudExternalDataManager;
31 class DeviceManagementService; 34 class DeviceManagementService;
32 class UserCloudPolicyStore; 35 class UserCloudPolicyStore;
33 36
34 // UserCloudPolicyManager handles initialization of user policy for Chrome 37 // UserCloudPolicyManager handles initialization of user policy for Chrome
35 // Profiles on the desktop platforms. 38 // Profiles on the desktop platforms.
36 class UserCloudPolicyManager : public CloudPolicyManager, 39 class UserCloudPolicyManager : public CloudPolicyManager,
37 public BrowserContextKeyedService { 40 public BrowserContextKeyedService {
38 public: 41 public:
39 // |task_runner| is the runner for policy refresh tasks. 42 // |task_runner| is the runner for policy refresh tasks.
40 UserCloudPolicyManager( 43 UserCloudPolicyManager(
41 Profile* profile, 44 content::BrowserContext* context,
42 scoped_ptr<UserCloudPolicyStore> store, 45 scoped_ptr<UserCloudPolicyStore> store,
43 scoped_ptr<CloudExternalDataManager> external_data_manager, 46 scoped_ptr<CloudExternalDataManager> external_data_manager,
44 const scoped_refptr<base::SequencedTaskRunner>& task_runner); 47 const scoped_refptr<base::SequencedTaskRunner>& task_runner);
45 virtual ~UserCloudPolicyManager(); 48 virtual ~UserCloudPolicyManager();
46 49
47 virtual void Shutdown() OVERRIDE; 50 virtual void Shutdown() OVERRIDE;
48 51
49 void SetSigninUsername(const std::string& username); 52 void SetSigninUsername(const std::string& username);
50 53
51 // Initializes the cloud connection. |local_state| must stay valid until this 54 // Initializes the cloud connection. |local_state| must stay valid until this
(...skipping 14 matching lines...) Expand all
66 // Virtual for mocking. 69 // Virtual for mocking.
67 virtual bool IsClientRegistered() const; 70 virtual bool IsClientRegistered() const;
68 71
69 // Creates a CloudPolicyClient for this client. Used in situations where 72 // Creates a CloudPolicyClient for this client. Used in situations where
70 // callers want to create a DMToken without actually initializing the 73 // callers want to create a DMToken without actually initializing the
71 // profile's policy infrastructure. 74 // profile's policy infrastructure.
72 static scoped_ptr<CloudPolicyClient> CreateCloudPolicyClient( 75 static scoped_ptr<CloudPolicyClient> CreateCloudPolicyClient(
73 DeviceManagementService* device_management_service); 76 DeviceManagementService* device_management_service);
74 77
75 private: 78 private:
76 // The profile this instance belongs to. 79 // The context this instance belongs to.
77 Profile* profile_; 80 content::BrowserContext* context_;
78 81
79 // Typed pointer to the store owned by UserCloudPolicyManager. Note that 82 // Typed pointer to the store owned by UserCloudPolicyManager. Note that
80 // CloudPolicyManager only keeps a plain CloudPolicyStore pointer. 83 // CloudPolicyManager only keeps a plain CloudPolicyStore pointer.
81 scoped_ptr<UserCloudPolicyStore> store_; 84 scoped_ptr<UserCloudPolicyStore> store_;
82 85
83 // Manages external data referenced by policies. 86 // Manages external data referenced by policies.
84 scoped_ptr<CloudExternalDataManager> external_data_manager_; 87 scoped_ptr<CloudExternalDataManager> external_data_manager_;
85 88
86 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManager); 89 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManager);
87 }; 90 };
88 91
89 } // namespace policy 92 } // namespace policy
90 93
91 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_MANAGER_H_ 94 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_CLOUD_POLICY_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698