OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "remoting/client/token_fetcher_proxy.h" |
| 6 |
| 7 namespace remoting { |
| 8 |
| 9 TokenFetcherProxy::TokenFetcherProxy(TokenFetcherCallback token_fetcher_impl, |
| 10 const std::string& host_public_key) |
| 11 : host_public_key_(host_public_key), |
| 12 token_fetcher_impl_(token_fetcher_impl), |
| 13 weak_factory_(this) { |
| 14 } |
| 15 |
| 16 TokenFetcherProxy::~TokenFetcherProxy() { |
| 17 } |
| 18 |
| 19 void TokenFetcherProxy::FetchThirdPartyToken( |
| 20 const GURL& token_url, |
| 21 const std::string& scope, |
| 22 const TokenFetchedCallback& token_fetched_callback) { |
| 23 token_fetched_callback_ = token_fetched_callback; |
| 24 token_fetcher_impl_.Run(token_url, scope, weak_factory_.GetWeakPtr()); |
| 25 } |
| 26 |
| 27 void TokenFetcherProxy::OnTokenFetched( |
| 28 const std::string& token, const std::string& shared_secret) { |
| 29 if (!token_fetched_callback_.is_null()) { |
| 30 token_fetched_callback_.Run(token, shared_secret); |
| 31 token_fetched_callback_.Reset(); |
| 32 } |
| 33 } |
| 34 |
| 35 } // namespace remoting |
OLD | NEW |