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/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "chrome/browser/infobars/infobar.h" | 10 #include "components/infobars/core/infobar.h" |
11 #include "chrome/browser/infobars/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_item_view.h" | 14 #include "ui/views/controls/menu/menu_item_view.h" |
15 #include "ui/views/focus/external_focus_tracker.h" | 15 #include "ui/views/focus/external_focus_tracker.h" |
16 | 16 |
17 namespace ui { | 17 namespace ui { |
18 class MenuModel; | 18 class MenuModel; |
19 } | 19 } |
20 | 20 |
21 namespace views { | 21 namespace views { |
22 class ImageButton; | 22 class ImageButton; |
23 class ImageView; | 23 class ImageView; |
24 class Label; | 24 class Label; |
25 class LabelButton; | 25 class LabelButton; |
26 class Link; | 26 class Link; |
27 class LinkListener; | 27 class LinkListener; |
28 class MenuButton; | 28 class MenuButton; |
29 class MenuButtonListener; | 29 class MenuButtonListener; |
30 class MenuRunner; | 30 class MenuRunner; |
31 } // namespace views | 31 } // namespace views |
32 | 32 |
33 class InfoBarView : public 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: | 37 public: |
38 explicit InfoBarView(scoped_ptr<InfoBarDelegate> delegate); | 38 explicit InfoBarView(scoped_ptr<infobars::InfoBarDelegate> delegate); |
39 | 39 |
40 const SkPath& fill_path() const { return fill_path_; } | 40 const SkPath& fill_path() const { return fill_path_; } |
41 const SkPath& stroke_path() const { return stroke_path_; } | 41 const SkPath& stroke_path() const { return stroke_path_; } |
42 | 42 |
43 protected: | 43 protected: |
44 typedef std::vector<views::Label*> Labels; | 44 typedef std::vector<views::Label*> Labels; |
45 | 45 |
46 static const int kButtonButtonSpacing; | 46 static const int kButtonButtonSpacing; |
47 static const int kEndOfLabelSpacing; | 47 static const int kEndOfLabelSpacing; |
48 | 48 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // out their controls. | 94 // out their controls. |
95 int StartX() const; | 95 int StartX() const; |
96 int EndX() const; | 96 int EndX() const; |
97 | 97 |
98 // Given a |view|, returns the centered y position within us, taking into | 98 // Given a |view|, returns the centered y position within us, taking into |
99 // account animation so the control "slides in" (or out) as we animate open | 99 // account animation so the control "slides in" (or out) as we animate open |
100 // and closed. | 100 // and closed. |
101 int OffsetY(views::View* view) const; | 101 int OffsetY(views::View* view) const; |
102 | 102 |
103 // Convenience getter. | 103 // Convenience getter. |
104 const InfoBarContainer::Delegate* container_delegate() const; | 104 const infobars::InfoBarContainer::Delegate* container_delegate() const; |
105 | 105 |
106 // Shows a menu at the specified position. | 106 // Shows a menu at the specified position. |
107 // NOTE: This must not be called if we're unowned. (Subclasses should ignore | 107 // NOTE: This must not be called if we're unowned. (Subclasses should ignore |
108 // calls to RunMenu() in this case.) | 108 // calls to RunMenu() in this case.) |
109 void RunMenuAt(ui::MenuModel* menu_model, | 109 void RunMenuAt(ui::MenuModel* menu_model, |
110 views::MenuButton* button, | 110 views::MenuButton* button, |
111 views::MenuItemView::AnchorPosition anchor); | 111 views::MenuItemView::AnchorPosition anchor); |
112 | 112 |
113 private: | 113 private: |
114 static const int kHorizontalPadding; | 114 static const int kHorizontalPadding; |
(...skipping 28 matching lines...) Expand all Loading... |
143 SkPath fill_path_; | 143 SkPath fill_path_; |
144 SkPath stroke_path_; | 144 SkPath stroke_path_; |
145 | 145 |
146 // Used to run the menu. | 146 // Used to run the menu. |
147 scoped_ptr<views::MenuRunner> menu_runner_; | 147 scoped_ptr<views::MenuRunner> menu_runner_; |
148 | 148 |
149 DISALLOW_COPY_AND_ASSIGN(InfoBarView); | 149 DISALLOW_COPY_AND_ASSIGN(InfoBarView); |
150 }; | 150 }; |
151 | 151 |
152 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ | 152 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_VIEW_H_ |
OLD | NEW |