From 594f7fc0e1a80197d21147abcc6fc3306e5709b5 Mon Sep 17 00:00:00 2001 From: Francis Tsui Date: Mon, 21 Jul 2025 11:27:16 -0700 Subject: [PATCH] Remove unused legacy rpc client. PiperOrigin-RevId: 785510820 --- sharing/fake_nearby_sharing_service.cc | 7 --- sharing/fake_nearby_sharing_service.h | 2 - sharing/internal/api/BUILD | 1 - .../internal/api/fake_nearby_share_client.h | 4 -- sharing/internal/api/sharing_rpc_client.h | 2 - sharing/internal/api/sharing_rpc_notifier.h | 60 ------------------- sharing/nearby_sharing_service.h | 3 - sharing/nearby_sharing_service_impl.cc | 6 -- sharing/nearby_sharing_service_impl.h | 2 - 9 files changed, 87 deletions(-) delete mode 100644 sharing/internal/api/sharing_rpc_notifier.h diff --git a/sharing/fake_nearby_sharing_service.cc b/sharing/fake_nearby_sharing_service.cc index 6516762a..4dfb048b 100644 --- a/sharing/fake_nearby_sharing_service.cc +++ b/sharing/fake_nearby_sharing_service.cc @@ -22,7 +22,6 @@ #include "internal/base/observer_list.h" #include "sharing/advertisement.h" #include "sharing/attachment_container.h" -#include "sharing/internal/api/sharing_rpc_notifier.h" #include "sharing/local_device_data/nearby_share_local_device_data_manager.h" #include "sharing/nearby_sharing_service.h" #include "sharing/nearby_sharing_settings.h" @@ -35,8 +34,6 @@ namespace nearby { namespace sharing { -using ::nearby::sharing::api::SharingRpcNotifier; - void FakeNearbySharingService::AddObserver(Observer* observer) { observers_.AddObserver(observer); } @@ -154,10 +151,6 @@ std::string FakeNearbySharingService::Dump() const { return ""; } NearbyShareSettings* FakeNearbySharingService::GetSettings() { return nullptr; } -SharingRpcNotifier* FakeNearbySharingService::GetRpcNotifier() { - return nullptr; -} - NearbyShareLocalDeviceDataManager* FakeNearbySharingService::GetLocalDeviceDataManager() { return nullptr; diff --git a/sharing/fake_nearby_sharing_service.h b/sharing/fake_nearby_sharing_service.h index 9bfd6dbf..a754e451 100644 --- a/sharing/fake_nearby_sharing_service.h +++ b/sharing/fake_nearby_sharing_service.h @@ -24,7 +24,6 @@ #include "internal/base/observer_list.h" #include "sharing/advertisement.h" #include "sharing/attachment_container.h" -#include "sharing/internal/api/sharing_rpc_notifier.h" #include "sharing/local_device_data/nearby_share_local_device_data_manager.h" #include "sharing/nearby_sharing_service.h" #include "sharing/nearby_sharing_settings.h" @@ -108,7 +107,6 @@ class FakeNearbySharingService : public NearbySharingService { std::string Dump() const override; NearbyShareSettings* GetSettings() override; - nearby::sharing::api::SharingRpcNotifier* GetRpcNotifier() override; NearbyShareLocalDeviceDataManager* GetLocalDeviceDataManager() override; NearbyShareContactManager* GetContactManager() override; NearbyShareCertificateManager* GetCertificateManager() override; diff --git a/sharing/internal/api/BUILD b/sharing/internal/api/BUILD index 5a1566df..027bc2c3 100644 --- a/sharing/internal/api/BUILD +++ b/sharing/internal/api/BUILD @@ -27,7 +27,6 @@ cc_library( "public_certificate_database.h", "sharing_platform.h", "sharing_rpc_client.h", - "sharing_rpc_notifier.h", "system_info.h", "wifi_adapter.h", ], diff --git a/sharing/internal/api/fake_nearby_share_client.h b/sharing/internal/api/fake_nearby_share_client.h index dbed19c0..6912ef55 100644 --- a/sharing/internal/api/fake_nearby_share_client.h +++ b/sharing/internal/api/fake_nearby_share_client.h @@ -21,7 +21,6 @@ #include "absl/functional/any_invocable.h" #include "absl/status/statusor.h" #include "sharing/internal/api/sharing_rpc_client.h" -#include "sharing/internal/api/sharing_rpc_notifier.h" #include "sharing/proto/certificate_rpc.pb.h" #include "sharing/proto/contact_rpc.pb.h" #include "sharing/proto/device_rpc.pb.h" @@ -191,9 +190,6 @@ class FakeNearbyShareClientFactory std::vector& identity_instances() { return identity_instances_; } - nearby::sharing::api::SharingRpcNotifier* GetRpcNotifier() const override { - return nullptr; - } private: // SharingRpcClientFactory: diff --git a/sharing/internal/api/sharing_rpc_client.h b/sharing/internal/api/sharing_rpc_client.h index 7c653227..5bd876ce 100644 --- a/sharing/internal/api/sharing_rpc_client.h +++ b/sharing/internal/api/sharing_rpc_client.h @@ -20,7 +20,6 @@ #include "absl/functional/any_invocable.h" #include "absl/status/statusor.h" #include "proto/identity/v1/rpcs.pb.h" -#include "sharing/internal/api/sharing_rpc_notifier.h" #include "sharing/proto/certificate_rpc.pb.h" #include "sharing/proto/contact_rpc.pb.h" #include "sharing/proto/device_rpc.pb.h" @@ -97,7 +96,6 @@ class SharingRpcClientFactory { virtual std::unique_ptr CreateInstance() = 0; virtual std::unique_ptr CreateIdentityInstance() = 0; - virtual api::SharingRpcNotifier* GetRpcNotifier() const = 0; }; } // namespace nearby::sharing::api diff --git a/sharing/internal/api/sharing_rpc_notifier.h b/sharing/internal/api/sharing_rpc_notifier.h deleted file mode 100644 index 0ca97f40..00000000 --- a/sharing/internal/api/sharing_rpc_notifier.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef THIRD_PARTY_NEARBY_SHARING_INTERNAL_API_SHARING_RPC_NOTIFIER_H_ -#define THIRD_PARTY_NEARBY_SHARING_INTERNAL_API_SHARING_RPC_NOTIFIER_H_ - -#include "sharing/proto/certificate_rpc.pb.h" -#include "sharing/proto/contact_rpc.pb.h" -#include "sharing/proto/device_rpc.pb.h" - -namespace nearby::sharing::api { - -// Interface for passing RPC Responses/Requests to observers, by passing -// instances of this class to each RPC Client. -class SharingRpcNotifier { - public: - class Observer { - public: - virtual ~Observer() = default; - - // Called when HTTP RPC is made for request and responses. - virtual void OnUpdateDeviceRequest( - const nearby::sharing::proto::UpdateDeviceRequest& request) = 0; - virtual void OnUpdateDeviceResponse( - const nearby::sharing::proto::UpdateDeviceResponse& response) = 0; - virtual void OnListContactPeopleRequest( - const nearby::sharing::proto::ListContactPeopleRequest& request) = 0; - virtual void OnListContactPeopleResponse( - const nearby::sharing::proto::ListContactPeopleResponse& response) = 0; - virtual void OnListPublicCertificatesRequest( - const nearby::sharing::proto::ListPublicCertificatesRequest& - request) = 0; - virtual void OnListPublicCertificatesResponse( - const nearby::sharing::proto::ListPublicCertificatesResponse& - response) = 0; - }; - - virtual ~SharingRpcNotifier() = default; - - virtual void AddObserver(Observer* observer) = 0; - virtual void RemoveObserver(Observer* observer) = 0; - - protected: - SharingRpcNotifier() = default; -}; - -} // namespace nearby::sharing::api - -#endif // THIRD_PARTY_NEARBY_SHARING_INTERNAL_API_SHARING_RPC_NOTIFIER_H_ diff --git a/sharing/nearby_sharing_service.h b/sharing/nearby_sharing_service.h index 65c13ef2..a16c05b7 100644 --- a/sharing/nearby_sharing_service.h +++ b/sharing/nearby_sharing_service.h @@ -26,7 +26,6 @@ #include "sharing/advertisement.h" #include "sharing/attachment_container.h" #include "sharing/certificates/nearby_share_certificate_manager.h" -#include "sharing/internal/api/sharing_rpc_notifier.h" #include "sharing/local_device_data/nearby_share_local_device_data_manager.h" #include "sharing/nearby_sharing_settings.h" #include "sharing/share_target_discovered_callback.h" @@ -40,7 +39,6 @@ namespace sharing { class NearbyNotificationDelegate; class NearbyShareContactManager; -class NearbyShareHttpNotifier; // This service implements Nearby Sharing on top of the Nearby Connections mojo. // Currently, only single profile will be allowed to be bound at a time and only @@ -236,7 +234,6 @@ class NearbySharingService { virtual void UpdateFilePathsInProgress(bool update_file_paths) = 0; virtual NearbyShareSettings* GetSettings() = 0; - virtual nearby::sharing::api::SharingRpcNotifier* GetRpcNotifier() = 0; virtual NearbyShareLocalDeviceDataManager* GetLocalDeviceDataManager() = 0; virtual NearbyShareContactManager* GetContactManager() = 0; virtual NearbyShareCertificateManager* GetCertificateManager() = 0; diff --git a/sharing/nearby_sharing_service_impl.cc b/sharing/nearby_sharing_service_impl.cc index c6e7350b..11055c48 100644 --- a/sharing/nearby_sharing_service_impl.cc +++ b/sharing/nearby_sharing_service_impl.cc @@ -74,7 +74,6 @@ #include "sharing/incoming_share_session.h" #include "sharing/internal/api/bluetooth_adapter.h" #include "sharing/internal/api/sharing_platform.h" -#include "sharing/internal/api/sharing_rpc_notifier.h" #include "sharing/internal/api/wifi_adapter.h" #include "sharing/internal/base/encode.h" #include "sharing/internal/public/connectivity_manager.h" @@ -1008,11 +1007,6 @@ NearbyShareSettings* NearbySharingServiceImpl::GetSettings() { return settings_.get(); } -nearby::sharing::api::SharingRpcNotifier* -NearbySharingServiceImpl::GetRpcNotifier() { - return nearby_share_client_factory_->GetRpcNotifier(); -} - NearbyShareLocalDeviceDataManager* NearbySharingServiceImpl::GetLocalDeviceDataManager() { return local_device_data_manager_.get(); diff --git a/sharing/nearby_sharing_service_impl.h b/sharing/nearby_sharing_service_impl.h index 90ffd03b..887be53e 100644 --- a/sharing/nearby_sharing_service_impl.h +++ b/sharing/nearby_sharing_service_impl.h @@ -54,7 +54,6 @@ #include "sharing/internal/api/preference_manager.h" #include "sharing/internal/api/sharing_platform.h" #include "sharing/internal/api/sharing_rpc_client.h" -#include "sharing/internal/api/sharing_rpc_notifier.h" #include "sharing/internal/api/wifi_adapter.h" #include "sharing/internal/public/connectivity_manager.h" #include "sharing/internal/public/context.h" @@ -161,7 +160,6 @@ class NearbySharingServiceImpl proto::DeviceVisibility visibility, absl::Duration expiration, absl::AnyInvocable callback) override; NearbyShareSettings* GetSettings() override; - nearby::sharing::api::SharingRpcNotifier* GetRpcNotifier() override; NearbyShareLocalDeviceDataManager* GetLocalDeviceDataManager() override; NearbyShareContactManager* GetContactManager() override; NearbyShareCertificateManager* GetCertificateManager() override;