blob: a5074fb88e6e98fffd89700e4e57ad3e2459e11f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
// based on chrome/browser/custom_handlers/chrome_protocol_handler_registry_delegate.cc:
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "protocol_handler_registry_delegate_qt.h"
#include "content/public/browser/child_process_security_policy.h"
#include "url/url_util_qt.h"
namespace QtWebEngineCore {
using content::ChildProcessSecurityPolicy;
ProtocolHandlerRegistryDelegateQt::ProtocolHandlerRegistryDelegateQt() = default;
ProtocolHandlerRegistryDelegateQt::~ProtocolHandlerRegistryDelegateQt() = default;
// ProtocolHandlerRegistry::Delegate:
void ProtocolHandlerRegistryDelegateQt::RegisterExternalHandler(const std::string &protocol)
{
ChildProcessSecurityPolicy *policy = ChildProcessSecurityPolicy::GetInstance();
if (!policy->IsWebSafeScheme(protocol)) {
policy->RegisterWebSafeScheme(protocol);
}
}
bool ProtocolHandlerRegistryDelegateQt::IsExternalHandlerRegistered(const std::string &protocol)
{
return url::IsHandledProtocol(protocol);
}
} // namespace QtWebEngineCore
|