Browse Source

refactor: remove ssl_security_state_tab_helper.patch (#29196)

Jeremy Rose 3 years ago
parent
commit
dcbabcb23c

+ 1 - 0
BUILD.gn

@@ -335,6 +335,7 @@ source_set("electron_lib") {
     "//components/network_session_configurator/common",
     "//components/pref_registry",
     "//components/prefs",
+    "//components/security_state/content",
     "//components/upload_list",
     "//components/user_prefs",
     "//components/viz/host",

+ 0 - 3
chromium_src/BUILD.gn

@@ -43,8 +43,6 @@ static_library("chrome") {
     "//chrome/browser/predictors/proxy_lookup_client_impl.h",
     "//chrome/browser/predictors/resolve_host_client_impl.cc",
     "//chrome/browser/predictors/resolve_host_client_impl.h",
-    "//chrome/browser/ssl/security_state_tab_helper.cc",
-    "//chrome/browser/ssl/security_state_tab_helper.h",
     "//chrome/browser/ui/views/autofill/autofill_popup_view_utils.cc",
     "//chrome/browser/ui/views/autofill/autofill_popup_view_utils.h",
     "//extensions/browser/app_window/size_constraints.cc",
@@ -80,7 +78,6 @@ static_library("chrome") {
     "//components/keyed_service/content",
     "//components/paint_preview/buildflags",
     "//components/proxy_config",
-    "//components/security_state/content",
     "//content/public/browser",
     "//services/strings",
   ]

+ 0 - 1
patches/chromium/.patches

@@ -33,7 +33,6 @@ mas_disable_remote_accessibility.patch
 mas_disable_custom_window_frame.patch
 chrome_key_systems.patch
 add_didinstallconditionalfeatures.patch
-ssl_security_state_tab_helper.patch
 desktop_media_list.patch
 proxy_config_monitor.patch
 gritsettings_resource_ids.patch

+ 0 - 112
patches/chromium/ssl_security_state_tab_helper.patch

@@ -1,112 +0,0 @@
-From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
-From: deepak1556 <[email protected]>
-Date: Thu, 20 Sep 2018 17:50:34 -0700
-Subject: ssl_security_state_tab_helper.patch
-
-Allows populating security tab info for devtools in Electron.
-
-diff --git a/chrome/browser/ssl/security_state_tab_helper.cc b/chrome/browser/ssl/security_state_tab_helper.cc
-index 33d13d4f01cd333bd510e49d62944431df15417a..677239abeee39d1f6a2b8886597b989ec993bd1c 100644
---- a/chrome/browser/ssl/security_state_tab_helper.cc
-+++ b/chrome/browser/ssl/security_state_tab_helper.cc
-@@ -7,6 +7,7 @@
- #include <string>
- 
- #include "base/bind.h"
-+#include "base/command_line.h"
- #include "base/feature_list.h"
- #include "base/metrics/field_trial_params.h"
- #include "base/metrics/histogram_macros.h"
-@@ -14,24 +15,28 @@
- #include "base/strings/string_util.h"
- #include "build/build_config.h"
- #include "build/chromeos_buildflags.h"
-+#if 0
- #include "chrome/browser/browser_process.h"
- #include "chrome/browser/profiles/profile.h"
- #include "chrome/browser/reputation/reputation_web_contents_observer.h"
- #include "chrome/browser/safe_browsing/safe_browsing_service.h"
- #include "chrome/browser/safe_browsing/ui_manager.h"
- #include "chrome/browser/ssl/known_interception_disclosure_infobar_delegate.h"
-+#endif
- #include "chrome/common/chrome_features.h"
- #include "chrome/common/chrome_switches.h"
- #include "chrome/common/pref_names.h"
- #include "chrome/common/secure_origin_allowlist.h"
- #include "components/autofill/core/common/autofill_features.h"
-+#if 0
- #include "components/omnibox/browser/omnibox_field_trial.h"
- #include "components/omnibox/common/omnibox_features.h"
- #include "components/password_manager/core/browser/password_manager_metrics_util.h"
--#include "components/prefs/pref_service.h"
- #include "components/safe_browsing/buildflags.h"
- #include "components/security_interstitials/core/features.h"
- #include "components/security_interstitials/core/pref_names.h"
-+#endif
-+#include "components/prefs/pref_service.h"
- #include "components/security_state/content/content_utils.h"
- #include "content/public/browser/browser_context.h"
- #include "content/public/browser/navigation_entry.h"
-@@ -54,7 +59,7 @@
- #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h"
- #endif  // BUILDFLAG(IS_CHROMEOS_ASH)
- 
--#if BUILDFLAG(FULL_SAFE_BROWSING)
-+#if 0
- #include "chrome/browser/safe_browsing/chrome_password_protection_service.h"
- #endif
- 
-@@ -76,8 +81,9 @@ void RecordSecurityLevel(
- 
- }  // namespace
- 
-+#if 0
- using password_manager::metrics_util::PasswordType;
--using safe_browsing::SafeBrowsingUIManager;
-+#endif
- 
- SecurityStateTabHelper::SecurityStateTabHelper(
-     content::WebContents* web_contents)
-@@ -101,6 +107,7 @@ SecurityStateTabHelper::GetVisibleSecurityState() {
-   // information is still being initialized, thus no need to check for that.
-   state->malicious_content_status = GetMaliciousContentStatus();
- 
-+#if 0
-   ReputationWebContentsObserver* reputation_web_contents_observer =
-       ReputationWebContentsObserver::FromWebContents(web_contents());
-   state->safety_tip_info =
-@@ -125,6 +132,7 @@ SecurityStateTabHelper::GetVisibleSecurityState() {
-     }
-   }
- 
-+#endif
-   return state;
- }
- 
-@@ -184,8 +192,10 @@ void SecurityStateTabHelper::DidFinishNavigation(
-     UMA_HISTOGRAM_BOOLEAN("interstitial.ssl.visited_site_after_warning", true);
-   }
- 
-+#if 0
-   MaybeShowKnownInterceptionDisclosureDialog(
-       web_contents(), visible_security_state->cert_status);
-+#endif
- }
- 
- void SecurityStateTabHelper::DidChangeVisibleSecurityState() {
-@@ -209,6 +219,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const {
-       web_contents()->GetController().GetVisibleEntry();
-   if (!entry)
-     return security_state::MALICIOUS_CONTENT_STATUS_NONE;
-+#if 0
-   safe_browsing::SafeBrowsingService* sb_service =
-       g_browser_process->safe_browsing_service();
-   if (!sb_service)
-@@ -287,6 +298,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const {
-         break;
-     }
-   }
-+#endif
-   return security_state::MALICIOUS_CONTENT_STATUS_NONE;
- }
- 

+ 3 - 8
shell/browser/api/electron_api_web_contents.cc

@@ -27,7 +27,6 @@
 #include "base/threading/thread_task_runner_handle.h"
 #include "base/values.h"
 #include "chrome/browser/browser_process.h"
-#include "chrome/browser/ssl/security_state_tab_helper.h"
 #include "chrome/browser/ui/views/eye_dropper/eye_dropper.h"
 #include "chrome/common/pref_names.h"
 #include "components/prefs/pref_service.h"
@@ -833,7 +832,6 @@ void WebContents::InitWithSessionAndOptions(
   web_contents()->NotifyPreferencesChanged();
 
   WebContentsPermissionHelper::CreateForWebContents(web_contents());
-  SecurityStateTabHelper::CreateForWebContents(web_contents());
   InitZoomController(web_contents(), options);
 #if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
   extensions::ElectronExtensionWebContentsObserver::CreateForWebContents(
@@ -877,7 +875,6 @@ void WebContents::InitWithExtensionView(v8::Isolate* isolate,
   Observe(web_contents);
   InitWithWebContents(web_contents, GetBrowserContext(), IsGuest());
   inspectable_web_contents_->GetView()->SetDelegate(this);
-  SecurityStateTabHelper::CreateForWebContents(web_contents);
 }
 #endif
 
@@ -3237,11 +3234,9 @@ bool WebContents::IsFullscreenForTabOrPending(
 blink::SecurityStyle WebContents::GetSecurityStyle(
     content::WebContents* web_contents,
     content::SecurityStyleExplanations* security_style_explanations) {
-  SecurityStateTabHelper* helper =
-      SecurityStateTabHelper::FromWebContents(web_contents);
-  DCHECK(helper);
-  return security_state::GetSecurityStyle(helper->GetSecurityLevel(),
-                                          *helper->GetVisibleSecurityState(),
+  auto state = security_state::GetVisibleSecurityState(web_contents);
+  auto security_level = security_state::GetSecurityLevel(*state, false);
+  return security_state::GetSecurityStyle(security_level, *state,
                                           security_style_explanations);
 }