OLD | NEW |
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 GOOGLE_APIS_GAIA_ACCOUNT_TRACKER_H_ | 5 #ifndef GOOGLE_APIS_GAIA_ACCOUNT_TRACKER_H_ |
6 #define GOOGLE_APIS_GAIA_ACCOUNT_TRACKER_H_ | 6 #define GOOGLE_APIS_GAIA_ACCOUNT_TRACKER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 void AddObserver(Observer* observer); | 60 void AddObserver(Observer* observer); |
61 void RemoveObserver(Observer* observer); | 61 void RemoveObserver(Observer* observer); |
62 | 62 |
63 // Returns the list of accounts that are signed in, and for which gaia IDs | 63 // Returns the list of accounts that are signed in, and for which gaia IDs |
64 // have been fetched. The primary account for the profile will be first | 64 // have been fetched. The primary account for the profile will be first |
65 // in the vector. Additional accounts will be in order of their gaia IDs. | 65 // in the vector. Additional accounts will be in order of their gaia IDs. |
66 std::vector<AccountIds> GetAccounts() const; | 66 std::vector<AccountIds> GetAccounts() const; |
67 AccountIds FindAccountIdsByGaiaId(const std::string& gaia_id); | 67 AccountIds FindAccountIdsByGaiaId(const std::string& gaia_id); |
68 | 68 |
69 // OAuth2TokenService::Observer implementation. | 69 // OAuth2TokenService::Observer implementation. |
70 virtual void OnRefreshTokenAvailable(const std::string& account_key) OVERRIDE; | 70 virtual void OnRefreshTokenAvailable(const std::string& account_key) override; |
71 virtual void OnRefreshTokenRevoked(const std::string& account_key) OVERRIDE; | 71 virtual void OnRefreshTokenRevoked(const std::string& account_key) override; |
72 | 72 |
73 void OnUserInfoFetchSuccess(AccountIdFetcher* fetcher, | 73 void OnUserInfoFetchSuccess(AccountIdFetcher* fetcher, |
74 const std::string& gaia_id); | 74 const std::string& gaia_id); |
75 void OnUserInfoFetchFailure(AccountIdFetcher* fetcher); | 75 void OnUserInfoFetchFailure(AccountIdFetcher* fetcher); |
76 | 76 |
77 // IdentityProvider::Observer implementation. | 77 // IdentityProvider::Observer implementation. |
78 virtual void OnActiveAccountLogin() OVERRIDE; | 78 virtual void OnActiveAccountLogin() override; |
79 virtual void OnActiveAccountLogout() OVERRIDE; | 79 virtual void OnActiveAccountLogout() override; |
80 | 80 |
81 // Sets the state of an account. Does not fire notifications. | 81 // Sets the state of an account. Does not fire notifications. |
82 void SetAccountStateForTest(AccountIds ids, bool is_signed_in); | 82 void SetAccountStateForTest(AccountIds ids, bool is_signed_in); |
83 | 83 |
84 IdentityProvider* identity_provider() { return identity_provider_; } | 84 IdentityProvider* identity_provider() { return identity_provider_; } |
85 | 85 |
86 // Indicates if all user information has been fetched. If the result is false, | 86 // Indicates if all user information has been fetched. If the result is false, |
87 // there are still unfininshed fetchers. | 87 // there are still unfininshed fetchers. |
88 virtual bool IsAllUserInfoFetched() const; | 88 virtual bool IsAllUserInfoFetched() const; |
89 | 89 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 const std::string& account_key); | 122 const std::string& account_key); |
123 virtual ~AccountIdFetcher(); | 123 virtual ~AccountIdFetcher(); |
124 | 124 |
125 const std::string& account_key() { return account_key_; } | 125 const std::string& account_key() { return account_key_; } |
126 | 126 |
127 void Start(); | 127 void Start(); |
128 | 128 |
129 // OAuth2TokenService::Consumer implementation. | 129 // OAuth2TokenService::Consumer implementation. |
130 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, | 130 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, |
131 const std::string& access_token, | 131 const std::string& access_token, |
132 const base::Time& expiration_time) OVERRIDE; | 132 const base::Time& expiration_time) override; |
133 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, | 133 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, |
134 const GoogleServiceAuthError& error) OVERRIDE; | 134 const GoogleServiceAuthError& error) override; |
135 | 135 |
136 // gaia::GaiaOAuthClient::Delegate implementation. | 136 // gaia::GaiaOAuthClient::Delegate implementation. |
137 virtual void OnGetUserIdResponse(const std::string& gaia_id) OVERRIDE; | 137 virtual void OnGetUserIdResponse(const std::string& gaia_id) override; |
138 virtual void OnOAuthError() OVERRIDE; | 138 virtual void OnOAuthError() override; |
139 virtual void OnNetworkError(int response_code) OVERRIDE; | 139 virtual void OnNetworkError(int response_code) override; |
140 | 140 |
141 private: | 141 private: |
142 OAuth2TokenService* token_service_; | 142 OAuth2TokenService* token_service_; |
143 net::URLRequestContextGetter* request_context_getter_; | 143 net::URLRequestContextGetter* request_context_getter_; |
144 AccountTracker* tracker_; | 144 AccountTracker* tracker_; |
145 const std::string account_key_; | 145 const std::string account_key_; |
146 | 146 |
147 scoped_ptr<OAuth2TokenService::Request> login_token_request_; | 147 scoped_ptr<OAuth2TokenService::Request> login_token_request_; |
148 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; | 148 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; |
149 }; | 149 }; |
150 | 150 |
151 } // namespace extensions | 151 } // namespace extensions |
152 | 152 |
153 #endif // GOOGLE_APIS_GAIA_ACCOUNT_TRACKER_H_ | 153 #endif // GOOGLE_APIS_GAIA_ACCOUNT_TRACKER_H_ |
OLD | NEW |