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

Side by Side Diff: chrome/browser/ui/views/infobars/infobar_view.h

Issue 1700383002: [MD] Fix clipping of infobar child elements (particularly close button). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adjust comment Created 4 years, 10 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 (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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // Returns the minimum width the content (that is, everything between the icon 85 // Returns the minimum width the content (that is, everything between the icon
86 // and the close button) can be shrunk to. This is used to prevent the close 86 // and the close button) can be shrunk to. This is used to prevent the close
87 // button from overlapping views that cannot be shrunk any further. 87 // button from overlapping views that cannot be shrunk any further.
88 virtual int ContentMinimumWidth() const; 88 virtual int ContentMinimumWidth() const;
89 89
90 // These return x coordinates delimiting the usable area for subclasses to lay 90 // These return x coordinates delimiting the usable area for subclasses to lay
91 // out their controls. 91 // out their controls.
92 int StartX() const; 92 int StartX() const;
93 int EndX() const; 93 int EndX() const;
94 94
95 // Given a |view|, returns the centered y position within us, taking into 95 // Given a |view|, returns the centered y position within |child_container_|,
96 // account animation so the control "slides in" (or out) as we animate open 96 // taking into account animation so the control "slides in" (or out) as we
97 // and closed. 97 // animate open and closed.
98 int OffsetY(views::View* view) const; 98 int OffsetY(views::View* view) const;
99 99
100 // Convenience getter. 100 // Convenience getter.
101 const infobars::InfoBarContainer::Delegate* container_delegate() const; 101 const infobars::InfoBarContainer::Delegate* container_delegate() const;
102 102
103 // Shows a menu at the specified position. 103 // Shows a menu at the specified position.
104 // NOTE: This must not be called if we're unowned. (Subclasses should ignore 104 // NOTE: This must not be called if we're unowned. (Subclasses should ignore
105 // calls to RunMenu() in this case.) 105 // calls to RunMenu() in this case.)
106 void RunMenuAt(ui::MenuModel* menu_model, 106 void RunMenuAt(ui::MenuModel* menu_model,
107 views::MenuButton* button, 107 views::MenuButton* button,
108 views::MenuAnchorPosition anchor); 108 views::MenuAnchorPosition anchor);
109 109
110 protected:
111 // Adds |view| to the content area, i.e. |child_container_|. The |view| won't
112 // automatically get any layout, so should still be laid out manually.
113 void AddViewToContentArea(views::View* view);
114
110 private: 115 private:
111 // Does the actual work for AssignWidths(). Assumes |labels| is sorted by 116 // Does the actual work for AssignWidths(). Assumes |labels| is sorted by
112 // decreasing preferred width. 117 // decreasing preferred width.
113 static void AssignWidthsSorted(Labels* labels, int available_width); 118 static void AssignWidthsSorted(Labels* labels, int available_width);
114 119
115 // InfoBar: 120 // InfoBar:
116 void PlatformSpecificShow(bool animate) override; 121 void PlatformSpecificShow(bool animate) override;
117 void PlatformSpecificHide(bool animate) override; 122 void PlatformSpecificHide(bool animate) override;
118 void PlatformSpecificOnHeightsRecalculated() override; 123 void PlatformSpecificOnHeightsRecalculated() override;
119 124
120 // views::View: 125 // views::View:
121 void GetAccessibleState(ui::AXViewState* state) override; 126 void GetAccessibleState(ui::AXViewState* state) override;
122 gfx::Size GetPreferredSize() const override; 127 gfx::Size GetPreferredSize() const override;
123 void PaintChildren(const ui::PaintContext& context) override;
124 128
125 // views::ExternalFocusTracker: 129 // views::ExternalFocusTracker:
126 void OnWillChangeFocus(View* focused_before, View* focused_now) override; 130 void OnWillChangeFocus(View* focused_before, View* focused_now) override;
127 131
132 // This container holds the children and clips their painting during
133 // animation.
134 views::View* child_container_;
135
128 // The optional icon at the left edge of the InfoBar. 136 // The optional icon at the left edge of the InfoBar.
129 views::ImageView* icon_; 137 views::ImageView* icon_;
130 138
131 // The close button at the right edge of the InfoBar. 139 // The close button at the right edge of the InfoBar.
132 views::ImageButton* close_button_; 140 views::ImageButton* close_button_;
133 141
134 // The paths for the InfoBarBackground to draw, sized according to the heights 142 // The paths for the InfoBarBackground to draw, sized according to the heights
135 // above. 143 // above.
136 SkPath fill_path_; 144 SkPath fill_path_;
137 SkPath stroke_path_; 145 SkPath stroke_path_;
138 146
139 // Used to run the menu. 147 // Used to run the menu.
140 scoped_ptr<views::MenuRunner> menu_runner_; 148 scoped_ptr<views::MenuRunner> menu_runner_;
141 149
142 DISALLOW_COPY_AND_ASSIGN(InfoBarView); 150 DISALLOW_COPY_AND_ASSIGN(InfoBarView);
143 }; 151 };
144 152
145 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ 153 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/confirm_infobar.cc ('k') | chrome/browser/ui/views/infobars/infobar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698