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 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_TOKEN_FETCHER_H_
6 #define REMOTING_CLIENT_PLUGIN_PEPPER_TOKEN_FETCHER_H_
8 #include "base/callback.h"
9 #include "base/memory/weak_ptr.h"
10 #include "remoting/protocol/third_party_client_authenticator.h"
14 class ChromotingInstance;
16 class PepperTokenFetcher
17 : public protocol::ThirdPartyClientAuthenticator::TokenFetcher {
19 PepperTokenFetcher(base::WeakPtr<ChromotingInstance> plugin,
20 const std::string& host_public_key);
21 virtual ~PepperTokenFetcher();
23 // protocol::TokenClientAuthenticator::TokenFetcher interface.
24 virtual void FetchThirdPartyToken(
25 const GURL& token_url,
26 const std::string& scope,
27 const TokenFetchedCallback& token_fetched_callback) OVERRIDE;
29 // Called by ChromotingInstance when the webapp finishes fetching the token.
30 void OnTokenFetched(const std::string& token,
31 const std::string& shared_secret);
34 base::WeakPtr<ChromotingInstance> plugin_;
35 std::string host_public_key_;
36 TokenFetchedCallback token_fetched_callback_;
37 base::WeakPtrFactory<PepperTokenFetcher> weak_factory_;
39 DISALLOW_COPY_AND_ASSIGN(PepperTokenFetcher);
42 } // namespace remoting
44 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_TOKEN_FETCHER_H_