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_INFOBARS_CONFIRM_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_INFOBARS_CONFIRM_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_INFOBARS_CONFIRM_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_INFOBARS_CONFIRM_INFOBAR_DELEGATE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/compiler_specific.h" | |
10 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
11 #include "chrome/browser/infobars/infobar_delegate.h" | 10 #include "chrome/browser/infobars/infobar_delegate.h" |
12 | 11 |
| 12 class InfoBar; |
| 13 |
13 // An interface derived from InfoBarDelegate implemented by objects wishing to | 14 // An interface derived from InfoBarDelegate implemented by objects wishing to |
14 // control a ConfirmInfoBar. | 15 // control a ConfirmInfoBar. |
15 class ConfirmInfoBarDelegate : public InfoBarDelegate { | 16 class ConfirmInfoBarDelegate : public InfoBarDelegate { |
16 public: | 17 public: |
17 enum InfoBarButton { | 18 enum InfoBarButton { |
18 BUTTON_NONE = 0, | 19 BUTTON_NONE = 0, |
19 BUTTON_OK = 1 << 0, | 20 BUTTON_OK = 1 << 0, |
20 BUTTON_CANCEL = 1 << 1, | 21 BUTTON_CANCEL = 1 << 1, |
21 }; | 22 }; |
22 | 23 |
(...skipping 30 matching lines...) Expand all Loading... |
53 virtual string16 GetLinkText() const; | 54 virtual string16 GetLinkText() const; |
54 | 55 |
55 // Called when the Link (if any) is clicked. The |disposition| specifies how | 56 // Called when the Link (if any) is clicked. The |disposition| specifies how |
56 // the resulting document should be loaded (based on the event flags present | 57 // the resulting document should be loaded (based on the event flags present |
57 // when the link was clicked). If this function returns true, the infobar is | 58 // when the link was clicked). If this function returns true, the infobar is |
58 // then immediately closed. Subclasses MUST NOT return true if in handling | 59 // then immediately closed. Subclasses MUST NOT return true if in handling |
59 // this call something triggers the infobar to begin closing. | 60 // this call something triggers the infobar to begin closing. |
60 virtual bool LinkClicked(WindowOpenDisposition disposition); | 61 virtual bool LinkClicked(WindowOpenDisposition disposition); |
61 | 62 |
62 protected: | 63 protected: |
63 explicit ConfirmInfoBarDelegate(InfoBarService* infobar_service); | 64 ConfirmInfoBarDelegate(); |
| 65 |
| 66 // Returns a confirm infobar that owns |delegate|. |
| 67 static scoped_ptr<InfoBar> CreateInfoBar( |
| 68 scoped_ptr<ConfirmInfoBarDelegate> delegate); |
64 | 69 |
65 virtual bool ShouldExpireInternal( | 70 virtual bool ShouldExpireInternal( |
66 const content::LoadCommittedDetails& details) const OVERRIDE; | 71 const content::LoadCommittedDetails& details) const OVERRIDE; |
67 | 72 |
68 private: | 73 private: |
69 // InfoBarDelegate: | 74 // InfoBarDelegate: |
70 virtual InfoBar* CreateInfoBar(InfoBarService* owner) OVERRIDE; | |
71 virtual bool EqualsDelegate(InfoBarDelegate* delegate) const OVERRIDE; | 75 virtual bool EqualsDelegate(InfoBarDelegate* delegate) const OVERRIDE; |
72 virtual ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate() OVERRIDE; | 76 virtual ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate() OVERRIDE; |
73 | 77 |
74 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBarDelegate); | 78 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBarDelegate); |
75 }; | 79 }; |
76 | 80 |
77 #endif // CHROME_BROWSER_INFOBARS_CONFIRM_INFOBAR_DELEGATE_H_ | 81 #endif // CHROME_BROWSER_INFOBARS_CONFIRM_INFOBAR_DELEGATE_H_ |
OLD | NEW |