#include "chrome/browser/extensions/permissions/permissions_helpers.h"
#include <stddef.h>
#include <memory>
#include <string_view>
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/values.h"
#include "chrome/common/extensions/api/permissions.h"
#include "content/public/common/url_constants.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/extension.h"
#include "extensions/common/permissions/permission_set.h"
#include "extensions/common/permissions/permissions_info.h"
#include "extensions/common/permissions/usb_device_permission.h"
#include "extensions/common/url_pattern_set.h"
#include "extensions/common/user_script.h"
namespace extensions {
Permissions;
namespace permissions_api_helpers {
namespace {
const char kDelimiter[] = …;
const char kInvalidParameter[] = …;
const char kInvalidOrigin[] = …;
const char kUnknownPermissionError[] = …;
const char kUnsupportedPermissionId[] = …;
std::unique_ptr<APIPermission> UnpackPermissionWithArguments(
std::string_view permission_name,
std::string_view permission_arg,
const std::string& permission_str,
std::string* error) { … }
bool UnpackAPIPermissions(const std::vector<std::string>& permissions_input,
const PermissionSet& required_permissions,
const PermissionSet& optional_permissions,
UnpackPermissionSetResult* result,
std::string* error) { … }
bool UnpackOriginPermissions(const std::vector<std::string>& origins_input,
const PermissionSet& required_permissions,
const PermissionSet& optional_permissions,
bool allow_file_access,
UnpackPermissionSetResult* result,
std::string* error) { … }
}
UnpackPermissionSetResult::UnpackPermissionSetResult() = default;
UnpackPermissionSetResult::~UnpackPermissionSetResult() = default;
std::unique_ptr<Permissions> PackPermissionSet(const PermissionSet& set) { … }
std::unique_ptr<UnpackPermissionSetResult> UnpackPermissionSet(
const Permissions& permissions_input,
const PermissionSet& required_permissions,
const PermissionSet& optional_permissions,
bool allow_file_access,
std::string* error) { … }
}
}