chromium/chrome/browser/extensions/commands/command_service.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.

#include "chrome/browser/extensions/commands/command_service.h"

#include <memory>
#include <string_view>
#include <utility>
#include <vector>

#include "base/lazy_instance.h"
#include "base/observer_list.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/extension_commands_global_registry.h"
#include "chrome/browser/extensions/extension_keybinding_registry.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/accelerator_utils.h"
#include "chrome/common/pref_names.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "extensions/browser/extension_function_registry.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/api/commands/commands_handler.h"
#include "extensions/common/command.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/feature_switch.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/permissions/permissions_data.h"

namespace extensions {
namespace {

const char kExtension[] =;
const char kCommandName[] =;
const char kGlobal[] =;

// A preference that stores keybinding state associated with extension commands.
const char kCommands[] =;

// Preference key name for saving the extension-suggested key.
const char kSuggestedKey[] =;

// Preference key name for saving whether the extension-suggested key was
// actually assigned.
const char kSuggestedKeyWasAssigned[] =;

std::string GetPlatformKeybindingKeyForAccelerator(
    const ui::Accelerator& accelerator,
    const ExtensionId& extension_id) {}

bool IsForCurrentPlatform(const std::string& key) {}

// Merge |suggested_key_prefs| into the saved preferences for the extension. We
// merge rather than overwrite to preserve existing was_assigned preferences.
void MergeSuggestedKeyPrefs(const ExtensionId& extension_id,
                            ExtensionPrefs* extension_prefs,
                            base::Value::Dict suggested_key_prefs) {}

}  // namespace

// static
void CommandService::RegisterProfilePrefs(
    user_prefs::PrefRegistrySyncable* registry) {}

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

CommandService::~CommandService() {}

static base::LazyInstance<BrowserContextKeyedAPIFactory<CommandService>>::
    DestructorAtExit g_command_service_factory =;

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

// static
CommandService* CommandService::Get(content::BrowserContext* context) {}

bool CommandService::GetNamedCommands(const ExtensionId& extension_id,
                                      QueryType type,
                                      CommandScope scope,
                                      CommandMap* command_map) const {}

bool CommandService::AddKeybindingPref(const ui::Accelerator& accelerator,
                                       const ExtensionId& extension_id,
                                       const std::string& command_name,
                                       bool allow_overrides,
                                       bool global) {}

void CommandService::OnExtensionWillBeInstalled(
    content::BrowserContext* browser_context,
    const Extension* extension,
    bool is_update,
    const std::string& old_name) {}

void CommandService::OnExtensionUninstalled(
    content::BrowserContext* browser_context,
    const Extension* extension,
    extensions::UninstallReason reason) {}

void CommandService::UpdateKeybindingPrefs(const ExtensionId& extension_id,
                                           const std::string& command_name,
                                           const std::string& keystroke) {}

bool CommandService::SetScope(const ExtensionId& extension_id,
                              const std::string& command_name,
                              bool global) {}

Command CommandService::FindCommandByName(const ExtensionId& extension_id,
                                          const std::string& command) const {}

void CommandService::AddObserver(Observer* observer) {}

void CommandService::RemoveObserver(Observer* observer) {}

const Extension* CommandService::GetExtensionInEnabledOrDisabledExtensions(
    const ExtensionId& extension_id) const {}

bool CommandService::IsUpgradeFromMV2ToMV3(
    const Extension* extension,
    const std::string& existing_command_name) const {}

void CommandService::UpdateKeybindings(const Extension* extension) {}

void CommandService::RemoveRelinquishedKeybindings(const Extension* extension) {}

void CommandService::AssignKeybindings(const Extension* extension) {}

bool CommandService::CanAutoAssign(const Command &command,
                                   const Extension* extension) {}

void CommandService::UpdateExtensionSuggestedCommandPrefs(
    const Extension* extension) {}

void CommandService::RemoveDefunctExtensionSuggestedCommandPrefs(
    const Extension* extension) {}

bool CommandService::IsCommandShortcutUserModified(
    const Extension* extension,
    const std::string& command_name) {}

void CommandService::RemoveKeybindingPrefs(const ExtensionId& extension_id,
                                           const std::string& command_name) {}

bool CommandService::GetExtensionActionCommand(const ExtensionId& extension_id,
                                               ActionInfo::Type action_type,
                                               QueryType query_type,
                                               Command* command,
                                               bool* active) const {}

template <>
void BrowserContextKeyedAPIFactory<
    CommandService>::DeclareFactoryDependencies() {}

}  // namespace extensions