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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 private: | 90 private: |
91 struct AccountState { | 91 struct AccountState { |
92 AccountIds ids; | 92 AccountIds ids; |
93 bool is_signed_in; | 93 bool is_signed_in; |
94 }; | 94 }; |
95 | 95 |
96 void NotifyAccountAdded(const AccountState& account); | 96 void NotifyAccountAdded(const AccountState& account); |
97 void NotifyAccountRemoved(const AccountState& account); | 97 void NotifyAccountRemoved(const AccountState& account); |
98 void NotifySignInChanged(const AccountState& account); | 98 void NotifySignInChanged(const AccountState& account); |
99 | 99 |
100 void UpdateSignInState(const std::string account_key, bool is_signed_in); | 100 void UpdateSignInState(const std::string& account_key, bool is_signed_in); |
101 | 101 |
102 void StartTrackingAccount(const std::string account_key); | 102 void StartTrackingAccount(const std::string& account_key); |
| 103 |
| 104 // Note: |account_key| is passed by value here, because the original |
| 105 // object may be stored in |accounts_| and if so, it will be destroyed |
| 106 // after erasing the key from the map. |
103 void StopTrackingAccount(const std::string account_key); | 107 void StopTrackingAccount(const std::string account_key); |
| 108 |
104 void StopTrackingAllAccounts(); | 109 void StopTrackingAllAccounts(); |
105 void StartFetchingUserInfo(const std::string account_key); | 110 void StartFetchingUserInfo(const std::string& account_key); |
106 void DeleteFetcher(AccountIdFetcher* fetcher); | 111 void DeleteFetcher(AccountIdFetcher* fetcher); |
107 | 112 |
108 IdentityProvider* identity_provider_; // Not owned. | 113 IdentityProvider* identity_provider_; // Not owned. |
109 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | 114 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; |
110 std::map<std::string, AccountIdFetcher*> user_info_requests_; | 115 std::map<std::string, AccountIdFetcher*> user_info_requests_; |
111 std::map<std::string, AccountState> accounts_; | 116 std::map<std::string, AccountState> accounts_; |
112 base::ObserverList<Observer> observer_list_; | 117 base::ObserverList<Observer> observer_list_; |
113 bool shutdown_called_; | 118 bool shutdown_called_; |
114 }; | 119 }; |
115 | 120 |
(...skipping 28 matching lines...) Expand all Loading... |
144 AccountTracker* tracker_; | 149 AccountTracker* tracker_; |
145 const std::string account_key_; | 150 const std::string account_key_; |
146 | 151 |
147 scoped_ptr<OAuth2TokenService::Request> login_token_request_; | 152 scoped_ptr<OAuth2TokenService::Request> login_token_request_; |
148 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; | 153 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; |
149 }; | 154 }; |
150 | 155 |
151 } // namespace extensions | 156 } // namespace extensions |
152 | 157 |
153 #endif // GOOGLE_APIS_GAIA_ACCOUNT_TRACKER_H_ | 158 #endif // GOOGLE_APIS_GAIA_ACCOUNT_TRACKER_H_ |
OLD | NEW |