12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Copyright 2012 The Chromium Authors. All rights reserved. 22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)// found in the LICENSE file. 42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#ifndef CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_ 62a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#define CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_ 72a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 8a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)#include "base/memory/scoped_ptr.h" 90529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch#include "components/infobars/core/infobar_delegate.h" 105f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)#include "components/omnibox/autocomplete_match.h" 112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 12116680a4aac90f2aa7413d9095a592090648e557Ben Murdochclass Profile; 13116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch 14a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochnamespace content { 15a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass WebContents; 16a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch} 17a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch 180529e5d033099cbfc42635f6f6183833b09dff6eBen Murdochclass AlternateNavInfoBarDelegate : public infobars::InfoBarDelegate { 192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) public: 20a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) virtual ~AlternateNavInfoBarDelegate(); 21a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 22a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) // Creates an alternate nav infobar and delegate and adds the infobar to the 23a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) // infobar service for |web_contents|. 24f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) static void Create(content::WebContents* web_contents, 25a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const base::string16& text, 26f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) const AutocompleteMatch& match, 27f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) const GURL& search_url); 282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 29a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) base::string16 GetMessageTextWithOffset(size_t* link_offset) const; 30a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) base::string16 GetLinkText() const; 312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool LinkClicked(WindowOpenDisposition disposition); 322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) private: 34a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) AlternateNavInfoBarDelegate(Profile* profile, 35a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const base::string16& text, 36f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) const AutocompleteMatch& match, 37f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) const GURL& search_url); 38a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 39a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) // Returns an alternate nav infobar that owns |delegate|. 400529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch static scoped_ptr<infobars::InfoBar> CreateInfoBar( 41a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) scoped_ptr<AlternateNavInfoBarDelegate> delegate); 422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 432a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // InfoBarDelegate: 4490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) virtual int GetIconID() const OVERRIDE; 452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual Type GetInfoBarType() const OVERRIDE; 462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 47f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) Profile* profile_; 48a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) const base::string16 text_; 49f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) const AutocompleteMatch match_; 50f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) const GURL search_url_; 512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 522a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(AlternateNavInfoBarDelegate); 532a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)}; 542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 552a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif // CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_ 56