OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_VIEWS_INFOBARS_INFOBAR_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "components/infobars/core/infobar.h" | 10 #include "components/infobars/core/infobar.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // These return x coordinates delimiting the usable area for subclasses to lay | 83 // These return x coordinates delimiting the usable area for subclasses to lay |
84 // out their controls. | 84 // out their controls. |
85 int StartX() const; | 85 int StartX() const; |
86 int EndX() const; | 86 int EndX() const; |
87 | 87 |
88 // Given a |view|, returns the centered y position within |child_container_|, | 88 // Given a |view|, returns the centered y position within |child_container_|, |
89 // taking into account animation so the control "slides in" (or out) as we | 89 // taking into account animation so the control "slides in" (or out) as we |
90 // animate open and closed. | 90 // animate open and closed. |
91 int OffsetY(views::View* view) const; | 91 int OffsetY(views::View* view) const; |
92 | 92 |
93 // Shows a menu at the specified position. | |
94 // NOTE: This must not be called if we're unowned. (Subclasses should ignore | |
95 // calls to RunMenu() in this case.) | |
96 void RunMenuAt(ui::MenuModel* menu_model, | |
97 views::MenuButton* button, | |
98 views::MenuAnchorPosition anchor); | |
99 | |
100 protected: | 93 protected: |
101 // Adds |view| to the content area, i.e. |child_container_|. The |view| won't | 94 // Adds |view| to the content area, i.e. |child_container_|. The |view| won't |
102 // automatically get any layout, so should still be laid out manually. | 95 // automatically get any layout, so should still be laid out manually. |
103 void AddViewToContentArea(views::View* view); | 96 void AddViewToContentArea(views::View* view); |
104 | 97 |
105 private: | 98 private: |
106 // Does the actual work for AssignWidths(). Assumes |labels| is sorted by | 99 // Does the actual work for AssignWidths(). Assumes |labels| is sorted by |
107 // decreasing preferred width. | 100 // decreasing preferred width. |
108 static void AssignWidthsSorted(Labels* labels, int available_width); | 101 static void AssignWidthsSorted(Labels* labels, int available_width); |
109 | 102 |
(...skipping 23 matching lines...) Expand all Loading... |
133 // The close button at the right edge of the InfoBar. | 126 // The close button at the right edge of the InfoBar. |
134 views::VectorIconButton* close_button_; | 127 views::VectorIconButton* close_button_; |
135 | 128 |
136 // Used to run the menu. | 129 // Used to run the menu. |
137 std::unique_ptr<views::MenuRunner> menu_runner_; | 130 std::unique_ptr<views::MenuRunner> menu_runner_; |
138 | 131 |
139 DISALLOW_COPY_AND_ASSIGN(InfoBarView); | 132 DISALLOW_COPY_AND_ASSIGN(InfoBarView); |
140 }; | 133 }; |
141 | 134 |
142 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ | 135 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ |
OLD | NEW |