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

Side by Side Diff: chrome/browser/infobars/infobar_responder.h

Issue 1175443002: Revert of Convert the WebRtcTestBase to use infobar and bubble autoresponders (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/infobars/infobar_responder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_INFOBARS_INFOBAR_RESPONDER_H_ 5 #ifndef CHROME_BROWSER_INFOBARS_INFOBAR_RESPONDER_H_
6 #define CHROME_BROWSER_INFOBARS_INFOBAR_RESPONDER_H_ 6 #define CHROME_BROWSER_INFOBARS_INFOBAR_RESPONDER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "components/infobars/core/infobar_manager.h" 9 #include "components/infobars/core/infobar_manager.h"
10 10
11 namespace infobars { 11 namespace infobars {
12 class InfoBar; 12 class InfoBar;
13 } 13 }
14 14
15 class ConfirmInfoBarDelegate; 15 class ConfirmInfoBarDelegate;
16 class InfoBarService; 16 class InfoBarService;
17 17
18 // Used by test code to asynchronously respond to the first infobar shown, which 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 19 // must have a ConfirmInfoBarDelegate. This can be used to ensure various
20 // interaction flows work correctly. 20 // interaction flows work correctly.
21 // 21 //
22 // The asynchronous response matches how real users will use the infobar. 22 // The asynchronous response matches how real users will use the infobar.
23 class InfoBarResponder : public infobars::InfoBarManager::Observer { 23 class InfoBarResponder : public infobars::InfoBarManager::Observer {
24 public: 24 public:
25 enum AutoResponseType { 25 // If |should_accept| is true, the responder will asynchronously Accept() the
26 ACCEPT, 26 // infobar; otherwise it will Cancel() it.
27 DENY, 27 InfoBarResponder(InfoBarService* infobar_service, bool should_accept);
28 DISMISS
29 };
30
31 // The responder will asynchronously perform the requested |response|.
32 InfoBarResponder(InfoBarService* infobar_service, AutoResponseType response);
33 ~InfoBarResponder() override; 28 ~InfoBarResponder() override;
34 29
35 // infobars::InfoBarManager::Observer: 30 // infobars::InfoBarManager::Observer:
36 void OnInfoBarAdded(infobars::InfoBar* infobar) override; 31 void OnInfoBarAdded(infobars::InfoBar* infobar) override;
37 void OnInfoBarReplaced(infobars::InfoBar* old_infobar,
38 infobars::InfoBar* new_infobar) override;
39 32
40 private: 33 private:
41 void Respond(ConfirmInfoBarDelegate* delegate); 34 void Respond(ConfirmInfoBarDelegate* delegate);
42 35
43 InfoBarService* infobar_service_; 36 InfoBarService* infobar_service_;
44 AutoResponseType response_; 37 bool should_accept_;
45 38
46 DISALLOW_COPY_AND_ASSIGN(InfoBarResponder); 39 DISALLOW_COPY_AND_ASSIGN(InfoBarResponder);
47 }; 40 };
48 41
49 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_RESPONDER_H_ 42 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_RESPONDER_H_
OLDNEW
« 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