Skip to content

Commit

Permalink
Remove InsecureContentInfobarDelegate, which has been broken for a while
Browse files Browse the repository at this point in the history
anyway and was only available behind a flag. Also remove said flag
(--no-displaying-insecure-content)

Originally it was used for all mixed content but a while ago it was
constrained to passive mixed content (i.e. display of insecure content).

BUG=628812

Review-Url: https://codereview.chromium.org/2167513002
Cr-Commit-Position: refs/heads/master@{#407833}
  • Loading branch information
estade authored and Commit bot committed Jul 26, 2016
1 parent f49dfc9 commit 76fe1a6
Show file tree
Hide file tree
Showing 12 changed files with 5 additions and 230 deletions.
15 changes: 0 additions & 15 deletions chrome/browser/infobars/infobar_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include "base/command_line.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/infobars/insecure_content_infobar_delegate.h"
#include "chrome/common/render_messages.h"
#include "components/content_settings/content/common/content_settings_messages.h"
#include "components/infobars/core/infobar.h"
Expand Down Expand Up @@ -115,20 +114,6 @@ void InfoBarService::WebContentsDestroyed() {
// returning from this function is the only safe thing to do.
}

bool InfoBarService::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(InfoBarService, message)
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_DidBlockDisplayingInsecureContent,
OnDidBlockDisplayingInsecureContent)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}

void InfoBarService::OnDidBlockDisplayingInsecureContent() {
InsecureContentInfoBarDelegate::Create(this);
}

void InfoBarService::OpenURL(const GURL& url,
WindowOpenDisposition disposition) {
// A normal user click on an infobar URL will result in a CURRENT_TAB
Expand Down
4 changes: 0 additions & 4 deletions chrome/browser/infobars/infobar_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ class InfoBarService : public infobars::InfoBarManager,
void NavigationEntryCommitted(
const content::LoadCommittedDetails& load_details) override;
void WebContentsDestroyed() override;
bool OnMessageReceived(const IPC::Message& message) override;

// Message handlers.
void OnDidBlockDisplayingInsecureContent();

// See description in set_ignore_next_reload().
bool ignore_next_reload_;
Expand Down
111 changes: 0 additions & 111 deletions chrome/browser/infobars/insecure_content_infobar_delegate.cc

This file was deleted.

48 changes: 0 additions & 48 deletions chrome/browser/infobars/insecure_content_infobar_delegate.h

This file was deleted.

2 changes: 0 additions & 2 deletions chrome/browser/prefs/command_line_pref_store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ const CommandLinePrefStore::BooleanSwitchToPreferenceMapEntry
{ switches::kNoReferrers, prefs::kEnableReferrers, false },
{ switches::kAllowRunningInsecureContent,
prefs::kWebKitAllowRunningInsecureContent, true },
{ switches::kNoDisplayingInsecureContent,
prefs::kWebKitAllowDisplayingInsecureContent, false },
{ switches::kAllowCrossOriginAuthPrompt,
prefs::kAllowCrossOriginAuthPrompt, true },
{ switches::kDisablePrintPreview, prefs::kPrintPreviewDisabled, true },
Expand Down
24 changes: 3 additions & 21 deletions chrome/browser/ssl/ssl_browser_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -610,9 +610,10 @@ class SSLUITestBlock : public SSLUITest {
public:
SSLUITestBlock() : SSLUITest() {}

// Browser will neither run nor display insecure content.
// Browser will not run insecure content.
void SetUpCommandLine(base::CommandLine* command_line) override {
command_line->AppendSwitch(switches::kNoDisplayingInsecureContent);
// By overriding SSLUITest, we won't apply the flag that allows running
// insecure content.
}
};

Expand Down Expand Up @@ -2344,25 +2345,6 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeImageWithUserException) {
EXPECT_GT(img_width, 100);
}

// Test that when the browser blocks displaying insecure content (images), the
// indicator shows a secure page, because the blocking made the otherwise
// unsafe page safe (the notification of this state is handled by other means).
IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockDisplayingInsecureImage) {
ASSERT_TRUE(embedded_test_server()->Start());
ASSERT_TRUE(https_server_.Start());

std::string replacement_path;
GetFilePathWithHostAndPortReplacement(
"/ssl/page_displays_insecure_content.html",
embedded_test_server()->host_port_pair(), &replacement_path);

ui_test_utils::NavigateToURL(browser(),
https_server_.GetURL(replacement_path));

CheckAuthenticatedState(browser()->tab_strip_model()->GetActiveWebContents(),
AuthState::NONE);
}

// Test that when the browser blocks displaying insecure content (iframes), the
// indicator shows a secure page, because the blocking made the otherwise
// unsafe page safe (the notification of this state is handled by other means)
Expand Down
2 changes: 0 additions & 2 deletions chrome/chrome_browser.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,6 @@
'browser/infobars/infobar_responder.h',
'browser/infobars/infobar_service.cc',
'browser/infobars/infobar_service.h',
'browser/infobars/insecure_content_infobar_delegate.cc',
'browser/infobars/insecure_content_infobar_delegate.h',
'browser/install_verification/win/install_verification.cc',
'browser/install_verification/win/install_verification.h',
'browser/install_verification/win/loaded_module_verification.cc',
Expand Down
4 changes: 0 additions & 4 deletions chrome/common/chrome_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -676,10 +676,6 @@ const char kNetLogCaptureMode[] = "net-log-capture-mode";
// want to avoid having the default browser info-bar displayed.
const char kNoDefaultBrowserCheck[] = "no-default-browser-check";

// By default, an https page can load images, fonts or frames from an http
// page. This switch overrides this to block this lesser mixed-content problem.
const char kNoDisplayingInsecureContent[] = "no-displaying-insecure-content";

// Disables all experiments set on about:flags. Does not disable about:flags
// itself. Useful if an experiment makes chrome crash at startup: One can start
// chrome with --no-experiments, disable the problematic lab at about:flags and
Expand Down
1 change: 0 additions & 1 deletion chrome/common/chrome_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ extern const char kMetricsRecordingOnly[];
extern const char kMonitoringDestinationID[];
extern const char kNetLogCaptureMode[];
extern const char kNoDefaultBrowserCheck[];
extern const char kNoDisplayingInsecureContent[];
extern const char kNoExperiments[];
extern const char kNoFirstRun[];
extern const char kNoPings[];
Expand Down
19 changes: 2 additions & 17 deletions chrome/renderer/content_settings_observer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ ContentSettingsObserver::ContentSettingsObserver(
#if defined(ENABLE_EXTENSIONS)
extension_dispatcher_(extension_dispatcher),
#endif
allow_displaying_insecure_content_(false),
allow_running_insecure_content_(false),
content_setting_rules_(NULL),
is_interstitial_page_(false),
Expand All @@ -108,8 +107,6 @@ ContentSettingsObserver::ContentSettingsObserver(
// Copy all the settings from the main render frame to avoid race conditions
// when initializing this data. See https://crbug.com/333308.
ContentSettingsObserver* parent = ContentSettingsObserver::Get(main_frame);
allow_displaying_insecure_content_ =
parent->allow_displaying_insecure_content_;
allow_running_insecure_content_ = parent->allow_running_insecure_content_;
temporarily_allowed_plugins_ = parent->temporarily_allowed_plugins_;
is_interstitial_page_ = parent->is_interstitial_page_;
Expand Down Expand Up @@ -155,8 +152,6 @@ bool ContentSettingsObserver::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ContentSettingsObserver, message)
IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAsInterstitial, OnSetAsInterstitial)
IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAllowDisplayingInsecureContent,
OnSetAllowDisplayingInsecureContent)
IPC_MESSAGE_HANDLER(ChromeViewMsg_SetAllowRunningInsecureContent,
OnSetAllowRunningInsecureContent)
IPC_MESSAGE_HANDLER(ChromeViewMsg_ReloadFrame, OnReloadFrame);
Expand Down Expand Up @@ -399,15 +394,10 @@ bool ContentSettingsObserver::allowMutationEvents(bool default_value) {
bool ContentSettingsObserver::allowDisplayingInsecureContent(
bool allowed_per_settings,
const blink::WebURL& resource_url) {
DCHECK(allowed_per_settings);
ReportInsecureContent(SslInsecureContentType::DISPLAY);
FilteredReportInsecureContentDisplayed(GURL(resource_url));

if (allowed_per_settings || allow_displaying_insecure_content_)
return true;

Send(new ChromeViewHostMsg_DidBlockDisplayingInsecureContent(routing_id()));

return false;
return true;
}

bool ContentSettingsObserver::allowRunningInsecureContent(
Expand Down Expand Up @@ -460,13 +450,8 @@ void ContentSettingsObserver::OnSetAsInterstitial() {
is_interstitial_page_ = true;
}

void ContentSettingsObserver::OnSetAllowDisplayingInsecureContent(bool allow) {
allow_displaying_insecure_content_ = allow;
}

void ContentSettingsObserver::OnSetAllowRunningInsecureContent(bool allow) {
allow_running_insecure_content_ = allow;
OnSetAllowDisplayingInsecureContent(allow);
}

void ContentSettingsObserver::OnReloadFrame() {
Expand Down
1 change: 0 additions & 1 deletion chrome/renderer/content_settings_observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ class ContentSettingsObserver
// Message handlers.
void OnLoadBlockedPlugins(const std::string& identifier);
void OnSetAsInterstitial();
void OnSetAllowDisplayingInsecureContent(bool allow);
void OnSetAllowRunningInsecureContent(bool allow);
void OnReloadFrame();
void OnRequestFileSystemAccessAsyncResponse(int request_id, bool allowed);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ IPC_ENUM_TRAITS_MAX_VALUE(ContentSettingsType,
//-----------------------------------------------------------------------------
// These are messages sent from the browser to the renderer process.

// Sent in response to FrameHostMsg_DidBlockDisplayingInsecureContent.
IPC_MESSAGE_ROUTED1(ChromeViewMsg_SetAllowDisplayingInsecureContent,
bool /* allowed */)

// Sent in response to FrameHostMsg_DidBlockRunningInsecureContent.
IPC_MESSAGE_ROUTED1(ChromeViewMsg_SetAllowRunningInsecureContent,
bool /* allowed */)
Expand Down

0 comments on commit 76fe1a6

Please sign in to comment.