1 // Copyright 2012 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.
5 #ifndef CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/autocomplete/autocomplete_match.h"
10 #include "chrome/browser/infobars/infobar_delegate.h"
12 class AlternateNavInfoBarDelegate
: public InfoBarDelegate
{
14 virtual ~AlternateNavInfoBarDelegate();
16 // Creates an alternate nav infobar and delegate and adds the infobar to the
17 // infobar service for |web_contents|.
18 static void Create(content::WebContents
* web_contents
,
19 const base::string16
& text
,
20 const AutocompleteMatch
& match
,
21 const GURL
& search_url
);
23 base::string16
GetMessageTextWithOffset(size_t* link_offset
) const;
24 base::string16
GetLinkText() const;
25 bool LinkClicked(WindowOpenDisposition disposition
);
28 AlternateNavInfoBarDelegate(Profile
* profile
,
29 const base::string16
& text
,
30 const AutocompleteMatch
& match
,
31 const GURL
& search_url
);
33 // Returns an alternate nav infobar that owns |delegate|.
34 static scoped_ptr
<InfoBar
> CreateInfoBar(
35 scoped_ptr
<AlternateNavInfoBarDelegate
> delegate
);
38 virtual int GetIconID() const OVERRIDE
;
39 virtual Type
GetInfoBarType() const OVERRIDE
;
42 const base::string16 text_
;
43 const AutocompleteMatch match_
;
44 const GURL search_url_
;
46 DISALLOW_COPY_AND_ASSIGN(AlternateNavInfoBarDelegate
);
49 #endif // CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_