Index: remoting/client/jni/jni_token_fetcher.h |
diff --git a/remoting/client/jni/jni_token_fetcher.h b/remoting/client/jni/jni_token_fetcher.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e8af19f2763b652094094636e71c06e51d767d56 |
--- /dev/null |
+++ b/remoting/client/jni/jni_token_fetcher.h |
@@ -0,0 +1,47 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef REMOTING_CLIENT_JNI_JNI_TOKEN_FETCHER_H_ |
+#define REMOTING_CLIENT_JNI_JNI_TOKEN_FETCHER_H_ |
+ |
+#include "base/callback.h" |
+#include "base/memory/weak_ptr.h" |
+#include "remoting/protocol/third_party_client_authenticator.h" |
+ |
+namespace remoting { |
+ |
+class ChromotingJniInstance; |
+ |
+// JniTokenFetcher is used by the ThirdPartyClientAuthenticator to fetch the |
+// access code and token from the android app via JNI. |
+class JniTokenFetcher |
Sergey Ulanov
2014/06/04 03:49:17
This looks a lot like PepperTokenFetcher. I think
kelvinp
2014/06/04 21:13:53
Done.
|
+ : public protocol::ThirdPartyClientAuthenticator::TokenFetcher { |
+ public: |
+ JniTokenFetcher(base::WeakPtr<ChromotingJniInstance> jni_instance, |
+ const std::string& host_public_key); |
+ virtual ~JniTokenFetcher(); |
+ |
+ // protocol::TokenClientAuthenticator::TokenFetcher interface. |
+ virtual void FetchThirdPartyToken( |
+ const GURL& token_url, |
+ const std::string& scope, |
+ const TokenFetchedCallback& token_fetched_callback) OVERRIDE; |
+ |
+ // Called by ChromotingJniInstance when the android app finishes fetching the |
+ // token. |
+ void OnTokenFetched(const std::string& token, |
+ const std::string& shared_secret); |
+ |
+ private: |
+ base::WeakPtr<ChromotingJniInstance> jni_instance_; |
+ std::string client_id_; |
+ TokenFetchedCallback token_fetched_callback_; |
+ base::WeakPtrFactory<JniTokenFetcher> weak_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(JniTokenFetcher); |
+}; |
+ |
+} // namespace remoting |
+ |
+#endif // REMOTING_CLIENT_JNI_JNI_TOKEN_FETCHER_H_ |