chromium/extensions/common/manifest_handlers/permissions_parser.cc

// Copyright 2014 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/manifest_handlers/permissions_parser.h"

#include <memory>
#include <utility>

#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "content/public/common/url_constants.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/extension.h"
#include "extensions/common/extensions_client.h"
#include "extensions/common/features/feature.h"
#include "extensions/common/features/feature_provider.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handler.h"
#include "extensions/common/permissions/api_permission.h"
#include "extensions/common/permissions/api_permission_set.h"
#include "extensions/common/permissions/permission_set.h"
#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/switches.h"
#include "extensions/common/url_pattern_set.h"
#include "url/url_constants.h"

APIPermissionID;

namespace extensions {

keys;
errors;

namespace {

struct ManifestPermissions : public Extension::ManifestData {};

ManifestPermissions::ManifestPermissions(
    std::unique_ptr<const PermissionSet> permissions)
    :{}

ManifestPermissions::~ManifestPermissions() {}

// Checks whether the host |pattern| is allowed for the given |extension|,
// given API permissions |permissions|.
bool CanSpecifyHostPermission(const Extension* extension,
                              const URLPattern& pattern,
                              const APIPermissionSet& permissions) {}

// Parses hosts from `key` in the extension's manifest into |hosts|.
bool ParseHostsFromJSON(Extension* extension,
                        const char* key,
                        std::vector<std::string>* hosts,
                        std::u16string* error) {}

void ParseHostPermissions(Extension* extension,
                          const char* key,
                          const std::vector<std::string>& host_data,
                          const APIPermissionSet& api_permissions,
                          URLPatternSet* host_permissions) {}

// Parses the host and api permissions from the specified permission |key|
// from |extension|'s manifest.
bool ParseHelper(Extension* extension,
                 const char* key,
                 APIPermissionSet* api_permissions,
                 URLPatternSet* host_permissions,
                 std::u16string* error) {}

void RemoveNonAllowedOptionalPermissions(
    Extension* extension,
    APIPermissionSet* optional_api_permissions) {}

void RemoveOverlappingAPIPermissions(
    Extension* extension,
    const APIPermissionSet& required_api_permissions,
    APIPermissionSet* optional_api_permissions) {}

void RemoveOverlappingHostPermissions(
    Extension* extension,
    const URLPatternSet& required_host_permissions,
    URLPatternSet* optional_host_permissions) {}

}  // namespace

struct PermissionsParser::InitialPermissions {};

PermissionsParser::PermissionsParser() {}

PermissionsParser::~PermissionsParser() {}

bool PermissionsParser::Parse(Extension* extension, std::u16string* error) {}

void PermissionsParser::Finalize(Extension* extension) {}

// static
void PermissionsParser::AddAPIPermission(Extension* extension,
                                         APIPermissionID permission) {}

// static
void PermissionsParser::AddAPIPermission(Extension* extension,
                                         APIPermission* permission) {}

// static
bool PermissionsParser::HasAPIPermission(const Extension* extension,
                                         APIPermissionID permission) {}

// static
void PermissionsParser::SetScriptableHosts(
    Extension* extension,
    const URLPatternSet& scriptable_hosts) {}

// static
const PermissionSet& PermissionsParser::GetRequiredPermissions(
    const Extension* extension) {}

// static
const PermissionSet& PermissionsParser::GetOptionalPermissions(
    const Extension* extension) {}

}  // namespace extensions