Files
brave-core/browser/ui/geolocation/geolocation_utils_mac.mm
T
Simon HongandBrian Clifton 219f661a74 Update Geolocation permission bubble (#23278)
* Update Geolocation permission dialog

fix https://github.com/brave/brave-browser/issues/16897

Added more information to users for getting precise location.

---------

Co-authored-by: Brian Clifton <brian@clifton.me>
2024-05-08 09:35:18 +09:00

50 lines
1.1 KiB
Plaintext

/* Copyright (c) 2024 The Brave Authors. All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at https://mozilla.org/MPL/2.0/. */
#include "brave/browser/ui/geolocation/geolocation_utils.h"
#import <CoreLocation/CoreLocation.h>
#include <utility>
#include "base/functional/callback.h"
namespace geolocation {
namespace {
bool GetSystemLocationSettingEnabled() {
// Service is off globally.
if (![CLLocationManager locationServicesEnabled]) {
return false;
}
if (@available(macOS 11.0, *)) {
CLLocationManager* manager = [[CLLocationManager alloc] init];
if ([manager authorizationStatus] ==
kCLAuthorizationStatusAuthorizedAlways) {
return true;
}
}
return false;
}
} // namespace
void IsSystemLocationSettingEnabled(base::OnceCallback<void(bool)> callback) {
std::move(callback).Run(GetSystemLocationSettingEnabled());
}
bool CanGiveDetailedGeolocationRequestInfo() {
if (@available(macOS 11.0, *)) {
return true;
}
return false;
}
} // namespace geolocation