Remove flash deprecation infobar code

Since Flash is deprecated we dont need the warning prompts about Flash deprecation anymore.

Bug: 1134202
Change-Id: I52ba1a8bb6c87c280ede20ad2d7178da25a755c7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2536643
Reviewed-by: Ravjit Singh Uppal <ravjit@chromium.org>
Reviewed-by: Tommy Li <tommycli@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Ravjit Singh Uppal <ravjit@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827941}
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 29897cee..5dd7dd41 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -8107,9 +8107,6 @@
       <message name="IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT" desc="Infobar message to notify that we couldn't load a plugin">
         Could not load <ph name="PLUGIN_NAME">$1<ex>Flash</ex></ph>
       </message>
-      <message name="IDS_PLUGIN_FLASH_DEPRECATION_PROMPT" desc="Infobar message to notify users that Flash player will be deprecated soon.">
-        Flash Player will no longer be supported after December 2020.
-      </message>
 
       <!-- External Protocol Dialog -->
       <message name="IDS_EXTERNAL_PROTOCOL_TITLE" desc="External Protocol Dialog Title">
diff --git a/chrome/app/generated_resources_grd/IDS_PLUGIN_FLASH_DEPRECATION_PROMPT.png.sha1 b/chrome/app/generated_resources_grd/IDS_PLUGIN_FLASH_DEPRECATION_PROMPT.png.sha1
deleted file mode 100644
index 8ac4ff54..0000000
--- a/chrome/app/generated_resources_grd/IDS_PLUGIN_FLASH_DEPRECATION_PROMPT.png.sha1
+++ /dev/null
@@ -1 +0,0 @@
-e55f6342b985914d4c45c276f49b24df5e58a83f
\ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 74be8a8..1476994 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -5911,8 +5911,6 @@
       "plugins/chrome_content_browser_client_plugins_part.h",
       "plugins/chrome_plugin_service_filter.cc",
       "plugins/chrome_plugin_service_filter.h",
-      "plugins/flash_deprecation_infobar_delegate.cc",
-      "plugins/flash_deprecation_infobar_delegate.h",
       "plugins/flash_permission_context.cc",
       "plugins/flash_permission_context.h",
       "plugins/flash_temporary_permission_tracker.cc",
diff --git a/chrome/browser/infobars/infobars_browsertest.cc b/chrome/browser/infobars/infobars_browsertest.cc
index 165d68f1..1b7573ae 100644
--- a/chrome/browser/infobars/infobars_browsertest.cc
+++ b/chrome/browser/infobars/infobars_browsertest.cc
@@ -22,7 +22,6 @@
 #include "chrome/browser/infobars/infobar_service.h"
 #include "chrome/browser/installable/installable_metrics.h"
 #include "chrome/browser/pepper_broker_infobar_delegate.h"
-#include "chrome/browser/plugins/flash_deprecation_infobar_delegate.h"
 #include "chrome/browser/plugins/hung_plugin_infobar_delegate.h"
 #include "chrome/browser/plugins/plugin_infobar_delegates.h"
 #include "chrome/browser/plugins/plugin_metadata.h"
@@ -206,7 +205,6 @@
       {"translate", IBD::TRANSLATE_INFOBAR_DELEGATE_NON_AURA},
       {"automation", IBD::AUTOMATION_INFOBAR_DELEGATE},
       {"previews_lite_page", IBD::LITE_PAGE_PREVIEWS_INFOBAR},
-      {"flash_deprecation", IBD::FLASH_DEPRECATION_INFOBAR_DELEGATE},
       {"tab_sharing", IBD::TAB_SHARING_INFOBAR_DELEGATE},
       {"rosetta_required", IBD::ROSETTA_REQUIRED_INFOBAR_DELEGATE},
   };
@@ -384,9 +382,6 @@
       PreviewsLitePageInfoBarDelegate::Create(GetWebContents());
       break;
 
-    case IBD::FLASH_DEPRECATION_INFOBAR_DELEGATE:
-      FlashDeprecationInfoBarDelegate::Create(GetInfoBarService(), nullptr);
-      break;
     case IBD::TAB_SHARING_INFOBAR_DELEGATE:
       TabSharingInfoBarDelegate::Create(
           GetInfoBarService(), base::ASCIIToUTF16("example.com"),
@@ -505,10 +500,6 @@
   ShowAndVerifyUi();
 }
 
-IN_PROC_BROWSER_TEST_F(InfoBarUiTest, InvokeUi_flash_deprecation) {
-  ShowAndVerifyUi();
-}
-
 IN_PROC_BROWSER_TEST_F(InfoBarUiTest, InvokeUi_tab_sharing) {
   ShowAndVerifyUi();
 }
diff --git a/chrome/browser/plugins/flash_deprecation_infobar_delegate.cc b/chrome/browser/plugins/flash_deprecation_infobar_delegate.cc
deleted file mode 100644
index 78dab2f5..0000000
--- a/chrome/browser/plugins/flash_deprecation_infobar_delegate.cc
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2019 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 "chrome/browser/plugins/flash_deprecation_infobar_delegate.h"
-
-#include "base/feature_list.h"
-#include "chrome/browser/infobars/infobar_service.h"
-#include "chrome/browser/plugins/plugin_utils.h"
-#include "chrome/common/chrome_features.h"
-#include "chrome/grit/generated_resources.h"
-#include "components/content_settings/core/browser/host_content_settings_map.h"
-#include "components/content_settings/core/common/content_settings.h"
-#include "components/content_settings/core/common/content_settings_types.h"
-#include "components/infobars/core/infobar.h"
-#include "components/strings/grit/components_strings.h"
-#include "components/vector_icons/vector_icons.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "url/gurl.h"
-#include "url/url_constants.h"
-
-// static
-void FlashDeprecationInfoBarDelegate::Create(
-    InfoBarService* infobar_service,
-    HostContentSettingsMap* host_content_settings_map) {
-  infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar(
-      std::make_unique<FlashDeprecationInfoBarDelegate>(
-          host_content_settings_map)));
-}
-
-// static
-bool FlashDeprecationInfoBarDelegate::ShouldDisplayFlashDeprecation(
-    HostContentSettingsMap* host_content_settings_map) {
-  DCHECK(host_content_settings_map);
-
-  if (!base::FeatureList::IsEnabled(features::kFlashDeprecationWarning))
-    return false;
-
-  bool is_managed = false;
-  ContentSetting flash_setting =
-      PluginUtils::UnsafeGetRawDefaultFlashContentSetting(
-          host_content_settings_map, &is_managed);
-
-  // If the user can't do anything about their browser's Flash behavior,
-  // there's no point to showing a Flash deprecation warning infobar.
-  if (is_managed)
-    return false;
-
-  // Display the infobar if the Flash setting is anything other than BLOCK.
-  return flash_setting != CONTENT_SETTING_BLOCK;
-}
-
-FlashDeprecationInfoBarDelegate::FlashDeprecationInfoBarDelegate(
-    HostContentSettingsMap* host_content_settings_map)
-    : host_content_settings_map_(host_content_settings_map) {}
-
-infobars::InfoBarDelegate::InfoBarIdentifier
-FlashDeprecationInfoBarDelegate::GetIdentifier() const {
-  return FLASH_DEPRECATION_INFOBAR_DELEGATE;
-}
-
-const gfx::VectorIcon& FlashDeprecationInfoBarDelegate::GetVectorIcon() const {
-  return vector_icons::kExtensionIcon;
-}
-
-base::string16 FlashDeprecationInfoBarDelegate::GetLinkText() const {
-  return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
-}
-
-GURL FlashDeprecationInfoBarDelegate::GetLinkURL() const {
-  return GURL(
-      "https://www.blog.google/products/chrome/saying-goodbye-flash-chrome/");
-}
-
-base::string16 FlashDeprecationInfoBarDelegate::GetMessageText() const {
-  return l10n_util::GetStringUTF16(IDS_PLUGIN_FLASH_DEPRECATION_PROMPT);
-}
-
-int FlashDeprecationInfoBarDelegate::GetButtons() const {
-  return BUTTON_OK;
-}
-
-base::string16 FlashDeprecationInfoBarDelegate::GetButtonLabel(
-    InfoBarButton button) const {
-  return l10n_util::GetStringUTF16(IDS_TURN_OFF);
-}
-
-bool FlashDeprecationInfoBarDelegate::Accept() {
-  // Can be nullptr in tests.
-  if (!host_content_settings_map_)
-    return true;
-
-  host_content_settings_map_->SetDefaultContentSetting(
-      ContentSettingsType::PLUGINS, CONTENT_SETTING_DEFAULT);
-  return true;
-}
diff --git a/chrome/browser/plugins/flash_deprecation_infobar_delegate.h b/chrome/browser/plugins/flash_deprecation_infobar_delegate.h
deleted file mode 100644
index 94862d7..0000000
--- a/chrome/browser/plugins/flash_deprecation_infobar_delegate.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2019 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 CHROME_BROWSER_PLUGINS_FLASH_DEPRECATION_INFOBAR_DELEGATE_H_
-#define CHROME_BROWSER_PLUGINS_FLASH_DEPRECATION_INFOBAR_DELEGATE_H_
-
-#include "base/time/time.h"
-#include "components/infobars/core/confirm_infobar_delegate.h"
-
-class HostContentSettingsMap;
-class InfoBarService;
-
-class FlashDeprecationInfoBarDelegate : public ConfirmInfoBarDelegate {
- public:
-  static void Create(InfoBarService* infobar_service,
-                     HostContentSettingsMap* host_content_settings_map);
-
-  // Returns true if we should display a deprecation warning for
-  // |host_content_settings_map|.
-  static bool ShouldDisplayFlashDeprecation(
-      HostContentSettingsMap* host_content_settings_map);
-
-  explicit FlashDeprecationInfoBarDelegate(
-      HostContentSettingsMap* host_content_settings_map);
-  ~FlashDeprecationInfoBarDelegate() override = default;
-
-  // ConfirmInfobarDelegate:
-  infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
-  const gfx::VectorIcon& GetVectorIcon() const override;
-  base::string16 GetLinkText() const override;
-  GURL GetLinkURL() const override;
-  base::string16 GetMessageText() const override;
-  int GetButtons() const override;
-  base::string16 GetButtonLabel(InfoBarButton button) const override;
-  bool Accept() override;
-
- private:
-  HostContentSettingsMap* const host_content_settings_map_;
-};
-
-#endif  // CHROME_BROWSER_PLUGINS_FLASH_DEPRECATION_INFOBAR_DELEGATE_H_
diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc
index 4faeac0..f1a9ede 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc
@@ -73,10 +73,6 @@
 #include "chrome/browser/win/conflicts/incompatible_applications_updater.h"
 #endif
 
-#if BUILDFLAG(ENABLE_PLUGINS)
-#include "chrome/browser/plugins/flash_deprecation_infobar_delegate.h"
-#endif
-
 #if BUILDFLAG(ENABLE_RLZ)
 #include "components/google/core/common/google_util.h"
 #include "components/rlz/rlz_tracker.h"  // nogncheck
@@ -612,15 +608,6 @@
     }
 #endif
 
-#if BUILDFLAG(ENABLE_PLUGINS)
-    auto* host_content_settings_map =
-        HostContentSettingsMapFactory::GetForProfile(profile_);
-    if (FlashDeprecationInfoBarDelegate::ShouldDisplayFlashDeprecation(
-            host_content_settings_map)) {
-      FlashDeprecationInfoBarDelegate::Create(infobar_service,
-                                              host_content_settings_map);
-    }
-#endif
   }
 }
 
diff --git a/components/infobars/core/infobar_delegate.h b/components/infobars/core/infobar_delegate.h
index 10c2fdc..d32451e39 100644
--- a/components/infobars/core/infobar_delegate.h
+++ b/components/infobars/core/infobar_delegate.h
@@ -158,7 +158,7 @@
     MODULE_INSTALL_FAILURE_INFOBAR_ANDROID = 88,
     INLINE_UPDATE_READY_INFOBAR_ANDROID = 89,
     INLINE_UPDATE_FAILED_INFOBAR_ANDROID = 90,
-    FLASH_DEPRECATION_INFOBAR_DELEGATE = 91,
+    // Removed: FLASH_DEPRECATION_INFOBAR_DELEGATE = 91,
     SEND_TAB_TO_SELF_INFOBAR_DELEGATE = 92,
     TAB_SHARING_INFOBAR_DELEGATE = 93,
     SAFETY_TIP_INFOBAR_DELEGATE = 94,
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml
index 3faef65..dc3f1c3d 100644
--- a/tools/metrics/histograms/enums.xml
+++ b/tools/metrics/histograms/enums.xml
@@ -37679,7 +37679,7 @@
   <int value="88" label="MODULE_INSTALL_FAILURE_INFOBAR_ANDROID"/>
   <int value="89" label="INLINE_UPDATE_READY_INFOBAR_ANDROID"/>
   <int value="90" label="INLINE_UPDATE_FAILED_INFOBAR_ANDROID"/>
-  <int value="91" label="FLASH_DEPRECATION_INFOBAR_DELEGATE"/>
+  <int value="91" label="FLASH_DEPRECATION_INFOBAR_DELEGATE (Obsolete)"/>
   <int value="92" label="SEND_TAB_TO_SELF_INFOBAR_DELEGATE"/>
   <int value="93" label="TAB_SHARING_INFOBAR_DELEGATE"/>
   <int value="94" label="SAFETY_TIP_INFOBAR_DELEGATE"/>