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

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

Issue 23068005: Convert UserPolicySigninService to use OAuth2TokenService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with ToT Created 7 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 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 16 matching lines...) Expand all
49 PolicyRegistrationCallback; 50 PolicyRegistrationCallback;
50 51
51 // The callback invoked once policy fetch is complete. Passed boolean 52 // The callback invoked once policy fetch is complete. Passed boolean
52 // parameter is set to true if the policy fetch succeeded. 53 // parameter is set to true if the policy fetch succeeded.
53 typedef base::Callback<void(bool)> PolicyFetchCallback; 54 typedef base::Callback<void(bool)> PolicyFetchCallback;
54 55
55 // Creates a UserPolicySigninServiceBase associated with the passed |profile|. 56 // Creates a UserPolicySigninServiceBase associated with the passed |profile|.
56 UserPolicySigninServiceBase( 57 UserPolicySigninServiceBase(
57 Profile* profile, 58 Profile* profile,
58 PrefService* local_state, 59 PrefService* local_state,
59 DeviceManagementService* device_management_service); 60 DeviceManagementService* device_management_service,
61 SigninManager* signin_manager);
60 virtual ~UserPolicySigninServiceBase(); 62 virtual ~UserPolicySigninServiceBase();
61 63
62 // Initiates a policy fetch as part of user signin, using a CloudPolicyClient 64 // Initiates a policy fetch as part of user signin, using a CloudPolicyClient
63 // previously initialized via RegisterPolicyClient. |callback| is invoked 65 // previously initialized via RegisterPolicyClient. |callback| is invoked
64 // once the policy fetch is complete, passing true if the policy fetch 66 // once the policy fetch is complete, passing true if the policy fetch
65 // succeeded. 67 // succeeded.
66 void FetchPolicyForSignedInUser(scoped_ptr<CloudPolicyClient> client, 68 void FetchPolicyForSignedInUser(scoped_ptr<CloudPolicyClient> client,
67 const PolicyFetchCallback& callback); 69 const PolicyFetchCallback& callback);
68 70
69 // content::NotificationObserver implementation: 71 // content::NotificationObserver implementation:
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // signs-in and an OAuth2 login refresh token becomes available. 111 // signs-in and an OAuth2 login refresh token becomes available.
110 void InitializeForSignedInUser(const std::string& username); 112 void InitializeForSignedInUser(const std::string& username);
111 113
112 // Initializes the cloud policy manager with the passed |client|. This is 114 // Initializes the cloud policy manager with the passed |client|. This is
113 // called from InitializeForSignedInUser() when the Profile already has a 115 // called from InitializeForSignedInUser() when the Profile already has a
114 // signed in account at startup, and from FetchPolicyForSignedInUser() during 116 // signed in account at startup, and from FetchPolicyForSignedInUser() during
115 // the initial policy fetch after signing in. 117 // the initial policy fetch after signing in.
116 virtual void InitializeUserCloudPolicyManager( 118 virtual void InitializeUserCloudPolicyManager(
117 scoped_ptr<CloudPolicyClient> client); 119 scoped_ptr<CloudPolicyClient> client);
118 120
121 // Prepares for the UserCloudPolicyManager to be shutdown due to
122 // user signout or profile destruction.
123 virtual void PrepareForUserCloudPolicyManagerShutdown();
124
119 // Shuts down the UserCloudPolicyManager (for example, after the user signs 125 // Shuts down the UserCloudPolicyManager (for example, after the user signs
120 // out) and deletes any cached policy. 126 // out) and deletes any cached policy.
121 virtual void ShutdownUserCloudPolicyManager(); 127 virtual void ShutdownUserCloudPolicyManager();
122 128
123 // Convenience helper to get the UserCloudPolicyManager for |profile_|. 129 // Convenience helper to get the UserCloudPolicyManager for |profile_|.
124 UserCloudPolicyManager* GetManager(); 130 UserCloudPolicyManager* GetManager();
125 131
126 Profile* profile() { return profile_; } 132 Profile* profile() { return profile_; }
127 content::NotificationRegistrar* registrar() { return &registrar_; } 133 content::NotificationRegistrar* registrar() { return &registrar_; }
134 SigninManager* signin_manager() { return signin_manager_; }
128 135
129 private: 136 private:
130 // Weak pointer to the profile this service is associated with. 137 // Weak pointer to the profile this service is associated with.
131 Profile* profile_; 138 Profile* profile_;
132 139
133 content::NotificationRegistrar registrar_; 140 content::NotificationRegistrar registrar_;
134 141
135 PrefService* local_state_; 142 PrefService* local_state_;
136 DeviceManagementService* device_management_service_; 143 DeviceManagementService* device_management_service_;
144 SigninManager* signin_manager_;
137 145
138 base::WeakPtrFactory<UserPolicySigninServiceBase> weak_factory_; 146 base::WeakPtrFactory<UserPolicySigninServiceBase> weak_factory_;
139 147
140 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninServiceBase); 148 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninServiceBase);
141 }; 149 };
142 150
143 } // namespace policy 151 } // namespace policy
144 152
145 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_BASE_H_ 153 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_BASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698