Commit ab93b409 authored by Carlos IL's avatar Carlos IL Committed by Commit Bot

Refactor SecurityInterstitialPageController into components

Android webview interstitials will require this code. Moving it into
components to avoid duplication.

Bug: 1016581
Change-Id: I79c9f7f274f6880a7ae102f5b747b79acb72835d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1872736Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Reviewed-by: default avatarEmily Stark <estark@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Reviewed-by: default avatarMatt Falkenhagen <falken@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Auto-Submit: Carlos IL <carlosil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709175}
parent abfeb013
......@@ -92,8 +92,6 @@ jumbo_static_library("renderer") {
"previews/resource_loading_hints_agent.h",
"sandbox_status_extension_android.cc",
"sandbox_status_extension_android.h",
"security_interstitials/security_interstitial_page_controller.cc",
"security_interstitials/security_interstitial_page_controller.h",
"subresource_redirect/subresource_redirect_experiments.cc",
"subresource_redirect/subresource_redirect_experiments.h",
"subresource_redirect/subresource_redirect_params.cc",
......@@ -153,6 +151,7 @@ jumbo_static_library("renderer") {
"//components/safe_browsing:buildflags",
"//components/safe_browsing/common:interfaces",
"//components/safe_browsing/renderer:throttles",
"//components/security_interstitials/content/renderer:security_interstitial_page_controller",
"//components/security_interstitials/core:",
"//components/security_interstitials/core/common/mojom:",
"//components/spellcheck:buildflags",
......
include_rules = [
"+components/error_page/renderer",
"+components/offline_pages/core",
"+components/security_interstitials/content/renderer",
"+components/security_interstitials/core",
"+components/security_interstitials/core/common/mojom",
"+gin",
......
......@@ -24,13 +24,13 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/render_messages.h"
#include "chrome/renderer/chrome_render_thread_observer.h"
#include "chrome/renderer/security_interstitials/security_interstitial_page_controller.h"
#include "components/error_page/common/error.h"
#include "components/error_page/common/error_page_params.h"
#include "components/error_page/common/localized_error.h"
#include "components/error_page/common/net_error_info.h"
#include "components/grit/components_resources.h"
#include "components/offline_pages/core/offline_page_feature.h"
#include "components/security_interstitials/content/renderer/security_interstitial_page_controller.h"
#include "components/security_interstitials/core/common/mojom/interstitial_commands.mojom.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_features.h"
......@@ -410,7 +410,7 @@ void NetErrorHelper::LoadErrorPage(const std::string& html,
}
void NetErrorHelper::EnablePageHelperFunctions() {
SecurityInterstitialPageController::Install(
security_interstitials::SecurityInterstitialPageController::Install(
render_frame(),
weak_security_interstitial_controller_delegate_factory_.GetWeakPtr());
NetErrorPageController::Install(
......
......@@ -17,9 +17,9 @@
#include "chrome/common/network_easter_egg.mojom.h"
#include "chrome/renderer/net/net_error_helper_core.h"
#include "chrome/renderer/net/net_error_page_controller.h"
#include "chrome/renderer/security_interstitials/security_interstitial_page_controller.h"
#include "components/error_page/common/localized_error.h"
#include "components/error_page/common/net_error_info.h"
#include "components/security_interstitials/content/renderer/security_interstitial_page_controller.h"
#include "components/security_interstitials/core/controller_client.h"
#include "content/public/renderer/render_frame_observer.h"
#include "content/public/renderer/render_frame_observer_tracker.h"
......@@ -51,7 +51,8 @@ class NetErrorHelper
public content::RenderThreadObserver,
public NetErrorHelperCore::Delegate,
public NetErrorPageController::Delegate,
public SecurityInterstitialPageController::Delegate,
public security_interstitials::SecurityInterstitialPageController::
Delegate,
public chrome::mojom::NetworkDiagnosticsClient,
public chrome::mojom::NavigationCorrector {
public:
......@@ -70,7 +71,8 @@ class NetErrorHelper
void UpdateEasterEggHighScore(int high_score) override;
void ResetEasterEggHighScore() override;
// SecurityInterstitialPageController::Delegate implementation
// security_interstitials::SecurityInterstitialPageController::Delegate
// implementation
void SendCommand(
security_interstitials::SecurityInterstitialCommand command) override;
......@@ -194,7 +196,8 @@ class NetErrorHelper
base::WeakPtrFactory<NetErrorPageController::Delegate>
weak_controller_delegate_factory_{this};
base::WeakPtrFactory<SecurityInterstitialPageController::Delegate>
base::WeakPtrFactory<
security_interstitials::SecurityInterstitialPageController::Delegate>
weak_security_interstitial_controller_delegate_factory_{this};
DISALLOW_COPY_AND_ASSIGN(NetErrorHelper);
......
carlosil@chromium.org
estark@chromium.org
meacer@chromium.org
# COMPONENT: UI>Browser>Interstitials
# TEAM: security-enamel@chromium.org
static_library("security_interstitial_page_controller") {
sources = [
"security_interstitial_page_controller.cc",
"security_interstitial_page_controller.h",
]
deps = [
"//base",
"//components/security_interstitials/core:",
"//content/public/renderer",
"//gin",
"//third_party/blink/public:blink_headers",
]
}
include_rules = [
"+base/memory",
"+components/security_interstitials/content",
"+components/security_interstitials/core",
"+content/public/renderer",
"+gin",
"+third_party/blink/public/web",
]
\ No newline at end of file
......@@ -2,15 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/renderer/security_interstitials/security_interstitial_page_controller.h"
#include "components/security_interstitials/content/renderer/security_interstitial_page_controller.h"
#include "components/security_interstitials/core/controller_client.h"
#include "content/public/renderer/render_frame.h"
#include "gin/converter.h"
#include "gin/handle.h"
#include "gin/object_template_builder.h"
#include "third_party/blink/public/web/blink.h"
#include "third_party/blink/public/web/web_local_frame.h"
namespace security_interstitials {
gin::WrapperInfo SecurityInterstitialPageController::kWrapperInfo = {
gin::kEmbedderNativeGin};
......@@ -146,3 +149,5 @@ SecurityInterstitialPageController::GetObjectTemplateBuilder(
.SetMethod("reportPhishingError",
&SecurityInterstitialPageController::ReportPhishingError);
}
} // namespace security_interstitials
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_RENDERER_SECURITY_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_CONTROLLER_H_
#define CHROME_RENDERER_SECURITY_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_CONTROLLER_H_
#ifndef COMPONENTS_SECURITY_INTERSTITIALS_CONTENT_RENDERER_SECURITY_INTERSTITIAL_PAGE_CONTROLLER_H_
#define COMPONENTS_SECURITY_INTERSTITIALS_CONTENT_RENDERER_SECURITY_INTERSTITIAL_PAGE_CONTROLLER_H_
#include "base/memory/weak_ptr.h"
#include "components/security_interstitials/core/controller_client.h"
......@@ -13,6 +13,8 @@ namespace content {
class RenderFrame;
}
namespace security_interstitials {
// This class makes various helper functions available to interstitials
// when committed interstitials are on. It is bound to the JavaScript
// window.certificateErrorPageController object.
......@@ -68,4 +70,6 @@ class SecurityInterstitialPageController
DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPageController);
};
#endif // CHROME_RENDERER_SECURITY_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_CONTROLLER_H_
} // namespace security_interstitials
#endif // COMPONENTS_SECURITY_INTERSTITIALS_CONTENT_RENDERER_SECURITY_INTERSTITIAL_PAGE_CONTROLLER_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment