#include "components/history/core/browser/url_database.h"
#include <string>
#include <vector>
#include "base/i18n/case_conversion.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "components/crash/core/common/crash_key.h"
#include "components/database_utils/upper_bound_string.h"
#include "components/database_utils/url_converter.h"
#include "components/history/core/browser/keyword_search_term.h"
#include "components/history/core/browser/keyword_search_term_util.h"
#include "components/url_formatter/url_formatter.h"
#include "sql/statement.h"
#include "url/gurl.h"
namespace history {
const int URLDatabase::kNumURLRowFields = …;
URLDatabase::URLEnumeratorBase::URLEnumeratorBase()
: … { … }
URLDatabase::URLEnumeratorBase::~URLEnumeratorBase() = default;
URLDatabase::URLEnumerator::URLEnumerator() = default;
bool URLDatabase::URLEnumerator::GetNextURL(URLRow* r) { … }
URLDatabase::URLDatabase()
: … { … }
URLDatabase::~URLDatabase() = default;
bool URLDatabase::FillURLRow(sql::Statement& s, URLRow* i) { … }
bool URLDatabase::MigrateKeywordsSearchTermsLowerTermColumn() { … }
bool URLDatabase::GetURLRow(URLID url_id, URLRow* info) { … }
URLID URLDatabase::GetRowForURL(const GURL& url, URLRow* info) { … }
bool URLDatabase::UpdateURLRow(URLID url_id, const URLRow& info) { … }
URLID URLDatabase::AddURLInternal(const URLRow& info, bool is_temporary) { … }
bool URLDatabase::URLTableContainsAutoincrement() { … }
bool URLDatabase::InsertOrUpdateURLRowByID(const URLRow& info) { … }
bool URLDatabase::DeleteURLRow(URLID id) { … }
bool URLDatabase::CreateTemporaryURLTable() { … }
bool URLDatabase::CommitTemporaryURLTable() { … }
bool URLDatabase::InitURLEnumeratorForEverything(URLEnumerator* enumerator) { … }
bool URLDatabase::InitURLEnumeratorForSignificant(URLEnumerator* enumerator) { … }
bool URLDatabase::AutocompleteForPrefix(const std::string& prefix,
size_t max_results,
bool typed_only,
URLRows* results) { … }
bool URLDatabase::IsTypedHost(const std::string& host, std::string* scheme) { … }
bool URLDatabase::FindShortestURLFromBase(const std::string& base,
const std::string& url,
int min_visits,
int min_typed,
bool allow_base,
URLRow* info) { … }
URLRows URLDatabase::GetTextMatches(const std::u16string& query) { … }
URLRows URLDatabase::GetTextMatchesWithAlgorithm(
const std::u16string& query,
query_parser::MatchingAlgorithm algorithm) { … }
bool URLDatabase::InitKeywordSearchTermsTable() { … }
bool URLDatabase::CreateKeywordSearchTermsIndices() { … }
bool URLDatabase::DropKeywordSearchTermsTable() { … }
bool URLDatabase::SetKeywordSearchTermsForURL(URLID url_id,
KeywordID keyword_id,
const std::u16string& term) { … }
bool URLDatabase::GetAggregateURLDataForKeywordSearchTerm(
const std::u16string& term,
URLRow* url_info) { … }
bool URLDatabase::GetKeywordSearchTermRow(URLID url_id,
KeywordSearchTermRow* row) { … }
bool URLDatabase::GetKeywordSearchTermRows(
const std::u16string& term,
std::vector<KeywordSearchTermRow>* rows) { … }
void URLDatabase::DeleteAllSearchTermsForKeyword(
KeywordID keyword_id) { … }
std::unique_ptr<KeywordSearchTermVisitEnumerator>
URLDatabase::CreateKeywordSearchTermVisitEnumerator(
KeywordID keyword_id,
const std::u16string& prefix) { … }
std::unique_ptr<KeywordSearchTermVisitEnumerator>
URLDatabase::CreateKeywordSearchTermVisitEnumerator(KeywordID keyword_id) { … }
bool URLDatabase::DeleteKeywordSearchTerm(const std::u16string& term) { … }
bool URLDatabase::DeleteKeywordSearchTermForNormalizedTerm(
KeywordID keyword_id,
const std::u16string& normalized_term) { … }
bool URLDatabase::DeleteKeywordSearchTermForURL(URLID url_id) { … }
bool URLDatabase::DropStarredIDFromURLs() { … }
bool URLDatabase::CreateURLTable(bool is_temporary) { … }
bool URLDatabase::CreateMainURLIndex() { … }
bool URLDatabase::RecreateURLTableWithAllContents() { … }
const int kLowQualityMatchTypedLimit = …;
const int kLowQualityMatchVisitLimit = …;
const int kLowQualityMatchAgeLimitInDays = …;
base::Time AutocompleteAgeThreshold() { … }
bool RowQualifiesAsSignificant(const URLRow& row,
const base::Time& threshold) { … }
}