OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef REMOTING_CLIENT_PLUGIN_PEPPER_TOKEN_FETCHER_H_ | 5 #ifndef REMOTING_PROTOCOL_TOKEN_FETCHER_PROXY_H_ |
Lambros
2014/06/04 22:20:19
nit: s/PROTOCOL/CLIENT (same at bottom of file)
kelvinp
2014/06/05 23:53:14
Done.
| |
6 #define REMOTING_CLIENT_PLUGIN_PEPPER_TOKEN_FETCHER_H_ | 6 #define REMOTING_PROTOCOL_TOKEN_FETCHER_PROXY_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "remoting/protocol/third_party_client_authenticator.h" | 10 #include "remoting/protocol/third_party_client_authenticator.h" |
11 | 11 |
12 namespace remoting { | 12 namespace remoting { |
13 | 13 |
14 class ChromotingInstance; | 14 class TokenFetcherProxy |
15 | |
16 class PepperTokenFetcher | |
17 : public protocol::ThirdPartyClientAuthenticator::TokenFetcher { | 15 : public protocol::ThirdPartyClientAuthenticator::TokenFetcher { |
18 public: | 16 public: |
19 PepperTokenFetcher(base::WeakPtr<ChromotingInstance> plugin, | 17 typedef base::Callback<void( |
20 const std::string& host_public_key); | 18 const GURL& token_url, |
21 virtual ~PepperTokenFetcher(); | 19 const std::string& scope, |
20 base::WeakPtr<TokenFetcherProxy>)> TokenFetcherCallback; | |
21 | |
22 TokenFetcherProxy(TokenFetcherCallback token_fetcher_impl, | |
Sergey Ulanov
2014/06/05 22:04:01
nit: const reference
kelvinp
2014/06/05 23:53:14
Done.
| |
23 const std::string& host_public_key); | |
Sergey Ulanov
2014/06/05 22:06:18
please mark constructor as explicit if you remove
kelvinp
2014/06/05 23:53:14
Turns out |host_public_key| is needed. See commen
| |
24 virtual ~TokenFetcherProxy(); | |
22 | 25 |
23 // protocol::TokenClientAuthenticator::TokenFetcher interface. | 26 // protocol::TokenClientAuthenticator::TokenFetcher interface. |
24 virtual void FetchThirdPartyToken( | 27 virtual void FetchThirdPartyToken( |
25 const GURL& token_url, | 28 const GURL& token_url, |
26 const std::string& scope, | 29 const std::string& scope, |
27 const TokenFetchedCallback& token_fetched_callback) OVERRIDE; | 30 const TokenFetchedCallback& token_fetched_callback) OVERRIDE; |
28 | 31 |
29 // Called by ChromotingInstance when the webapp finishes fetching the token. | 32 // Called by the token fetching implementation when the token is fetched. |
30 void OnTokenFetched(const std::string& token, | 33 void OnTokenFetched(const std::string& token, |
31 const std::string& shared_secret); | 34 const std::string& shared_secret); |
32 | 35 |
33 private: | 36 private: |
34 base::WeakPtr<ChromotingInstance> plugin_; | |
35 std::string host_public_key_; | 37 std::string host_public_key_; |
Sergey Ulanov
2014/06/05 22:04:01
This is not used anywhere. Can it be removed (and
kelvinp
2014/06/05 23:53:14
Good catch. This should be used when calling to t
| |
36 TokenFetchedCallback token_fetched_callback_; | 38 TokenFetchedCallback token_fetched_callback_; |
37 base::WeakPtrFactory<PepperTokenFetcher> weak_factory_; | 39 TokenFetcherCallback token_fetcher_impl_; |
Sergey Ulanov
2014/06/05 22:04:01
nit: move this to top of the list, where plugin_ u
kelvinp
2014/06/05 23:53:14
Done.
| |
40 base::WeakPtrFactory<TokenFetcherProxy> weak_factory_; | |
38 | 41 |
39 DISALLOW_COPY_AND_ASSIGN(PepperTokenFetcher); | 42 DISALLOW_COPY_AND_ASSIGN(TokenFetcherProxy); |
40 }; | 43 }; |
41 | 44 |
42 } // namespace remoting | 45 } // namespace remoting |
43 | 46 |
44 #endif // REMOTING_CLIENT_PLUGIN_PEPPER_TOKEN_FETCHER_H_ | 47 #endif // REMOTING_PROTOCOL_TOKEN_FETCHER_PROXY_H_ |
OLD | NEW |