diff --git a/connections/implementation/client_proxy.cc b/connections/implementation/client_proxy.cc index df7ec898..760f358c 100644 --- a/connections/implementation/client_proxy.cc +++ b/connections/implementation/client_proxy.cc @@ -60,7 +60,9 @@ #include "internal/platform/byte_array.h" #include "internal/platform/cancelable_alarm.h" #include "internal/platform/cancellation_flag.h" +#ifndef NEARBY_CHROMIUM #include "internal/platform/device_info_impl.h" +#endif #include "internal/platform/error_code_params.h" #include "internal/platform/error_code_recorder.h" #include "internal/platform/feature_flags.h" @@ -1329,6 +1331,12 @@ std::optional ClientProxy::GetEndpointIdForDct() const { return dct_endpoint_id_; } +#ifdef NEARBY_CHROMIUM +void ClientProxy::InitializePreferencesManager() { + // This method is not currently used by Chromium. + NOTREACHED(); +} +#else void ClientProxy::InitializePreferencesManager() { LOG(INFO) << "ClientProxy [InitializePreferencesManager]: client=" << GetClientId(); @@ -1350,6 +1358,7 @@ void ClientProxy::InitializePreferencesManager() { << GetClientId(); } } +#endif void ClientProxy::SaveClientInfoToPreferences() { MutexLock lock(&mutex_); diff --git a/internal/platform/implementation/platform.h b/internal/platform/implementation/platform.h index 49aaed18..6c923033 100644 --- a/internal/platform/implementation/platform.h +++ b/internal/platform/implementation/platform.h @@ -134,7 +134,6 @@ class ImplementationPlatform { static std::unique_ptr CreateWifiHotspotMedium(); static std::unique_ptr CreateWifiDirectMedium(); static std::unique_ptr CreateTimer(); - static std::unique_ptr CreateDeviceInfo(); #ifndef NO_WEBRTC static std::unique_ptr CreateWebRtcMedium(); #endif @@ -145,10 +144,17 @@ class ImplementationPlatform { state_updated_callback) { return nullptr; } + static std::unique_ptr + CreatePreferencesManager(absl::string_view path) { + return nullptr; + } #else static std::unique_ptr CreateAppLifecycleMonitor( std::function state_updated_callback); + static std::unique_ptr + CreatePreferencesManager(absl::string_view path); + static std::unique_ptr CreateDeviceInfo(); #endif // Gets HTTP response from remote server. @@ -159,16 +165,6 @@ class ImplementationPlatform { // return WebResponse if HTTP status code between 200 and 300. // other cases will return absl Status in error. static absl::StatusOr SendRequest(const WebRequest& request); - -#if defined(NEARBY_CHROMIUM) - static std::unique_ptr - CreatePreferencesManager(absl::string_view path) { - return nullptr; - } -#else - static std::unique_ptr - CreatePreferencesManager(absl::string_view path); -#endif }; } // namespace api diff --git a/internal/platform/implementation/shared/file.h b/internal/platform/implementation/shared/file.h index fbf7bfd0..ddc71828 100644 --- a/internal/platform/implementation/shared/file.h +++ b/internal/platform/implementation/shared/file.h @@ -15,7 +15,6 @@ #ifndef PLATFORM_IMPL_SHARED_FILE_H_ #define PLATFORM_IMPL_SHARED_FILE_H_ -#include #include #include #include @@ -23,6 +22,7 @@ #include "absl/strings/string_view.h" #include "absl/time/time.h" +#include "internal/platform/byte_array.h" #include "internal/platform/exception.h" #include "internal/platform/implementation/input_file.h" #include "internal/platform/implementation/output_file.h" @@ -49,7 +49,7 @@ class IOFile final : public api::InputFile, public api::OutputFile { void SetLastModifiedTime(absl::Time last_modified_time) override; private: - explicit IOFile(absl::string_view file_path) : path_(file_path) {}; + explicit IOFile(absl::string_view file_path) : path_(file_path) {} void OpenForRead(); void OpenForWrite(); diff --git a/internal/platform/service_address.h b/internal/platform/service_address.h index dfc6d83b..887e0b18 100644 --- a/internal/platform/service_address.h +++ b/internal/platform/service_address.h @@ -16,6 +16,7 @@ #define THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_SERVICE_ADDRESS_H_ #include +#include #include #include @@ -44,6 +45,18 @@ void AbslStringify(Sink& sink, const ServiceAddress& service_address) { service_address.port); } +#ifdef NEARBY_CHROMIUM +// Support logging of ServiceAddress (Chromium does not use absl log). +inline std::ostream& operator<<(std::ostream& os, + const ServiceAddress& service_address) { + return os << "[" + << WifiUtils::GetHumanReadableIpAddress( + std::string(service_address.address.begin(), + service_address.address.end())) + << "]:" << service_address.port; +} +#endif + void ServiceAddressToProto( const ServiceAddress& service_address, location::nearby::connections::ServiceAddress& proto);