• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #pragma once
8 
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
11 #include "base/string16.h"
12 #include "chrome/browser/tab_contents/infobar_delegate.h"
13 
14 class TabContents;
15 
16 // An interface derived from InfoBarDelegate implemented by objects wishing to
17 // control a LinkInfoBar.
18 class LinkInfoBarDelegate : public InfoBarDelegate {
19  public:
20   // Returns the message string to be displayed in the InfoBar. |link_offset|
21   // is the position where the link should be inserted.
22   virtual string16 GetMessageTextWithOffset(size_t* link_offset) const = 0;
23 
24   // Returns the text of the link to be displayed.
25   virtual string16 GetLinkText() const = 0;
26 
27   // 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   // 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   // it.
32   virtual bool LinkClicked(WindowOpenDisposition disposition);
33 
34  protected:
35   explicit LinkInfoBarDelegate(TabContents* contents);
36   virtual ~LinkInfoBarDelegate();
37 
38  private:
39   // InfoBarDelegate:
40   virtual InfoBar* CreateInfoBar() OVERRIDE;
41   virtual LinkInfoBarDelegate* AsLinkInfoBarDelegate() OVERRIDE;
42 
43   DISALLOW_COPY_AND_ASSIGN(LinkInfoBarDelegate);
44 };
45 
46 #endif  // CHROME_BROWSER_TAB_CONTENTS_LINK_INFOBAR_DELEGATE_H_
47