OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_ |
6 #define CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
9 #include "chrome/browser/autocomplete/autocomplete_match.h" | 10 #include "chrome/browser/autocomplete/autocomplete_match.h" |
10 #include "chrome/browser/infobars/infobar_delegate.h" | 11 #include "chrome/browser/infobars/infobar_delegate.h" |
11 | 12 |
12 class AlternateNavInfoBarDelegate : public InfoBarDelegate { | 13 class AlternateNavInfoBarDelegate : public InfoBarDelegate { |
13 public: | 14 public: |
14 virtual ~AlternateNavInfoBarDelegate(); | 15 // Creates an alternate nav infobar delegate and adds it to the infobar |
15 | 16 // service for |web_contents|. |
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, | 17 static void Create(content::WebContents* web_contents, |
19 const string16& text, | 18 const string16& text, |
20 const AutocompleteMatch& match, | 19 const AutocompleteMatch& match, |
21 const GURL& search_url); | 20 const GURL& search_url); |
22 | 21 |
23 string16 GetMessageTextWithOffset(size_t* link_offset) const; | 22 string16 GetMessageTextWithOffset(size_t* link_offset) const; |
24 string16 GetLinkText() const; | 23 string16 GetLinkText() const; |
25 bool LinkClicked(WindowOpenDisposition disposition); | 24 bool LinkClicked(WindowOpenDisposition disposition); |
26 | 25 |
27 private: | 26 private: |
28 AlternateNavInfoBarDelegate(Profile* profile, | 27 AlternateNavInfoBarDelegate(InfoBarService* owner, |
| 28 Profile* profile, |
29 const string16& text, | 29 const string16& text, |
30 const AutocompleteMatch& match, | 30 const AutocompleteMatch& match, |
31 const GURL& search_url); | 31 const GURL& search_url); |
32 | 32 virtual ~AlternateNavInfoBarDelegate(); |
33 // Returns an alternate nav infobar that owns |delegate|. | |
34 static scoped_ptr<InfoBar> CreateInfoBar( | |
35 scoped_ptr<AlternateNavInfoBarDelegate> delegate); | |
36 | 33 |
37 // InfoBarDelegate: | 34 // InfoBarDelegate: |
| 35 virtual InfoBar* CreateInfoBar(InfoBarService* owner) OVERRIDE; |
38 virtual int GetIconID() const OVERRIDE; | 36 virtual int GetIconID() const OVERRIDE; |
39 virtual Type GetInfoBarType() const OVERRIDE; | 37 virtual Type GetInfoBarType() const OVERRIDE; |
40 | 38 |
41 Profile* profile_; | 39 Profile* profile_; |
42 const string16 text_; | 40 const string16 text_; |
43 const AutocompleteMatch match_; | 41 const AutocompleteMatch match_; |
44 const GURL search_url_; | 42 const GURL search_url_; |
45 | 43 |
46 DISALLOW_COPY_AND_ASSIGN(AlternateNavInfoBarDelegate); | 44 DISALLOW_COPY_AND_ASSIGN(AlternateNavInfoBarDelegate); |
47 }; | 45 }; |
48 | 46 |
49 #endif // CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_ | 47 #endif // CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_ |
OLD | NEW |