#include "chrome/browser/extensions/api/permissions/permissions_api.h"
#include <memory>
#include <utility>
#include "base/check_is_test.h"
#include "base/functional/bind.h"
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/extensions/chrome_extension_function_details.h"
#include "chrome/browser/extensions/extension_install_prompt.h"
#include "chrome/browser/extensions/extension_management.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/extensions/permissions/permissions_helpers.h"
#include "chrome/browser/extensions/permissions/permissions_updater.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/api/permissions.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_api_frame_id_map.h"
#include "extensions/browser/extension_function.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/permissions_manager.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/manifest_handlers/permissions_parser.h"
#include "extensions/common/permissions/permission_message_provider.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/permissions/permissions_info.h"
#include "extensions/common/url_pattern.h"
#include "extensions/common/url_pattern_set.h"
namespace extensions {
Permissions;
UnpackPermissionSetResult;
namespace {
const char kBlockedByEnterprisePolicy[] = …;
const char kCantRemoveRequiredPermissionsError[] = …;
const char kNotInManifestPermissionsError[] = …;
const char kUserGestureRequiredError[] = …;
constexpr char kMustSpecifyDocumentIdOrTabIdError[] = …;
constexpr char kTabNotFoundError[] = …;
constexpr char kInvalidDocumentIdError[] = …;
constexpr char kExtensionCantRequestSiteAccessError[] = …;
constexpr char kExtensionHasSiteAccessError[] = …;
constexpr char kExtensionRequestCannotBeRemovedError[] = …;
PermissionsRequestFunction::DialogAction g_dialog_action = …;
PermissionsRequestFunction::ShowDialogCallback* g_show_dialog_callback = …;
PermissionsRequestFunction* g_pending_request_function = …;
bool ignore_user_gesture_for_tests = …;
bool ValidateTab(int tab_id,
bool include_incognito_information,
content::BrowserContext* browser_context,
content::WebContents** web_contents,
std::string* error) { … }
bool ValidateDocument(const std::string& document_id,
bool include_incognito_information,
content::BrowserContext* browser_context,
content::WebContents** web_contents,
std::string* error) { … }
}
ExtensionFunction::ResponseAction PermissionsContainsFunction::Run() { … }
ExtensionFunction::ResponseAction PermissionsGetAllFunction::Run() { … }
ExtensionFunction::ResponseAction PermissionsRemoveFunction::Run() { … }
base::AutoReset<PermissionsRequestFunction::DialogAction>
PermissionsRequestFunction::SetDialogActionForTests(
DialogAction dialog_action) { … }
base::AutoReset<PermissionsRequestFunction::ShowDialogCallback*>
PermissionsRequestFunction::SetShowDialogCallbackForTests(
ShowDialogCallback* callback) { … }
void PermissionsRequestFunction::ResolvePendingDialogForTests(
bool accept_dialog) { … }
void PermissionsRequestFunction::SetIgnoreUserGestureForTests(
bool ignore) { … }
PermissionsRequestFunction::PermissionsRequestFunction() { … }
PermissionsRequestFunction::~PermissionsRequestFunction() { … }
ExtensionFunction::ResponseAction PermissionsRequestFunction::Run() { … }
bool PermissionsRequestFunction::ShouldKeepWorkerAliveIndefinitely() { … }
void PermissionsRequestFunction::OnInstallPromptDone(
ExtensionInstallPrompt::DoneCallbackPayload payload) { … }
void PermissionsRequestFunction::OnRuntimePermissionsGranted() { … }
void PermissionsRequestFunction::OnOptionalPermissionsGranted() { … }
void PermissionsRequestFunction::RespondIfRequestsFinished() { … }
std::unique_ptr<const PermissionSet>
PermissionsRequestFunction::TakePromptedPermissionsForTesting() { … }
ExtensionFunction::ResponseAction
PermissionsAddSiteAccessRequestFunction::Run() { … }
ExtensionFunction::ResponseAction
PermissionsRemoveSiteAccessRequestFunction::Run() { … }
}