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