Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 1905033002: PlzNavigate: Move navigation-level mixed content checks to the browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@console-security-message
Patch Set: Addressed all jam@ latest comments. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index dbfff0a06a54116bc6cf478efaabb8576e6d4d24..95736c7fae507d4f20b7c9b5ddca2ecc48daa711 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -44,12 +44,15 @@
#include "chrome/browser/chrome_quota_permission_context.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
+#include "chrome/browser/content_settings/mixed_content_settings.h"
+#include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/defaults.h"
#include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/engagement/site_engagement_eviction_policy.h"
#include "chrome/browser/field_trial_recorder.h"
#include "chrome/browser/font_family_cache.h"
+#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h"
#include "chrome/browser/memory/chrome_memory_coordinator_delegate.h"
#include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h"
@@ -113,6 +116,7 @@
#include "chrome/common/render_messages.h"
#include "chrome/common/renderer_configuration.mojom.h"
#include "chrome/common/secure_origin_whitelist.h"
+#include "chrome/common/ssl_insecure_content.h"
#include "chrome/common/stack_sampling_configuration.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/browser_resources.h"
@@ -3293,6 +3297,43 @@ void ChromeContentBrowserClient::OverridePageVisibilityState(
}
}
+void ChromeContentBrowserClient::PassiveInsecureContentFound(
+ const GURL& resource_url) {
+ // Note: this implementation is a mirror of
+ // ContentSettingsObserver::passiveInsecureContentFound
+ ReportInsecureContent(SslInsecureContentType::DISPLAY);
+ FilteredReportInsecureContentDisplayed(resource_url);
+}
+
+bool ChromeContentBrowserClient::ShouldAllowRunningInsecureContent(
+ bool allowed_per_settings,
+ const url::Origin& origin,
+ const GURL& resource_url,
+ content::WebContents* web_contents) {
+ // Note: this implementation is a mirror of
+ // ContentSettingsObserver::allowRunningInsecureContent
+ FilteredReportInsecureContentRan(resource_url);
+
+ MixedContentSettings* mixed_content_settings =
+ MixedContentSettings::FromWebContents(web_contents);
+ DCHECK(mixed_content_settings);
+ if (allowed_per_settings ||
+ mixed_content_settings->insecure_content_allowed_running()) {
+ return true;
+ }
+
+ // Note: this is a browser-side-translation of the call to DidBlockContentType
+ // from inside ContentSettingsObserver::allowRunningInsecureContent.
+ if (!origin.host().empty()) {
+ TabSpecificContentSettings* tab_settings =
+ TabSpecificContentSettings::FromWebContents(web_contents);
+ DCHECK(tab_settings);
+ tab_settings->OnContentBlockedWithDetail(CONTENT_SETTINGS_TYPE_MIXEDSCRIPT,
+ base::UTF8ToUTF16(origin.host()));
+ }
+ return false;
+}
+
#if BUILDFLAG(ENABLE_WEBRTC)
void ChromeContentBrowserClient::MaybeCopyDisableWebRtcEncryptionSwitch(
base::CommandLine* to_command_line,

Powered by Google App Engine
This is Rietveld 408576698