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

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

Issue 1831673002: [MD] Apply appropriate call to action styling to infobar buttons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compile Created 4 years, 9 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/menu/menu_types.h" 14 #include "ui/views/controls/menu/menu_types.h"
15 #include "ui/views/focus/external_focus_tracker.h" 15 #include "ui/views/focus/external_focus_tracker.h"
16 #include "ui/views/view_targeter_delegate.h" 16 #include "ui/views/view_targeter_delegate.h"
17 17
18 namespace ui { 18 namespace ui {
19 class MenuModel; 19 class MenuModel;
20 } 20 }
21 21
22 namespace views { 22 namespace views {
23 class ImageButton; 23 class ImageButton;
24 class ImageView; 24 class ImageView;
25 class Label; 25 class Label;
26 class LabelButton; 26 class LabelButton;
27 class Link; 27 class Link;
28 class LinkListener; 28 class LinkListener;
29 class MdTextButton;
29 class MenuButton; 30 class MenuButton;
30 class MenuRunner; 31 class MenuRunner;
31 } // namespace views 32 } // namespace views
32 33
33 class InfoBarView : public infobars::InfoBar, 34 class InfoBarView : public infobars::InfoBar,
34 public views::View, 35 public views::View,
35 public views::ButtonListener, 36 public views::ButtonListener,
36 public views::ExternalFocusTracker, 37 public views::ExternalFocusTracker,
37 public views::ViewTargeterDelegate { 38 public views::ViewTargeterDelegate {
38 public: 39 public:
(...skipping 12 matching lines...) Expand all
51 52
52 // 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.
53 views::Label* CreateLabel(const base::string16& text) const; 54 views::Label* CreateLabel(const base::string16& text) const;
54 55
55 // 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.
56 // NOTE: Subclasses must ignore link clicks if we're unowned. 57 // NOTE: Subclasses must ignore link clicks if we're unowned.
57 views::Link* CreateLink(const base::string16& text, 58 views::Link* CreateLink(const base::string16& text,
58 views::LinkListener* listener) const; 59 views::LinkListener* listener) const;
59 60
60 // Creates a focusable button for use on an infobar. The appearance is 61 // Creates a focusable button for use on an infobar. The appearance is
61 // customized for infobars (except in Material mode). 62 // customized for infobars. Used for pre-MD only.
62 // NOTE: Subclasses must ignore button presses if we're unowned. 63 // NOTE: Subclasses must ignore button presses if we're unowned.
63 static views::LabelButton* CreateTextButton(views::ButtonListener* listener, 64 static views::LabelButton* CreateTextButton(views::ButtonListener* listener,
64 const base::string16& text); 65 const base::string16& text);
66 // As above, but used for MD.
67 static views::MdTextButton* CreateMdTextButton(
68 views::ButtonListener* listener,
69 const base::string16& text);
65 70
66 // Given |labels| and the total |available_width| to display them in, sets 71 // Given |labels| and the total |available_width| to display them in, sets
67 // each label's size so that the longest label shrinks until it reaches the 72 // each label's size so that the longest label shrinks until it reaches the
68 // length of the next-longest label, then both shrink until reaching the 73 // length of the next-longest label, then both shrink until reaching the
69 // length of the next-longest, and so forth. 74 // length of the next-longest, and so forth.
70 static void AssignWidths(Labels* labels, int available_width); 75 static void AssignWidths(Labels* labels, int available_width);
71 76
72 // views::View: 77 // views::View:
73 void Layout() override; 78 void Layout() override;
74 void ViewHierarchyChanged( 79 void ViewHierarchyChanged(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 SkPath fill_path_; 150 SkPath fill_path_;
146 SkPath stroke_path_; 151 SkPath stroke_path_;
147 152
148 // Used to run the menu. 153 // Used to run the menu.
149 scoped_ptr<views::MenuRunner> menu_runner_; 154 scoped_ptr<views::MenuRunner> menu_runner_;
150 155
151 DISALLOW_COPY_AND_ASSIGN(InfoBarView); 156 DISALLOW_COPY_AND_ASSIGN(InfoBarView);
152 }; 157 };
153 158
154 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ 159 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698