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

Side by Side Diff: chrome/browser/chromeos/login/signin/token_handle_fetcher.h

Issue 1412813003: This CL replaces user_manager::UserID with AccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@468875--Chrome-OS-handles-deletion-of-Gmail-account-poorly--Create-AccountID-structure-part2--user_names
Patch Set: Rebased. Created 5 years, 2 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_LOGIN_SIGNIN_TOKEN_HANDLE_FETCHER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_FETCHER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_FETCHER_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_FETCHER_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/containers/scoped_ptr_hash_map.h" 12 #include "base/containers/scoped_ptr_hash_map.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "components/keyed_service/core/keyed_service_shutdown_notifier.h" 15 #include "components/keyed_service/core/keyed_service_shutdown_notifier.h"
16 #include "components/user_manager/user_id.h" 16 #include "components/signin/core/account_id/account_id.h"
17 #include "google_apis/gaia/gaia_oauth_client.h" 17 #include "google_apis/gaia/gaia_oauth_client.h"
18 #include "google_apis/gaia/oauth2_token_service.h" 18 #include "google_apis/gaia/oauth2_token_service.h"
19 19
20 class TokenHandleUtil; 20 class TokenHandleUtil;
21 class Profile; 21 class Profile;
22 22
23 // This class is resposible for obtaining new token handle for user. 23 // This class is resposible for obtaining new token handle for user.
24 // It can be used in two ways. When user have just used GAIA signin there is 24 // It can be used in two ways. When user have just used GAIA signin there is
25 // an OAuth2 token available. If there is profile already loaded, then 25 // an OAuth2 token available. If there is profile already loaded, then
26 // minting additional access token might be required. 26 // minting additional access token might be required.
27 27
28 class TokenHandleFetcher : public gaia::GaiaOAuthClient::Delegate, 28 class TokenHandleFetcher : public gaia::GaiaOAuthClient::Delegate,
29 public OAuth2TokenService::Consumer, 29 public OAuth2TokenService::Consumer,
30 public OAuth2TokenService::Observer { 30 public OAuth2TokenService::Observer {
31 public: 31 public:
32 TokenHandleFetcher(TokenHandleUtil* util, 32 TokenHandleFetcher(TokenHandleUtil* util, const AccountId& user_id);
achuithb 2015/10/23 00:08:50 account_id
Alexander Alekseev 2015/10/23 09:11:22 Done.
33 const user_manager::UserID& user_id);
34 ~TokenHandleFetcher() override; 33 ~TokenHandleFetcher() override;
35 34
36 typedef base::Callback<void(const user_manager::UserID&, bool success)> 35 typedef base::Callback<void(const AccountId&, bool success)>
37 TokenFetchingCallback; 36 TokenFetchingCallback;
38 37
39 // Get token handle for user who have just signed in via GAIA. This 38 // Get token handle for user who have just signed in via GAIA. This
40 // request will be performed using signin profile. 39 // request will be performed using signin profile.
41 void FillForNewUser(const std::string& access_token, 40 void FillForNewUser(const std::string& access_token,
42 const TokenFetchingCallback& callback); 41 const TokenFetchingCallback& callback);
43 42
44 // Get token handle for existing user. 43 // Get token handle for existing user.
45 void BackfillToken(Profile* profile, const TokenFetchingCallback& callback); 44 void BackfillToken(Profile* profile, const TokenFetchingCallback& callback);
46 45
(...skipping 14 matching lines...) Expand all
61 void OnGetTokenInfoResponse( 60 void OnGetTokenInfoResponse(
62 scoped_ptr<base::DictionaryValue> token_info) override; 61 scoped_ptr<base::DictionaryValue> token_info) override;
63 62
64 void RequestAccessToken(const std::string& account_id); 63 void RequestAccessToken(const std::string& account_id);
65 void FillForAccessToken(const std::string& access_token); 64 void FillForAccessToken(const std::string& access_token);
66 65
67 // This is called before profile is detroyed. 66 // This is called before profile is detroyed.
68 void OnProfileDestroyed(); 67 void OnProfileDestroyed();
69 68
70 TokenHandleUtil* token_handle_util_; 69 TokenHandleUtil* token_handle_util_;
71 user_manager::UserID user_id_; 70 AccountId user_id_;
72 OAuth2TokenService* token_service_; 71 OAuth2TokenService* token_service_;
73 72
74 bool waiting_for_refresh_token_; 73 bool waiting_for_refresh_token_;
75 std::string account_without_token_; 74 std::string account_without_token_;
76 Profile* profile_; 75 Profile* profile_;
77 base::TimeTicks tokeninfo_response_start_time_; 76 base::TimeTicks tokeninfo_response_start_time_;
78 TokenFetchingCallback callback_; 77 TokenFetchingCallback callback_;
79 scoped_ptr<gaia::GaiaOAuthClient> gaia_client_; 78 scoped_ptr<gaia::GaiaOAuthClient> gaia_client_;
80 scoped_ptr<OAuth2TokenService::Request> oauth2_access_token_request_; 79 scoped_ptr<OAuth2TokenService::Request> oauth2_access_token_request_;
81 scoped_ptr<KeyedServiceShutdownNotifier::Subscription> 80 scoped_ptr<KeyedServiceShutdownNotifier::Subscription>
82 profile_shutdown_notification_; 81 profile_shutdown_notification_;
83 82
84 DISALLOW_COPY_AND_ASSIGN(TokenHandleFetcher); 83 DISALLOW_COPY_AND_ASSIGN(TokenHandleFetcher);
85 }; 84 };
86 85
87 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_FETCHER_H_ 86 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_FETCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698