1eb19f3078
* chore: bump chromium in DEPS to 116.0.5835.0 * chore: update patches * chore: bump chromium in DEPS to 116.0.5837.0 * chore: bump chromium in DEPS to 116.0.5839.0 * chore: bump chromium in DEPS to 116.0.5841.0 * chore: bump chromium in DEPS to 116.0.5843.0 * Update patches CLs that affected printing.patch: - 4616791: Refactor PrintViewManagerBase::PrintNow() https://chromium-review.googlesource.com/c/chromium/src/+/4616791 - 4602776: Make PrintNodeUnderContextMenu operation go through PrintViewManager https://chromium-review.googlesource.com/c/chromium/src/+/4602776 * 4506614: geolocation: Add LocationProvider::FillDiagnostics https://chromium-review.googlesource.com/c/chromium/src/+/4506614 * chore: bump chromium in DEPS to 116.0.5845.0 * chore: update patches * fixup! 4506614: geolocation: Add LocationProvider::FillDiagnostics https://chromium-review.googlesource.com/c/chromium/src/+/4506614 * 4609704: Remove gnome-keyring https://chromium-review.googlesource.com/c/chromium/src/+/4609704 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: clavin <clavin@electronjs.org>
54 lines
1.6 KiB
C++
54 lines
1.6 KiB
C++
// Copyright (c) 2018 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "shell/browser/fake_location_provider.h"
|
|
|
|
#include "base/functional/callback.h"
|
|
#include "base/time/time.h"
|
|
#include "services/device/public/mojom/geoposition.mojom-shared.h"
|
|
#include "services/device/public/mojom/geoposition.mojom.h"
|
|
|
|
namespace electron {
|
|
|
|
FakeLocationProvider::FakeLocationProvider() {
|
|
result_ = device::mojom::GeopositionResult::NewError(
|
|
device::mojom::GeopositionError::New(
|
|
device::mojom::GeopositionErrorCode::kPositionUnavailable,
|
|
"Position unavailable.", ""));
|
|
}
|
|
|
|
FakeLocationProvider::~FakeLocationProvider() = default;
|
|
|
|
void FakeLocationProvider::FillDiagnostics(
|
|
device::mojom::GeolocationDiagnostics& diagnostics) {
|
|
diagnostics.provider_state = state_;
|
|
}
|
|
|
|
void FakeLocationProvider::SetUpdateCallback(
|
|
const LocationProviderUpdateCallback& callback) {
|
|
callback_ = callback;
|
|
}
|
|
|
|
void FakeLocationProvider::StartProvider(bool high_accuracy) {
|
|
state_ =
|
|
high_accuracy
|
|
? device::mojom::GeolocationDiagnostics::ProviderState::kHighAccuracy
|
|
: device::mojom::GeolocationDiagnostics::ProviderState::kLowAccuracy;
|
|
}
|
|
|
|
void FakeLocationProvider::StopProvider() {
|
|
state_ = device::mojom::GeolocationDiagnostics::ProviderState::kStopped;
|
|
}
|
|
|
|
const device::mojom::GeopositionResult* FakeLocationProvider::GetPosition() {
|
|
return result_.get();
|
|
}
|
|
|
|
void FakeLocationProvider::OnPermissionGranted() {
|
|
if (!callback_.is_null()) {
|
|
callback_.Run(this, result_.Clone());
|
|
}
|
|
}
|
|
|
|
} // namespace electron
|