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 #include "components/infobars/core/infobar_manager.h" |
11 | 12 |
12 namespace infobars { | 13 namespace infobars { |
13 class InfoBar; | 14 class InfoBar; |
| 15 class InfoBarManager; |
14 } | 16 } |
15 | 17 |
16 // An interface derived from InfoBarDelegate implemented by objects wishing to | 18 // An interface derived from InfoBarDelegate implemented by objects wishing to |
17 // control a ConfirmInfoBar. | 19 // control a ConfirmInfoBar. |
18 class ConfirmInfoBarDelegate : public infobars::InfoBarDelegate { | 20 class ConfirmInfoBarDelegate : public infobars::InfoBarDelegate { |
19 public: | 21 public: |
20 enum InfoBarButton { | 22 enum InfoBarButton { |
21 BUTTON_NONE = 0, | 23 BUTTON_NONE = 0, |
22 BUTTON_OK = 1 << 0, | 24 BUTTON_OK = 1 << 0, |
23 BUTTON_CANCEL = 1 << 1, | 25 BUTTON_CANCEL = 1 << 1, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // Called when the Link (if any) is clicked. The |disposition| specifies how | 61 // Called when the Link (if any) is clicked. The |disposition| specifies how |
60 // the resulting document should be loaded (based on the event flags present | 62 // the resulting document should be loaded (based on the event flags present |
61 // when the link was clicked). If this function returns true, the infobar is | 63 // when the link was clicked). If this function returns true, the infobar is |
62 // then immediately closed. Subclasses MUST NOT return true if in handling | 64 // then immediately closed. Subclasses MUST NOT return true if in handling |
63 // this call something triggers the infobar to begin closing. | 65 // this call something triggers the infobar to begin closing. |
64 virtual bool LinkClicked(WindowOpenDisposition disposition); | 66 virtual bool LinkClicked(WindowOpenDisposition disposition); |
65 | 67 |
66 protected: | 68 protected: |
67 ConfirmInfoBarDelegate(); | 69 ConfirmInfoBarDelegate(); |
68 | 70 |
69 // Returns a confirm infobar that owns |delegate|. | |
70 static scoped_ptr<infobars::InfoBar> CreateInfoBar( | |
71 scoped_ptr<ConfirmInfoBarDelegate> delegate); | |
72 | |
73 bool ShouldExpireInternal(const NavigationDetails& details) const override; | 71 bool ShouldExpireInternal(const NavigationDetails& details) const override; |
74 | 72 |
75 private: | 73 private: |
76 // InfoBarDelegate: | 74 // InfoBarDelegate: |
77 bool EqualsDelegate(infobars::InfoBarDelegate* delegate) const override; | 75 bool EqualsDelegate(infobars::InfoBarDelegate* delegate) const override; |
78 ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate() override; | 76 ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate() override; |
79 | 77 |
80 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBarDelegate); | 78 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBarDelegate); |
81 }; | 79 }; |
82 | 80 |
83 #endif // COMPONENTS_INFOBARS_CORE_CONFIRM_INFOBAR_DELEGATE_H_ | 81 #endif // COMPONENTS_INFOBARS_CORE_CONFIRM_INFOBAR_DELEGATE_H_ |
OLD | NEW |