Chromium Code Reviews| 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 20 matching lines...) Expand all Loading... | |
| 31 } // namespace views | 31 } // namespace views |
| 32 | 32 |
| 33 class InfoBarView : public infobars::InfoBar, | 33 class InfoBarView : public infobars::InfoBar, |
| 34 public views::View, | 34 public views::View, |
| 35 public views::ButtonListener, | 35 public views::ButtonListener, |
| 36 public views::ExternalFocusTracker, | 36 public views::ExternalFocusTracker, |
| 37 public views::ViewTargeterDelegate { | 37 public views::ViewTargeterDelegate { |
| 38 public: | 38 public: |
| 39 explicit InfoBarView(scoped_ptr<infobars::InfoBarDelegate> delegate); | 39 explicit InfoBarView(scoped_ptr<infobars::InfoBarDelegate> delegate); |
| 40 | 40 |
| 41 const infobars::InfoBarContainer::Delegate* container_delegate() const; | |
| 42 // TODO(estade): remove these when MD is default. | |
| 41 const SkPath& fill_path() const { return fill_path_; } | 43 const SkPath& fill_path() const { return fill_path_; } |
| 42 const SkPath& stroke_path() const { return stroke_path_; } | 44 const SkPath& stroke_path() const { return stroke_path_; } |
| 43 | 45 |
| 44 protected: | 46 protected: |
| 45 typedef std::vector<views::Label*> Labels; | 47 typedef std::vector<views::Label*> Labels; |
| 46 | 48 |
| 47 static const int kButtonButtonSpacing; | 49 static const int kButtonButtonSpacing; |
| 48 static const int kEndOfLabelSpacing; | 50 static const int kEndOfLabelSpacing; |
| 49 | 51 |
| 50 ~InfoBarView() override; | 52 ~InfoBarView() override; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 // These return x coordinates delimiting the usable area for subclasses to lay | 89 // These return x coordinates delimiting the usable area for subclasses to lay |
| 88 // out their controls. | 90 // out their controls. |
| 89 int StartX() const; | 91 int StartX() const; |
| 90 int EndX() const; | 92 int EndX() const; |
| 91 | 93 |
| 92 // Given a |view|, returns the centered y position within |child_container_|, | 94 // Given a |view|, returns the centered y position within |child_container_|, |
| 93 // taking into account animation so the control "slides in" (or out) as we | 95 // taking into account animation so the control "slides in" (or out) as we |
| 94 // animate open and closed. | 96 // animate open and closed. |
| 95 int OffsetY(views::View* view) const; | 97 int OffsetY(views::View* view) const; |
| 96 | 98 |
| 97 // Convenience getter. | |
| 98 const infobars::InfoBarContainer::Delegate* container_delegate() const; | |
| 99 | |
| 100 // Shows a menu at the specified position. | 99 // Shows a menu at the specified position. |
| 101 // NOTE: This must not be called if we're unowned. (Subclasses should ignore | 100 // NOTE: This must not be called if we're unowned. (Subclasses should ignore |
| 102 // calls to RunMenu() in this case.) | 101 // calls to RunMenu() in this case.) |
| 103 void RunMenuAt(ui::MenuModel* menu_model, | 102 void RunMenuAt(ui::MenuModel* menu_model, |
| 104 views::MenuButton* button, | 103 views::MenuButton* button, |
| 105 views::MenuAnchorPosition anchor); | 104 views::MenuAnchorPosition anchor); |
| 106 | 105 |
| 107 protected: | 106 protected: |
| 108 // Adds |view| to the content area, i.e. |child_container_|. The |view| won't | 107 // Adds |view| to the content area, i.e. |child_container_|. The |view| won't |
| 109 // automatically get any layout, so should still be laid out manually. | 108 // automatically get any layout, so should still be laid out manually. |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 134 // animation. | 133 // animation. |
| 135 views::View* child_container_; | 134 views::View* child_container_; |
| 136 | 135 |
| 137 // The optional icon at the left edge of the InfoBar. | 136 // The optional icon at the left edge of the InfoBar. |
| 138 views::ImageView* icon_; | 137 views::ImageView* icon_; |
| 139 | 138 |
| 140 // The close button at the right edge of the InfoBar. | 139 // The close button at the right edge of the InfoBar. |
| 141 views::ImageButton* close_button_; | 140 views::ImageButton* close_button_; |
| 142 | 141 |
| 143 // 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 |
| 144 // above. | 143 // above. |
|
Peter Kasting
2016/03/30 00:20:26
Nit: Might want removal TODO here also
Evan Stade
2016/04/02 02:21:42
moved the todo here
| |
| 145 SkPath fill_path_; | 144 SkPath fill_path_; |
| 146 SkPath stroke_path_; | 145 SkPath stroke_path_; |
| 147 | 146 |
| 148 // Used to run the menu. | 147 // Used to run the menu. |
| 149 scoped_ptr<views::MenuRunner> menu_runner_; | 148 scoped_ptr<views::MenuRunner> menu_runner_; |
| 150 | 149 |
| 151 DISALLOW_COPY_AND_ASSIGN(InfoBarView); | 150 DISALLOW_COPY_AND_ASSIGN(InfoBarView); |
| 152 }; | 151 }; |
| 153 | 152 |
| 154 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ | 153 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ |
| OLD | NEW |