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

Side by Side Diff: remoting/client/token_fetcher_proxy.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/client/plugin/chromoting_instance.cc ('k') | remoting/host/daemon_process.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 #include "remoting/client/token_fetcher_proxy.h" 5 #include "remoting/client/token_fetcher_proxy.h"
6 6
7 #include "base/callback_helpers.h"
8
7 namespace remoting { 9 namespace remoting {
8 10
9 TokenFetcherProxy::TokenFetcherProxy( 11 TokenFetcherProxy::TokenFetcherProxy(
10 const TokenFetcherCallback& token_fetcher_impl, 12 const TokenFetcherCallback& token_fetcher_impl,
11 const std::string& host_public_key) 13 const std::string& host_public_key)
12 : host_public_key_(host_public_key), 14 : host_public_key_(host_public_key),
13 token_fetcher_impl_(token_fetcher_impl), 15 token_fetcher_impl_(token_fetcher_impl),
14 weak_factory_(this) { 16 weak_factory_(this) {
15 } 17 }
16 18
17 TokenFetcherProxy::~TokenFetcherProxy() { 19 TokenFetcherProxy::~TokenFetcherProxy() {
18 } 20 }
19 21
20 void TokenFetcherProxy::FetchThirdPartyToken( 22 void TokenFetcherProxy::FetchThirdPartyToken(
21 const GURL& token_url, 23 const GURL& token_url,
22 const std::string& scope, 24 const std::string& scope,
23 const TokenFetchedCallback& token_fetched_callback) { 25 const TokenFetchedCallback& token_fetched_callback) {
24 token_fetched_callback_ = token_fetched_callback; 26 token_fetched_callback_ = token_fetched_callback;
25 token_fetcher_impl_.Run( 27 token_fetcher_impl_.Run(
26 token_url, host_public_key_, scope, weak_factory_.GetWeakPtr()); 28 token_url, host_public_key_, scope, weak_factory_.GetWeakPtr());
27 } 29 }
28 30
29 void TokenFetcherProxy::OnTokenFetched( 31 void TokenFetcherProxy::OnTokenFetched(
30 const std::string& token, const std::string& shared_secret) { 32 const std::string& token, const std::string& shared_secret) {
31 if (!token_fetched_callback_.is_null()) { 33 if (!token_fetched_callback_.is_null()) {
32 token_fetched_callback_.Run(token, shared_secret); 34 base::ResetAndReturn(&token_fetched_callback_).Run(token, shared_secret);
33 token_fetched_callback_.Reset();
34 } 35 }
35 } 36 }
36 37
37 } // namespace remoting 38 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/plugin/chromoting_instance.cc ('k') | remoting/host/daemon_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698