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

Side by Side Diff: remoting/host/setup/oauth_client.cc

Issue 1064863004: Use base::ResetAndReturn() in remoting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/setup/host_starter.cc ('k') | remoting/protocol/fake_authenticator.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "remoting/host/setup/oauth_client.h" 5 #include "remoting/host/setup/oauth_client.h"
6 6
7 #include "base/callback_helpers.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
8 9
9 namespace { 10 namespace {
10 const int kMaxGaiaRetries = 3; 11 const int kMaxGaiaRetries = 3;
11 } // namespace 12 } // namespace
12 13
13 namespace remoting { 14 namespace remoting {
14 15
15 OAuthClient::OAuthClient( 16 OAuthClient::OAuthClient(
16 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter) 17 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 55
55 void OAuthClient::OnRefreshTokenResponse( 56 void OAuthClient::OnRefreshTokenResponse(
56 const std::string& access_token, 57 const std::string& access_token,
57 int expires_in_seconds) { 58 int expires_in_seconds) {
58 // We never request a refresh token, so this call is not expected. 59 // We never request a refresh token, so this call is not expected.
59 NOTREACHED(); 60 NOTREACHED();
60 } 61 }
61 62
62 void OAuthClient::SendResponse(const std::string& user_email, 63 void OAuthClient::SendResponse(const std::string& user_email,
63 const std::string& refresh_token) { 64 const std::string& refresh_token) {
64 CompletionCallback on_done = on_done_; 65 base::ResetAndReturn(&on_done_).Run(user_email, refresh_token);
65 on_done_.Reset();
66 on_done.Run(user_email, refresh_token);
67 66
68 // Process the next request in the queue. 67 // Process the next request in the queue.
69 if (pending_requests_.size()) { 68 if (pending_requests_.size()) {
70 Request request = pending_requests_.front(); 69 Request request = pending_requests_.front();
71 pending_requests_.pop(); 70 pending_requests_.pop();
72 // GetCredentialsFromAuthCode is asynchronous, so it's safe to call it here. 71 // GetCredentialsFromAuthCode is asynchronous, so it's safe to call it here.
73 GetCredentialsFromAuthCode( 72 GetCredentialsFromAuthCode(
74 request.oauth_client_info, 73 request.oauth_client_info,
75 request.auth_code, 74 request.auth_code,
76 request.need_user_email, 75 request.need_user_email,
(...skipping 21 matching lines...) Expand all
98 this->oauth_client_info = oauth_client_info; 97 this->oauth_client_info = oauth_client_info;
99 this->auth_code = auth_code; 98 this->auth_code = auth_code;
100 this->need_user_email = need_user_email; 99 this->need_user_email = need_user_email;
101 this->on_done = on_done; 100 this->on_done = on_done;
102 } 101 }
103 102
104 OAuthClient::Request::~Request() { 103 OAuthClient::Request::~Request() {
105 } 104 }
106 105
107 } // namespace remoting 106 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/setup/host_starter.cc ('k') | remoting/protocol/fake_authenticator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698