chromium/extensions/common/permissions/permissions_data.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "extensions/common/permissions/permissions_data.h"

#include <memory>
#include <utility>

#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/memory/stack_allocated.h"
#include "base/no_destructor.h"
#include "content/public/common/url_constants.h"
#include "extensions/common/constants.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/extension_urls.h"
#include "extensions/common/extensions_client.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/permissions/permission_message_provider.h"
#include "extensions/common/switches.h"
#include "extensions/common/url_pattern_set.h"
#include "url/gurl.h"
#include "url/origin.h"
#include "url/url_constants.h"

APIPermissionID;

namespace extensions {

namespace {

PermissionsData::PolicyDelegate* g_policy_delegate =;

struct URLPatternAccessSet {};

struct ContextPermissions {};

// A map between a profile (referenced by a unique id) and the default policies
// for that profile. Since different profile have different defaults, we need to
// have separate entries.
ContextPermissionsMap;

// Lock to access the context permissions map. This should never be acquired
// before PermissionsData instance level |runtime_lock_| to prevent deadlocks.
base::Lock& GetContextPermissionsLock() {}

// Returns the ContextPermissions for the given context_id.
// Must be called with the context permissions lock already required.
ContextPermissions& GetContextPermissions(int context_id) {}

class AutoLockOnValidThread {};

}  // namespace

PermissionsData::PermissionsData(
    const ExtensionId& extension_id,
    Manifest::Type manifest_type,
    mojom::ManifestLocation location,
    std::unique_ptr<const PermissionSet> initial_permissions)
    :{}

PermissionsData::~PermissionsData() {}

// static
void PermissionsData::SetPolicyDelegate(PolicyDelegate* delegate) {}

// static
bool PermissionsData::CanExecuteScriptEverywhere(
    const ExtensionId& extension_id,
    mojom::ManifestLocation location) {}

bool PermissionsData::IsRestrictedUrl(const GURL& document_url,
                                      std::string* error) const {}

// static
bool PermissionsData::AllUrlsIncludesChromeUrls(
    const ExtensionId& extension_id) {}

bool PermissionsData::UsesDefaultPolicyHostRestrictions() const {}

// static
URLPatternSet PermissionsData::GetDefaultPolicyBlockedHosts(int context_id) {}

// static
URLPatternSet PermissionsData::GetDefaultPolicyAllowedHosts(int context_id) {}

URLPatternSet PermissionsData::policy_blocked_hosts() const {}

URLPatternSet PermissionsData::policy_allowed_hosts() const {}

void PermissionsData::BindToCurrentThread() const {}

void PermissionsData::SetContextId(int context_id) const {}

void PermissionsData::SetPermissions(
    std::unique_ptr<const PermissionSet> active,
    std::unique_ptr<const PermissionSet> withheld) const {}

void PermissionsData::SetPolicyHostRestrictions(
    const URLPatternSet& policy_blocked_hosts,
    const URLPatternSet& policy_allowed_hosts) const {}

void PermissionsData::SetUsesDefaultHostRestrictions() const {}

// static
void PermissionsData::SetDefaultPolicyHostRestrictions(
    int context_id,
    const URLPatternSet& default_policy_blocked_hosts,
    const URLPatternSet& default_policy_allowed_hosts) {}

// static
void PermissionsData::SetUserHostRestrictions(
    int context_id,
    URLPatternSet user_blocked_hosts,
    URLPatternSet user_allowed_hosts) {}

// static
URLPatternSet PermissionsData::GetUserAllowedHosts(int context_id) {}

// static
URLPatternSet PermissionsData::GetUserBlockedHosts(int context_id) {}

URLPatternSet PermissionsData::GetUserBlockedHosts() const {}

void PermissionsData::UpdateTabSpecificPermissions(
    int tab_id,
    const PermissionSet& permissions) const {}

void PermissionsData::ClearTabSpecificPermissions(int tab_id) const {}

bool PermissionsData::HasTabPermissionsForSecurityOrigin(
    int tab_id,
    const GURL& url) const {}

bool PermissionsData::HasAPIPermission(APIPermissionID permission) const {}

bool PermissionsData::HasAPIPermission(
    const std::string& permission_name) const {}

bool PermissionsData::HasAPIPermissionForTab(int tab_id,
                                             APIPermissionID permission) const {}

bool PermissionsData::CheckAPIPermissionWithParam(
    APIPermissionID permission,
    const APIPermission::CheckParam* param) const {}

URLPatternSet PermissionsData::GetEffectiveHostPermissions() const {}

bool PermissionsData::HasHostPermission(const GURL& url) const {}

PermissionMessages PermissionsData::GetPermissionMessages() const {}

PermissionMessages PermissionsData::GetNewPermissionMessages(
    const PermissionSet& granted_permissions) const {}

bool PermissionsData::CanAccessPage(const GURL& document_url,
                                    int tab_id,
                                    std::string* error) const {}

PermissionsData::PageAccess PermissionsData::GetPageAccess(
    const GURL& document_url,
    int tab_id,
    std::string* error) const {}

bool PermissionsData::CanRunContentScriptOnPage(const GURL& document_url,
                                                int tab_id,
                                                std::string* error) const {}

PermissionsData::PageAccess PermissionsData::GetContentScriptAccess(
    const GURL& document_url,
    int tab_id,
    std::string* error) const {}

bool PermissionsData::CanCaptureVisiblePage(
    const GURL& document_url,
    int tab_id,
    std::string* error,
    CaptureRequirement capture_requirement) const {}

const PermissionSet* PermissionsData::GetTabSpecificPermissions(
    int tab_id) const {}

bool PermissionsData::IsPolicyBlockedHostUnsafe(const GURL& url) const {}

PermissionsData::PageAccess PermissionsData::CanRunOnPage(
    const GURL& document_url,
    const URLPatternSet& permitted_url_patterns,
    const URLPatternSet& withheld_url_patterns,
    const URLPatternSet* tab_url_patterns,
    std::string* error) const {}

}  // namespace extensions