mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 14:46:12 -04:00
Fix a few error triggered when trying to roll nearby in Chromium.
PiperOrigin-RevId: 889051225
This commit is contained in:
@@ -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<std::string> 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_);
|
||||
|
||||
@@ -134,7 +134,6 @@ class ImplementationPlatform {
|
||||
static std::unique_ptr<WifiHotspotMedium> CreateWifiHotspotMedium();
|
||||
static std::unique_ptr<WifiDirectMedium> CreateWifiDirectMedium();
|
||||
static std::unique_ptr<Timer> CreateTimer();
|
||||
static std::unique_ptr<DeviceInfo> CreateDeviceInfo();
|
||||
#ifndef NO_WEBRTC
|
||||
static std::unique_ptr<WebRtcMedium> CreateWebRtcMedium();
|
||||
#endif
|
||||
@@ -145,10 +144,17 @@ class ImplementationPlatform {
|
||||
state_updated_callback) {
|
||||
return nullptr;
|
||||
}
|
||||
static std::unique_ptr<nearby::api::PreferencesManager>
|
||||
CreatePreferencesManager(absl::string_view path) {
|
||||
return nullptr;
|
||||
}
|
||||
#else
|
||||
static std::unique_ptr<AppLifecycleMonitor> CreateAppLifecycleMonitor(
|
||||
std::function<void(AppLifecycleMonitor::AppLifecycleState)>
|
||||
state_updated_callback);
|
||||
static std::unique_ptr<nearby::api::PreferencesManager>
|
||||
CreatePreferencesManager(absl::string_view path);
|
||||
static std::unique_ptr<DeviceInfo> 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<WebResponse> SendRequest(const WebRequest& request);
|
||||
|
||||
#if defined(NEARBY_CHROMIUM)
|
||||
static std::unique_ptr<nearby::api::PreferencesManager>
|
||||
CreatePreferencesManager(absl::string_view path) {
|
||||
return nullptr;
|
||||
}
|
||||
#else
|
||||
static std::unique_ptr<nearby::api::PreferencesManager>
|
||||
CreatePreferencesManager(absl::string_view path);
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace api
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#ifndef PLATFORM_IMPL_SHARED_FILE_H_
|
||||
#define PLATFORM_IMPL_SHARED_FILE_H_
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#define THIRD_PARTY_NEARBY_INTERNAL_PLATFORM_SERVICE_ADDRESS_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user