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/basictypes.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/compiler_specific.h" | |
10 #include "chrome/browser/infobars/infobar_delegate.h" | 9 #include "chrome/browser/infobars/infobar_delegate.h" |
11 #include "url/gurl.h" | 10 #include "url/gurl.h" |
12 | 11 |
13 class AlternateNavInfoBarDelegate : public InfoBarDelegate { | 12 class AlternateNavInfoBarDelegate : public InfoBarDelegate { |
14 public: | 13 public: |
15 // Creates an alternate nav infobar delegate and adds it to |infobar_service|. | 14 virtual ~AlternateNavInfoBarDelegate(); |
| 15 |
| 16 // Creates an alternate nav infobar and delegate and adds the infobar to |
| 17 // |infobar_service|. |
16 static void Create(InfoBarService* infobar_service, | 18 static void Create(InfoBarService* infobar_service, |
17 const GURL& alternate_nav_url); | 19 const GURL& alternate_nav_url); |
18 | 20 |
19 string16 GetMessageTextWithOffset(size_t* link_offset) const; | 21 string16 GetMessageTextWithOffset(size_t* link_offset) const; |
20 string16 GetLinkText() const; | 22 string16 GetLinkText() const; |
21 bool LinkClicked(WindowOpenDisposition disposition); | 23 bool LinkClicked(WindowOpenDisposition disposition); |
22 | 24 |
23 private: | 25 private: |
24 AlternateNavInfoBarDelegate(InfoBarService* owner, | 26 explicit AlternateNavInfoBarDelegate(const GURL& alternate_nav_url); |
25 const GURL& alternate_nav_url); | 27 |
26 virtual ~AlternateNavInfoBarDelegate(); | 28 // Returns an alternate nav infobar that owns |delegate|. |
| 29 static scoped_ptr<InfoBar> CreateInfoBar( |
| 30 scoped_ptr<AlternateNavInfoBarDelegate> delegate); |
27 | 31 |
28 // InfoBarDelegate: | 32 // InfoBarDelegate: |
29 virtual InfoBar* CreateInfoBar(InfoBarService* owner) OVERRIDE; | |
30 virtual int GetIconID() const OVERRIDE; | 33 virtual int GetIconID() const OVERRIDE; |
31 virtual Type GetInfoBarType() const OVERRIDE; | 34 virtual Type GetInfoBarType() const OVERRIDE; |
32 | 35 |
33 GURL alternate_nav_url_; | 36 GURL alternate_nav_url_; |
34 | 37 |
35 DISALLOW_COPY_AND_ASSIGN(AlternateNavInfoBarDelegate); | 38 DISALLOW_COPY_AND_ASSIGN(AlternateNavInfoBarDelegate); |
36 }; | 39 }; |
37 | 40 |
38 #endif // CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_ | 41 #endif // CHROME_BROWSER_UI_OMNIBOX_ALTERNATE_NAV_INFOBAR_DELEGATE_H_ |
OLD | NEW |