chromium/extensions/common/features/feature_provider.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/features/feature_provider.h"

#include <map>
#include <memory>
#include <string_view>

#include "base/containers/map_util.h"
#include "base/debug/alias.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/trace_event/trace_event.h"
#include "extensions/common/extensions_client.h"
#include "extensions/common/features/feature.h"

namespace extensions {

namespace {

// Writes |message| to the stack so that it shows up in the minidump, then
// crashes the current process.
//
// The prefix "e::" is used so that the crash can be quickly located.
//
// This is provided in feature_util because for some reason features are prone
// to mysterious crashes in named map lookups. For example see crbug.com/365192
// and crbug.com/461915.
#define CRASH_WITH_MINIDUMP(message)

class FeatureProviderStatic {};

base::LazyInstance<FeatureProviderStatic>::Leaky g_feature_provider_static =;

const Feature* GetFeatureFromProviderByName(const std::string& provider_name,
                                            const std::string& feature_name) {}

}  // namespace

FeatureProvider::FeatureProvider() = default;
FeatureProvider::~FeatureProvider() = default;

// static
const FeatureProvider* FeatureProvider::GetByName(const std::string& name) {}

// static
const FeatureProvider* FeatureProvider::GetAPIFeatures() {}

// static
const FeatureProvider* FeatureProvider::GetManifestFeatures() {}

// static
const FeatureProvider* FeatureProvider::GetPermissionFeatures() {}

// static
const FeatureProvider* FeatureProvider::GetBehaviorFeatures() {}

// static
const Feature* FeatureProvider::GetAPIFeature(const std::string& name) {}

// static
const Feature* FeatureProvider::GetManifestFeature(const std::string& name) {}

// static
const Feature* FeatureProvider::GetPermissionFeature(const std::string& name) {}

// static
const Feature* FeatureProvider::GetBehaviorFeature(const std::string& name) {}

const Feature* FeatureProvider::GetFeature(const std::string& name) const {}

const Feature* FeatureProvider::GetParent(const Feature& feature) const {}

// Children of a given API are named starting with parent.name()+".", which
// means they'll be contiguous in the features_ std::map.
std::vector<const Feature*> FeatureProvider::GetChildren(
    const Feature& parent) const {}

const FeatureMap& FeatureProvider::GetAllFeatures() const {}

void FeatureProvider::AddFeature(std::string_view name,
                                 std::unique_ptr<Feature> feature) {}

void FeatureProvider::AddFeature(std::string_view name, Feature* feature) {}

}  // namespace extensions