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

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

Issue 378643002: [GCM] Check-in with signed in accounts associates device to user (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Version storing last checked in accounts Created 6 years, 5 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 | Annotate | Revision Log
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"
fgorski 2014/07/15 17:46:37 remove
fgorski 2014/07/17 03:35:34 Done.
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 21 matching lines...) Expand all
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| maps email
53 // addresses to OAuth2 access tokens. |account_removed| indicates whether an 54 // addresses to OAuth2 access tokens.
54 // account has been removed since the last time the callback was called. 55 typedef base::Callback<void(const std::map<std::string, std::string>&
55 typedef base::Callback< 56 account_tokens)> UpdateAccountsCallback;
56 void(const std::map<std::string, std::string>& account_tokens,
57 bool account_removed)> UpdateAccountsCallback;
58 57
59 // Creates an instance of GCMAccountTracker. |account_tracker| is used to 58 // Creates an instance of GCMAccountTracker. |account_tracker| is used to
60 // deliver information about the account, while |callback| will be called 59 // deliver information about the account, while |callback| will be called
61 // 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
62 // 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
63 // 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
64 // fetching OAuth2 tokens. 63 // fetching OAuth2 tokens.
65 GCMAccountTracker(scoped_ptr<gaia::AccountTracker> account_tracker, 64 GCMAccountTracker(scoped_ptr<gaia::AccountTracker> account_tracker,
66 const UpdateAccountsCallback& callback); 65 const UpdateAccountsCallback& callback);
67 virtual ~GCMAccountTracker(); 66 virtual ~GCMAccountTracker();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 bool shutdown_called_; 125 bool shutdown_called_;
127 126
128 ScopedVector<OAuth2TokenService::Request> pending_token_requests_; 127 ScopedVector<OAuth2TokenService::Request> pending_token_requests_;
129 128
130 DISALLOW_COPY_AND_ASSIGN(GCMAccountTracker); 129 DISALLOW_COPY_AND_ASSIGN(GCMAccountTracker);
131 }; 130 };
132 131
133 } // namespace gcm 132 } // namespace gcm
134 133
135 #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') | chrome/browser/services/gcm/gcm_profile_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698