alternate_nav_infobar_delegate.h revision 0529e5d033099cbfc42635f6f6183833b09dff6e
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. 4 5#ifndef CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_ 6#define CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_ 7 8#include "base/memory/scoped_ptr.h" 9#include "chrome/browser/autocomplete/autocomplete_match.h" 10#include "components/infobars/core/infobar_delegate.h" 11 12namespace content { 13class WebContents; 14} 15 16class AlternateNavInfoBarDelegate : public infobars::InfoBarDelegate { 17 public: 18 virtual ~AlternateNavInfoBarDelegate(); 19 20 // Creates an alternate nav infobar and delegate and adds the infobar to the 21 // infobar service for |web_contents|. 22 static void Create(content::WebContents* web_contents, 23 const base::string16& text, 24 const AutocompleteMatch& match, 25 const GURL& search_url); 26 27 base::string16 GetMessageTextWithOffset(size_t* link_offset) const; 28 base::string16 GetLinkText() const; 29 bool LinkClicked(WindowOpenDisposition disposition); 30 31 private: 32 AlternateNavInfoBarDelegate(Profile* profile, 33 const base::string16& text, 34 const AutocompleteMatch& match, 35 const GURL& search_url); 36 37 // Returns an alternate nav infobar that owns |delegate|. 38 static scoped_ptr<infobars::InfoBar> CreateInfoBar( 39 scoped_ptr<AlternateNavInfoBarDelegate> delegate); 40 41 // InfoBarDelegate: 42 virtual int GetIconID() const OVERRIDE; 43 virtual Type GetInfoBarType() const OVERRIDE; 44 45 Profile* profile_; 46 const base::string16 text_; 47 const AutocompleteMatch match_; 48 const GURL search_url_; 49 50 DISALLOW_COPY_AND_ASSIGN(AlternateNavInfoBarDelegate); 51}; 52 53#endif // CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_ 54