summaryrefslogtreecommitdiff
path: root/chromium/components/security_interstitials
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-24 12:15:48 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-08-28 13:30:04 +0000
commitb014812705fc80bff0a5c120dfcef88f349816dc (patch)
tree25a2e2d9fa285f1add86aa333389a839f81a39ae /chromium/components/security_interstitials
parent9f4560b1027ae06fdb497023cdcaf91b8511fa74 (diff)
downloadqtwebengine-chromium-b014812705fc80bff0a5c120dfcef88f349816dc.tar.gz
BASELINE: Update Chromium to 68.0.3440.125
Change-Id: I23f19369e01f688e496f5bf179abb521ad73874f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/components/security_interstitials')
-rw-r--r--chromium/components/security_interstitials/content/BUILD.gn22
-rw-r--r--chromium/components/security_interstitials/content/DEPS3
-rw-r--r--chromium/components/security_interstitials/content/security_interstitial_tab_helper.cc160
-rw-r--r--chromium/components/security_interstitials/content/security_interstitial_tab_helper.h97
-rw-r--r--chromium/components/security_interstitials/content/security_interstitial_tab_helper_unittest.cc210
-rw-r--r--chromium/components/security_interstitials/core/browser/resources/interstitial_large.html4
-rw-r--r--chromium/components/security_interstitials/core/browser/resources/interstitial_large.js11
-rw-r--r--chromium/components/security_interstitials/core/browser/resources/interstitial_webview_quiet.css1
-rw-r--r--chromium/components/security_interstitials/core/common/resources/interstitial_common.css16
-rw-r--r--chromium/components/security_interstitials/core/common/resources/interstitial_core.css2
-rw-r--r--chromium/components/security_interstitials/core/common_string_util.cc4
-rw-r--r--chromium/components/security_interstitials/core/controller_client.cc4
-rw-r--r--chromium/components/security_interstitials/core/controller_client.h4
-rw-r--r--chromium/components/security_interstitials/core/safe_browsing_loud_error_ui.cc4
-rw-r--r--chromium/components/security_interstitials/core/safe_browsing_quiet_error_ui.cc4
-rw-r--r--chromium/components/security_interstitials/core/ssl_error_ui.cc8
-rw-r--r--chromium/components/security_interstitials/core/superfish_error_ui.cc2
17 files changed, 551 insertions, 5 deletions
diff --git a/chromium/components/security_interstitials/content/BUILD.gn b/chromium/components/security_interstitials/content/BUILD.gn
index b3f383efe07..7b6d5b3eefc 100644
--- a/chromium/components/security_interstitials/content/BUILD.gn
+++ b/chromium/components/security_interstitials/content/BUILD.gn
@@ -10,6 +10,8 @@ static_library("security_interstitial_page") {
"security_interstitial_controller_client.h",
"security_interstitial_page.cc",
"security_interstitial_page.h",
+ "security_interstitial_tab_helper.cc",
+ "security_interstitial_tab_helper.h",
"unsafe_resource.cc",
"unsafe_resource.h",
"urls.cc",
@@ -33,3 +35,23 @@ static_library("security_interstitial_page") {
"//content/public/common",
]
}
+
+source_set("unit_tests") {
+ testonly = true
+ sources = [
+ "security_interstitial_tab_helper_unittest.cc",
+ ]
+
+ deps = [
+ ":security_interstitial_page",
+ "//base",
+ "//base/test:test_support",
+ "//components/security_interstitials/core:core",
+ "//content/public/browser",
+ "//content/public/common",
+ "//content/test:test_support",
+ "//net:",
+ "//net:test_support",
+ "//testing/gtest",
+ ]
+}
diff --git a/chromium/components/security_interstitials/content/DEPS b/chromium/components/security_interstitials/content/DEPS
index 3cd103b13b9..84d5909b858 100644
--- a/chromium/components/security_interstitials/content/DEPS
+++ b/chromium/components/security_interstitials/content/DEPS
@@ -6,4 +6,7 @@ include_rules = [
"+components/security_interstitials/core",
"+content/public/browser",
"+content/public/common",
+ "+content/public/test",
+ "+net",
+ "+net/test",
]
diff --git a/chromium/components/security_interstitials/content/security_interstitial_tab_helper.cc b/chromium/components/security_interstitials/content/security_interstitial_tab_helper.cc
new file mode 100644
index 00000000000..bf942f1c953
--- /dev/null
+++ b/chromium/components/security_interstitials/content/security_interstitial_tab_helper.cc
@@ -0,0 +1,160 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/security_interstitials/content/security_interstitial_tab_helper.h"
+#include "base/strings/string_number_conversions.h"
+#include "components/security_interstitials/content/security_interstitial_page.h"
+#include "components/security_interstitials/core/controller_client.h"
+#include "content/public/browser/navigation_handle.h"
+
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(
+ security_interstitials::SecurityInterstitialTabHelper);
+
+namespace security_interstitials {
+
+SecurityInterstitialTabHelper::~SecurityInterstitialTabHelper() {}
+
+void SecurityInterstitialTabHelper::DidFinishNavigation(
+ content::NavigationHandle* navigation_handle) {
+ if (navigation_handle->IsSameDocument()) {
+ return;
+ }
+
+ auto it = blocking_pages_for_navigations_.find(
+ navigation_handle->GetNavigationId());
+
+ if (navigation_handle->HasCommitted()) {
+ if (blocking_page_for_currently_committed_navigation_) {
+ blocking_page_for_currently_committed_navigation_
+ ->OnInterstitialClosing();
+ }
+
+ if (it == blocking_pages_for_navigations_.end()) {
+ blocking_page_for_currently_committed_navigation_.reset();
+ } else {
+ blocking_page_for_currently_committed_navigation_ = std::move(it->second);
+ }
+ }
+
+ if (it != blocking_pages_for_navigations_.end()) {
+ blocking_pages_for_navigations_.erase(it);
+ }
+}
+
+void SecurityInterstitialTabHelper::WebContentsDestroyed() {
+ if (blocking_page_for_currently_committed_navigation_) {
+ blocking_page_for_currently_committed_navigation_->OnInterstitialClosing();
+ }
+}
+
+// static
+void SecurityInterstitialTabHelper::AssociateBlockingPage(
+ content::WebContents* web_contents,
+ int64_t navigation_id,
+ std::unique_ptr<security_interstitials::SecurityInterstitialPage>
+ blocking_page) {
+ // CreateForWebContents() creates a tab helper if it doesn't exist for
+ // |web_contents| yet.
+ SecurityInterstitialTabHelper::CreateForWebContents(web_contents);
+
+ SecurityInterstitialTabHelper* helper =
+ SecurityInterstitialTabHelper::FromWebContents(web_contents);
+ helper->SetBlockingPage(navigation_id, std::move(blocking_page));
+}
+
+security_interstitials::SecurityInterstitialPage*
+SecurityInterstitialTabHelper::
+ GetBlockingPageForCurrentlyCommittedNavigationForTesting() {
+ return blocking_page_for_currently_committed_navigation_.get();
+}
+
+SecurityInterstitialTabHelper::SecurityInterstitialTabHelper(
+ content::WebContents* web_contents)
+ : WebContentsObserver(web_contents), binding_(web_contents, this) {}
+
+void SecurityInterstitialTabHelper::SetBlockingPage(
+ int64_t navigation_id,
+ std::unique_ptr<security_interstitials::SecurityInterstitialPage>
+ blocking_page) {
+ blocking_pages_for_navigations_[navigation_id] = std::move(blocking_page);
+}
+
+void SecurityInterstitialTabHelper::HandleCommand(
+ security_interstitials::SecurityInterstitialCommand cmd) {
+ if (blocking_page_for_currently_committed_navigation_) {
+ // Currently commands need to be converted to strings before passing them
+ // to CommandReceived, which then turns them into integers again, this
+ // redundant conversion will be removed once commited interstitials are the
+ // only supported codepath.
+ blocking_page_for_currently_committed_navigation_->CommandReceived(
+ base::NumberToString(cmd));
+ }
+}
+
+void SecurityInterstitialTabHelper::DontProceed() {
+ HandleCommand(
+ security_interstitials::SecurityInterstitialCommand::CMD_DONT_PROCEED);
+}
+
+void SecurityInterstitialTabHelper::Proceed() {
+ HandleCommand(
+ security_interstitials::SecurityInterstitialCommand::CMD_PROCEED);
+}
+
+void SecurityInterstitialTabHelper::ShowMoreSection() {
+ HandleCommand(security_interstitials::SecurityInterstitialCommand::
+ CMD_SHOW_MORE_SECTION);
+}
+
+void SecurityInterstitialTabHelper::OpenHelpCenter() {
+ HandleCommand(security_interstitials::SecurityInterstitialCommand::
+ CMD_OPEN_HELP_CENTER);
+}
+
+void SecurityInterstitialTabHelper::OpenDiagnostic() {
+ // SSL error pages do not implement this.
+ NOTREACHED();
+}
+
+void SecurityInterstitialTabHelper::Reload() {
+ HandleCommand(
+ security_interstitials::SecurityInterstitialCommand::CMD_RELOAD);
+}
+
+void SecurityInterstitialTabHelper::OpenDateSettings() {
+ HandleCommand(security_interstitials::SecurityInterstitialCommand::
+ CMD_OPEN_DATE_SETTINGS);
+}
+
+void SecurityInterstitialTabHelper::OpenLogin() {
+ HandleCommand(
+ security_interstitials::SecurityInterstitialCommand::CMD_OPEN_LOGIN);
+}
+
+void SecurityInterstitialTabHelper::DoReport() {
+ HandleCommand(
+ security_interstitials::SecurityInterstitialCommand::CMD_DO_REPORT);
+}
+
+void SecurityInterstitialTabHelper::DontReport() {
+ HandleCommand(
+ security_interstitials::SecurityInterstitialCommand::CMD_DONT_REPORT);
+}
+
+void SecurityInterstitialTabHelper::OpenReportingPrivacy() {
+ HandleCommand(security_interstitials::SecurityInterstitialCommand::
+ CMD_OPEN_REPORTING_PRIVACY);
+}
+
+void SecurityInterstitialTabHelper::OpenWhitepaper() {
+ HandleCommand(
+ security_interstitials::SecurityInterstitialCommand::CMD_OPEN_WHITEPAPER);
+}
+
+void SecurityInterstitialTabHelper::ReportPhishingError() {
+ // SSL error pages do not implement this.
+ NOTREACHED();
+}
+
+} // namespace security_interstitials
diff --git a/chromium/components/security_interstitials/content/security_interstitial_tab_helper.h b/chromium/components/security_interstitials/content/security_interstitial_tab_helper.h
new file mode 100644
index 00000000000..bd13124dc38
--- /dev/null
+++ b/chromium/components/security_interstitials/content/security_interstitial_tab_helper.h
@@ -0,0 +1,97 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_SECURITY_INTERSTITIALS_CONTENT_SECURITY_INTERSTITIAL_TAB_HELPER_H_
+#define COMPONENTS_SECURITY_INTERSTITIALS_CONTENT_SECURITY_INTERSTITIAL_TAB_HELPER_H_
+
+#include <map>
+
+#include "components/security_interstitials/core/common/interfaces/interstitial_commands.mojom.h"
+#include "components/security_interstitials/core/controller_client.h"
+#include "content/public/browser/web_contents_binding_set.h"
+#include "content/public/browser/web_contents_observer.h"
+#include "content/public/browser/web_contents_user_data.h"
+
+namespace content {
+class NavigationHandle;
+class WebContents;
+} // namespace content
+
+namespace security_interstitials {
+class SecurityInterstitialPage;
+
+// Long-lived helper associated with a WebContents, for owning blocking pages.
+class SecurityInterstitialTabHelper
+ : public content::WebContentsObserver,
+ public content::WebContentsUserData<SecurityInterstitialTabHelper>,
+ public security_interstitials::mojom::InterstitialCommands {
+ public:
+ ~SecurityInterstitialTabHelper() override;
+
+ // WebContentsObserver:
+ void DidFinishNavigation(
+ content::NavigationHandle* navigation_handle) override;
+ void WebContentsDestroyed() override;
+
+ // Associates |blocking_page| with an SecurityInterstitialTabHelper for the
+ // given |web_contents| and |navigation_id|, to manage the |blocking_page|'s
+ // lifetime.
+ static void AssociateBlockingPage(
+ content::WebContents* web_contents,
+ int64_t navigation_id,
+ std::unique_ptr<security_interstitials::SecurityInterstitialPage>
+ blocking_page);
+
+ security_interstitials::SecurityInterstitialPage*
+ GetBlockingPageForCurrentlyCommittedNavigationForTesting();
+
+ private:
+ explicit SecurityInterstitialTabHelper(content::WebContents* web_contents);
+ friend class content::WebContentsUserData<SecurityInterstitialTabHelper>;
+
+ void SetBlockingPage(
+ int64_t navigation_id,
+ std::unique_ptr<security_interstitials::SecurityInterstitialPage>
+ blocking_page);
+
+ void HandleCommand(security_interstitials::SecurityInterstitialCommand cmd);
+
+ // security_interstitials::mojom::InterstitialCommands::
+ void DontProceed() override;
+ void Proceed() override;
+ void ShowMoreSection() override;
+ void OpenHelpCenter() override;
+ void OpenDiagnostic() override;
+ void Reload() override;
+ void OpenDateSettings() override;
+ void OpenLogin() override;
+ void DoReport() override;
+ void DontReport() override;
+ void OpenReportingPrivacy() override;
+ void OpenWhitepaper() override;
+ void ReportPhishingError() override;
+
+ // Keeps track of blocking pages for navigations that have encountered
+ // certificate errors in this WebContents. When a navigation commits, the
+ // corresponding blocking page is moved out and stored in
+ // |blocking_page_for_currently_committed_navigation_|.
+ std::map<int64_t,
+ std::unique_ptr<security_interstitials::SecurityInterstitialPage>>
+ blocking_pages_for_navigations_;
+ // Keeps track of the blocking page for the current committed navigation, if
+ // there is one. The value is replaced (if the new committed navigation has a
+ // blocking page) or reset on every committed navigation.
+ std::unique_ptr<security_interstitials::SecurityInterstitialPage>
+ blocking_page_for_currently_committed_navigation_;
+
+ content::WebContentsFrameBindingSet<
+ security_interstitials::mojom::InterstitialCommands>
+ binding_;
+
+ DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialTabHelper);
+};
+
+} // namespace security_interstitials
+
+#endif // COMPONENTS_SECURITY_INTERSTITIALS_CONTENT_SECURITY_INTERSTITIAL_TAB_HELPER_H_
diff --git a/chromium/components/security_interstitials/content/security_interstitial_tab_helper_unittest.cc b/chromium/components/security_interstitials/content/security_interstitial_tab_helper_unittest.cc
new file mode 100644
index 00000000000..1725aa04376
--- /dev/null
+++ b/chromium/components/security_interstitials/content/security_interstitial_tab_helper_unittest.cc
@@ -0,0 +1,210 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/security_interstitials/content/security_interstitial_tab_helper.h"
+
+#include <memory>
+
+#include "base/bind.h"
+#include "base/i18n/rtl.h"
+#include "base/time/time.h"
+#include "components/security_interstitials/content/security_interstitial_controller_client.h"
+#include "components/security_interstitials/content/security_interstitial_page.h"
+#include "components/security_interstitials/core/controller_client.h"
+#include "components/security_interstitials/core/metrics_helper.h"
+#include "content/public/browser/certificate_request_result_type.h"
+#include "content/public/browser/navigation_handle.h"
+#include "content/public/common/browser_side_navigation_policy.h"
+#include "content/public/test/test_renderer_host.h"
+#include "net/base/net_errors.h"
+#include "net/test/cert_test_util.h"
+#include "net/test/test_data_directory.h"
+#include "url/gurl.h"
+
+namespace security_interstitials {
+
+const char kTestSslMetricsName[] = "test_blocking_page";
+
+std::unique_ptr<security_interstitials::MetricsHelper> CreateTestMetricsHelper(
+ content::WebContents* web_contents) {
+ MetricsHelper::ReportDetails report_details;
+ report_details.metric_prefix = kTestSslMetricsName;
+ return std::make_unique<security_interstitials::MetricsHelper>(
+ GURL(), report_details, nullptr);
+}
+
+class TestInterstitialPage : public SecurityInterstitialPage {
+ public:
+ // |*destroyed_tracker| is set to true in the destructor.
+ TestInterstitialPage(content::WebContents* web_contents,
+ const GURL& request_url,
+ bool* destroyed_tracker)
+ : SecurityInterstitialPage(
+ web_contents,
+ request_url,
+ std::make_unique<SecurityInterstitialControllerClient>(
+ web_contents,
+ CreateTestMetricsHelper(web_contents),
+ nullptr,
+ base::i18n::GetConfiguredLocale(),
+ GURL())),
+ destroyed_tracker_(destroyed_tracker) {}
+
+ ~TestInterstitialPage() override { *destroyed_tracker_ = true; }
+
+ void OnInterstitialClosing() override {}
+
+ protected:
+ bool ShouldCreateNewNavigation() const override { return false; }
+
+ void PopulateInterstitialStrings(
+ base::DictionaryValue* load_time_data) override {}
+
+ private:
+ bool* destroyed_tracker_;
+};
+
+class SecurityInterstitialTabHelperTest
+ : public content::RenderViewHostTestHarness {
+ protected:
+ std::unique_ptr<content::NavigationHandle> CreateHandle(
+ bool committed,
+ bool is_same_document) {
+ return content::NavigationHandle::CreateNavigationHandleForTesting(
+ GURL(), main_rfh(), committed, net::OK, is_same_document);
+ }
+
+ // The lifetime of the blocking page is managed by the
+ // SecurityInterstitialTabHelper for the test's web_contents.
+ // |destroyed_tracker| will be set to true when the corresponding blocking
+ // page is destroyed.
+ void CreateAssociatedBlockingPage(content::NavigationHandle* handle,
+ bool* destroyed_tracker) {
+ SecurityInterstitialTabHelper::AssociateBlockingPage(
+ web_contents(), handle->GetNavigationId(),
+ std::make_unique<TestInterstitialPage>(web_contents(), GURL(),
+ destroyed_tracker));
+ }
+};
+
+// Tests that the helper properly handles the lifetime of a single blocking
+// page, interleaved with other navigations.
+TEST_F(SecurityInterstitialTabHelperTest, SingleBlockingPage) {
+ std::unique_ptr<content::NavigationHandle> blocking_page_handle =
+ CreateHandle(true, false);
+ bool blocking_page_destroyed = false;
+ CreateAssociatedBlockingPage(blocking_page_handle.get(),
+ &blocking_page_destroyed);
+ SecurityInterstitialTabHelper* helper =
+ SecurityInterstitialTabHelper::FromWebContents(web_contents());
+
+ // Test that a same-document navigation doesn't destroy the blocking page if
+ // its navigation hasn't committed yet.
+ std::unique_ptr<content::NavigationHandle> same_document_handle =
+ CreateHandle(true, true);
+ helper->DidFinishNavigation(same_document_handle.get());
+ EXPECT_FALSE(blocking_page_destroyed);
+
+ // Test that a committed (non-same-document) navigation doesn't destroy the
+ // blocking page if its navigation hasn't committed yet.
+ std::unique_ptr<content::NavigationHandle> committed_handle1 =
+ CreateHandle(true, false);
+ helper->DidFinishNavigation(committed_handle1.get());
+ EXPECT_FALSE(blocking_page_destroyed);
+
+ // Simulate comitting the interstitial.
+ helper->DidFinishNavigation(blocking_page_handle.get());
+ EXPECT_FALSE(blocking_page_destroyed);
+
+ // Test that a subsequent committed navigation releases the blocking page
+ // stored for the currently committed navigation.
+ std::unique_ptr<content::NavigationHandle> committed_handle2 =
+ CreateHandle(true, false);
+ helper->DidFinishNavigation(committed_handle2.get());
+ EXPECT_TRUE(blocking_page_destroyed);
+}
+
+// Tests that the helper properly handles the lifetime of multiple blocking
+// pages, committed in a different order than they are created.
+TEST_F(SecurityInterstitialTabHelperTest, MultipleBlockingPages) {
+ // Simulate associating the first interstitial.
+ std::unique_ptr<content::NavigationHandle> handle1 =
+ CreateHandle(true, false);
+ bool blocking_page1_destroyed = false;
+ CreateAssociatedBlockingPage(handle1.get(), &blocking_page1_destroyed);
+
+ // We can directly retrieve the helper for testing once
+ // CreateAssociatedBlockingPage() was called.
+ SecurityInterstitialTabHelper* helper =
+ SecurityInterstitialTabHelper::FromWebContents(web_contents());
+
+ // Simulate commiting the first interstitial.
+ helper->DidFinishNavigation(handle1.get());
+ EXPECT_FALSE(blocking_page1_destroyed);
+
+ // Associate the second interstitial.
+ std::unique_ptr<content::NavigationHandle> handle2 =
+ CreateHandle(true, false);
+ bool blocking_page2_destroyed = false;
+ CreateAssociatedBlockingPage(handle2.get(), &blocking_page2_destroyed);
+ EXPECT_FALSE(blocking_page1_destroyed);
+ EXPECT_FALSE(blocking_page2_destroyed);
+
+ // Associate the third interstitial.
+ std::unique_ptr<content::NavigationHandle> handle3 =
+ CreateHandle(true, false);
+ bool blocking_page3_destroyed = false;
+ CreateAssociatedBlockingPage(handle3.get(), &blocking_page3_destroyed);
+ EXPECT_FALSE(blocking_page1_destroyed);
+ EXPECT_FALSE(blocking_page2_destroyed);
+ EXPECT_FALSE(blocking_page3_destroyed);
+
+ // Simulate commiting the third interstitial.
+ helper->DidFinishNavigation(handle3.get());
+ EXPECT_TRUE(blocking_page1_destroyed);
+ EXPECT_FALSE(blocking_page2_destroyed);
+ EXPECT_FALSE(blocking_page3_destroyed);
+
+ // Simulate commiting the second interstitial.
+ helper->DidFinishNavigation(handle2.get());
+ EXPECT_TRUE(blocking_page1_destroyed);
+ EXPECT_FALSE(blocking_page2_destroyed);
+ EXPECT_TRUE(blocking_page3_destroyed);
+}
+
+// Tests that the helper properly handles a navigation that finishes without
+// committing.
+TEST_F(SecurityInterstitialTabHelperTest, NavigationDoesNotCommit) {
+ std::unique_ptr<content::NavigationHandle> committed_handle =
+ CreateHandle(true, false);
+ bool committed_blocking_page_destroyed = false;
+ CreateAssociatedBlockingPage(committed_handle.get(),
+ &committed_blocking_page_destroyed);
+ SecurityInterstitialTabHelper* helper =
+ SecurityInterstitialTabHelper::FromWebContents(web_contents());
+ helper->DidFinishNavigation(committed_handle.get());
+ EXPECT_FALSE(committed_blocking_page_destroyed);
+
+ // Simulate a navigation that does not commit.
+ std::unique_ptr<content::NavigationHandle> non_committed_handle =
+ CreateHandle(false, false);
+ bool non_committed_blocking_page_destroyed = false;
+ CreateAssociatedBlockingPage(non_committed_handle.get(),
+ &non_committed_blocking_page_destroyed);
+ helper->DidFinishNavigation(non_committed_handle.get());
+
+ // The blocking page for the non-committed navigation should have been cleaned
+ // up, but the one for the previous committed navigation should still be
+ // around.
+ EXPECT_TRUE(non_committed_blocking_page_destroyed);
+ EXPECT_FALSE(committed_blocking_page_destroyed);
+
+ // When a navigation does commit, the previous one should be cleaned up.
+ std::unique_ptr<content::NavigationHandle> next_committed_handle =
+ CreateHandle(true, false);
+ helper->DidFinishNavigation(next_committed_handle.get());
+ EXPECT_TRUE(committed_blocking_page_destroyed);
+}
+
+} // namespace security_interstitials
diff --git a/chromium/components/security_interstitials/core/browser/resources/interstitial_large.html b/chromium/components/security_interstitials/core/browser/resources/interstitial_large.html
index e60f2253ea5..cdb7392a5e7 100644
--- a/chromium/components/security_interstitials/core/browser/resources/interstitial_large.html
+++ b/chromium/components/security_interstitials/core/browser/resources/interstitial_large.html
@@ -2,6 +2,7 @@
<html dir="$i18n{textdirection}" lang="$i18n{language}">
<head>
<meta charset="utf-8">
+ <meta name="theme-color" content="#fff">
<meta name="viewport"
content="initial-scale=1, minimum-scale=1, width=device-width">
<title>$i18n{tabTitle}</title>
@@ -31,6 +32,9 @@
<div id="error-debugging-info" class="hidden"></div>
</div>
</div>
+ <div id="recurrent-error-message">
+ $i18nRaw{recurrentErrorParagraph}
+ </div>
<div id="extended-reporting-opt-in" class="hidden">
<label>
<div class="checkboxes">
diff --git a/chromium/components/security_interstitials/core/browser/resources/interstitial_large.js b/chromium/components/security_interstitials/core/browser/resources/interstitial_large.js
index 0fa7dbf5ecf..d57ec6945a3 100644
--- a/chromium/components/security_interstitials/core/browser/resources/interstitial_large.js
+++ b/chromium/components/security_interstitials/core/browser/resources/interstitial_large.js
@@ -69,6 +69,8 @@ function setupEvents() {
var captivePortal = interstitialType == 'CAPTIVE_PORTAL';
var badClock = ssl && loadTimeData.getBoolean('bad_clock');
var hidePrimaryButton = loadTimeData.getBoolean('hide_primary_button');
+ var showRecurrentErrorParagraph = loadTimeData.getBoolean(
+ 'show_recurrent_error_paragraph');
if (ssl) {
$('body').classList.add(badClock ? 'bad-clock' : 'ssl');
@@ -78,6 +80,9 @@ function setupEvents() {
$('body').classList.add('captive-portal');
} else {
$('body').classList.add('safe-browsing');
+ // Override the default theme color.
+ document.querySelector('meta[name=theme-color]').setAttribute('content',
+ 'rgb(206, 52, 38)');
}
$('icon').classList.add('icon');
@@ -123,6 +128,12 @@ function setupEvents() {
$('proceed-link').classList.add('small-link');
}
+ if (!ssl || !showRecurrentErrorParagraph) {
+ $('recurrent-error-message').classList.add(HIDDEN_CLASS);
+ } else {
+ $('body').classList.add('showing-recurrent-error-message');
+ }
+
if ($('diagnostic-link')) {
$('diagnostic-link').addEventListener('click', function(event) {
sendCommand(SecurityInterstitialCommandId.CMD_OPEN_DIAGNOSTIC);
diff --git a/chromium/components/security_interstitials/core/browser/resources/interstitial_webview_quiet.css b/chromium/components/security_interstitials/core/browser/resources/interstitial_webview_quiet.css
index fe9ff5de784..a25aa8a8480 100644
--- a/chromium/components/security_interstitials/core/browser/resources/interstitial_webview_quiet.css
+++ b/chromium/components/security_interstitials/core/browser/resources/interstitial_webview_quiet.css
@@ -3,6 +3,7 @@
* found in the LICENSE file. */
body {
+ background-color: rgb(247, 247, 247);
margin: 0;
}
diff --git a/chromium/components/security_interstitials/core/common/resources/interstitial_common.css b/chromium/components/security_interstitials/core/common/resources/interstitial_common.css
index bb1ca4f6502..51a5b7102f2 100644
--- a/chromium/components/security_interstitials/core/common/resources/interstitial_common.css
+++ b/chromium/components/security_interstitials/core/common/resources/interstitial_common.css
@@ -188,6 +188,18 @@ input[type=checkbox]:checked ~ .checkbox::before {
opacity: 1;
}
+#recurrent-error-message {
+ background: #ededed;
+ border-radius: 4px;
+ padding: 12px 16px;
+ margin-top: 12px;
+ margin-bottom: 16px;
+}
+
+.showing-recurrent-error-message #extended-reporting-opt-in {
+ margin-top: 16px;
+}
+
@media (max-width: 700px) {
.interstitial-wrapper {
padding: 0 10%;
@@ -268,9 +280,9 @@ input[type=checkbox]:checked ~ .checkbox::before {
(min-width: 421px) and (min-height: 240px) and
(max-height: 560px) {
body .nav-wrapper {
- background: #f7f7f7;
+ background: #fff;
bottom: 0;
- box-shadow: 0 -22px 40px rgb(247, 247, 247);
+ box-shadow: 0 -22px 40px #fff;
left: 0;
margin: 0 auto;
max-width: 736px;
diff --git a/chromium/components/security_interstitials/core/common/resources/interstitial_core.css b/chromium/components/security_interstitials/core/common/resources/interstitial_core.css
index 5ec9a2ba1fb..925722e2bac 100644
--- a/chromium/components/security_interstitials/core/common/resources/interstitial_core.css
+++ b/chromium/components/security_interstitials/core/common/resources/interstitial_core.css
@@ -7,7 +7,7 @@ a {
}
body {
- background-color: rgb(247, 247, 247);
+ background-color: #fff;
color: rgb(100, 100, 100);
word-wrap: break-word;
}
diff --git a/chromium/components/security_interstitials/core/common_string_util.cc b/chromium/components/security_interstitials/core/common_string_util.cc
index 6c36f648cb2..bf218065dfc 100644
--- a/chromium/components/security_interstitials/core/common_string_util.cc
+++ b/chromium/components/security_interstitials/core/common_string_util.cc
@@ -31,6 +31,10 @@ void PopulateSSLLayoutStrings(int cert_error,
"openDetails", l10n_util::GetStringUTF16(IDS_SSL_OPEN_DETAILS_BUTTON));
load_time_data->SetString(
"closeDetails", l10n_util::GetStringUTF16(IDS_SSL_CLOSE_DETAILS_BUTTON));
+ // Not used by most interstitials; can be overridden by individual
+ // interstitials as needed.
+ load_time_data->SetString("recurrentErrorParagraph", "");
+ load_time_data->SetBoolean("show_recurrent_error_paragraph", false);
}
void PopulateSSLDebuggingStrings(const net::SSLInfo ssl_info,
diff --git a/chromium/components/security_interstitials/core/controller_client.cc b/chromium/components/security_interstitials/core/controller_client.cc
index 09fa690c303..e416177aec9 100644
--- a/chromium/components/security_interstitials/core/controller_client.cc
+++ b/chromium/components/security_interstitials/core/controller_client.cc
@@ -68,6 +68,10 @@ void ControllerClient::OpenURL(bool open_links_in_new_tab, const GURL& url) {
}
}
+bool ControllerClient::HasSeenRecurrentError() {
+ return false;
+}
+
GURL ControllerClient::GetBaseHelpCenterUrl() const {
return help_center_url_;
}
diff --git a/chromium/components/security_interstitials/core/controller_client.h b/chromium/components/security_interstitials/core/controller_client.h
index 25fdd9c10e7..603bd595aea 100644
--- a/chromium/components/security_interstitials/core/controller_client.h
+++ b/chromium/components/security_interstitials/core/controller_client.h
@@ -100,6 +100,10 @@ class ControllerClient {
virtual const std::string& GetApplicationLocale() const = 0;
+ // Returns true if the error page should display a message to account for the
+ // fact that the user has seen the same error multiple times.
+ virtual bool HasSeenRecurrentError();
+
GURL GetBaseHelpCenterUrl() const;
void SetBaseHelpCenterUrlForTesting(const GURL& test_url);
diff --git a/chromium/components/security_interstitials/core/safe_browsing_loud_error_ui.cc b/chromium/components/security_interstitials/core/safe_browsing_loud_error_ui.cc
index 4e40f5c59f9..06f0b5c6dde 100644
--- a/chromium/components/security_interstitials/core/safe_browsing_loud_error_ui.cc
+++ b/chromium/components/security_interstitials/core/safe_browsing_loud_error_ui.cc
@@ -105,6 +105,10 @@ void SafeBrowsingLoudErrorUI::PopulateStringsForHtml(
break;
}
+ // Not used by this interstitial.
+ load_time_data->SetString("recurrentErrorParagraph", base::string16());
+ load_time_data->SetBoolean("show_recurrent_error_paragraph", false);
+
PopulateExtendedReportingOption(load_time_data);
}
diff --git a/chromium/components/security_interstitials/core/safe_browsing_quiet_error_ui.cc b/chromium/components/security_interstitials/core/safe_browsing_quiet_error_ui.cc
index 5953562cc05..65ad7085104 100644
--- a/chromium/components/security_interstitials/core/safe_browsing_quiet_error_ui.cc
+++ b/chromium/components/security_interstitials/core/safe_browsing_quiet_error_ui.cc
@@ -81,6 +81,10 @@ void SafeBrowsingQuietErrorUI::PopulateStringsForHtml(
} else {
NOTREACHED();
}
+
+ // Not used by this interstitial.
+ load_time_data->SetString("recurrentErrorParagraph", base::string16());
+ load_time_data->SetBoolean("show_recurrent_error_paragraph", false);
}
void SafeBrowsingQuietErrorUI::SetGiantWebViewForTesting(
diff --git a/chromium/components/security_interstitials/core/ssl_error_ui.cc b/chromium/components/security_interstitials/core/ssl_error_ui.cc
index 3f9165c904d..23bdac6ef74 100644
--- a/chromium/components/security_interstitials/core/ssl_error_ui.cc
+++ b/chromium/components/security_interstitials/core/ssl_error_ui.cc
@@ -47,8 +47,7 @@ SSLErrorUI::SSLErrorUI(const GURL& request_url,
controller_->metrics_helper()->RecordUserInteraction(
MetricsHelper::TOTAL_VISITS);
ssl_errors::RecordUMAStatistics(soft_override_enabled_, time_triggered_,
- request_url, cert_error_,
- *ssl_info_.cert.get());
+ request_url, cert_error_, *ssl_info_.cert);
}
SSLErrorUI::~SSLErrorUI() {
@@ -81,6 +80,11 @@ void SSLErrorUI::PopulateStringsForHTML(base::DictionaryValue* load_time_data) {
l10n_util::GetStringFUTF16(
IDS_SSL_V2_PRIMARY_PARAGRAPH,
common_string_util::GetFormattedHostName(request_url_)));
+ load_time_data->SetString(
+ "recurrentErrorParagraph",
+ l10n_util::GetStringUTF16(IDS_SSL_V2_RECURRENT_ERROR_PARAGRAPH));
+ load_time_data->SetBoolean("show_recurrent_error_paragraph",
+ controller_->HasSeenRecurrentError());
if (soft_override_enabled_)
PopulateOverridableStrings(load_time_data);
diff --git a/chromium/components/security_interstitials/core/superfish_error_ui.cc b/chromium/components/security_interstitials/core/superfish_error_ui.cc
index 912f36acbcf..1389bcc3f38 100644
--- a/chromium/components/security_interstitials/core/superfish_error_ui.cc
+++ b/chromium/components/security_interstitials/core/superfish_error_ui.cc
@@ -59,6 +59,8 @@ void SuperfishErrorUI::PopulateStringsForHTML(
load_time_data->SetString("finalParagraph", std::string());
load_time_data->SetString("openDetails", base::string16());
load_time_data->SetString("closeDetails", base::string16());
+ load_time_data->SetString("recurrentErrorParagraph", base::string16());
+ load_time_data->SetBoolean("show_recurrent_error_paragraph", false);
}
void SuperfishErrorUI::HandleCommand(SecurityInterstitialCommand command) {