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 COMPONENTS_INFOBARS_CORE_CONFIRM_INFOBAR_DELEGATE_H_ | 5 #ifndef COMPONENTS_INFOBARS_CORE_CONFIRM_INFOBAR_DELEGATE_H_ |
6 #define COMPONENTS_INFOBARS_CORE_CONFIRM_INFOBAR_DELEGATE_H_ | 6 #define COMPONENTS_INFOBARS_CORE_CONFIRM_INFOBAR_DELEGATE_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "components/infobars/core/infobar_delegate.h" | 10 #include "components/infobars/core/infobar_delegate.h" |
11 | 11 |
12 namespace infobars { | 12 namespace infobars { |
13 class InfoBar; | 13 class InfoBar; |
14 } | 14 } |
15 | 15 |
16 // An interface derived from InfoBarDelegate implemented by objects wishing to | 16 // An interface derived from InfoBarDelegate implemented by objects wishing to |
17 // control a ConfirmInfoBar. | 17 // control a ConfirmInfoBar. |
18 class ConfirmInfoBarDelegate : public infobars::InfoBarDelegate { | 18 class ConfirmInfoBarDelegate : public infobars::InfoBarDelegate { |
19 public: | 19 public: |
20 enum InfoBarButton { | 20 enum InfoBarButton { |
21 BUTTON_NONE = 0, | 21 BUTTON_NONE = 0, |
22 BUTTON_OK = 1 << 0, | 22 BUTTON_OK = 1 << 0, |
23 BUTTON_CANCEL = 1 << 1, | 23 BUTTON_CANCEL = 1 << 1, |
24 }; | 24 }; |
25 | 25 |
26 virtual ~ConfirmInfoBarDelegate(); | 26 virtual ~ConfirmInfoBarDelegate(); |
27 | 27 |
28 // Returns the InfoBar type to be displayed for the InfoBar. | 28 // Returns the InfoBar type to be displayed for the InfoBar. |
29 virtual InfoBarAutomationType GetInfoBarAutomationType() const OVERRIDE; | 29 virtual InfoBarAutomationType GetInfoBarAutomationType() const override; |
30 | 30 |
31 // Returns the message string to be displayed for the InfoBar. | 31 // Returns the message string to be displayed for the InfoBar. |
32 virtual base::string16 GetMessageText() const = 0; | 32 virtual base::string16 GetMessageText() const = 0; |
33 | 33 |
34 // Returns the buttons to be shown for this InfoBar. | 34 // Returns the buttons to be shown for this InfoBar. |
35 virtual int GetButtons() const; | 35 virtual int GetButtons() const; |
36 | 36 |
37 // Returns the label for the specified button. The default implementation | 37 // Returns the label for the specified button. The default implementation |
38 // returns "OK" for the OK button and "Cancel" for the Cancel button. | 38 // returns "OK" for the OK button and "Cancel" for the Cancel button. |
39 virtual base::string16 GetButtonLabel(InfoBarButton button) const; | 39 virtual base::string16 GetButtonLabel(InfoBarButton button) const; |
(...skipping 24 matching lines...) Expand all Loading... |
64 virtual bool LinkClicked(WindowOpenDisposition disposition); | 64 virtual bool LinkClicked(WindowOpenDisposition disposition); |
65 | 65 |
66 protected: | 66 protected: |
67 ConfirmInfoBarDelegate(); | 67 ConfirmInfoBarDelegate(); |
68 | 68 |
69 // Returns a confirm infobar that owns |delegate|. | 69 // Returns a confirm infobar that owns |delegate|. |
70 static scoped_ptr<infobars::InfoBar> CreateInfoBar( | 70 static scoped_ptr<infobars::InfoBar> CreateInfoBar( |
71 scoped_ptr<ConfirmInfoBarDelegate> delegate); | 71 scoped_ptr<ConfirmInfoBarDelegate> delegate); |
72 | 72 |
73 virtual bool ShouldExpireInternal( | 73 virtual bool ShouldExpireInternal( |
74 const NavigationDetails& details) const OVERRIDE; | 74 const NavigationDetails& details) const override; |
75 | 75 |
76 private: | 76 private: |
77 // InfoBarDelegate: | 77 // InfoBarDelegate: |
78 virtual bool EqualsDelegate( | 78 virtual bool EqualsDelegate( |
79 infobars::InfoBarDelegate* delegate) const OVERRIDE; | 79 infobars::InfoBarDelegate* delegate) const override; |
80 virtual ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate() OVERRIDE; | 80 virtual ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate() override; |
81 | 81 |
82 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBarDelegate); | 82 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBarDelegate); |
83 }; | 83 }; |
84 | 84 |
85 #endif // COMPONENTS_INFOBARS_CORE_CONFIRM_INFOBAR_DELEGATE_H_ | 85 #endif // COMPONENTS_INFOBARS_CORE_CONFIRM_INFOBAR_DELEGATE_H_ |
OLD | NEW |