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

Side by Side Diff: chrome/browser/chromeos/policy/user_cloud_policy_token_forwarder.h

Issue 137553007: User cloud policy token forwarder: Replace PO2TS::GetPrimaryAccountId() with SMB::GetAuthenticatedAc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 6 years, 9 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_CHROMEOS_POLICY_USER_CLOUD_POLICY_TOKEN_FORWARDER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_TOKEN_FORWARDER_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_TOKEN_FORWARDER_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_TOKEN_FORWARDER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "components/browser_context_keyed_service/browser_context_keyed_service .h" 9 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
10 #include "components/policy/core/common/cloud/cloud_policy_service.h" 10 #include "components/policy/core/common/cloud/cloud_policy_service.h"
11 #include "google_apis/gaia/oauth2_token_service.h" 11 #include "google_apis/gaia/oauth2_token_service.h"
12 12
13 class ProfileOAuth2TokenService; 13 class ProfileOAuth2TokenService;
14 class SigninManagerBase;
14 15
15 namespace policy { 16 namespace policy {
16 17
17 class UserCloudPolicyManagerChromeOS; 18 class UserCloudPolicyManagerChromeOS;
18 19
19 // A PKS that observes a ProfileOAuth2TokenService and mints the policy access 20 // A PKS that observes a ProfileOAuth2TokenService and mints the policy access
20 // token for the UserCloudPolicyManagerChromeOS, when the token service becomes 21 // token for the UserCloudPolicyManagerChromeOS, when the token service becomes
21 // ready. This service decouples the UserCloudPolicyManagerChromeOS from 22 // ready. This service decouples the UserCloudPolicyManagerChromeOS from
22 // depending directly on the ProfileOAuth2TokenService, since it is initialized 23 // depending directly on the ProfileOAuth2TokenService, since it is initialized
23 // much earlier. 24 // much earlier.
24 class UserCloudPolicyTokenForwarder : public BrowserContextKeyedService, 25 class UserCloudPolicyTokenForwarder : public BrowserContextKeyedService,
25 public OAuth2TokenService::Observer, 26 public OAuth2TokenService::Observer,
26 public OAuth2TokenService::Consumer, 27 public OAuth2TokenService::Consumer,
27 public CloudPolicyService::Observer { 28 public CloudPolicyService::Observer {
28 public: 29 public:
29 // The factory of this PKS depends on the factories of these two arguments, 30 // The factory of this PKS depends on the factories of these two arguments,
30 // so this object will be Shutdown() first and these pointers can be used 31 // so this object will be Shutdown() first and these pointers can be used
31 // until that point. 32 // until that point.
32 UserCloudPolicyTokenForwarder(UserCloudPolicyManagerChromeOS* manager, 33 UserCloudPolicyTokenForwarder(UserCloudPolicyManagerChromeOS* manager,
33 ProfileOAuth2TokenService* token_service); 34 ProfileOAuth2TokenService* token_service,
35 SigninManagerBase* signin_manager);
34 virtual ~UserCloudPolicyTokenForwarder(); 36 virtual ~UserCloudPolicyTokenForwarder();
35 37
36 // BrowserContextKeyedService: 38 // BrowserContextKeyedService:
37 virtual void Shutdown() OVERRIDE; 39 virtual void Shutdown() OVERRIDE;
38 40
39 // OAuth2TokenService::Observer: 41 // OAuth2TokenService::Observer:
40 virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE; 42 virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE;
41 43
42 // OAuth2TokenService::Consumer: 44 // OAuth2TokenService::Consumer:
43 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, 45 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
44 const std::string& access_token, 46 const std::string& access_token,
45 const base::Time& expiration_time) OVERRIDE; 47 const base::Time& expiration_time) OVERRIDE;
46 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, 48 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request,
47 const GoogleServiceAuthError& error) OVERRIDE; 49 const GoogleServiceAuthError& error) OVERRIDE;
48 50
49 // CloudPolicyService::Observer: 51 // CloudPolicyService::Observer:
50 virtual void OnInitializationCompleted(CloudPolicyService* service) OVERRIDE; 52 virtual void OnInitializationCompleted(CloudPolicyService* service) OVERRIDE;
51 53
52 private: 54 private:
53 void Initialize(); 55 void Initialize();
54 56
55 void RequestAccessToken(); 57 void RequestAccessToken();
56 58
57 UserCloudPolicyManagerChromeOS* manager_; 59 UserCloudPolicyManagerChromeOS* manager_;
58 ProfileOAuth2TokenService* token_service_; 60 ProfileOAuth2TokenService* token_service_;
61 SigninManagerBase* signin_manager_;
59 scoped_ptr<OAuth2TokenService::Request> request_; 62 scoped_ptr<OAuth2TokenService::Request> request_;
60 63
61 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyTokenForwarder); 64 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyTokenForwarder);
62 }; 65 };
63 66
64 } // namespace policy 67 } // namespace policy
65 68
66 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_TOKEN_FORWARDER_H_ 69 #endif // CHROME_BROWSER_CHROMEOS_POLICY_USER_CLOUD_POLICY_TOKEN_FORWARDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698