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. 4 5 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_TOKEN_FETCHER_H_ 6 #define REMOTING_CLIENT_PLUGIN_PEPPER_TOKEN_FETCHER_H_ 7 8 #include "base/callback.h" 9 #include "base/memory/weak_ptr.h" 10 #include "remoting/protocol/third_party_client_authenticator.h" 11 12 namespace remoting { 13 14 class ChromotingInstance; 15 16 class PepperTokenFetcher 17 : public protocol::ThirdPartyClientAuthenticator::TokenFetcher { 18 public: 19 PepperTokenFetcher(base::WeakPtr<ChromotingInstance> plugin, 20 const std::string& host_public_key); 21 virtual ~PepperTokenFetcher(); 22 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; 28 29 // Called by ChromotingInstance when the webapp finishes fetching the token. 30 void OnTokenFetched(const std::string& token, 31 const std::string& shared_secret); 32 33 private: 34 base::WeakPtr<ChromotingInstance> plugin_; 35 std::string host_public_key_; 36 TokenFetchedCallback token_fetched_callback_; 37 base::WeakPtrFactory<PepperTokenFetcher> weak_factory_; 38 39 DISALLOW_COPY_AND_ASSIGN(PepperTokenFetcher); 40 }; 41 42 } // namespace remoting 43 44 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_TOKEN_FETCHER_H_ 45