#include "components/custom_handlers/protocol_handler_registry.h"
#include <stddef.h>
#include <string_view>
#include <utility>
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/memory/ref_counted.h"
#include "base/notreached.h"
#include "base/observer_list.h"
#include "base/ranges/algorithm.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "components/custom_handlers/pref_names.h"
#include "components/custom_handlers/protocol_handler.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/child_process_security_policy.h"
#include "url/url_util.h"
BrowserThread;
ChildProcessSecurityPolicy;
namespace custom_handlers {
namespace {
const ProtocolHandler& LookupHandler(
const ProtocolHandlerRegistry::ProtocolHandlerMap& handler_map,
std::string_view scheme) { … }
GURL TranslateUrl(
const ProtocolHandlerRegistry::ProtocolHandlerMap& handler_map,
const GURL& url) { … }
}
std::unique_ptr<ProtocolHandlerRegistry> ProtocolHandlerRegistry::Create(
PrefService* prefs,
std::unique_ptr<Delegate> delegate) { … }
ProtocolHandlerRegistry::ProtocolHandlerRegistry(
PrefService* prefs,
std::unique_ptr<Delegate> delegate)
: … { … }
bool ProtocolHandlerRegistry::SilentlyHandleRegisterHandlerRequest(
const ProtocolHandler& handler) { … }
void ProtocolHandlerRegistry::OnAcceptRegisterProtocolHandler(
const ProtocolHandler& handler) { … }
void ProtocolHandlerRegistry::OnDenyRegisterProtocolHandler(
const ProtocolHandler& handler) { … }
void ProtocolHandlerRegistry::OnIgnoreRegisterProtocolHandler(
const ProtocolHandler& handler) { … }
bool ProtocolHandlerRegistry::AttemptReplace(const ProtocolHandler& handler) { … }
ProtocolHandlerRegistry::ProtocolHandlerList
ProtocolHandlerRegistry::GetReplacedHandlers(
const ProtocolHandler& handler) const { … }
void ProtocolHandlerRegistry::ClearDefault(const std::string& scheme) { … }
bool ProtocolHandlerRegistry::IsDefault(const ProtocolHandler& handler) const { … }
void ProtocolHandlerRegistry::InstallPredefinedHandlers() { … }
void ProtocolHandlerRegistry::InitProtocolSettings() { … }
int ProtocolHandlerRegistry::GetHandlerIndex(std::string_view scheme) const { … }
ProtocolHandlerRegistry::ProtocolHandlerList
ProtocolHandlerRegistry::GetHandlersFor(std::string_view scheme) const { … }
ProtocolHandlerRegistry::ProtocolHandlerList
ProtocolHandlerRegistry::GetUserDefinedHandlers(base::Time begin,
base::Time end) const { … }
ProtocolHandlerRegistry::ProtocolHandlerList
ProtocolHandlerRegistry::GetUserIgnoredHandlers(base::Time begin,
base::Time end) const { … }
void ProtocolHandlerRegistry::ClearUserDefinedHandlers(base::Time begin,
base::Time end) { … }
ProtocolHandlerRegistry::ProtocolHandlerList
ProtocolHandlerRegistry::GetIgnoredHandlers() { … }
void ProtocolHandlerRegistry::GetRegisteredProtocols(
std::vector<std::string>* output) const { … }
bool ProtocolHandlerRegistry::CanSchemeBeOverridden(
std::string_view scheme) const { … }
bool ProtocolHandlerRegistry::IsRegistered(
const ProtocolHandler& handler) const { … }
bool ProtocolHandlerRegistry::IsRegisteredByUser(
const ProtocolHandler& handler) { … }
bool ProtocolHandlerRegistry::HasPolicyRegisteredHandler(
std::string_view scheme) { … }
bool ProtocolHandlerRegistry::IsIgnored(const ProtocolHandler& handler) const { … }
bool ProtocolHandlerRegistry::HasRegisteredEquivalent(
const ProtocolHandler& handler) const { … }
bool ProtocolHandlerRegistry::HasIgnoredEquivalent(
const ProtocolHandler& handler) const { … }
void ProtocolHandlerRegistry::RemoveIgnoredHandler(
const ProtocolHandler& handler) { … }
bool ProtocolHandlerRegistry::IsHandledProtocol(std::string_view scheme) const { … }
void ProtocolHandlerRegistry::RemoveHandler(const ProtocolHandler& handler) { … }
void ProtocolHandlerRegistry::RemoveDefaultHandler(std::string_view scheme) { … }
const ProtocolHandler& ProtocolHandlerRegistry::GetHandlerFor(
std::string_view scheme) const { … }
GURL ProtocolHandlerRegistry::Translate(const GURL& url) const { … }
void ProtocolHandlerRegistry::Enable() { … }
void ProtocolHandlerRegistry::Disable() { … }
void ProtocolHandlerRegistry::Shutdown() { … }
void ProtocolHandlerRegistry::RegisterProfilePrefs(
user_prefs::PrefRegistrySyncable* registry) { … }
ProtocolHandlerRegistry::~ProtocolHandlerRegistry() { … }
void ProtocolHandlerRegistry::AddObserver(Observer* observer) { … }
void ProtocolHandlerRegistry::RemoveObserver(Observer* observer) { … }
void ProtocolHandlerRegistry::PromoteHandler(const ProtocolHandler& handler) { … }
void ProtocolHandlerRegistry::Save() { … }
const ProtocolHandlerRegistry::ProtocolHandlerList*
ProtocolHandlerRegistry::GetHandlerList(std::string_view scheme) const { … }
void ProtocolHandlerRegistry::SetDefault(const ProtocolHandler& handler) { … }
void ProtocolHandlerRegistry::InsertHandler(const ProtocolHandler& handler) { … }
base::Value::List ProtocolHandlerRegistry::EncodeRegisteredHandlers() { … }
base::Value::List ProtocolHandlerRegistry::EncodeIgnoredHandlers() { … }
void ProtocolHandlerRegistry::NotifyChanged() { … }
bool ProtocolHandlerRegistry::RegisterProtocolHandler(
const ProtocolHandler& handler,
const HandlerSource source) { … }
std::vector<const base::Value::Dict*>
ProtocolHandlerRegistry::GetHandlersFromPref(const char* pref_name) const { … }
void ProtocolHandlerRegistry::RegisterProtocolHandlersFromPref(
const char* pref_name,
const HandlerSource source) { … }
void ProtocolHandlerRegistry::IgnoreProtocolHandler(
const ProtocolHandler& handler,
const HandlerSource source) { … }
void ProtocolHandlerRegistry::IgnoreProtocolHandlersFromPref(
const char* pref_name,
const HandlerSource source) { … }
bool ProtocolHandlerRegistry::HandlerExists(const ProtocolHandler& handler,
ProtocolHandlerMultiMap* map) { … }
bool ProtocolHandlerRegistry::HandlerExists(const ProtocolHandler& handler,
const ProtocolHandlerList& list) { … }
void ProtocolHandlerRegistry::EraseHandler(const ProtocolHandler& handler,
ProtocolHandlerMultiMap* map) { … }
void ProtocolHandlerRegistry::EraseHandler(const ProtocolHandler& handler,
ProtocolHandlerList* list) { … }
void ProtocolHandlerRegistry::OnSetAsDefaultProtocolClientFinished(
const std::string& protocol,
bool is_default) { … }
void ProtocolHandlerRegistry::SetIsLoading(bool is_loading) { … }
base::WeakPtr<ProtocolHandlerRegistry> ProtocolHandlerRegistry::GetWeakPtr() { … }
void ProtocolHandlerRegistry::AddPredefinedHandler(
const ProtocolHandler& handler) { … }
DefaultClientCallback ProtocolHandlerRegistry::GetDefaultWebClientCallback(
const std::string& protocol) { … }
}