OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_API_INFOBARS_CONFIRM_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_API_INFOBARS_CONFIRM_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_API_INFOBARS_CONFIRM_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_API_INFOBARS_CONFIRM_INFOBAR_DELEGATE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
11 #include "chrome/browser/api/infobars/infobar_delegate.h" | 11 #include "chrome/browser/api/infobars/infobar_delegate.h" |
12 | 12 |
13 // An interface derived from InfoBarDelegate implemented by objects wishing to | 13 // An interface derived from InfoBarDelegate implemented by objects wishing to |
14 // control a ConfirmInfoBar. | 14 // control a ConfirmInfoBar. |
15 class ConfirmInfoBarDelegate : public InfoBarDelegate { | 15 class ConfirmInfoBarDelegate : public InfoBarDelegate { |
16 public: | 16 public: |
17 enum InfoBarButton { | 17 enum InfoBarButton { |
18 BUTTON_NONE = 0, | 18 BUTTON_NONE = 0, |
19 BUTTON_OK = 1 << 0, | 19 BUTTON_OK = 1 << 0, |
20 BUTTON_CANCEL = 1 << 1, | 20 BUTTON_CANCEL = 1 << 1, |
21 }; | 21 }; |
22 | 22 |
| 23 virtual ~ConfirmInfoBarDelegate(); |
| 24 |
23 // Returns the InfoBar type to be displayed for the InfoBar. | 25 // Returns the InfoBar type to be displayed for the InfoBar. |
24 virtual InfoBarAutomationType GetInfoBarAutomationType() const OVERRIDE; | 26 virtual InfoBarAutomationType GetInfoBarAutomationType() const OVERRIDE; |
25 | 27 |
26 // Returns the message string to be displayed for the InfoBar. | 28 // Returns the message string to be displayed for the InfoBar. |
27 virtual string16 GetMessageText() const = 0; | 29 virtual string16 GetMessageText() const = 0; |
28 | 30 |
29 // Return the buttons to be shown for this InfoBar. | 31 // Return the buttons to be shown for this InfoBar. |
30 virtual int GetButtons() const; | 32 virtual int GetButtons() const; |
31 | 33 |
32 // Return the label for the specified button. The default implementation | 34 // Return the label for the specified button. The default implementation |
(...skipping 19 matching lines...) Expand all Loading... |
52 | 54 |
53 // Called when the Link (if any) is clicked. The |disposition| specifies how | 55 // Called when the Link (if any) is clicked. The |disposition| specifies how |
54 // the resulting document should be loaded (based on the event flags present | 56 // the resulting document should be loaded (based on the event flags present |
55 // when the link was clicked). If this function returns true, the infobar is | 57 // when the link was clicked). If this function returns true, the infobar is |
56 // then immediately closed. Subclasses MUST NOT return true if in handling | 58 // then immediately closed. Subclasses MUST NOT return true if in handling |
57 // this call something triggers the infobar to begin closing. | 59 // this call something triggers the infobar to begin closing. |
58 virtual bool LinkClicked(WindowOpenDisposition disposition); | 60 virtual bool LinkClicked(WindowOpenDisposition disposition); |
59 | 61 |
60 protected: | 62 protected: |
61 explicit ConfirmInfoBarDelegate(InfoBarService* infobar_service); | 63 explicit ConfirmInfoBarDelegate(InfoBarService* infobar_service); |
62 virtual ~ConfirmInfoBarDelegate(); | |
63 | 64 |
64 virtual bool ShouldExpireInternal( | 65 virtual bool ShouldExpireInternal( |
65 const content::LoadCommittedDetails& details) const OVERRIDE; | 66 const content::LoadCommittedDetails& details) const OVERRIDE; |
66 | 67 |
67 private: | 68 private: |
68 // InfoBarDelegate: | 69 // InfoBarDelegate: |
69 virtual InfoBar* CreateInfoBar(InfoBarService* owner) OVERRIDE; | 70 virtual InfoBar* CreateInfoBar(InfoBarService* owner) OVERRIDE; |
70 virtual bool EqualsDelegate(InfoBarDelegate* delegate) const OVERRIDE; | 71 virtual bool EqualsDelegate(InfoBarDelegate* delegate) const OVERRIDE; |
71 virtual ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate() OVERRIDE; | 72 virtual ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate() OVERRIDE; |
72 | 73 |
73 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBarDelegate); | 74 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBarDelegate); |
74 }; | 75 }; |
75 | 76 |
76 #endif // CHROME_BROWSER_API_INFOBARS_CONFIRM_INFOBAR_DELEGATE_H_ | 77 #endif // CHROME_BROWSER_API_INFOBARS_CONFIRM_INFOBAR_DELEGATE_H_ |
OLD | NEW |