OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_VIEWS_INFOBARS_ALTERNATE_NAV_INFOBAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_ALTERNATE_NAV_INFOBAR_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_ALTERNATE_NAV_INFOBAR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_ALTERNATE_NAV_INFOBAR_VIEW_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "chrome/browser/ui/views/infobars/infobar_view.h" | 11 #include "chrome/browser/ui/views/infobars/infobar_view.h" |
11 #include "ui/views/controls/link_listener.h" | 12 #include "ui/views/controls/link_listener.h" |
12 | 13 |
13 class AlternateNavInfoBarDelegate; | 14 class AlternateNavInfoBarDelegate; |
14 | 15 |
15 // An infobar that shows a string with an embedded link. | 16 // An infobar that shows a string with an embedded link. |
16 class AlternateNavInfoBarView : public InfoBarView, | 17 class AlternateNavInfoBarView : public InfoBarView, |
17 public views::LinkListener { | 18 public views::LinkListener { |
18 public: | 19 public: |
19 explicit AlternateNavInfoBarView( | 20 explicit AlternateNavInfoBarView( |
20 scoped_ptr<AlternateNavInfoBarDelegate> delegate); | 21 std::unique_ptr<AlternateNavInfoBarDelegate> delegate); |
21 ~AlternateNavInfoBarView() override; | 22 ~AlternateNavInfoBarView() override; |
22 | 23 |
23 private: | 24 private: |
24 // Treating |labels| as pieces of one continuous string, elides to fit | 25 // Treating |labels| as pieces of one continuous string, elides to fit |
25 // |available_width| so as to guarantee that a trailing ellipsis is always | 26 // |available_width| so as to guarantee that a trailing ellipsis is always |
26 // displayed when the string is elided and there is at least room to display | 27 // displayed when the string is elided and there is at least room to display |
27 // a lone ellipsis. | 28 // a lone ellipsis. |
28 // | 29 // |
29 // NOTE: This may modify the text of any/all of the labels, so reset their | 30 // NOTE: This may modify the text of any/all of the labels, so reset their |
30 // texts when the available width changes before calling this again. | 31 // texts when the available width changes before calling this again. |
(...skipping 15 matching lines...) Expand all Loading... |
46 base::string16 label_2_text_; | 47 base::string16 label_2_text_; |
47 | 48 |
48 views::Label* label_1_; | 49 views::Label* label_1_; |
49 views::Link* link_; | 50 views::Link* link_; |
50 views::Label* label_2_; | 51 views::Label* label_2_; |
51 | 52 |
52 DISALLOW_COPY_AND_ASSIGN(AlternateNavInfoBarView); | 53 DISALLOW_COPY_AND_ASSIGN(AlternateNavInfoBarView); |
53 }; | 54 }; |
54 | 55 |
55 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_ALTERNATE_NAV_INFOBAR_VIEW_H_ | 56 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_ALTERNATE_NAV_INFOBAR_VIEW_H_ |
OLD | NEW |