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
3 // found in the LICENSE file.
5 #include "remoting/client/plugin/pepper_token_fetcher.h"
7 #include "remoting/client/plugin/chromoting_instance.h"
11 PepperTokenFetcher::PepperTokenFetcher(base::WeakPtr<ChromotingInstance> plugin,
12 const std::string& host_public_key)
14 host_public_key_(host_public_key),
18 PepperTokenFetcher::~PepperTokenFetcher() {
21 void PepperTokenFetcher::FetchThirdPartyToken(
22 const GURL& token_url,
23 const std::string& scope,
24 const TokenFetchedCallback& token_fetched_callback) {
26 token_fetched_callback_ = token_fetched_callback;
27 plugin_->FetchThirdPartyToken(token_url, host_public_key_, scope,
28 weak_factory_.GetWeakPtr());
32 void PepperTokenFetcher::OnTokenFetched(
33 const std::string& token, const std::string& shared_secret) {
34 if (!token_fetched_callback_.is_null()) {
35 token_fetched_callback_.Run(token, shared_secret);
36 token_fetched_callback_.Reset();
40 } // namespace remoting