ssl_security_state_tab_helper.patch 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: deepak1556 <[email protected]>
  3. Date: Thu, 20 Sep 2018 17:50:34 -0700
  4. Subject: ssl_security_state_tab_helper.patch
  5. Allows populating security tab info for devtools in Electron.
  6. diff --git a/chrome/browser/ssl/security_state_tab_helper.cc b/chrome/browser/ssl/security_state_tab_helper.cc
  7. index 02cfe5551f579c83b5e0d015566681704ce31e3f..779f33c17972f892e1086d1e65fb8071d7acb15f 100644
  8. --- a/chrome/browser/ssl/security_state_tab_helper.cc
  9. +++ b/chrome/browser/ssl/security_state_tab_helper.cc
  10. @@ -13,22 +13,26 @@
  11. #include "base/strings/pattern.h"
  12. #include "base/strings/string_util.h"
  13. #include "build/build_config.h"
  14. +#if 0
  15. #include "chrome/browser/browser_process.h"
  16. #include "chrome/browser/profiles/profile.h"
  17. #include "chrome/browser/reputation/reputation_web_contents_observer.h"
  18. #include "chrome/browser/safe_browsing/safe_browsing_service.h"
  19. #include "chrome/browser/safe_browsing/ui_manager.h"
  20. #include "chrome/browser/ssl/known_interception_disclosure_infobar_delegate.h"
  21. +#endif
  22. #include "chrome/browser/ssl/tls_deprecation_config.h"
  23. #include "chrome/common/chrome_features.h"
  24. #include "chrome/common/chrome_switches.h"
  25. #include "chrome/common/pref_names.h"
  26. #include "chrome/common/secure_origin_whitelist.h"
  27. +#if 0
  28. #include "components/omnibox/browser/omnibox_field_trial.h"
  29. #include "components/omnibox/common/omnibox_features.h"
  30. #include "components/password_manager/core/browser/password_manager_metrics_util.h"
  31. -#include "components/prefs/pref_service.h"
  32. #include "components/safe_browsing/buildflags.h"
  33. +#endif
  34. +#include "components/prefs/pref_service.h"
  35. #include "components/security_state/content/content_utils.h"
  36. #include "components/security_state/core/security_state_pref_names.h"
  37. #include "content/public/browser/browser_context.h"
  38. @@ -52,7 +56,7 @@
  39. #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h"
  40. #endif // defined(OS_CHROMEOS)
  41. -#if BUILDFLAG(FULL_SAFE_BROWSING)
  42. +#if 0
  43. #include "chrome/browser/safe_browsing/chrome_password_protection_service.h"
  44. #endif
  45. @@ -96,9 +100,12 @@ bool IsLegacyTLS(GURL url, int connection_status) {
  46. // default we treat TLS < 1.2 as Legacy, unless the "SSLVersionMin" policy is
  47. // set.
  48. std::string ssl_version_min_str = switches::kSSLVersionTLSv12;
  49. - PrefService* local_state = g_browser_process->local_state();
  50. - if (local_state && local_state->HasPrefPath(prefs::kSSLVersionMin)) {
  51. - ssl_version_min_str = local_state->GetString(prefs::kSSLVersionMin);
  52. +
  53. + // Read directly from the command line, since our pref store is not the same
  54. + // as Chrome's.
  55. + auto* cmd_line = base::CommandLine::ForCurrentProcess();
  56. + if (cmd_line->HasSwitch(::switches::kSSLVersionMin)) {
  57. + ssl_version_min_str = cmd_line->GetSwitchValueASCII(::switches::kSSLVersionMin);
  58. }
  59. // Convert the pref string to an SSLVersion, if it is valid. Otherwise use the
  60. @@ -118,8 +125,9 @@ bool IsLegacyTLS(GURL url, int connection_status) {
  61. } // namespace
  62. +#if 0
  63. using password_manager::metrics_util::PasswordType;
  64. -using safe_browsing::SafeBrowsingUIManager;
  65. +#endif
  66. SecurityStateTabHelper::SecurityStateTabHelper(
  67. content::WebContents* web_contents)
  68. @@ -162,6 +170,7 @@ SecurityStateTabHelper::GetVisibleSecurityState() {
  69. // information is still being initialized, thus no need to check for that.
  70. state->malicious_content_status = GetMaliciousContentStatus();
  71. +#if 0
  72. ReputationWebContentsObserver* reputation_web_contents_observer =
  73. ReputationWebContentsObserver::FromWebContents(web_contents());
  74. state->safety_tip_info =
  75. @@ -179,6 +188,7 @@ SecurityStateTabHelper::GetVisibleSecurityState() {
  76. security_state::prefs::kStricterMixedContentTreatmentEnabled)) {
  77. state->should_suppress_mixed_content_warning = true;
  78. }
  79. +#endif
  80. return state;
  81. }
  82. @@ -229,8 +239,10 @@ void SecurityStateTabHelper::DidFinishNavigation(
  83. UMA_HISTOGRAM_BOOLEAN("interstitial.ssl.visited_site_after_warning", true);
  84. }
  85. +#if 0
  86. MaybeShowKnownInterceptionDisclosureDialog(
  87. web_contents(), visible_security_state->cert_status);
  88. +#endif
  89. }
  90. void SecurityStateTabHelper::DidChangeVisibleSecurityState() {
  91. @@ -254,6 +266,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const {
  92. web_contents()->GetController().GetVisibleEntry();
  93. if (!entry)
  94. return security_state::MALICIOUS_CONTENT_STATUS_NONE;
  95. +#if 0
  96. safe_browsing::SafeBrowsingService* sb_service =
  97. g_browser_process->safe_browsing_service();
  98. if (!sb_service)
  99. @@ -336,6 +349,7 @@ SecurityStateTabHelper::GetMaliciousContentStatus() const {
  100. break;
  101. }
  102. }
  103. +#endif
  104. return security_state::MALICIOUS_CONTENT_STATUS_NONE;
  105. }