Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1950)

Unified Diff: chrome/browser/infobars/infobar_responder.h

Issue 1100953002: Move InfoBarResponder into its own file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/infobars/infobar_responder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/infobars/infobar_responder.h
diff --git a/chrome/browser/infobars/infobar_responder.h b/chrome/browser/infobars/infobar_responder.h
new file mode 100644
index 0000000000000000000000000000000000000000..266a2be9bcf6130cd6407186e5305643124ee16f
--- /dev/null
+++ b/chrome/browser/infobars/infobar_responder.h
@@ -0,0 +1,42 @@
+// Copyright 2015 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_INFOBAR_RESPONDER_H_
+#define CHROME_BROWSER_INFOBARS_INFOBAR_RESPONDER_H_
+
+#include "base/macros.h"
+#include "components/infobars/core/infobar_manager.h"
+
+namespace infobars {
+class InfoBar;
+}
+
+class ConfirmInfoBarDelegate;
+class InfoBarService;
+
+// Used by test code to asynchronously respond to the first infobar shown, which
+// must have a ConfirmInfoBarDelegate. This can be used to ensure various
+// interaction flows work correctly.
+//
+// The asynchronous response matches how real users will use the infobar.
+class InfoBarResponder : public infobars::InfoBarManager::Observer {
+ public:
+ // If |should_accept| is true, the responder will asynchronously Accept() the
+ // infobar; otherwise it will Cancel() it.
+ InfoBarResponder(InfoBarService* infobar_service, bool should_accept);
+ ~InfoBarResponder() override;
+
+ // infobars::InfoBarManager::Observer:
+ void OnInfoBarAdded(infobars::InfoBar* infobar) override;
+
+ private:
+ void Respond(ConfirmInfoBarDelegate* delegate);
+
+ InfoBarService* infobar_service_;
+ bool should_accept_;
+
+ DISALLOW_COPY_AND_ASSIGN(InfoBarResponder);
+};
+
+#endif // CHROME_BROWSER_INFOBARS_INFOBAR_RESPONDER_H_
« no previous file with comments | « no previous file | chrome/browser/infobars/infobar_responder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698