一、历史记录和下载记录存储位置:
C:\Users\Administrator\AppData\Local\Google\Chrome\User Data\Default\History数据库文件里面:
二、对应数据库操作类
2.1)、历史记录操作类
components\history\core\browser\history_database.cc
components\history\core\browser\history_database.h
sql::InitStatus HistoryDatabase::Init(const base::FilePath& history_name) {
db_.set_histogram_tag("History");
if (!db_.Open(history_name))
return LogInitFailure(InitStep::OPEN);
// Wrap the rest of init in a transaction. This will prevent the database from
// getting corrupted if we crash in the middle of initialization or migration.
sql::Transaction committer(&db_);
if (!committer.Begin())
return LogInitFailure(InitStep::TRANSACTION_BEGIN);
#if BUILDFLAG(IS_APPLE)
// Exclude the history file from backups.
base::apple::SetBackupExclusion(history_name);
#endif
// Prime the cache.
db_.Preload();
// Create the tables and indices. If you add something here, also add it to
// `RecreateAllTablesButURL()`.
if (!meta_table_.Init(&db_, GetCurrentVersion(), kCompatibleVersionNumber))
return LogInitFailure(InitStep::META_TABLE_INIT);
if (!CreateURLTable(false) || !InitVisitTable() ||
!InitKeywordSearchTermsTable() || !InitDownloadTable() ||
!InitSegmentTables() || !InitVisitAnnotationsTables() ||
!CreateVisitedLinkTable() || !history_metadata_db_.Init()) {
return LogInitFailure(InitStep::CREATE_TABLES);
}
CreateMainURLIndex();
// Version check.
sql::InitStatus version_status = EnsureCurrentVersion();
if (version_status != sql::INIT_OK) {
LogInitFailure(InitStep::VERSION);
return version_status;
}
if (!committer.Commit())
return LogInitFailure(InitStep::COMMIT);
return sql::INIT_OK;
}
2.2)、下载记录操作类
components\history\core\browser\download_database.cc
components\history\core\browser\download_database.h
三、总结:
历史和下载记录数据来源都在两个文件里面,需要的可以在此更改数据源逻辑。