#include "extensions/browser/api/web_request/web_request_permissions.h"
#include <string_view>
#include "base/debug/crash_logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
#include "build/chromeos_buildflags.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/common/url_constants.h"
#include "extensions/browser/api/extensions_api_client.h"
#include "extensions/browser/api/web_request/permission_helper.h"
#include "extensions/browser/api/web_request/web_request_api_constants.h"
#include "extensions/browser/api/web_request/web_request_info.h"
#include "extensions/browser/extension_navigation_ui_data.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_util.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/process_map.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/extension_urls.h"
#include "extensions/common/manifest_handlers/incognito_info.h"
#include "extensions/common/permissions/permissions_data.h"
#include "services/network/public/mojom/fetch_api.mojom-shared.h"
#include "third_party/abseil-cpp/absl/strings/ascii.h"
#include "third_party/blink/public/common/loader/resource_type_util.h"
#include "url/gurl.h"
#include "url/origin.h"
PermissionsData;
namespace {
bool HasWebRequestScheme(const GURL& url) { … }
PermissionsData::PageAccess GetHostAccessForURL(
const extensions::Extension& extension,
const GURL& url,
int tab_id) { … }
bool IsWebRequestResourceTypeFrame(
extensions::WebRequestResourceType web_request_type) { … }
PermissionsData::PageAccess CanExtensionAccessURLInternal(
extensions::PermissionHelper* permission_helper,
const extensions::ExtensionId& extension_id,
const GURL& url,
int tab_id,
bool crosses_incognito,
WebRequestPermissions::HostPermissionsCheck host_permissions_check,
const std::optional<url::Origin>& initiator,
const std::optional<extensions::WebRequestResourceType>& web_request_type) { … }
bool IsSensitiveGoogleClientUrl(const extensions::WebRequestInfo& request) { … }
bool IsMainFrameNavigationRequest(const extensions::WebRequestInfo& request) { … }
}
bool WebRequestPermissions::HideRequest(
extensions::PermissionHelper* permission_helper,
const extensions::WebRequestInfo& request) { … }
PermissionsData::PageAccess WebRequestPermissions::CanExtensionAccessURL(
extensions::PermissionHelper* permission_helper,
const extensions::ExtensionId& extension_id,
const GURL& url,
int tab_id,
bool crosses_incognito,
HostPermissionsCheck host_permissions_check,
const std::optional<url::Origin>& initiator,
extensions::WebRequestResourceType web_request_type) { … }
bool WebRequestPermissions::CanExtensionAccessInitiator(
extensions::PermissionHelper* permission_helper,
const extensions::ExtensionId extension_id,
const std::optional<url::Origin>& initiator,
int tab_id,
bool crosses_incognito) { … }