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 #include "components/infobars/core/infobar_manager.h" |
| 12 #include "url/gurl.h" |
12 | 13 |
13 namespace infobars { | 14 namespace infobars { |
14 class InfoBar; | 15 class InfoBar; |
15 class InfoBarManager; | 16 class InfoBarManager; |
16 } | 17 } |
17 | 18 |
18 // An interface derived from InfoBarDelegate implemented by objects wishing to | 19 // An interface derived from InfoBarDelegate implemented by objects wishing to |
19 // control a ConfirmInfoBar. | 20 // control a ConfirmInfoBar. |
20 class ConfirmInfoBarDelegate : public infobars::InfoBarDelegate { | 21 class ConfirmInfoBarDelegate : public infobars::InfoBarDelegate { |
21 public: | 22 public: |
(...skipping 26 matching lines...) Expand all Loading... |
48 // infobar is then immediately closed. Subclasses MUST NOT return true if in | 49 // infobar is then immediately closed. Subclasses MUST NOT return true if in |
49 // handling this call something triggers the infobar to begin closing. | 50 // handling this call something triggers the infobar to begin closing. |
50 virtual bool Accept(); | 51 virtual bool Accept(); |
51 | 52 |
52 // Called when the Cancel button is pressed. If this function returns true, | 53 // Called when the Cancel button is pressed. If this function returns true, |
53 // the infobar is then immediately closed. Subclasses MUST NOT return true if | 54 // the infobar is then immediately closed. Subclasses MUST NOT return true if |
54 // in handling this call something triggers the infobar to begin closing. | 55 // in handling this call something triggers the infobar to begin closing. |
55 virtual bool Cancel(); | 56 virtual bool Cancel(); |
56 | 57 |
57 // Returns the text of the link to be displayed, if any. Otherwise returns | 58 // Returns the text of the link to be displayed, if any. Otherwise returns |
58 // and empty string. | 59 // an empty string. |
59 virtual base::string16 GetLinkText() const; | 60 virtual base::string16 GetLinkText() const; |
60 | 61 |
61 // Called when the Link (if any) is clicked. The |disposition| specifies how | 62 // Returns the URL of the link to be displayed. |
62 // the resulting document should be loaded (based on the event flags present | 63 virtual GURL GetLinkURL() const; |
63 // when the link was clicked). If this function returns true, the infobar is | 64 |
64 // then immediately closed. Subclasses MUST NOT return true if in handling | 65 // Called when the link (if any) is clicked; if this function returns true, |
65 // this call something triggers the infobar to begin closing. | 66 // the infobar is then immediately closed. The default implementation opens |
| 67 // the URL returned by GetLinkURL(), above, and returns false. Subclasses MUST |
| 68 // NOT return true if in handling this call something triggers the infobar to |
| 69 // begin closing. |
| 70 // |
| 71 // The |disposition| specifies how the resulting document should be loaded |
| 72 // (based on the event flags present when the link was clicked). |
66 virtual bool LinkClicked(WindowOpenDisposition disposition); | 73 virtual bool LinkClicked(WindowOpenDisposition disposition); |
67 | 74 |
68 protected: | 75 protected: |
69 ConfirmInfoBarDelegate(); | 76 ConfirmInfoBarDelegate(); |
70 | 77 |
71 private: | 78 private: |
72 // InfoBarDelegate: | 79 // InfoBarDelegate: |
73 bool EqualsDelegate(infobars::InfoBarDelegate* delegate) const override; | 80 bool EqualsDelegate(infobars::InfoBarDelegate* delegate) const override; |
74 ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate() override; | 81 ConfirmInfoBarDelegate* AsConfirmInfoBarDelegate() override; |
75 | 82 |
76 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBarDelegate); | 83 DISALLOW_COPY_AND_ASSIGN(ConfirmInfoBarDelegate); |
77 }; | 84 }; |
78 | 85 |
79 #endif // COMPONENTS_INFOBARS_CORE_CONFIRM_INFOBAR_DELEGATE_H_ | 86 #endif // COMPONENTS_INFOBARS_CORE_CONFIRM_INFOBAR_DELEGATE_H_ |
OLD | NEW |