#include "components/omnibox/browser/shortcuts_database.h"
#include <string>
#include <tuple>
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/numerics/safe_conversions.h"
#include "base/time/time.h"
#include "base/uuid.h"
#include "components/omnibox/browser/autocomplete_match_type.h"
#include "components/omnibox/common/omnibox_features.h"
#include "sql/meta_table.h"
#include "sql/recovery.h"
#include "sql/statement.h"
#include "sql/transaction.h"
#include "ui/base/page_transition_types.h"
namespace {
const int kCurrentVersionNumber = …;
const int kCompatibleVersionNumber = …;
void BindShortcutToStatement(const ShortcutsDatabase::Shortcut& shortcut,
sql::Statement& s) { … }
void DatabaseErrorCallback(sql::Database* db,
int extended_error,
sql::Statement* stmt) { … }
}
ShortcutsDatabase::Shortcut::MatchCore::MatchCore(
const std::u16string& fill_into_edit,
const GURL& destination_url,
AutocompleteMatch::DocumentType document_type,
const std::u16string& contents,
const std::string& contents_class,
const std::u16string& description,
const std::string& description_class,
ui::PageTransition transition,
AutocompleteMatchType::Type type,
const std::u16string& keyword)
: … { … }
ShortcutsDatabase::Shortcut::MatchCore::MatchCore(const MatchCore&) = default;
ShortcutsDatabase::Shortcut::MatchCore::~MatchCore() = default;
ShortcutsDatabase::Shortcut::Shortcut(const std::string& id,
const std::u16string& text,
const MatchCore& match_core,
const base::Time& last_access_time,
int number_of_hits)
: … { … }
ShortcutsDatabase::Shortcut::Shortcut()
: … { … }
ShortcutsDatabase::Shortcut::Shortcut(const Shortcut&) = default;
ShortcutsDatabase::Shortcut::~Shortcut() = default;
ShortcutsDatabase::ShortcutsDatabase(const base::FilePath& database_path)
: … { … }
bool ShortcutsDatabase::Init() { … }
bool ShortcutsDatabase::AddShortcut(const Shortcut& shortcut) { … }
bool ShortcutsDatabase::UpdateShortcut(const Shortcut& shortcut) { … }
bool ShortcutsDatabase::DeleteShortcutsWithIDs(
const ShortcutIDs& shortcut_ids) { … }
bool ShortcutsDatabase::DeleteShortcutsWithURL(
const std::string& shortcut_url_spec) { … }
bool ShortcutsDatabase::DeleteAllShortcuts() { … }
void ShortcutsDatabase::LoadShortcuts(GuidToShortcutMap* shortcuts) { … }
ShortcutsDatabase::~ShortcutsDatabase() = default;
bool ShortcutsDatabase::EnsureTable() { … }
bool ShortcutsDatabase::DoMigration(int version) { … }