Re-land: C++ readability review
[chromium-blink-merge.git] / remoting / client / token_fetcher_proxy.cc
blobc1082b2d427050621df7b1ba380dc8f384a221ef
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 namespace remoting {
9 TokenFetcherProxy::TokenFetcherProxy(
10 const TokenFetcherCallback& token_fetcher_impl,
11 const std::string& host_public_key)
12 : host_public_key_(host_public_key),
13 token_fetcher_impl_(token_fetcher_impl),
14 weak_factory_(this) {
17 TokenFetcherProxy::~TokenFetcherProxy() {
20 void TokenFetcherProxy::FetchThirdPartyToken(
21 const GURL& token_url,
22 const std::string& scope,
23 const TokenFetchedCallback& token_fetched_callback) {
24 token_fetched_callback_ = token_fetched_callback;
25 token_fetcher_impl_.Run(
26 token_url, host_public_key_, scope, weak_factory_.GetWeakPtr());
29 void TokenFetcherProxy::OnTokenFetched(
30 const std::string& token, const std::string& shared_secret) {
31 if (!token_fetched_callback_.is_null()) {
32 token_fetched_callback_.Run(token, shared_secret);
33 token_fetched_callback_.Reset();
37 } // namespace remoting