Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / omnibox / alternate_nav_infobar_delegate.h
blobc01f2ef5f9d2454425ac259f65173c19b07f3327
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 "components/infobars/core/infobar_delegate.h"
10 #include "components/omnibox/browser/autocomplete_match.h"
12 class Profile;
14 namespace content {
15 class WebContents;
18 class AlternateNavInfoBarDelegate : public infobars::InfoBarDelegate {
19 public:
20 ~AlternateNavInfoBarDelegate() override;
22 // Creates an alternate nav infobar and delegate and adds the infobar to the
23 // infobar service for |web_contents|.
24 static void Create(content::WebContents* web_contents,
25 const base::string16& text,
26 const AutocompleteMatch& match,
27 const GURL& search_url);
29 base::string16 GetMessageTextWithOffset(size_t* link_offset) const;
30 base::string16 GetLinkText() const;
31 bool LinkClicked(WindowOpenDisposition disposition);
33 private:
34 AlternateNavInfoBarDelegate(Profile* profile,
35 const base::string16& text,
36 const AutocompleteMatch& match,
37 const GURL& search_url);
39 // Returns an alternate nav infobar that owns |delegate|.
40 static scoped_ptr<infobars::InfoBar> CreateInfoBar(
41 scoped_ptr<AlternateNavInfoBarDelegate> delegate);
43 // InfoBarDelegate:
44 Type GetInfoBarType() const override;
45 int GetIconId() const override;
46 gfx::VectorIconId GetVectorIconId() const override;
48 Profile* profile_;
49 const base::string16 text_;
50 const AutocompleteMatch match_;
51 const GURL search_url_;
53 DISALLOW_COPY_AND_ASSIGN(AlternateNavInfoBarDelegate);
56 #endif // CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_