OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_TAB_CONTENTS_LINK_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_LINK_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_TAB_CONTENTS_LINK_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_LINK_INFOBAR_DELEGATE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "chrome/browser/tab_contents/infobar_delegate.h" | 12 #include "chrome/browser/tab_contents/infobar_delegate.h" |
13 | 13 |
14 class TabContents; | 14 class TabContents; |
| 15 class TabContentsWrapper; |
15 | 16 |
16 // An interface derived from InfoBarDelegate implemented by objects wishing to | 17 // An interface derived from InfoBarDelegate implemented by objects wishing to |
17 // control a LinkInfoBar. | 18 // control a LinkInfoBar. |
18 class LinkInfoBarDelegate : public InfoBarDelegate { | 19 class LinkInfoBarDelegate : public InfoBarDelegate { |
19 public: | 20 public: |
20 // Returns the message string to be displayed in the InfoBar. |link_offset| | 21 // Returns the message string to be displayed in the InfoBar. |link_offset| |
21 // is the position where the link should be inserted. | 22 // is the position where the link should be inserted. |
22 virtual string16 GetMessageTextWithOffset(size_t* link_offset) const = 0; | 23 virtual string16 GetMessageTextWithOffset(size_t* link_offset) const = 0; |
23 | 24 |
24 // Returns the text of the link to be displayed. | 25 // Returns the text of the link to be displayed. |
25 virtual string16 GetLinkText() const = 0; | 26 virtual string16 GetLinkText() const = 0; |
26 | 27 |
27 // Called when the Link is clicked. The |disposition| specifies how the | 28 // Called when the Link is clicked. The |disposition| specifies how the |
28 // resulting document should be loaded (based on the event flags present when | 29 // resulting document should be loaded (based on the event flags present when |
29 // the link was clicked). This function returns true if the InfoBar should be | 30 // the link was clicked). This function returns true if the InfoBar should be |
30 // closed now or false if it should remain until the user explicitly closes | 31 // closed now or false if it should remain until the user explicitly closes |
31 // it. | 32 // it. |
32 virtual bool LinkClicked(WindowOpenDisposition disposition); | 33 virtual bool LinkClicked(WindowOpenDisposition disposition); |
33 | 34 |
34 protected: | 35 protected: |
35 explicit LinkInfoBarDelegate(TabContents* contents); | 36 explicit LinkInfoBarDelegate(TabContents* contents); |
36 virtual ~LinkInfoBarDelegate(); | 37 virtual ~LinkInfoBarDelegate(); |
37 | 38 |
38 private: | 39 private: |
39 // InfoBarDelegate: | 40 // InfoBarDelegate: |
40 virtual InfoBar* CreateInfoBar() OVERRIDE; | 41 virtual InfoBar* CreateInfoBar(TabContentsWrapper* owner) OVERRIDE; |
41 virtual LinkInfoBarDelegate* AsLinkInfoBarDelegate() OVERRIDE; | 42 virtual LinkInfoBarDelegate* AsLinkInfoBarDelegate() OVERRIDE; |
42 | 43 |
43 DISALLOW_COPY_AND_ASSIGN(LinkInfoBarDelegate); | 44 DISALLOW_COPY_AND_ASSIGN(LinkInfoBarDelegate); |
44 }; | 45 }; |
45 | 46 |
46 #endif // CHROME_BROWSER_TAB_CONTENTS_LINK_INFOBAR_DELEGATE_H_ | 47 #endif // CHROME_BROWSER_TAB_CONTENTS_LINK_INFOBAR_DELEGATE_H_ |
OLD | NEW |