| 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 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 const infobars::InfoBarContainer::Delegate* container_delegate() const; | 42 const infobars::InfoBarContainer::Delegate* container_delegate() const; |
| 43 const SkPath& fill_path() const { return fill_path_; } | 43 const SkPath& fill_path() const { return fill_path_; } |
| 44 const SkPath& stroke_path() const { return stroke_path_; } | 44 const SkPath& stroke_path() const { return stroke_path_; } |
| 45 | 45 |
| 46 protected: | 46 protected: |
| 47 typedef std::vector<views::Label*> Labels; | 47 typedef std::vector<views::Label*> Labels; |
| 48 | 48 |
| 49 static const int kButtonButtonSpacing; | 49 static const int kButtonButtonSpacing; |
| 50 static const int kEndOfLabelSpacing; | 50 static const int kEndOfLabelSpacing; |
| 51 static const SkColor kTextColor; |
| 51 | 52 |
| 52 ~InfoBarView() override; | 53 ~InfoBarView() override; |
| 53 | 54 |
| 54 // Creates a label with the appropriate font and color for an infobar. | 55 // Creates a label with the appropriate font and color for an infobar. |
| 55 views::Label* CreateLabel(const base::string16& text) const; | 56 views::Label* CreateLabel(const base::string16& text) const; |
| 56 | 57 |
| 57 // Creates a link with the appropriate font and color for an infobar. | 58 // Creates a link with the appropriate font and color for an infobar. |
| 58 // NOTE: Subclasses must ignore link clicks if we're unowned. | 59 // NOTE: Subclasses must ignore link clicks if we're unowned. |
| 59 views::Link* CreateLink(const base::string16& text, | 60 views::Link* CreateLink(const base::string16& text, |
| 60 views::LinkListener* listener) const; | 61 views::LinkListener* listener) const; |
| 61 | 62 |
| 62 // Creates a focusable button for use on an infobar. The appearance is | 63 // Creates a focusable button for use on an infobar. The appearance is |
| 63 // customized for infobars. Used for pre-MD only. | 64 // customized for infobars. Used for pre-MD only. |
| 64 // NOTE: Subclasses must ignore button presses if we're unowned. | 65 // NOTE: Subclasses must ignore button presses if we're unowned. |
| 65 static views::LabelButton* CreateTextButton(views::ButtonListener* listener, | 66 static views::LabelButton* CreateTextButton(views::ButtonListener* listener, |
| 66 const base::string16& text); | 67 const base::string16& text); |
| 67 // As above, but used for MD. | |
| 68 static views::MdTextButton* CreateMdTextButton( | |
| 69 views::ButtonListener* listener, | |
| 70 const base::string16& text); | |
| 71 | 68 |
| 72 // Given |labels| and the total |available_width| to display them in, sets | 69 // Given |labels| and the total |available_width| to display them in, sets |
| 73 // each label's size so that the longest label shrinks until it reaches the | 70 // each label's size so that the longest label shrinks until it reaches the |
| 74 // length of the next-longest label, then both shrink until reaching the | 71 // length of the next-longest label, then both shrink until reaching the |
| 75 // length of the next-longest, and so forth. | 72 // length of the next-longest, and so forth. |
| 76 static void AssignWidths(Labels* labels, int available_width); | 73 static void AssignWidths(Labels* labels, int available_width); |
| 77 | 74 |
| 78 // views::View: | 75 // views::View: |
| 79 void Layout() override; | 76 void Layout() override; |
| 80 void ViewHierarchyChanged( | 77 void ViewHierarchyChanged( |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 SkPath fill_path_; | 145 SkPath fill_path_; |
| 149 SkPath stroke_path_; | 146 SkPath stroke_path_; |
| 150 | 147 |
| 151 // Used to run the menu. | 148 // Used to run the menu. |
| 152 std::unique_ptr<views::MenuRunner> menu_runner_; | 149 std::unique_ptr<views::MenuRunner> menu_runner_; |
| 153 | 150 |
| 154 DISALLOW_COPY_AND_ASSIGN(InfoBarView); | 151 DISALLOW_COPY_AND_ASSIGN(InfoBarView); |
| 155 }; | 152 }; |
| 156 | 153 |
| 157 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ | 154 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ |
| OLD | NEW |