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

Side by Side Diff: remoting/host/oauth_token_getter.h

Issue 719983002: Reporting of policy errors via host-offline-reason: part 3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hor-nohoststatussender
Patch Set: Rebasing... Created 5 years, 11 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 | « remoting/host/mock_callback.h ('k') | remoting/host/oauth_token_getter.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_HOST_OAUTH_TOKEN_GETTER_H_ 5 #ifndef REMOTING_HOST_OAUTH_TOKEN_GETTER_H_
6 #define REMOTING_HOST_OAUTH_TOKEN_GETTER_H_ 6 #define REMOTING_HOST_OAUTH_TOKEN_GETTER_H_
7 7
8 #include <queue> 8 #include <queue>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 24 matching lines...) Expand all
35 AUTH_ERROR, 35 AUTH_ERROR,
36 }; 36 };
37 37
38 typedef base::Callback<void(Status status, 38 typedef base::Callback<void(Status status,
39 const std::string& user_email, 39 const std::string& user_email,
40 const std::string& access_token)> TokenCallback; 40 const std::string& access_token)> TokenCallback;
41 41
42 // This structure contains information required to perform 42 // This structure contains information required to perform
43 // authentication to OAuth2. 43 // authentication to OAuth2.
44 struct OAuthCredentials { 44 struct OAuthCredentials {
45 // |is_service_account| should be True if the OAuth refresh token is for a
46 // service account, False for a user account, to allow the correct client-ID
47 // to be used.
45 OAuthCredentials(const std::string& login, 48 OAuthCredentials(const std::string& login,
46 const std::string& refresh_token, 49 const std::string& refresh_token,
47 bool is_service_account); 50 bool is_service_account);
48 51
49 // The user's account name (i.e. their email address). 52 // The user's account name (i.e. their email address).
50 std::string login; 53 std::string login;
51 54
52 // Token delegating authority to us to act as the user. 55 // Token delegating authority to us to act as the user.
53 std::string refresh_token; 56 std::string refresh_token;
54 57
55 // Whether these credentials belong to a service account. 58 // Whether these credentials belong to a service account.
56 bool is_service_account; 59 bool is_service_account;
57 }; 60 };
58 61
59 OAuthTokenGetter( 62 OAuthTokenGetter(scoped_ptr<OAuthCredentials> oauth_credentials,
60 scoped_ptr<OAuthCredentials> oauth_credentials, 63 const scoped_refptr<net::URLRequestContextGetter>&
61 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter, 64 url_request_context_getter,
62 bool auto_refresh); 65 bool auto_refresh);
63 ~OAuthTokenGetter() override; 66 ~OAuthTokenGetter() override;
64 67
65 // Call |on_access_token| with an access token, or the failure status. 68 // Call |on_access_token| with an access token, or the failure status.
66 void CallWithToken(const OAuthTokenGetter::TokenCallback& on_access_token); 69 void CallWithToken(const OAuthTokenGetter::TokenCallback& on_access_token);
67 70
68 // gaia::GaiaOAuthClient::Delegate interface. 71 // gaia::GaiaOAuthClient::Delegate interface.
69 void OnGetTokensResponse(const std::string& user_email, 72 void OnGetTokensResponse(const std::string& user_email,
70 const std::string& access_token, 73 const std::string& access_token,
71 int expires_seconds) override; 74 int expires_seconds) override;
72 void OnRefreshTokenResponse(const std::string& access_token, 75 void OnRefreshTokenResponse(const std::string& access_token,
(...skipping 18 matching lines...) Expand all
91 base::Time auth_token_expiry_time_; 94 base::Time auth_token_expiry_time_;
92 std::queue<OAuthTokenGetter::TokenCallback> pending_callbacks_; 95 std::queue<OAuthTokenGetter::TokenCallback> pending_callbacks_;
93 scoped_ptr<base::OneShotTimer<OAuthTokenGetter> > refresh_timer_; 96 scoped_ptr<base::OneShotTimer<OAuthTokenGetter> > refresh_timer_;
94 97
95 DISALLOW_COPY_AND_ASSIGN(OAuthTokenGetter); 98 DISALLOW_COPY_AND_ASSIGN(OAuthTokenGetter);
96 }; 99 };
97 100
98 } // namespace remoting 101 } // namespace remoting
99 102
100 #endif // REMOTING_HOST_OAUTH_TOKEN_GETTER_H_ 103 #endif // REMOTING_HOST_OAUTH_TOKEN_GETTER_H_
OLDNEW
« no previous file with comments | « remoting/host/mock_callback.h ('k') | remoting/host/oauth_token_getter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698