#include "components/omnibox/browser/shortcuts_backend.h"
#include <stddef.h>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <utility>
#include "base/functional/bind.h"
#include "base/i18n/case_conversion.h"
#include "base/metrics/histogram_macros.h"
#include "base/ranges/algorithm.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/uuid.h"
#include "components/omnibox/browser/autocomplete_input.h"
#include "components/omnibox/browser/autocomplete_match.h"
#include "components/omnibox/browser/autocomplete_match_type.h"
#include "components/omnibox/browser/autocomplete_result.h"
#include "components/omnibox/browser/base_search_provider.h"
#include "components/omnibox/browser/in_memory_url_index_types.h"
#include "components/omnibox/browser/shortcuts_database.h"
#include "components/omnibox/browser/tailored_word_break_iterator.h"
namespace {
std::string StripMatchMarkers(const ACMatchClassifications& matches) { … }
AutocompleteMatch::Type GetTypeForShortcut(AutocompleteMatch::Type type) { … }
std::u16string ExpandToFullWord(std::u16string trimmed_text,
std::u16string match_text,
bool is_existing_shortcut) { … }
}
const std::u16string& ShortcutsBackend::GetDescription(
const AutocompleteMatch& match) { … }
const std::u16string& ShortcutsBackend::GetSwappedDescription(
const AutocompleteMatch& match) { … }
const ACMatchClassifications& ShortcutsBackend::GetDescriptionClass(
const AutocompleteMatch& match) { … }
const std::u16string& ShortcutsBackend::GetContents(
const AutocompleteMatch& match) { … }
const std::u16string& ShortcutsBackend::GetSwappedContents(
const AutocompleteMatch& match) { … }
const ACMatchClassifications& ShortcutsBackend::GetContentsClass(
const AutocompleteMatch& match) { … }
ShortcutsBackend::ShortcutsBackend(
TemplateURLService* template_url_service,
std::unique_ptr<SearchTermsData> search_terms_data,
history::HistoryService* history_service,
base::FilePath database_path,
bool suppress_db)
: … { … }
bool ShortcutsBackend::Init() { … }
bool ShortcutsBackend::DeleteShortcutsWithURL(const GURL& shortcut_url) { … }
bool ShortcutsBackend::DeleteShortcutsBeginningWithURL(
const GURL& shortcut_url) { … }
void ShortcutsBackend::AddObserver(ShortcutsBackendObserver* obs) { … }
void ShortcutsBackend::RemoveObserver(ShortcutsBackendObserver* obs) { … }
void ShortcutsBackend::AddOrUpdateShortcut(const std::u16string& text,
const AutocompleteMatch& match) { … }
ShortcutsBackend::~ShortcutsBackend() { … }
ShortcutsDatabase::Shortcut::MatchCore ShortcutsBackend::MatchToMatchCore(
const AutocompleteMatch& match,
TemplateURLService* template_url_service,
SearchTermsData* search_terms_data) { … }
void ShortcutsBackend::ShutdownOnUIThread() { … }
void ShortcutsBackend::OnHistoryDeletions(
history::HistoryService* history_service,
const history::DeletionInfo& deletion_info) { … }
void ShortcutsBackend::InitInternal() { … }
void ShortcutsBackend::InitCompleted() { … }
bool ShortcutsBackend::AddShortcut(
const ShortcutsDatabase::Shortcut& shortcut) { … }
bool ShortcutsBackend::UpdateShortcut(
const ShortcutsDatabase::Shortcut& shortcut) { … }
bool ShortcutsBackend::DeleteShortcutsWithIDs(
const ShortcutsDatabase::ShortcutIDs& shortcut_ids) { … }
bool ShortcutsBackend::DeleteShortcutsWithURL(const GURL& url,
bool exact_match) { … }
bool ShortcutsBackend::DeleteAllShortcuts() { … }