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

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

Issue 2347773003: Remove pre-MD infobar code (on Views). (Closed)
Patch Set: pkasting review/button image clear out Created 4 years, 3 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"
11 #include "components/infobars/core/infobar_container.h" 11 #include "components/infobars/core/infobar_container.h"
12 #include "third_party/skia/include/core/SkPath.h" 12 #include "third_party/skia/include/core/SkPath.h"
13 #include "ui/views/controls/button/button.h" 13 #include "ui/views/controls/button/button.h"
14 #include "ui/views/controls/button/vector_icon_button_delegate.h" 14 #include "ui/views/controls/button/vector_icon_button_delegate.h"
15 #include "ui/views/controls/menu/menu_types.h" 15 #include "ui/views/controls/menu/menu_types.h"
16 #include "ui/views/focus/external_focus_tracker.h" 16 #include "ui/views/focus/external_focus_tracker.h"
17 #include "ui/views/view_targeter_delegate.h" 17 #include "ui/views/view_targeter_delegate.h"
18 18
19 namespace ui { 19 namespace ui {
20 class MenuModel; 20 class MenuModel;
21 } 21 }
22 22
23 namespace views { 23 namespace views {
24 class ImageButton;
25 class ImageView; 24 class ImageView;
26 class Label; 25 class Label;
27 class LabelButton; 26 class LabelButton;
28 class Link; 27 class Link;
29 class LinkListener; 28 class LinkListener;
30 class MdTextButton;
31 class MenuButton; 29 class MenuButton;
32 class MenuRunner; 30 class MenuRunner;
31 class VectorIconButton;
33 } // namespace views 32 } // namespace views
34 33
35 class InfoBarView : public infobars::InfoBar, 34 class InfoBarView : public infobars::InfoBar,
36 public views::View, 35 public views::View,
37 public views::VectorIconButtonDelegate, 36 public views::VectorIconButtonDelegate,
38 public views::ExternalFocusTracker, 37 public views::ExternalFocusTracker,
39 public views::ViewTargeterDelegate { 38 public views::ViewTargeterDelegate {
40 public: 39 public:
41 explicit InfoBarView(std::unique_ptr<infobars::InfoBarDelegate> delegate); 40 explicit InfoBarView(std::unique_ptr<infobars::InfoBarDelegate> delegate);
42 41
43 const infobars::InfoBarContainer::Delegate* container_delegate() const; 42 const infobars::InfoBarContainer::Delegate* container_delegate() const;
44 const SkPath& fill_path() const { return fill_path_; }
45 const SkPath& stroke_path() const { return stroke_path_; }
46 43
47 protected: 44 protected:
48 typedef std::vector<views::Label*> Labels; 45 typedef std::vector<views::Label*> Labels;
49 46
50 static const int kButtonButtonSpacing; 47 static const int kButtonButtonSpacing;
51 static const int kEndOfLabelSpacing; 48 static const int kEndOfLabelSpacing;
52 static const SkColor kTextColor; 49 static const SkColor kTextColor;
53 50
54 ~InfoBarView() override; 51 ~InfoBarView() override;
55 52
56 // Creates a label with the appropriate font and color for an infobar. 53 // Creates a label with the appropriate font and color for an infobar.
57 views::Label* CreateLabel(const base::string16& text) const; 54 views::Label* CreateLabel(const base::string16& text) const;
58 55
59 // Creates a link with the appropriate font and color for an infobar. 56 // Creates a link with the appropriate font and color for an infobar.
60 // NOTE: Subclasses must ignore link clicks if we're unowned. 57 // NOTE: Subclasses must ignore link clicks if we're unowned.
61 views::Link* CreateLink(const base::string16& text, 58 views::Link* CreateLink(const base::string16& text,
62 views::LinkListener* listener) const; 59 views::LinkListener* listener) const;
63 60
64 // Creates a focusable button for use on an infobar. The appearance is
65 // customized for infobars. Used for pre-MD only.
66 // NOTE: Subclasses must ignore button presses if we're unowned.
67 static views::LabelButton* CreateTextButton(views::ButtonListener* listener,
68 const base::string16& text);
69
70 // Given |labels| and the total |available_width| to display them in, sets 61 // Given |labels| and the total |available_width| to display them in, sets
71 // each label's size so that the longest label shrinks until it reaches the 62 // each label's size so that the longest label shrinks until it reaches the
72 // length of the next-longest label, then both shrink until reaching the 63 // length of the next-longest label, then both shrink until reaching the
73 // length of the next-longest, and so forth. 64 // length of the next-longest, and so forth.
74 static void AssignWidths(Labels* labels, int available_width); 65 static void AssignWidths(Labels* labels, int available_width);
75 66
76 // views::View: 67 // views::View:
77 void Layout() override; 68 void Layout() override;
78 void ViewHierarchyChanged( 69 void ViewHierarchyChanged(
79 const ViewHierarchyChangedDetails& details) override; 70 const ViewHierarchyChangedDetails& details) override;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 const gfx::Rect& rect) const override; 124 const gfx::Rect& rect) const override;
134 125
135 // This container holds the children and clips their painting during 126 // This container holds the children and clips their painting during
136 // animation. 127 // animation.
137 views::View* child_container_; 128 views::View* child_container_;
138 129
139 // The optional icon at the left edge of the InfoBar. 130 // The optional icon at the left edge of the InfoBar.
140 views::ImageView* icon_; 131 views::ImageView* icon_;
141 132
142 // The close button at the right edge of the InfoBar. 133 // The close button at the right edge of the InfoBar.
143 views::ImageButton* close_button_; 134 views::VectorIconButton* close_button_;
144
145 // The paths for the InfoBarBackground to draw, sized according to the heights
146 // above. TODO(estade): remove these when MD is default.
147 SkPath fill_path_;
148 SkPath stroke_path_;
149 135
150 // Used to run the menu. 136 // Used to run the menu.
151 std::unique_ptr<views::MenuRunner> menu_runner_; 137 std::unique_ptr<views::MenuRunner> menu_runner_;
152 138
153 DISALLOW_COPY_AND_ASSIGN(InfoBarView); 139 DISALLOW_COPY_AND_ASSIGN(InfoBarView);
154 }; 140 };
155 141
156 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ 142 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/infobars/infobar_container_view.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