[Extensions] Make extension message bubble factory platform-abstract
[chromium-blink-merge.git] / chrome / browser / ui / views / infobars / alternate_nav_infobar_view.h
blobee9e05fe0f20de2be19d0fdade2486e6f740bf96
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_ALTERNATE_NAV_INFOBAR_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_ALTERNATE_NAV_INFOBAR_VIEW_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/ui/views/infobars/infobar_view.h"
10 #include "ui/views/controls/link_listener.h"
12 class AlternateNavInfoBarDelegate;
14 // An infobar that shows a string with an embedded link.
15 class AlternateNavInfoBarView : public InfoBarView,
16 public views::LinkListener {
17 public:
18 explicit AlternateNavInfoBarView(
19 scoped_ptr<AlternateNavInfoBarDelegate> delegate);
20 ~AlternateNavInfoBarView() override;
22 private:
23 // Treating |labels| as pieces of one continuous string, elides to fit
24 // |available_width| so as to guarantee that a trailing ellipsis is always
25 // displayed when the string is elided and there is at least room to display
26 // a lone ellipsis.
28 // NOTE: This may modify the text of any/all of the labels, so reset their
29 // texts when the available width changes before calling this again.
30 static void ElideLabels(Labels* labels, int available_width);
32 // InfoBarView:
33 void Layout() override;
34 void ViewHierarchyChanged(
35 const ViewHierarchyChangedDetails& details) override;
36 int ContentMinimumWidth() const override;
38 // views::LinkListener:
39 void LinkClicked(views::Link* source, int event_flags) override;
41 AlternateNavInfoBarDelegate* GetDelegate();
43 base::string16 label_1_text_;
44 base::string16 link_text_;
45 base::string16 label_2_text_;
47 views::Label* label_1_;
48 views::Link* link_;
49 views::Label* label_2_;
51 DISALLOW_COPY_AND_ASSIGN(AlternateNavInfoBarView);
54 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_ALTERNATE_NAV_INFOBAR_VIEW_H_