OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_TAB_CONTENTS_LINK_INFOBAR_DELEGATE_H_ | |
6 #define CHROME_BROWSER_TAB_CONTENTS_LINK_INFOBAR_DELEGATE_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/compiler_specific.h" | |
10 #include "base/string16.h" | |
11 #include "chrome/browser/infobars/infobar_delegate.h" | |
12 | |
13 class InfoBarTabHelper; | |
14 | |
15 // An interface derived from InfoBarDelegate implemented by objects wishing to | |
16 // control a LinkInfoBar. | |
17 class LinkInfoBarDelegate : public InfoBarDelegate { | |
18 public: | |
19 // Returns the message string to be displayed in the InfoBar. |link_offset| | |
20 // is the position where the link should be inserted. | |
21 virtual string16 GetMessageTextWithOffset(size_t* link_offset) const = 0; | |
22 | |
23 // Returns the text of the link to be displayed. | |
24 virtual string16 GetLinkText() const = 0; | |
25 | |
26 // Called when the Link is clicked. The |disposition| specifies how the | |
27 // resulting document should be loaded (based on the event flags present when | |
28 // the link was clicked). If this function returns true, the infobar is then | |
29 // immediately closed. Subclasses MUST NOT return true if in handling this | |
30 // call something triggers the infobar to begin closing. | |
31 virtual bool LinkClicked(WindowOpenDisposition disposition); | |
32 | |
33 protected: | |
34 explicit LinkInfoBarDelegate(InfoBarTabHelper* infobar_helper); | |
35 virtual ~LinkInfoBarDelegate(); | |
36 | |
37 private: | |
38 // InfoBarDelegate: | |
39 virtual InfoBar* CreateInfoBar(InfoBarTabHelper* infobar_helper) OVERRIDE; | |
40 virtual LinkInfoBarDelegate* AsLinkInfoBarDelegate() OVERRIDE; | |
41 | |
42 DISALLOW_COPY_AND_ASSIGN(LinkInfoBarDelegate); | |
43 }; | |
44 | |
45 #endif // CHROME_BROWSER_TAB_CONTENTS_LINK_INFOBAR_DELEGATE_H_ | |
OLD | NEW |