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

Unified Diff: chrome/browser/ui/browser.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: Moved methods from ContentBrowserClient to WebContentsDelegate; all caps constant names. 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/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index b64ad9188e41876adfbc062c9ba58453894c622b..e0df170599e96b785b407833a63747706c5c7a82 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -38,6 +38,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_shutdown.h"
#include "chrome/browser/chrome_notification_types.h"
+#include "chrome/browser/content_settings/mixed_content_settings.h"
#include "chrome/browser/content_settings/tab_specific_content_settings.h"
#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
#include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
@@ -150,6 +151,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/profiling.h"
#include "chrome/common/search/search_types.h"
+#include "chrome/common/ssl_insecure_content.h"
#include "chrome/common/url_constants.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
@@ -1330,6 +1332,42 @@ void Browser::RequestAppBannerFromDevTools(content::WebContents* web_contents) {
manager->RequestAppBanner(web_contents->GetLastCommittedURL(), true);
}
+void Browser::PassiveInsecureContentFound(const GURL& resource_url) {
+ // Note: this implementation is a mirror of
+ // ContentSettingsObserver::passiveInsecureContentFound
+ ReportInsecureContent(SslInsecureContentType::DISPLAY);
+ FilteredReportInsecureContentDisplayed(resource_url);
+}
+
+bool Browser::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;
+}
+
bool Browser::IsMouseLocked() const {
return exclusive_access_manager_->mouse_lock_controller()->IsMouseLocked();
}

Powered by Google App Engine
This is Rietveld 408576698