| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/wm/common/wm_window_observer.h" |
| 11 #include "ash/wm/overview/scoped_transform_overview_window.h" | 12 #include "ash/wm/overview/scoped_transform_overview_window.h" |
| 12 #include "base/compiler_specific.h" | |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "ui/aura/scoped_window_targeter.h" | |
| 15 #include "ui/aura/window_observer.h" | |
| 16 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
| 17 #include "ui/views/controls/button/button.h" | 15 #include "ui/views/controls/button/button.h" |
| 18 #include "ui/views/controls/button/image_button.h" | |
| 19 #include "ui/views/controls/button/label_button.h" | 16 #include "ui/views/controls/button/label_button.h" |
| 20 | 17 #include "ui/views/widget/widget.h" |
| 21 namespace aura { | |
| 22 class Window; | |
| 23 } | |
| 24 | 18 |
| 25 namespace views { | 19 namespace views { |
| 26 class LabelButton; | 20 class ImageButton; |
| 27 class Widget; | |
| 28 } | 21 } |
| 29 | 22 |
| 30 namespace ash { | 23 namespace ash { |
| 31 | 24 |
| 32 class WindowSelector; | 25 class WindowSelector; |
| 33 | 26 |
| 27 namespace wm { |
| 28 class WmWindow; |
| 29 } |
| 30 |
| 34 // This class represents an item in overview mode. | 31 // This class represents an item in overview mode. |
| 35 class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, | 32 class ASH_EXPORT WindowSelectorItem : public views::ButtonListener, |
| 36 public aura::WindowObserver { | 33 public wm::WmWindowObserver { |
| 37 public: | 34 public: |
| 38 class OverviewLabelButton : public views::LabelButton { | 35 class OverviewLabelButton : public views::LabelButton { |
| 39 public: | 36 public: |
| 40 OverviewLabelButton(views::ButtonListener* listener, | 37 OverviewLabelButton(views::ButtonListener* listener, |
| 41 const base::string16& text); | 38 const base::string16& text); |
| 42 | 39 |
| 43 ~OverviewLabelButton() override; | 40 ~OverviewLabelButton() override; |
| 44 | 41 |
| 45 void set_top_padding(int top_padding) { top_padding_ = top_padding; } | 42 void set_top_padding(int top_padding) { top_padding_ = top_padding; } |
| 46 | 43 |
| 47 protected: | 44 protected: |
| 48 // views::LabelButton: | 45 // views::LabelButton: |
| 49 gfx::Rect GetChildAreaBounds() override; | 46 gfx::Rect GetChildAreaBounds() override; |
| 50 | 47 |
| 51 private: | 48 private: |
| 52 // Padding on top of the button. | 49 // Padding on top of the button. |
| 53 int top_padding_; | 50 int top_padding_; |
| 54 | 51 |
| 55 DISALLOW_COPY_AND_ASSIGN(OverviewLabelButton); | 52 DISALLOW_COPY_AND_ASSIGN(OverviewLabelButton); |
| 56 }; | 53 }; |
| 57 | 54 |
| 58 WindowSelectorItem(aura::Window* window, WindowSelector* window_selector); | 55 WindowSelectorItem(wm::WmWindow* window, WindowSelector* window_selector); |
| 59 ~WindowSelectorItem() override; | 56 ~WindowSelectorItem() override; |
| 60 | 57 |
| 61 aura::Window* GetWindow(); | 58 wm::WmWindow* GetWindow(); |
| 62 | 59 |
| 63 // Returns the root window on which this item is shown. | 60 // Returns the root window on which this item is shown. |
| 64 aura::Window* root_window() { return root_window_; } | 61 wm::WmWindow* root_window() { return root_window_; } |
| 65 | 62 |
| 66 // Returns true if |target| is contained in this WindowSelectorItem. | 63 // Returns true if |target| is contained in this WindowSelectorItem. |
| 67 bool Contains(const aura::Window* target) const; | 64 bool Contains(const wm::WmWindow* target) const; |
| 68 | 65 |
| 69 // Restores and animates the managed window to it's non overview mode state. | 66 // Restores and animates the managed window to it's non overview mode state. |
| 70 void RestoreWindow(); | 67 void RestoreWindow(); |
| 71 | 68 |
| 72 // Forces the managed window to be shown (ie not hidden or minimized) when | 69 // Forces the managed window to be shown (ie not hidden or minimized) when |
| 73 // calling RestoreWindow(). | 70 // calling RestoreWindow(). |
| 74 void ShowWindowOnExit(); | 71 void ShowWindowOnExit(); |
| 75 | 72 |
| 76 // Dispatched before beginning window overview. This will do any necessary | 73 // Dispatched before beginning window overview. This will do any necessary |
| 77 // one time actions such as restoring minimized windows. | 74 // one time actions such as restoring minimized windows. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 95 // Sets if the item is dimmed in the overview. Changing the value will also | 92 // Sets if the item is dimmed in the overview. Changing the value will also |
| 96 // change the visibility of the transform windows. | 93 // change the visibility of the transform windows. |
| 97 void SetDimmed(bool dimmed); | 94 void SetDimmed(bool dimmed); |
| 98 bool dimmed() const { return dimmed_; } | 95 bool dimmed() const { return dimmed_; } |
| 99 | 96 |
| 100 const gfx::Rect& target_bounds() const { return target_bounds_; } | 97 const gfx::Rect& target_bounds() const { return target_bounds_; } |
| 101 | 98 |
| 102 // views::ButtonListener: | 99 // views::ButtonListener: |
| 103 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 100 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 104 | 101 |
| 105 // aura::WindowObserver: | 102 // wm::WmWindowObserver: |
| 106 void OnWindowDestroying(aura::Window* window) override; | 103 void OnWindowDestroying(wm::WmWindow* window) override; |
| 107 void OnWindowTitleChanged(aura::Window* window) override; | 104 void OnWindowTitleChanged(wm::WmWindow* window) override; |
| 108 | 105 |
| 109 private: | 106 private: |
| 110 friend class WindowSelectorTest; | 107 friend class WindowSelectorTest; |
| 111 | 108 |
| 112 // Sets the bounds of this selector's items to |target_bounds| in | 109 // Sets the bounds of this selector's items to |target_bounds| in |
| 113 // |root_window_|. The bounds change will be animated as specified | 110 // |root_window_|. The bounds change will be animated as specified |
| 114 // by |animation_type|. | 111 // by |animation_type|. |
| 115 void SetItemBounds(const gfx::Rect& target_bounds, | 112 void SetItemBounds(const gfx::Rect& target_bounds, |
| 116 OverviewAnimationType animation_type); | 113 OverviewAnimationType animation_type); |
| 117 | 114 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 131 void UpdateHeaderLayout(OverviewAnimationType animation_type); | 128 void UpdateHeaderLayout(OverviewAnimationType animation_type); |
| 132 | 129 |
| 133 // Updates the close buttons accessibility name. | 130 // Updates the close buttons accessibility name. |
| 134 void UpdateCloseButtonAccessibilityName(); | 131 void UpdateCloseButtonAccessibilityName(); |
| 135 | 132 |
| 136 // True if the item is being shown in the overview, false if it's being | 133 // True if the item is being shown in the overview, false if it's being |
| 137 // filtered. | 134 // filtered. |
| 138 bool dimmed_; | 135 bool dimmed_; |
| 139 | 136 |
| 140 // The root window this item is being displayed on. | 137 // The root window this item is being displayed on. |
| 141 aura::Window* root_window_; | 138 wm::WmWindow* root_window_; |
| 142 | 139 |
| 143 // The contained Window's wrapper. | 140 // The contained Window's wrapper. |
| 144 ScopedTransformOverviewWindow transform_window_; | 141 ScopedTransformOverviewWindow transform_window_; |
| 145 | 142 |
| 146 // The target bounds this selector item is fit within. | 143 // The target bounds this selector item is fit within. |
| 147 gfx::Rect target_bounds_; | 144 gfx::Rect target_bounds_; |
| 148 | 145 |
| 149 // True if running SetItemBounds. This prevents recursive calls resulting from | 146 // True if running SetItemBounds. This prevents recursive calls resulting from |
| 150 // the bounds update when calling ::wm::RecreateWindowLayers to copy | 147 // the bounds update when calling ::wm::RecreateWindowLayers to copy |
| 151 // a window layer for display on another monitor. | 148 // a window layer for display on another monitor. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 169 // Pointer to the WindowSelector that owns the WindowGrid containing |this|. | 166 // Pointer to the WindowSelector that owns the WindowGrid containing |this|. |
| 170 // Guaranteed to be non-null for the lifetime of |this|. | 167 // Guaranteed to be non-null for the lifetime of |this|. |
| 171 WindowSelector* window_selector_; | 168 WindowSelector* window_selector_; |
| 172 | 169 |
| 173 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); | 170 DISALLOW_COPY_AND_ASSIGN(WindowSelectorItem); |
| 174 }; | 171 }; |
| 175 | 172 |
| 176 } // namespace ash | 173 } // namespace ash |
| 177 | 174 |
| 178 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ | 175 #endif // ASH_WM_OVERVIEW_WINDOW_SELECTOR_ITEM_H_ |
| OLD | NEW |