#include "extensions/common/api/sockets/sockets_manifest_permission.h"
#include <memory>
#include "base/stl_util.h"
#include "base/strings/string_split.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "extensions/common/api/extensions_manifest_types.h"
#include "extensions/common/api/sockets/sockets_manifest_data.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/strings/grit/extensions_strings.h"
#include "ipc/ipc_message.h"
#include "ui/base/l10n/l10n_util.h"
APIPermissionID;
namespace extensions {
namespace sockets_errors {
const char kErrorInvalidHostPattern[] = …;
}
Sockets;
SocketHostPatterns;
SocketPermissionRequest;
namespace {
static bool ParseHostPattern(
SocketsManifestPermission* permission,
content::SocketPermissionRequest::OperationType operation_type,
const std::string& host_pattern,
std::u16string* error) { … }
static bool ParseHostPatterns(
SocketsManifestPermission* permission,
content::SocketPermissionRequest::OperationType operation_type,
const std::optional<SocketHostPatterns>& host_patterns,
std::u16string* error) { … }
static void SetHostPatterns(
std::optional<SocketHostPatterns>& host_patterns,
const SocketsManifestPermission* permission,
content::SocketPermissionRequest::OperationType operation_type) { … }
bool AddAnyHostMessage(const SocketPermissionEntrySet& sockets,
PermissionIDSet* ids) { … }
void AddSubdomainHostMessage(const SocketPermissionEntrySet& sockets,
PermissionIDSet* ids) { … }
void AddSpecificHostMessage(const SocketPermissionEntrySet& sockets,
PermissionIDSet* ids) { … }
void AddNetworkListMessage(const SocketPermissionEntrySet& sockets,
PermissionIDSet* ids) { … }
}
SocketsManifestPermission::SocketsManifestPermission() = default;
SocketsManifestPermission::~SocketsManifestPermission() = default;
std::unique_ptr<SocketsManifestPermission> SocketsManifestPermission::FromValue(
const base::Value& value,
std::u16string* error) { … }
bool SocketsManifestPermission::CheckRequest(
const Extension* extension,
const SocketPermissionRequest& request) const { … }
std::string SocketsManifestPermission::name() const { … }
std::string SocketsManifestPermission::id() const { … }
PermissionIDSet SocketsManifestPermission::GetPermissions() const { … }
bool SocketsManifestPermission::FromValue(const base::Value* value) { … }
std::unique_ptr<base::Value> SocketsManifestPermission::ToValue() const { … }
std::unique_ptr<ManifestPermission> SocketsManifestPermission::Diff(
const ManifestPermission* rhs) const { … }
std::unique_ptr<ManifestPermission> SocketsManifestPermission::Union(
const ManifestPermission* rhs) const { … }
std::unique_ptr<ManifestPermission> SocketsManifestPermission::Intersect(
const ManifestPermission* rhs) const { … }
void SocketsManifestPermission::AddPermission(
const SocketPermissionEntry& entry) { … }
void SocketsManifestPermission::AddSocketHostPermissions(
const SocketPermissionEntrySet& sockets,
PermissionIDSet* ids) { … }
bool SocketsManifestPermission::RequiresManagementUIWarning() const { … }
bool SocketsManifestPermission::RequiresManagedSessionFullLoginWarning() const { … }
}