Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: chrome/browser/ui/omnibox/alternate_nav_infobar_delegate.h

Issue 190063006: Infobar Componentization Proof of Concept (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor fixes Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/memory/scoped_ptr.h"
9 #include "chrome/browser/autocomplete/autocomplete_match.h" 9 #include "chrome/browser/autocomplete/autocomplete_match.h"
10 #include "chrome/browser/infobars/infobar_delegate.h" 10 #include "chrome/browser/infobars/infobar_delegate.h"
11 11
12 namespace content {
13 class WebContents;
14 }
15
12 class AlternateNavInfoBarDelegate : public InfoBarDelegate { 16 class AlternateNavInfoBarDelegate : public InfoBarDelegate {
13 public: 17 public:
14 virtual ~AlternateNavInfoBarDelegate(); 18 virtual ~AlternateNavInfoBarDelegate();
15 19
16 // Creates an alternate nav infobar and delegate and adds the infobar to the 20 // Creates an alternate nav infobar and delegate and adds the infobar to the
17 // infobar service for |web_contents|. 21 // infobar service for |web_contents|.
18 static void Create(content::WebContents* web_contents, 22 static void Create(content::WebContents* web_contents,
19 const base::string16& text, 23 const base::string16& text,
20 const AutocompleteMatch& match, 24 const AutocompleteMatch& match,
21 const GURL& search_url); 25 const GURL& search_url);
22 26
23 base::string16 GetMessageTextWithOffset(size_t* link_offset) const; 27 base::string16 GetMessageTextWithOffset(size_t* link_offset) const;
24 base::string16 GetLinkText() const; 28 base::string16 GetLinkText() const;
25 bool LinkClicked(WindowOpenDisposition disposition); 29 bool LinkClicked(WindowOpenDisposition disposition);
26 30
27 private: 31 private:
28 AlternateNavInfoBarDelegate(Profile* profile, 32 AlternateNavInfoBarDelegate(Profile* profile,
33 content::WebContents* web_contents,
29 const base::string16& text, 34 const base::string16& text,
30 const AutocompleteMatch& match, 35 const AutocompleteMatch& match,
31 const GURL& search_url); 36 const GURL& search_url);
32 37
33 // Returns an alternate nav infobar that owns |delegate|. 38 // Returns an alternate nav infobar that owns |delegate|.
34 static scoped_ptr<InfoBar> CreateInfoBar( 39 static scoped_ptr<InfoBar> CreateInfoBar(
35 scoped_ptr<AlternateNavInfoBarDelegate> delegate); 40 scoped_ptr<AlternateNavInfoBarDelegate> delegate);
36 41
37 // InfoBarDelegate: 42 // InfoBarDelegate:
38 virtual int GetIconID() const OVERRIDE; 43 virtual int GetIconID() const OVERRIDE;
39 virtual Type GetInfoBarType() const OVERRIDE; 44 virtual Type GetInfoBarType() const OVERRIDE;
45 virtual void CleanUp() OVERRIDE;
40 46
41 Profile* profile_; 47 Profile* profile_;
48 content::WebContents* web_contents_;
42 const base::string16 text_; 49 const base::string16 text_;
43 const AutocompleteMatch match_; 50 const AutocompleteMatch match_;
44 const GURL search_url_; 51 const GURL search_url_;
45 52
46 DISALLOW_COPY_AND_ASSIGN(AlternateNavInfoBarDelegate); 53 DISALLOW_COPY_AND_ASSIGN(AlternateNavInfoBarDelegate);
47 }; 54 };
48 55
49 #endif // CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_ 56 #endif // CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698