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.
5 #include "remoting/client/token_fetcher_proxy.h"
7 #include "base/callback_helpers.h"
11 TokenFetcherProxy::TokenFetcherProxy(
12 const TokenFetcherCallback
& token_fetcher_impl
,
13 const std::string
& host_public_key
)
14 : host_public_key_(host_public_key
),
15 token_fetcher_impl_(token_fetcher_impl
),
19 TokenFetcherProxy::~TokenFetcherProxy() {
22 void TokenFetcherProxy::FetchThirdPartyToken(
23 const GURL
& token_url
,
24 const std::string
& scope
,
25 const TokenFetchedCallback
& token_fetched_callback
) {
26 token_fetched_callback_
= token_fetched_callback
;
27 token_fetcher_impl_
.Run(
28 token_url
, host_public_key_
, scope
, weak_factory_
.GetWeakPtr());
31 void TokenFetcherProxy::OnTokenFetched(
32 const std::string
& token
, const std::string
& shared_secret
) {
33 if (!token_fetched_callback_
.is_null()) {
34 base::ResetAndReturn(&token_fetched_callback_
).Run(token
, shared_secret
);
38 } // namespace remoting