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

Side by Side Diff: chrome/browser/policy/cloud/user_policy_signin_service_android.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_ANDROID_H_ 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_ANDROID_H_
6 #define CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_ANDROID_H_ 6 #define CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_ANDROID_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/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "chrome/browser/policy/cloud/user_policy_signin_service_base.h" 14 #include "chrome/browser/policy/cloud/user_policy_signin_service_base.h"
15 15
16 class AndroidProfileOAuth2TokenService;
16 class Profile; 17 class Profile;
17 18
18 namespace policy { 19 namespace policy {
19 20
20 class CloudPolicyClientRegistrationHelper; 21 class CloudPolicyClientRegistrationHelper;
21 22
22 // A specialization of the UserPolicySigninServiceBase for Android. 23 // A specialization of the UserPolicySigninServiceBase for Android.
23 class UserPolicySigninService : public UserPolicySigninServiceBase { 24 class UserPolicySigninService : public UserPolicySigninServiceBase {
24 public: 25 public:
25 // Creates a UserPolicySigninService associated with the passed |profile|. 26 // Creates a UserPolicySigninService associated with the passed |profile|.
26 UserPolicySigninService(Profile* profile, 27 UserPolicySigninService(Profile* profile,
27 PrefService* local_state, 28 PrefService* local_state,
28 DeviceManagementService* device_management_service); 29 DeviceManagementService* device_management_service,
30 SigninManager* signin_manager,
31 AndroidProfileOAuth2TokenService* token_service);
29 virtual ~UserPolicySigninService(); 32 virtual ~UserPolicySigninService();
30 33
31 // Registers a CloudPolicyClient for fetching policy for |username|. 34 // Registers a CloudPolicyClient for fetching policy for |username|.
32 // This requests an OAuth2 token for the services involved, and contacts 35 // This requests an OAuth2 token for the services involved, and contacts
33 // the policy service if the account has management enabled. 36 // the policy service if the account has management enabled.
34 // |callback| is invoked once the CloudPolicyClient is ready to fetch policy, 37 // |callback| is invoked once the CloudPolicyClient is ready to fetch policy,
35 // or once it is determined that |username| is not a managed account. 38 // or once it is determined that |username| is not a managed account.
36 void RegisterPolicyClient(const std::string& username, 39 void RegisterPolicyClient(const std::string& username,
37 const PolicyRegistrationCallback& callback); 40 const PolicyRegistrationCallback& callback);
38 41
(...skipping 11 matching lines...) Expand all
50 void RegisterCloudPolicyService(); 53 void RegisterCloudPolicyService();
51 54
52 // Cancels a pending cloud policy registration attempt. 55 // Cancels a pending cloud policy registration attempt.
53 void CancelPendingRegistration(); 56 void CancelPendingRegistration();
54 57
55 void OnRegistrationDone(); 58 void OnRegistrationDone();
56 59
57 scoped_ptr<CloudPolicyClientRegistrationHelper> registration_helper_; 60 scoped_ptr<CloudPolicyClientRegistrationHelper> registration_helper_;
58 base::WeakPtrFactory<UserPolicySigninService> weak_factory_; 61 base::WeakPtrFactory<UserPolicySigninService> weak_factory_;
59 62
63 // Weak pointer to the token service used to authenticate the
64 // CloudPolicyClient during registration.
65 AndroidProfileOAuth2TokenService* oauth2_token_service_;
66
60 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninService); 67 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninService);
61 }; 68 };
62 69
63 } // namespace policy 70 } // namespace policy
64 71
65 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_ANDROID_H_ 72 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698