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 CHROME_BROWSER_SERVICES_GCM_GCM_ACCOUNT_TRACKER_H_ | 5 #ifndef CHROME_BROWSER_SERVICES_GCM_GCM_ACCOUNT_TRACKER_H_ |
6 #define CHROME_BROWSER_SERVICES_GCM_GCM_ACCOUNT_TRACKER_H_ | 6 #define CHROME_BROWSER_SERVICES_GCM_GCM_ACCOUNT_TRACKER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 // Email address of the tracked account. | 44 // Email address of the tracked account. |
45 std::string email; | 45 std::string email; |
46 // OAuth2 access token, when |state| is TOKEN_PRESENT. | 46 // OAuth2 access token, when |state| is TOKEN_PRESENT. |
47 std::string access_token; | 47 std::string access_token; |
48 // Status of the token fetching. | 48 // Status of the token fetching. |
49 AccountState state; | 49 AccountState state; |
50 }; | 50 }; |
51 | 51 |
52 // Callback for the GetAccountsForCheckin call. |account_tokens| maps email | 52 // Callback for the GetAccountsForCheckin call. |account_tokens| maps email |
53 // addresses to OAuth2 access tokens. |account_removed| indicates whether an | 53 // addresses to OAuth2 access tokens. |
54 // account has been removed since the last time the callback was called. | 54 typedef base::Callback<void(const std::map<std::string, std::string>& |
55 typedef base::Callback< | 55 account_tokens)> UpdateAccountsCallback; |
56 void(const std::map<std::string, std::string>& account_tokens, | |
57 bool account_removed)> UpdateAccountsCallback; | |
58 | 56 |
59 // Creates an instance of GCMAccountTracker. |account_tracker| is used to | 57 // Creates an instance of GCMAccountTracker. |account_tracker| is used to |
60 // deliver information about the account, while |callback| will be called | 58 // deliver information about the account, while |callback| will be called |
61 // once all of the accounts have been fetched a necessary OAuth2 token, as | 59 // once all of the accounts have been fetched a necessary OAuth2 token, as |
62 // many times as the list of accounts is stable, meaning that all accounts | 60 // many times as the list of accounts is stable, meaning that all accounts |
63 // are known and there is no related activity in progress for them, like | 61 // are known and there is no related activity in progress for them, like |
64 // fetching OAuth2 tokens. | 62 // fetching OAuth2 tokens. |
65 GCMAccountTracker(scoped_ptr<gaia::AccountTracker> account_tracker, | 63 GCMAccountTracker(scoped_ptr<gaia::AccountTracker> account_tracker, |
66 const UpdateAccountsCallback& callback); | 64 const UpdateAccountsCallback& callback); |
67 virtual ~GCMAccountTracker(); | 65 virtual ~GCMAccountTracker(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 bool shutdown_called_; | 124 bool shutdown_called_; |
127 | 125 |
128 ScopedVector<OAuth2TokenService::Request> pending_token_requests_; | 126 ScopedVector<OAuth2TokenService::Request> pending_token_requests_; |
129 | 127 |
130 DISALLOW_COPY_AND_ASSIGN(GCMAccountTracker); | 128 DISALLOW_COPY_AND_ASSIGN(GCMAccountTracker); |
131 }; | 129 }; |
132 | 130 |
133 } // namespace gcm | 131 } // namespace gcm |
134 | 132 |
135 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_ACCOUNT_TRACKER_H_ | 133 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_ACCOUNT_TRACKER_H_ |
OLD | NEW |