| 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" |
| 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/menu/menu_types.h" | 15 #include "ui/views/controls/menu/menu_types.h" |
| 15 #include "ui/views/focus/external_focus_tracker.h" | 16 #include "ui/views/focus/external_focus_tracker.h" |
| 16 #include "ui/views/view_targeter_delegate.h" | 17 #include "ui/views/view_targeter_delegate.h" |
| 17 | 18 |
| 18 namespace ui { | 19 namespace ui { |
| 19 class MenuModel; | 20 class MenuModel; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace views { | 23 namespace views { |
| 23 class ImageButton; | 24 class ImageButton; |
| 24 class ImageView; | 25 class ImageView; |
| 25 class Label; | 26 class Label; |
| 26 class LabelButton; | 27 class LabelButton; |
| 27 class Link; | 28 class Link; |
| 28 class LinkListener; | 29 class LinkListener; |
| 29 class MdTextButton; | 30 class MdTextButton; |
| 30 class MenuButton; | 31 class MenuButton; |
| 31 class MenuRunner; | 32 class MenuRunner; |
| 32 } // namespace views | 33 } // namespace views |
| 33 | 34 |
| 34 class InfoBarView : public infobars::InfoBar, | 35 class InfoBarView : public infobars::InfoBar, |
| 35 public views::View, | 36 public views::View, |
| 36 public views::ButtonListener, | 37 public views::VectorIconButtonDelegate, |
| 37 public views::ExternalFocusTracker, | 38 public views::ExternalFocusTracker, |
| 38 public views::ViewTargeterDelegate { | 39 public views::ViewTargeterDelegate { |
| 39 public: | 40 public: |
| 40 explicit InfoBarView(std::unique_ptr<infobars::InfoBarDelegate> delegate); | 41 explicit InfoBarView(std::unique_ptr<infobars::InfoBarDelegate> delegate); |
| 41 | 42 |
| 42 const infobars::InfoBarContainer::Delegate* container_delegate() const; | 43 const infobars::InfoBarContainer::Delegate* container_delegate() const; |
| 43 const SkPath& fill_path() const { return fill_path_; } | 44 const SkPath& fill_path() const { return fill_path_; } |
| 44 const SkPath& stroke_path() const { return stroke_path_; } | 45 const SkPath& stroke_path() const { return stroke_path_; } |
| 45 | 46 |
| 46 protected: | 47 protected: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 70 // each label's size so that the longest label shrinks until it reaches the | 71 // each label's size so that the longest label shrinks until it reaches the |
| 71 // length of the next-longest label, then both shrink until reaching the | 72 // length of the next-longest label, then both shrink until reaching the |
| 72 // length of the next-longest, and so forth. | 73 // length of the next-longest, and so forth. |
| 73 static void AssignWidths(Labels* labels, int available_width); | 74 static void AssignWidths(Labels* labels, int available_width); |
| 74 | 75 |
| 75 // views::View: | 76 // views::View: |
| 76 void Layout() override; | 77 void Layout() override; |
| 77 void ViewHierarchyChanged( | 78 void ViewHierarchyChanged( |
| 78 const ViewHierarchyChangedDetails& details) override; | 79 const ViewHierarchyChangedDetails& details) override; |
| 79 | 80 |
| 80 // views::ButtonListener: | 81 // views::VectorIconButtonDelegate: |
| 81 // NOTE: This must not be called if we're unowned. (Subclasses should ignore | 82 // NOTE: This must not be called if we're unowned. (Subclasses should ignore |
| 82 // calls to ButtonPressed() in this case.) | 83 // calls to ButtonPressed() in this case.) |
| 83 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 84 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 85 SkColor GetVectorIconBaseColor() const override; |
| 84 | 86 |
| 85 // Returns the minimum width the content (that is, everything between the icon | 87 // 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 | 88 // 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. | 89 // button from overlapping views that cannot be shrunk any further. |
| 88 virtual int ContentMinimumWidth() const; | 90 virtual int ContentMinimumWidth() const; |
| 89 | 91 |
| 90 // These return x coordinates delimiting the usable area for subclasses to lay | 92 // These return x coordinates delimiting the usable area for subclasses to lay |
| 91 // out their controls. | 93 // out their controls. |
| 92 int StartX() const; | 94 int StartX() const; |
| 93 int EndX() const; | 95 int EndX() const; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 SkPath fill_path_; | 147 SkPath fill_path_; |
| 146 SkPath stroke_path_; | 148 SkPath stroke_path_; |
| 147 | 149 |
| 148 // Used to run the menu. | 150 // Used to run the menu. |
| 149 std::unique_ptr<views::MenuRunner> menu_runner_; | 151 std::unique_ptr<views::MenuRunner> menu_runner_; |
| 150 | 152 |
| 151 DISALLOW_COPY_AND_ASSIGN(InfoBarView); | 153 DISALLOW_COPY_AND_ASSIGN(InfoBarView); |
| 152 }; | 154 }; |
| 153 | 155 |
| 154 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ | 156 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ |
| OLD | NEW |