[InfoBars] Eliminate InfoBarManager::CreateConfirmInfoBar()
This CL eliminates the last //components-level caller of
InfoBarManager::CreateConfirmInfoBar() and eliminates that method
existing at the //components level. The motivation is to enable removal
of the embedder-level subclasses of ContentInfoBarManager in followup
CLs.
Specifically, this method:
- Eliminates the static SimpleAlertInfoBarDelegate::Create() method in
favor of having that object be created directly in embedders as needed
- Eliminates InfoBarManager::CreateConfirmInfoBar(), which now has no
more //components-level callers
Bug: 1199686
Change-Id: Ia727a10120823695047de6a38ca18a17dd137a9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2831497
Commit-Queue: Colin Blundell <[email protected]>
Reviewed-by: Sylvain Defresne <[email protected]>
Reviewed-by: Evan Stade <[email protected]>
Cr-Commit-Position: refs/heads/master@{#876973}
diff --git a/chrome/browser/infobars/simple_alert_infobar_creator.h b/chrome/browser/infobars/simple_alert_infobar_creator.h
new file mode 100644
index 0000000..097c30b0
--- /dev/null
+++ b/chrome/browser/infobars/simple_alert_infobar_creator.h
@@ -0,0 +1,29 @@
+// Copyright 2021 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_INFOBARS_SIMPLE_ALERT_INFOBAR_CREATOR_H_
+#define CHROME_BROWSER_INFOBARS_SIMPLE_ALERT_INFOBAR_CREATOR_H_
+
+#include <string>
+
+#include "components/infobars/core/infobar_delegate.h"
+
+namespace gfx {
+struct VectorIcon;
+}
+
+class InfoBarService;
+
+// Creates a simple alert infobar and delegate and adds the infobar to
+// |infobar_manager|. If |vector_icon| is not null, it will be shown.
+// |infobar_identifier| names what class triggered the infobar for metrics.
+void CreateSimpleAlertInfoBar(
+ InfoBarService* infobar_service,
+ infobars::InfoBarDelegate::InfoBarIdentifier infobar_identifier,
+ const gfx::VectorIcon* vector_icon,
+ const std::u16string& message,
+ bool auto_expire = true,
+ bool should_animate = true);
+
+#endif // CHROME_BROWSER_INFOBARS_SIMPLE_ALERT_INFOBAR_CREATOR_H_