[remoting] Migrate directory services to Protobuf over HTTP
This CL introduces a DirectoryServiceClient for communicating with the
remoting directory service via Protobuf over HTTP, and makes existing
gRPC based directory client users (i.e. Android and iOS clients, and the
start host command) use the new unified client.
Bug: 1103416
Change-Id: Ib3062f0aec3012774928adc81b4786a89f79146d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2311696
Commit-Queue: Yuwei Huang <[email protected]>
Reviewed-by: Nicolas Ouellet-Payeur <[email protected]>
Reviewed-by: Joe Downing <[email protected]>
Cr-Commit-Position: refs/heads/master@{#792081}
diff --git a/remoting/client/jni/jni_directory_service.h b/remoting/client/jni/jni_directory_service.h
index 913c399..b3fc52b 100644
--- a/remoting/client/jni/jni_directory_service.h
+++ b/remoting/client/jni/jni_directory_service.h
@@ -9,14 +9,16 @@
#include "base/android/scoped_java_ref.h"
#include "base/memory/scoped_refptr.h"
+#include "base/memory/weak_ptr.h"
#include "base/sequence_checker.h"
#include "base/sequenced_task_runner.h"
-#include "remoting/base/grpc_support/grpc_authenticated_executor.h"
-#include "remoting/client/jni/jni_oauth_token_getter.h"
-#include "remoting/proto/remoting/v1/directory_service.grpc.pb.h"
+#include "base/threading/sequence_bound.h"
+#include "remoting/base/directory_service_client.h"
namespace remoting {
+class ProtobufHttpStatus;
+
class JniDirectoryService {
public:
// TODO(rkjnsn): Update error codes to better align with those returned by the
@@ -42,18 +44,19 @@
void Destroy(JNIEnv* env);
private:
- void OnHostListRetrieved(base::android::ScopedJavaGlobalRef<jobject> callback,
- const grpc::Status& status,
- const apis::v1::GetHostListResponse& response);
+ void OnHostListRetrieved(
+ base::android::ScopedJavaGlobalRef<jobject> callback,
+ const ProtobufHttpStatus& status,
+ std::unique_ptr<apis::v1::GetHostListResponse> response);
void OnHostDeleted(base::android::ScopedJavaGlobalRef<jobject> callback,
- const grpc::Status& status,
- const apis::v1::DeleteHostResponse& response);
+ const ProtobufHttpStatus& status,
+ std::unique_ptr<apis::v1::DeleteHostResponse> response);
- JniOAuthTokenGetter token_getter_;
- GrpcAuthenticatedExecutor grpc_executor_;
- std::unique_ptr<apis::v1::RemotingDirectoryService::Stub> stub_;
+ base::SequenceBound<DirectoryServiceClient> client_;
scoped_refptr<base::SequencedTaskRunner> sequence_;
SEQUENCE_CHECKER(sequence_checker_);
+
+ base::WeakPtrFactory<JniDirectoryService> weak_factory_{this};
};
} // namespace remoting