#include "content/browser/renderer_host/mixed_content_checker.h"
#include "base/containers/contains.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/field_trial_params.h"
#include "content/browser/preloading/prerender/prerender_final_status.h"
#include "content/browser/preloading/prerender/prerender_metrics.h"
#include "content/browser/renderer_host/frame_tree.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/browser/renderer_host/navigation_request.h"
#include "content/browser/renderer_host/render_frame_host_delegate.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/security_context/insecure_request_policy.h"
#include "third_party/blink/public/mojom/loader/mixed_content.mojom.h"
#include "third_party/blink/public/mojom/security_context/insecure_request_policy.mojom.h"
#include "url/origin.h"
#include "url/url_constants.h"
#include "url/url_util.h"
namespace content {
namespace {
bool ShouldFetchKeepAliveCancelPrerenderingOnMixedContent() { … }
bool IsSecureScheme(const std::string& scheme) { … }
bool ShouldTreatURLSchemeAsCorsEnabled(const GURL& url) { … }
bool IsUrlPotentiallySecure(const GURL& url) { … }
bool DoesOriginSchemeRestrictMixedContent(const url::Origin& origin) { … }
bool IsMixedContent(const url::Origin& origin, const GURL& url) { … }
RenderFrameHostImpl* InWhichFrameIsContentMixedForFetchKeepAlive(
RenderFrameHostImpl* initiator_frame,
const GURL& url) { … }
void UpdateRendererOnMixedContentFound(NavigationRequest* navigation_request,
const GURL& mixed_content_url,
bool was_allowed,
bool for_redirect) { … }
void MaybeSendBlinkFeatureUsageReport(
NavigationHandle& navigation_handle,
std::set<blink::mojom::WebFeature>& mixed_content_features) { … }
void ReportBasicMixedContentFeatures(
blink::mojom::RequestContextType request_context_type,
blink::mojom::MixedContentContextType mixed_content_context_type,
std::set<blink::mojom::WebFeature>& mixed_content_features) { … }
}
MixedContentChecker::MixedContentChecker() = default;
MixedContentChecker::~MixedContentChecker() = default;
bool MixedContentChecker::ShouldBlockNavigation(
NavigationHandle& navigation_handle,
bool for_redirect) { … }
bool MixedContentChecker::ShouldBlockInternal(
RenderFrameHostImpl* mixed_content_frame,
FrameTreeNode* node,
const GURL& url,
bool for_redirect,
bool cancel_prerendering,
blink::mojom::MixedContentContextType mixed_content_context_type,
std::set<blink::mojom::WebFeature>* mixed_content_features,
bool* should_report_to_renderer) { … }
RenderFrameHostImpl* MixedContentChecker::InWhichFrameIsContentMixed(
FrameTreeNode* node,
const GURL& url) { … }
bool MixedContentChecker::ShouldBlockFetchKeepAlive(
RenderFrameHostImpl* initiator_frame,
const GURL& url,
bool for_redirect) { … }
bool MixedContentChecker::IsMixedContentForTesting(const GURL& origin_url,
const GURL& url) { … }
}