chromium/chrome/browser/extensions/api/font_settings/font_settings_api.cc

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

// Font Settings Extension API implementation.

#include "chrome/browser/extensions/api/font_settings/font_settings_api.h"

#include <stddef.h>

#include <utility>

#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/json/json_writer.h"
#include "base/lazy_instance.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_util.h"
#include "base/trace_event/trace_event.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/preference/preference_helpers.h"
#include "chrome/browser/font_pref_change_notifier.h"
#include "chrome/browser/font_pref_change_notifier_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/api/font_settings.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_names_util.h"
#include "components/prefs/pref_change_registrar.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/font_list_async.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_event_histogram_value.h"
#include "extensions/browser/extension_prefs_helper.h"
#include "extensions/browser/extension_prefs_helper_factory.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/api/types.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/mojom/api_permission_id.mojom.h"

#if BUILDFLAG(IS_WIN)
#include "ui/gfx/win/direct_write.h"
#endif  // BUILDFLAG(IS_WIN)

namespace extensions {

fonts;
ChromeSettingScope;

namespace {

const char kFontIdKey[] =;
const char kGenericFamilyKey[] =;
const char kLevelOfControlKey[] =;
const char kDisplayNameKey[] =;
const char kPixelSizeKey[] =;
const char kScriptKey[] =;

const char kSetFromIncognitoError[] =;

// Gets the font name preference path for |generic_family| and |script|. If
// |script| is NULL, uses prefs::kWebKitCommonScript.
std::string GetFontNamePrefPath(fonts::GenericFamily generic_family_enum,
                                fonts::ScriptCode script_enum) {}

void MaybeUnlocalizeFontName(std::string* font_name) {}

}  // namespace

// This class observes pref changed events on a profile and dispatches the
// corresponding extension API events to extensions.
class FontSettingsEventRouter {};

FontSettingsEventRouter::FontSettingsEventRouter(Profile* profile)
    :{}

FontSettingsEventRouter::~FontSettingsEventRouter() {}

void FontSettingsEventRouter::AddPrefToObserve(
    const char* pref_name,
    events::HistogramValue histogram_value,
    const char* event_name,
    const char* key) {}

void FontSettingsEventRouter::OnFontFamilyMapPrefChanged(
    const std::string& pref_name) {}

void FontSettingsEventRouter::OnFontNamePrefChanged(
    const std::string& pref_name,
    const std::string& generic_family,
    const std::string& script) {}

void FontSettingsEventRouter::OnFontPrefChanged(
    events::HistogramValue histogram_value,
    const std::string& event_name,
    const std::string& key,
    const std::string& pref_name) {}

FontSettingsAPI::FontSettingsAPI(content::BrowserContext* context)
    :{}

FontSettingsAPI::~FontSettingsAPI() {}

static base::LazyInstance<BrowserContextKeyedAPIFactory<FontSettingsAPI>>::
    DestructorAtExit g_font_settings_api_factory =;

// static
BrowserContextKeyedAPIFactory<FontSettingsAPI>*
FontSettingsAPI::GetFactoryInstance() {}

ExtensionFunction::ResponseAction FontSettingsClearFontFunction::Run() {}

ExtensionFunction::ResponseAction FontSettingsGetFontFunction::Run() {}

ExtensionFunction::ResponseAction FontSettingsSetFontFunction::Run() {}

ExtensionFunction::ResponseAction FontSettingsGetFontListFunction::Run() {}

void FontSettingsGetFontListFunction::FontListHasLoaded(
    base::Value::List list) {}

ExtensionFunction::ResponseValue
FontSettingsGetFontListFunction::CopyFontsToResult(
    const base::Value::List& fonts) {}

ExtensionFunction::ResponseAction ClearFontPrefExtensionFunction::Run() {}

ExtensionFunction::ResponseAction GetFontPrefExtensionFunction::Run() {}

ExtensionFunction::ResponseAction SetFontPrefExtensionFunction::Run() {}

const char* FontSettingsClearDefaultFontSizeFunction::GetPrefName() {}

const char* FontSettingsGetDefaultFontSizeFunction::GetPrefName() {}

const char* FontSettingsGetDefaultFontSizeFunction::GetKey() {}

const char* FontSettingsSetDefaultFontSizeFunction::GetPrefName() {}

const char* FontSettingsSetDefaultFontSizeFunction::GetKey() {}

const char* FontSettingsClearDefaultFixedFontSizeFunction::GetPrefName() {}

const char* FontSettingsGetDefaultFixedFontSizeFunction::GetPrefName() {}

const char* FontSettingsGetDefaultFixedFontSizeFunction::GetKey() {}

const char* FontSettingsSetDefaultFixedFontSizeFunction::GetPrefName() {}

const char* FontSettingsSetDefaultFixedFontSizeFunction::GetKey() {}

const char* FontSettingsClearMinimumFontSizeFunction::GetPrefName() {}

const char* FontSettingsGetMinimumFontSizeFunction::GetPrefName() {}

const char* FontSettingsGetMinimumFontSizeFunction::GetKey() {}

const char* FontSettingsSetMinimumFontSizeFunction::GetPrefName() {}

const char* FontSettingsSetMinimumFontSizeFunction::GetKey() {}

}  // namespace extensions