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

Side by Side Diff: components/signin/core/browser/profile_oauth2_token_service.h

Issue 2939443004: Load credentials on desktop even when there is no authenticated account ID. (Closed)
Patch Set: Unit test Created 3 years, 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_SIGNIN_CORE_BROWSER_PROFILE_OAUTH2_TOKEN_SERVICE_H_ 5 #ifndef COMPONENTS_SIGNIN_CORE_BROWSER_PROFILE_OAUTH2_TOKEN_SERVICE_H_
6 #define COMPONENTS_SIGNIN_CORE_BROWSER_PROFILE_OAUTH2_TOKEN_SERVICE_H_ 6 #define COMPONENTS_SIGNIN_CORE_BROWSER_PROFILE_OAUTH2_TOKEN_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 24 matching lines...) Expand all
35 ProfileOAuth2TokenService( 35 ProfileOAuth2TokenService(
36 std::unique_ptr<OAuth2TokenServiceDelegate> delegate); 36 std::unique_ptr<OAuth2TokenServiceDelegate> delegate);
37 ~ProfileOAuth2TokenService() override; 37 ~ProfileOAuth2TokenService() override;
38 38
39 // KeyedService implementation. 39 // KeyedService implementation.
40 void Shutdown() override; 40 void Shutdown() override;
41 41
42 // Loads credentials from a backing persistent store to make them available 42 // Loads credentials from a backing persistent store to make them available
43 // after service is used between profile restarts. 43 // after service is used between profile restarts.
44 // 44 //
45 // Only call this method if there is at least one account connected to the 45 // The primary account is specified with the |primary_account_id| argument.
46 // profile, otherwise startup will cause unneeded work on the IO thread. The 46 // For a regular profile, the primary account id comes from SigninManager.
47 // primary account is specified with the |primary_account_id| argument. If 47 // For a supervised user, the id comes from SupervisedUserService.
48 // empty, no credentials will be loaded. For a regular profile, the primary
49 // account id comes from SigninManager. For a supervised user, the id comes
50 // from SupervisedUserService.
51 virtual void LoadCredentials(const std::string& primary_account_id); 48 virtual void LoadCredentials(const std::string& primary_account_id);
52 49
53 // Updates a |refresh_token| for an |account_id|. Credentials are persisted, 50 // Updates a |refresh_token| for an |account_id|. Credentials are persisted,
54 // and available through |LoadCredentials| after service is restarted. 51 // and available through |LoadCredentials| after service is restarted.
55 virtual void UpdateCredentials(const std::string& account_id, 52 virtual void UpdateCredentials(const std::string& account_id,
56 const std::string& refresh_token); 53 const std::string& refresh_token);
57 54
58 virtual void RevokeCredentials(const std::string& account_id); 55 virtual void RevokeCredentials(const std::string& account_id);
59 56
60 // Returns a pointer to its instance of net::BackoffEntry or nullptr if there 57 // Returns a pointer to its instance of net::BackoffEntry or nullptr if there
61 // is no such instance. 58 // is no such instance.
62 const net::BackoffEntry* GetDelegateBackoffEntry(); 59 const net::BackoffEntry* GetDelegateBackoffEntry();
63 60
64 private: 61 private:
65 void OnRefreshTokenAvailable(const std::string& account_id) override; 62 void OnRefreshTokenAvailable(const std::string& account_id) override;
66 void OnRefreshTokenRevoked(const std::string& account_id) override; 63 void OnRefreshTokenRevoked(const std::string& account_id) override;
67 64
68 DISALLOW_COPY_AND_ASSIGN(ProfileOAuth2TokenService); 65 DISALLOW_COPY_AND_ASSIGN(ProfileOAuth2TokenService);
69 }; 66 };
70 67
71 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_PROFILE_OAUTH2_TOKEN_SERVICE_H_ 68 #endif // COMPONENTS_SIGNIN_CORE_BROWSER_PROFILE_OAUTH2_TOKEN_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698