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

Side by Side Diff: remoting/base/oauth_token_getter_impl.h

Issue 2911893003: Deprecate NonThreadSafe in remoting in favor of SequenceChecker. (Closed)
Patch Set: Created 3 years, 6 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 | remoting/base/oauth_token_getter_impl.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 REMOTING_BASE_OAUTH_TOKEN_GETTER_IMPL_H_ 5 #ifndef REMOTING_BASE_OAUTH_TOKEN_GETTER_IMPL_H_
6 #define REMOTING_BASE_OAUTH_TOKEN_GETTER_IMPL_H_ 6 #define REMOTING_BASE_OAUTH_TOKEN_GETTER_IMPL_H_
7 7
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/threading/non_thread_safe.h" 11 #include "base/sequence_checker.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
14 #include "google_apis/gaia/gaia_oauth_client.h" 14 #include "google_apis/gaia/gaia_oauth_client.h"
15 #include "remoting/base/oauth_token_getter.h" 15 #include "remoting/base/oauth_token_getter.h"
16 16
17 namespace net { 17 namespace net {
18 class URLRequestContextGetter; 18 class URLRequestContextGetter;
19 } // namespace net 19 } // namespace net
20 20
21 namespace remoting { 21 namespace remoting {
22 22
23 // OAuthTokenGetter accepts an authorization code in the intermediate 23 // OAuthTokenGetter accepts an authorization code in the intermediate
24 // credentials or a refresh token in the authorization credentials. It will 24 // credentials or a refresh token in the authorization credentials. It will
25 // convert authorization code into a refresh token and access token, you may 25 // convert authorization code into a refresh token and access token, you may
26 // pass in a callback to be notified when a refresh token has been updated. 26 // pass in a callback to be notified when a refresh token has been updated.
27 // OAuthTokenGetter will exchange refresh tokens for access tokens and will 27 // OAuthTokenGetter will exchange refresh tokens for access tokens and will
28 // cache access tokens, refreshing them as needed. 28 // cache access tokens, refreshing them as needed.
29 // On first usage it is likely an application will only have an auth code, 29 // On first usage it is likely an application will only have an auth code,
30 // from this you can get a refresh token which can be reused next app launch. 30 // from this you can get a refresh token which can be reused next app launch.
31 class OAuthTokenGetterImpl : public OAuthTokenGetter, 31 class OAuthTokenGetterImpl : public OAuthTokenGetter,
32 public base::NonThreadSafe,
33 public gaia::GaiaOAuthClient::Delegate { 32 public gaia::GaiaOAuthClient::Delegate {
34 public: 33 public:
35 OAuthTokenGetterImpl( 34 OAuthTokenGetterImpl(
36 std::unique_ptr<OAuthIntermediateCredentials> intermediate_credentials, 35 std::unique_ptr<OAuthIntermediateCredentials> intermediate_credentials,
37 const OAuthTokenGetter::CredentialsUpdatedCallback& on_credentials_update, 36 const OAuthTokenGetter::CredentialsUpdatedCallback& on_credentials_update,
38 const scoped_refptr<net::URLRequestContextGetter>& 37 const scoped_refptr<net::URLRequestContextGetter>&
39 url_request_context_getter, 38 url_request_context_getter,
40 bool auto_refresh); 39 bool auto_refresh);
41 OAuthTokenGetterImpl( 40 OAuthTokenGetterImpl(
42 std::unique_ptr<OAuthAuthorizationCredentials> authorization_credentials, 41 std::unique_ptr<OAuthAuthorizationCredentials> authorization_credentials,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 OAuthTokenGetter::CredentialsUpdatedCallback credentials_updated_callback_; 75 OAuthTokenGetter::CredentialsUpdatedCallback credentials_updated_callback_;
77 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; 76 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
78 77
79 bool response_pending_ = false; 78 bool response_pending_ = false;
80 bool email_verified_ = false; 79 bool email_verified_ = false;
81 bool email_discovery_ = false; 80 bool email_discovery_ = false;
82 std::string oauth_access_token_; 81 std::string oauth_access_token_;
83 base::Time access_token_expiry_time_; 82 base::Time access_token_expiry_time_;
84 std::queue<OAuthTokenGetter::TokenCallback> pending_callbacks_; 83 std::queue<OAuthTokenGetter::TokenCallback> pending_callbacks_;
85 std::unique_ptr<base::OneShotTimer> refresh_timer_; 84 std::unique_ptr<base::OneShotTimer> refresh_timer_;
85
86 SEQUENCE_CHECKER(sequence_checker_);
86 }; 87 };
87 88
88 } // namespace remoting 89 } // namespace remoting
89 90
90 #endif // REMOTING_BASE_OAUTH_TOKEN_GETTER_IMPL_H_ 91 #endif // REMOTING_BASE_OAUTH_TOKEN_GETTER_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | remoting/base/oauth_token_getter_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698