OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_INFOBARS_INFOBAR_RESPONDER_H_ |
| 6 #define CHROME_BROWSER_INFOBARS_INFOBAR_RESPONDER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "components/infobars/core/infobar_manager.h" |
| 10 |
| 11 namespace infobars { |
| 12 class InfoBar; |
| 13 } |
| 14 |
| 15 class ConfirmInfoBarDelegate; |
| 16 class InfoBarService; |
| 17 |
| 18 // Used by test code to asynchronously respond to the first infobar shown, which |
| 19 // must have a ConfirmInfoBarDelegate. This can be used to ensure various |
| 20 // interaction flows work correctly. |
| 21 // |
| 22 // The asynchronous response matches how real users will use the infobar. |
| 23 class InfoBarResponder : public infobars::InfoBarManager::Observer { |
| 24 public: |
| 25 // If |should_accept| is true, the responder will asynchronously Accept() the |
| 26 // infobar; otherwise it will Cancel() it. |
| 27 InfoBarResponder(InfoBarService* infobar_service, bool should_accept); |
| 28 ~InfoBarResponder() override; |
| 29 |
| 30 // infobars::InfoBarManager::Observer: |
| 31 void OnInfoBarAdded(infobars::InfoBar* infobar) override; |
| 32 |
| 33 private: |
| 34 void Respond(ConfirmInfoBarDelegate* delegate); |
| 35 |
| 36 InfoBarService* infobar_service_; |
| 37 bool should_accept_; |
| 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(InfoBarResponder); |
| 40 }; |
| 41 |
| 42 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_RESPONDER_H_ |
OLD | NEW |