#include "chrome/browser/extensions/api/history/history_api.h"
#include <memory>
#include <set>
#include <utility>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/json/json_writer.h"
#include "base/lazy_instance.h"
#include "base/location.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/cancelable_task_tracker.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "base/values.h"
#include "chrome/browser/extensions/activity_log/activity_log.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/history/web_history_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/api/history.h"
#include "components/history/core/browser/history_service.h"
#include "components/history/core/browser/history_types.h"
#include "components/history/core/common/pref_names.h"
#include "components/prefs/pref_service.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_system_provider.h"
#include "extensions/browser/extensions_browser_client.h"
namespace extensions {
HistoryItem;
VisitItem;
HistoryItemList;
VisitItemList;
AddUrl;
DeleteUrl;
DeleteRange;
GetVisits;
OnVisited;
OnVisitRemoved;
Search;
namespace {
const char kInvalidUrlError[] = …;
const char kDeleteProhibitedError[] = …;
HistoryItem GetHistoryItem(const history::URLRow& row) { … }
VisitItem GetVisitItem(const history::VisitRow& row) { … }
}
HistoryEventRouter::HistoryEventRouter(Profile* profile,
history::HistoryService* history_service)
: … { … }
HistoryEventRouter::~HistoryEventRouter() { … }
void HistoryEventRouter::OnURLVisited(history::HistoryService* history_service,
const history::URLRow& url_row,
const history::VisitRow& new_visit) { … }
void HistoryEventRouter::OnHistoryDeletions(
history::HistoryService* history_service,
const history::DeletionInfo& deletion_info) { … }
void HistoryEventRouter::DispatchEvent(Profile* profile,
events::HistogramValue histogram_value,
const std::string& event_name,
base::Value::List event_args) { … }
HistoryAPI::HistoryAPI(content::BrowserContext* context)
: … { … }
HistoryAPI::~HistoryAPI() { … }
void HistoryAPI::Shutdown() { … }
static base::LazyInstance<BrowserContextKeyedAPIFactory<HistoryAPI>>::
DestructorAtExit g_history_api_factory = …;
BrowserContextKeyedAPIFactory<HistoryAPI>* HistoryAPI::GetFactoryInstance() { … }
template <>
void BrowserContextKeyedAPIFactory<HistoryAPI>::DeclareFactoryDependencies() { … }
void HistoryAPI::OnListenerAdded(const EventListenerInfo& details) { … }
bool HistoryFunction::ValidateUrl(const std::string& url_string,
GURL* url,
std::string* error) { … }
bool HistoryFunction::VerifyDeleteAllowed(std::string* error) { … }
base::Time HistoryFunction::GetTime(double ms_from_epoch) { … }
Profile* HistoryFunction::GetProfile() const { … }
HistoryFunctionWithCallback::HistoryFunctionWithCallback() { … }
HistoryFunctionWithCallback::~HistoryFunctionWithCallback() { … }
ExtensionFunction::ResponseAction HistoryGetVisitsFunction::Run() { … }
void HistoryGetVisitsFunction::QueryComplete(history::QueryURLResult result) { … }
ExtensionFunction::ResponseAction HistorySearchFunction::Run() { … }
void HistorySearchFunction::SearchComplete(history::QueryResults results) { … }
ExtensionFunction::ResponseAction HistoryAddUrlFunction::Run() { … }
ExtensionFunction::ResponseAction HistoryDeleteUrlFunction::Run() { … }
ExtensionFunction::ResponseAction HistoryDeleteRangeFunction::Run() { … }
void HistoryDeleteRangeFunction::DeleteComplete() { … }
ExtensionFunction::ResponseAction HistoryDeleteAllFunction::Run() { … }
void HistoryDeleteAllFunction::DeleteComplete() { … }
}