Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / remoting / client / token_fetcher_proxy.h
blobe71aa04611ed37835df0a929648e73ed17fed960
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 #ifndef REMOTING_CLIENT_TOKEN_FETCHER_PROXY_H_
6 #define REMOTING_CLIENT_TOKEN_FETCHER_PROXY_H_
8 #include "base/callback.h"
9 #include "base/memory/weak_ptr.h"
10 #include "remoting/protocol/third_party_client_authenticator.h"
12 namespace remoting {
14 class TokenFetcherProxy
15 : public protocol::ThirdPartyClientAuthenticator::TokenFetcher {
16 public:
17 typedef base::Callback<void(
18 const GURL& token_url,
19 const std::string& host_public_key,
20 const std::string& scope,
21 base::WeakPtr<TokenFetcherProxy>)> TokenFetcherCallback;
23 TokenFetcherProxy(const TokenFetcherCallback& token_fetcher_impl,
24 const std::string& host_public_key);
25 ~TokenFetcherProxy() override;
27 // protocol::TokenClientAuthenticator::TokenFetcher interface.
28 void FetchThirdPartyToken(
29 const GURL& token_url,
30 const std::string& scope,
31 const TokenFetchedCallback& token_fetched_callback) override;
33 // Called by the token fetching implementation when the token is fetched.
34 void OnTokenFetched(const std::string& token,
35 const std::string& shared_secret);
37 private:
38 std::string host_public_key_;
39 TokenFetcherCallback token_fetcher_impl_;
40 TokenFetchedCallback token_fetched_callback_;
41 base::WeakPtrFactory<TokenFetcherProxy> weak_factory_;
43 DISALLOW_COPY_AND_ASSIGN(TokenFetcherProxy);
46 } // namespace remoting
48 #endif // REMOTING_CLIENT_TOKEN_FETCHER_PROXY_H_