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

Side by Side Diff: chrome/browser/services/gcm/gcm_account_tracker.h

Issue 594383003: [GCM] Passing GCMClient::AccountTokenInfo list to GCMDriver (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@account-mapper
Patch Set: Addressing CR comments Created 6 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
« no previous file with comments | « no previous file | chrome/browser/services/gcm/gcm_account_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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
11 #include "base/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
12 #include "components/gcm_driver/gcm_client.h"
12 #include "google_apis/gaia/account_tracker.h" 13 #include "google_apis/gaia/account_tracker.h"
13 #include "google_apis/gaia/oauth2_token_service.h" 14 #include "google_apis/gaia/oauth2_token_service.h"
14 15
15 namespace gcm { 16 namespace gcm {
16 17
17 // Class for reporting back which accounts are signed into. It is only meant to 18 // Class for reporting back which accounts are signed into. It is only meant to
18 // be used when the user is signed into sync. 19 // be used when the user is signed into sync.
19 class GCMAccountTracker : public gaia::AccountTracker::Observer, 20 class GCMAccountTracker : public gaia::AccountTracker::Observer,
20 public OAuth2TokenService::Consumer { 21 public OAuth2TokenService::Consumer {
21 public: 22 public:
(...skipping 20 matching lines...) Expand all
42 ~AccountInfo(); 43 ~AccountInfo();
43 44
44 // Email address of the tracked account. 45 // Email address of the tracked account.
45 std::string email; 46 std::string email;
46 // OAuth2 access token, when |state| is TOKEN_PRESENT. 47 // OAuth2 access token, when |state| is TOKEN_PRESENT.
47 std::string access_token; 48 std::string access_token;
48 // Status of the token fetching. 49 // Status of the token fetching.
49 AccountState state; 50 AccountState state;
50 }; 51 };
51 52
52 // Callback for the GetAccountsForCheckin call. |account_tokens| maps email 53 // Callback for the GetAccountsForCheckin call. |account_tokens|: list of
53 // addresses to OAuth2 access tokens. 54 // email addresses, account ids and OAuth2 access tokens.
54 typedef base::Callback<void(const std::map<std::string, std::string>& 55 typedef base::Callback<void(const std::vector<GCMClient::AccountTokenInfo>&
55 account_tokens)> UpdateAccountsCallback; 56 account_tokens)> UpdateAccountsCallback;
56 57
57 // Creates an instance of GCMAccountTracker. |account_tracker| is used to 58 // Creates an instance of GCMAccountTracker. |account_tracker| is used to
58 // deliver information about the account, while |callback| will be called 59 // deliver information about the account, while |callback| will be called
59 // once all of the accounts have been fetched a necessary OAuth2 token, as 60 // once all of the accounts have been fetched a necessary OAuth2 token, as
60 // many times as the list of accounts is stable, meaning that all accounts 61 // many times as the list of accounts is stable, meaning that all accounts
61 // are known and there is no related activity in progress for them, like 62 // are known and there is no related activity in progress for them, like
62 // fetching OAuth2 tokens. 63 // fetching OAuth2 tokens.
63 GCMAccountTracker(scoped_ptr<gaia::AccountTracker> account_tracker, 64 GCMAccountTracker(scoped_ptr<gaia::AccountTracker> account_tracker,
64 const UpdateAccountsCallback& callback); 65 const UpdateAccountsCallback& callback);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 bool shutdown_called_; 125 bool shutdown_called_;
125 126
126 ScopedVector<OAuth2TokenService::Request> pending_token_requests_; 127 ScopedVector<OAuth2TokenService::Request> pending_token_requests_;
127 128
128 DISALLOW_COPY_AND_ASSIGN(GCMAccountTracker); 129 DISALLOW_COPY_AND_ASSIGN(GCMAccountTracker);
129 }; 130 };
130 131
131 } // namespace gcm 132 } // namespace gcm
132 133
133 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_ACCOUNT_TRACKER_H_ 134 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_ACCOUNT_TRACKER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/services/gcm/gcm_account_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698