OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_POLICY_SIGNIN_SERVICE_BASE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_BASE_H_ |
6 #define CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_BASE_H_ | 6 #define CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_BASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "chrome/browser/policy/cloud/cloud_policy_client.h" | 15 #include "chrome/browser/policy/cloud/cloud_policy_client.h" |
16 #include "chrome/browser/policy/cloud/cloud_policy_service.h" | 16 #include "chrome/browser/policy/cloud/cloud_policy_service.h" |
17 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 17 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
18 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
19 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
20 | 20 |
21 class PrefService; | 21 class PrefService; |
22 class Profile; | 22 class Profile; |
| 23 class SigninManager; |
23 | 24 |
24 namespace policy { | 25 namespace policy { |
25 | 26 |
26 class DeviceManagementService; | 27 class DeviceManagementService; |
27 class UserCloudPolicyManager; | 28 class UserCloudPolicyManager; |
28 | 29 |
29 // The UserPolicySigninService is responsible for interacting with the policy | 30 // The UserPolicySigninService is responsible for interacting with the policy |
30 // infrastructure (mainly UserCloudPolicyManager) to load policy for the signed | 31 // infrastructure (mainly UserCloudPolicyManager) to load policy for the signed |
31 // in user. This is the base class that contains shared behavior. | 32 // in user. This is the base class that contains shared behavior. |
32 // | 33 // |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // signs-in and an OAuth2 login refresh token becomes available. | 110 // signs-in and an OAuth2 login refresh token becomes available. |
110 void InitializeForSignedInUser(const std::string& username); | 111 void InitializeForSignedInUser(const std::string& username); |
111 | 112 |
112 // Initializes the cloud policy manager with the passed |client|. This is | 113 // Initializes the cloud policy manager with the passed |client|. This is |
113 // called from InitializeForSignedInUser() when the Profile already has a | 114 // called from InitializeForSignedInUser() when the Profile already has a |
114 // signed in account at startup, and from FetchPolicyForSignedInUser() during | 115 // signed in account at startup, and from FetchPolicyForSignedInUser() during |
115 // the initial policy fetch after signing in. | 116 // the initial policy fetch after signing in. |
116 virtual void InitializeUserCloudPolicyManager( | 117 virtual void InitializeUserCloudPolicyManager( |
117 scoped_ptr<CloudPolicyClient> client); | 118 scoped_ptr<CloudPolicyClient> client); |
118 | 119 |
| 120 // Prepares for the UserCloudPolicyManager to be shutdown due to |
| 121 // user signout or profile destruction. |
| 122 virtual void PrepareForUserCloudPolicyManagerShutdown(); |
| 123 |
119 // Shuts down the UserCloudPolicyManager (for example, after the user signs | 124 // Shuts down the UserCloudPolicyManager (for example, after the user signs |
120 // out) and deletes any cached policy. | 125 // out) and deletes any cached policy. |
121 virtual void ShutdownUserCloudPolicyManager(); | 126 virtual void ShutdownUserCloudPolicyManager(); |
122 | 127 |
123 // Convenience helper to get the UserCloudPolicyManager for |profile_|. | 128 // Convenience helper to get the UserCloudPolicyManager for |profile_|. |
124 UserCloudPolicyManager* GetManager(); | 129 UserCloudPolicyManager* GetManager(); |
125 | 130 |
126 Profile* profile() { return profile_; } | 131 Profile* profile() { return profile_; } |
127 content::NotificationRegistrar* registrar() { return ®istrar_; } | 132 content::NotificationRegistrar* registrar() { return ®istrar_; } |
| 133 SigninManager* GetSigninManager(); |
128 | 134 |
129 private: | 135 private: |
130 // Weak pointer to the profile this service is associated with. | 136 // Weak pointer to the profile this service is associated with. |
131 Profile* profile_; | 137 Profile* profile_; |
132 | 138 |
133 content::NotificationRegistrar registrar_; | 139 content::NotificationRegistrar registrar_; |
134 | 140 |
135 PrefService* local_state_; | 141 PrefService* local_state_; |
136 DeviceManagementService* device_management_service_; | 142 DeviceManagementService* device_management_service_; |
137 | 143 |
138 base::WeakPtrFactory<UserPolicySigninServiceBase> weak_factory_; | 144 base::WeakPtrFactory<UserPolicySigninServiceBase> weak_factory_; |
139 | 145 |
140 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninServiceBase); | 146 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninServiceBase); |
141 }; | 147 }; |
142 | 148 |
143 } // namespace policy | 149 } // namespace policy |
144 | 150 |
145 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_BASE_H_ | 151 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_BASE_H_ |
OLD | NEW |