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