#include "content/browser/webui/url_data_manager_backend.h"
#include <set>
#include <utility>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/memory/ref_counted_memory.h"
#include "base/no_destructor.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "base/values.h"
#include "content/browser/webui/shared_resources_data_source.h"
#include "content/browser/webui/url_data_source_impl.h"
#include "content/browser/webui/web_ui_data_source_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_client.h"
#include "content/public/common/url_constants.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/filter/source_stream.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_status_code.h"
#include "net/log/net_log_util.h"
#include "services/network/public/mojom/content_security_policy.mojom.h"
#include "ui/base/template_expressions.h"
#include "ui/base/webui/i18n_source_stream.h"
#include "url/url_util.h"
namespace content {
namespace {
const char kChromeURLContentSecurityPolicyHeaderName[] = …;
const char kChromeURLCrossOriginOpenerPolicyName[] = …;
const char kChromeURLCrossOriginEmbedderPolicyName[] = …;
const char kChromeURLCrossOriginResourcePolicyName[] = …;
const char kChromeURLXFrameOptionsHeaderName[] = …;
const char kChromeURLXFrameOptionsHeaderValue[] = …;
const char kNetworkErrorKey[] = …;
const char kURLDataManagerBackendKeyName[] = …;
bool SchemeIsInSchemes(const std::string& scheme,
const std::vector<std::string>& schemes) { … }
bool g_disallow_webui_scheme_caching_for_testing = …;
std::vector<std::string> GetWebUISchemesSlow() { … }
std::vector<std::string> GetWebUISchemesCached() { … }
}
URLDataManagerBackend::URLDataManagerBackend() { … }
URLDataManagerBackend::~URLDataManagerBackend() = default;
URLDataManagerBackend* URLDataManagerBackend::GetForBrowserContext(
BrowserContext* context) { … }
void URLDataManagerBackend::AddDataSource(URLDataSourceImpl* source) { … }
void URLDataManagerBackend::UpdateWebUIDataSource(
const std::string& source_name,
const base::Value::Dict& update) { … }
URLDataSourceImpl* URLDataManagerBackend::GetDataSourceFromURL(
const GURL& url) { … }
scoped_refptr<net::HttpResponseHeaders> URLDataManagerBackend::GetHeaders(
URLDataSourceImpl* source_impl,
const GURL& url,
const std::string& origin) { … }
bool URLDataManagerBackend::CheckURLIsValid(const GURL& url) { … }
bool URLDataManagerBackend::IsValidNetworkErrorCode(int error_code) { … }
std::vector<std::string> URLDataManagerBackend::GetWebUISchemes() { … }
void URLDataManagerBackend::SetDisallowWebUISchemeCachingForTesting(
bool disallow_caching) { … }
}