OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 5 #ifndef ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 6 #define ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/wm/overview/scoped_transform_overview_window.h" | 9 #include "ash/wm/overview/scoped_transform_overview_window.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "ui/aura/scoped_window_targeter.h" | 12 #include "ui/aura/scoped_window_targeter.h" |
13 #include "ui/aura/window_observer.h" | 13 #include "ui/aura/window_observer.h" |
14 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
15 #include "ui/views/controls/button/button.h" | 15 #include "ui/views/controls/button/button.h" |
16 #include "ui/views/controls/button/image_button.h" | 16 #include "ui/views/controls/button/image_button.h" |
17 #include "ui/views/controls/button/label_button.h" | 17 #include "ui/views/controls/button/label_button.h" |
18 | 18 |
19 namespace aura { | 19 namespace aura { |
20 class Window; | 20 class Window; |
21 } | 21 } |
22 | 22 |
23 namespace views { | 23 namespace views { |
24 class LabelButton; | 24 class LabelButton; |
25 class Widget; | 25 class Widget; |
26 } | 26 } |
27 | 27 |
28 namespace ash { | 28 namespace ash { |
29 | 29 |
30 class WindowSelector; | |
31 | |
30 // This class represents an item in overview mode. | 32 // This class represents an item in overview mode. |
31 class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, | 33 class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, |
32 public aura::WindowObserver { | 34 public aura::WindowObserver { |
33 public: | 35 public: |
34 class OverviewLabelButton : public views::LabelButton { | 36 class OverviewLabelButton : public views::LabelButton { |
35 public: | 37 public: |
36 OverviewLabelButton(views::ButtonListener* listener, | 38 OverviewLabelButton(views::ButtonListener* listener, |
37 const base::string16& text); | 39 const base::string16& text); |
38 | 40 |
39 ~OverviewLabelButton() override; | 41 ~OverviewLabelButton() override; |
40 | 42 |
41 void set_top_padding(int top_padding) { top_padding_ = top_padding; } | 43 void set_top_padding(int top_padding) { top_padding_ = top_padding; } |
42 | 44 |
43 protected: | 45 protected: |
44 // views::LabelButton: | 46 // views::LabelButton: |
45 gfx::Rect GetChildAreaBounds() override; | 47 gfx::Rect GetChildAreaBounds() override; |
46 | 48 |
47 private: | 49 private: |
48 // Padding on top of the button. | 50 // Padding on top of the button. |
49 int top_padding_; | 51 int top_padding_; |
50 | 52 |
51 DISALLOW_COPY_AND_ASSIGN(OverviewLabelButton); | 53 DISALLOW_COPY_AND_ASSIGN(OverviewLabelButton); |
52 }; | 54 }; |
53 | 55 |
54 explicit WindowSelectorItem(aura::Window* window); | 56 WindowSelectorItem(aura::Window* window, WindowSelector* window_selector); |
55 ~WindowSelectorItem() override; | 57 ~WindowSelectorItem() override; |
56 | 58 |
57 aura::Window* GetWindow(); | 59 aura::Window* GetWindow(); |
58 | 60 |
59 // Returns the root window on which this item is shown. | 61 // Returns the root window on which this item is shown. |
60 aura::Window* root_window() { return root_window_; } | 62 aura::Window* root_window() { return root_window_; } |
61 | 63 |
62 // Returns true if |target| is contained in this WindowSelectorItem. | 64 // Returns true if |target| is contained in this WindowSelectorItem. |
63 bool Contains(const aura::Window* target) const; | 65 bool Contains(const aura::Window* target) const; |
64 | 66 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 // View for the label under the window. | 153 // View for the label under the window. |
152 OverviewLabelButton* window_label_button_view_; | 154 OverviewLabelButton* window_label_button_view_; |
153 | 155 |
154 // The close buttons widget container. | 156 // The close buttons widget container. |
155 views::Widget close_button_widget_; | 157 views::Widget close_button_widget_; |
156 | 158 |
157 // An easy to access close button for the window in this item. Owned by the | 159 // An easy to access close button for the window in this item. Owned by the |
158 // close_button_widget_. | 160 // close_button_widget_. |
159 views::ImageButton* close_button_; | 161 views::ImageButton* close_button_; |
160 | 162 |
163 // Pointer to the WindowSelector that owns the WindowGrid containing |this|. | |
164 // Guaranteed to be non-null for the lifetime of |this|. | |
165 WindowSelector* window_selector_; | |
tdanderson
2015/05/14 01:36:32
Or should we instead have a non-owned pointer back
| |
166 | |
161 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); | 167 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); |
162 }; | 168 }; |
163 | 169 |
164 } // namespace ash | 170 } // namespace ash |
165 | 171 |
166 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 172 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
OLD | NEW |